It has only one change from original one. I added robotfeedback message on it.
Dependents: RobotFeedback mobileRobotITU
Fork of ros_lib_indigo by
rosserial_mbed/Adc.h@4:80d9bee5079a, 2017-03-04 (annotated)
- Committer:
- randalthor
- Date:
- Sat Mar 04 14:07:56 2017 +0000
- Revision:
- 4:80d9bee5079a
- Parent:
- 0:fd24f7ca9688
fatih
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:fd24f7ca9688 | 1 | #ifndef _ROS_rosserial_mbed_Adc_h |
garyservin | 0:fd24f7ca9688 | 2 | #define _ROS_rosserial_mbed_Adc_h |
garyservin | 0:fd24f7ca9688 | 3 | |
garyservin | 0:fd24f7ca9688 | 4 | #include <stdint.h> |
garyservin | 0:fd24f7ca9688 | 5 | #include <string.h> |
garyservin | 0:fd24f7ca9688 | 6 | #include <stdlib.h> |
garyservin | 0:fd24f7ca9688 | 7 | #include "ros/msg.h" |
garyservin | 0:fd24f7ca9688 | 8 | |
garyservin | 0:fd24f7ca9688 | 9 | namespace rosserial_mbed |
garyservin | 0:fd24f7ca9688 | 10 | { |
garyservin | 0:fd24f7ca9688 | 11 | |
garyservin | 0:fd24f7ca9688 | 12 | class Adc : public ros::Msg |
garyservin | 0:fd24f7ca9688 | 13 | { |
garyservin | 0:fd24f7ca9688 | 14 | public: |
garyservin | 0:fd24f7ca9688 | 15 | uint16_t adc0; |
garyservin | 0:fd24f7ca9688 | 16 | uint16_t adc1; |
garyservin | 0:fd24f7ca9688 | 17 | uint16_t adc2; |
garyservin | 0:fd24f7ca9688 | 18 | uint16_t adc3; |
garyservin | 0:fd24f7ca9688 | 19 | uint16_t adc4; |
garyservin | 0:fd24f7ca9688 | 20 | uint16_t adc5; |
garyservin | 0:fd24f7ca9688 | 21 | |
garyservin | 0:fd24f7ca9688 | 22 | Adc(): |
garyservin | 0:fd24f7ca9688 | 23 | adc0(0), |
garyservin | 0:fd24f7ca9688 | 24 | adc1(0), |
garyservin | 0:fd24f7ca9688 | 25 | adc2(0), |
garyservin | 0:fd24f7ca9688 | 26 | adc3(0), |
garyservin | 0:fd24f7ca9688 | 27 | adc4(0), |
garyservin | 0:fd24f7ca9688 | 28 | adc5(0) |
garyservin | 0:fd24f7ca9688 | 29 | { |
garyservin | 0:fd24f7ca9688 | 30 | } |
garyservin | 0:fd24f7ca9688 | 31 | |
garyservin | 0:fd24f7ca9688 | 32 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:fd24f7ca9688 | 33 | { |
garyservin | 0:fd24f7ca9688 | 34 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 35 | *(outbuffer + offset + 0) = (this->adc0 >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 36 | *(outbuffer + offset + 1) = (this->adc0 >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 37 | offset += sizeof(this->adc0); |
garyservin | 0:fd24f7ca9688 | 38 | *(outbuffer + offset + 0) = (this->adc1 >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 39 | *(outbuffer + offset + 1) = (this->adc1 >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 40 | offset += sizeof(this->adc1); |
garyservin | 0:fd24f7ca9688 | 41 | *(outbuffer + offset + 0) = (this->adc2 >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 42 | *(outbuffer + offset + 1) = (this->adc2 >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 43 | offset += sizeof(this->adc2); |
garyservin | 0:fd24f7ca9688 | 44 | *(outbuffer + offset + 0) = (this->adc3 >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 45 | *(outbuffer + offset + 1) = (this->adc3 >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 46 | offset += sizeof(this->adc3); |
garyservin | 0:fd24f7ca9688 | 47 | *(outbuffer + offset + 0) = (this->adc4 >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 48 | *(outbuffer + offset + 1) = (this->adc4 >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 49 | offset += sizeof(this->adc4); |
garyservin | 0:fd24f7ca9688 | 50 | *(outbuffer + offset + 0) = (this->adc5 >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 51 | *(outbuffer + offset + 1) = (this->adc5 >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 52 | offset += sizeof(this->adc5); |
garyservin | 0:fd24f7ca9688 | 53 | return offset; |
garyservin | 0:fd24f7ca9688 | 54 | } |
garyservin | 0:fd24f7ca9688 | 55 | |
garyservin | 0:fd24f7ca9688 | 56 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:fd24f7ca9688 | 57 | { |
garyservin | 0:fd24f7ca9688 | 58 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 59 | this->adc0 = ((uint16_t) (*(inbuffer + offset))); |
garyservin | 0:fd24f7ca9688 | 60 | this->adc0 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 61 | offset += sizeof(this->adc0); |
garyservin | 0:fd24f7ca9688 | 62 | this->adc1 = ((uint16_t) (*(inbuffer + offset))); |
garyservin | 0:fd24f7ca9688 | 63 | this->adc1 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 64 | offset += sizeof(this->adc1); |
garyservin | 0:fd24f7ca9688 | 65 | this->adc2 = ((uint16_t) (*(inbuffer + offset))); |
garyservin | 0:fd24f7ca9688 | 66 | this->adc2 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 67 | offset += sizeof(this->adc2); |
garyservin | 0:fd24f7ca9688 | 68 | this->adc3 = ((uint16_t) (*(inbuffer + offset))); |
garyservin | 0:fd24f7ca9688 | 69 | this->adc3 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 70 | offset += sizeof(this->adc3); |
garyservin | 0:fd24f7ca9688 | 71 | this->adc4 = ((uint16_t) (*(inbuffer + offset))); |
garyservin | 0:fd24f7ca9688 | 72 | this->adc4 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 73 | offset += sizeof(this->adc4); |
garyservin | 0:fd24f7ca9688 | 74 | this->adc5 = ((uint16_t) (*(inbuffer + offset))); |
garyservin | 0:fd24f7ca9688 | 75 | this->adc5 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 76 | offset += sizeof(this->adc5); |
garyservin | 0:fd24f7ca9688 | 77 | return offset; |
garyservin | 0:fd24f7ca9688 | 78 | } |
garyservin | 0:fd24f7ca9688 | 79 | |
garyservin | 0:fd24f7ca9688 | 80 | const char * getType(){ return "rosserial_mbed/Adc"; }; |
garyservin | 0:fd24f7ca9688 | 81 | const char * getMD5(){ return "6d7853a614e2e821319068311f2af25b"; }; |
garyservin | 0:fd24f7ca9688 | 82 | |
garyservin | 0:fd24f7ca9688 | 83 | }; |
garyservin | 0:fd24f7ca9688 | 84 | |
garyservin | 0:fd24f7ca9688 | 85 | } |
garyservin | 0:fd24f7ca9688 | 86 | #endif |