
test
ros_lib_melodic/rosserial_mbed/Adc.h@2:b7fdc74e5c5d, 2020-07-07 (annotated)
- Committer:
- ommpy
- Date:
- Tue Jul 07 15:19:06 2020 +0530
- Revision:
- 2:b7fdc74e5c5d
new board files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ommpy | 2:b7fdc74e5c5d | 1 | #ifndef _ROS_rosserial_mbed_Adc_h |
ommpy | 2:b7fdc74e5c5d | 2 | #define _ROS_rosserial_mbed_Adc_h |
ommpy | 2:b7fdc74e5c5d | 3 | |
ommpy | 2:b7fdc74e5c5d | 4 | #include <stdint.h> |
ommpy | 2:b7fdc74e5c5d | 5 | #include <string.h> |
ommpy | 2:b7fdc74e5c5d | 6 | #include <stdlib.h> |
ommpy | 2:b7fdc74e5c5d | 7 | #include "ros/msg.h" |
ommpy | 2:b7fdc74e5c5d | 8 | |
ommpy | 2:b7fdc74e5c5d | 9 | namespace rosserial_mbed |
ommpy | 2:b7fdc74e5c5d | 10 | { |
ommpy | 2:b7fdc74e5c5d | 11 | |
ommpy | 2:b7fdc74e5c5d | 12 | class Adc : public ros::Msg |
ommpy | 2:b7fdc74e5c5d | 13 | { |
ommpy | 2:b7fdc74e5c5d | 14 | public: |
ommpy | 2:b7fdc74e5c5d | 15 | typedef uint16_t _adc0_type; |
ommpy | 2:b7fdc74e5c5d | 16 | _adc0_type adc0; |
ommpy | 2:b7fdc74e5c5d | 17 | typedef uint16_t _adc1_type; |
ommpy | 2:b7fdc74e5c5d | 18 | _adc1_type adc1; |
ommpy | 2:b7fdc74e5c5d | 19 | typedef uint16_t _adc2_type; |
ommpy | 2:b7fdc74e5c5d | 20 | _adc2_type adc2; |
ommpy | 2:b7fdc74e5c5d | 21 | typedef uint16_t _adc3_type; |
ommpy | 2:b7fdc74e5c5d | 22 | _adc3_type adc3; |
ommpy | 2:b7fdc74e5c5d | 23 | typedef uint16_t _adc4_type; |
ommpy | 2:b7fdc74e5c5d | 24 | _adc4_type adc4; |
ommpy | 2:b7fdc74e5c5d | 25 | typedef uint16_t _adc5_type; |
ommpy | 2:b7fdc74e5c5d | 26 | _adc5_type adc5; |
ommpy | 2:b7fdc74e5c5d | 27 | |
ommpy | 2:b7fdc74e5c5d | 28 | Adc(): |
ommpy | 2:b7fdc74e5c5d | 29 | adc0(0), |
ommpy | 2:b7fdc74e5c5d | 30 | adc1(0), |
ommpy | 2:b7fdc74e5c5d | 31 | adc2(0), |
ommpy | 2:b7fdc74e5c5d | 32 | adc3(0), |
ommpy | 2:b7fdc74e5c5d | 33 | adc4(0), |
ommpy | 2:b7fdc74e5c5d | 34 | adc5(0) |
ommpy | 2:b7fdc74e5c5d | 35 | { |
ommpy | 2:b7fdc74e5c5d | 36 | } |
ommpy | 2:b7fdc74e5c5d | 37 | |
ommpy | 2:b7fdc74e5c5d | 38 | virtual int serialize(unsigned char *outbuffer) const |
ommpy | 2:b7fdc74e5c5d | 39 | { |
ommpy | 2:b7fdc74e5c5d | 40 | int offset = 0; |
ommpy | 2:b7fdc74e5c5d | 41 | *(outbuffer + offset + 0) = (this->adc0 >> (8 * 0)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 42 | *(outbuffer + offset + 1) = (this->adc0 >> (8 * 1)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 43 | offset += sizeof(this->adc0); |
ommpy | 2:b7fdc74e5c5d | 44 | *(outbuffer + offset + 0) = (this->adc1 >> (8 * 0)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 45 | *(outbuffer + offset + 1) = (this->adc1 >> (8 * 1)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 46 | offset += sizeof(this->adc1); |
ommpy | 2:b7fdc74e5c5d | 47 | *(outbuffer + offset + 0) = (this->adc2 >> (8 * 0)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 48 | *(outbuffer + offset + 1) = (this->adc2 >> (8 * 1)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 49 | offset += sizeof(this->adc2); |
ommpy | 2:b7fdc74e5c5d | 50 | *(outbuffer + offset + 0) = (this->adc3 >> (8 * 0)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 51 | *(outbuffer + offset + 1) = (this->adc3 >> (8 * 1)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 52 | offset += sizeof(this->adc3); |
ommpy | 2:b7fdc74e5c5d | 53 | *(outbuffer + offset + 0) = (this->adc4 >> (8 * 0)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 54 | *(outbuffer + offset + 1) = (this->adc4 >> (8 * 1)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 55 | offset += sizeof(this->adc4); |
ommpy | 2:b7fdc74e5c5d | 56 | *(outbuffer + offset + 0) = (this->adc5 >> (8 * 0)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 57 | *(outbuffer + offset + 1) = (this->adc5 >> (8 * 1)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 58 | offset += sizeof(this->adc5); |
ommpy | 2:b7fdc74e5c5d | 59 | return offset; |
ommpy | 2:b7fdc74e5c5d | 60 | } |
ommpy | 2:b7fdc74e5c5d | 61 | |
ommpy | 2:b7fdc74e5c5d | 62 | virtual int deserialize(unsigned char *inbuffer) |
ommpy | 2:b7fdc74e5c5d | 63 | { |
ommpy | 2:b7fdc74e5c5d | 64 | int offset = 0; |
ommpy | 2:b7fdc74e5c5d | 65 | this->adc0 = ((uint16_t) (*(inbuffer + offset))); |
ommpy | 2:b7fdc74e5c5d | 66 | this->adc0 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); |
ommpy | 2:b7fdc74e5c5d | 67 | offset += sizeof(this->adc0); |
ommpy | 2:b7fdc74e5c5d | 68 | this->adc1 = ((uint16_t) (*(inbuffer + offset))); |
ommpy | 2:b7fdc74e5c5d | 69 | this->adc1 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); |
ommpy | 2:b7fdc74e5c5d | 70 | offset += sizeof(this->adc1); |
ommpy | 2:b7fdc74e5c5d | 71 | this->adc2 = ((uint16_t) (*(inbuffer + offset))); |
ommpy | 2:b7fdc74e5c5d | 72 | this->adc2 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); |
ommpy | 2:b7fdc74e5c5d | 73 | offset += sizeof(this->adc2); |
ommpy | 2:b7fdc74e5c5d | 74 | this->adc3 = ((uint16_t) (*(inbuffer + offset))); |
ommpy | 2:b7fdc74e5c5d | 75 | this->adc3 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); |
ommpy | 2:b7fdc74e5c5d | 76 | offset += sizeof(this->adc3); |
ommpy | 2:b7fdc74e5c5d | 77 | this->adc4 = ((uint16_t) (*(inbuffer + offset))); |
ommpy | 2:b7fdc74e5c5d | 78 | this->adc4 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); |
ommpy | 2:b7fdc74e5c5d | 79 | offset += sizeof(this->adc4); |
ommpy | 2:b7fdc74e5c5d | 80 | this->adc5 = ((uint16_t) (*(inbuffer + offset))); |
ommpy | 2:b7fdc74e5c5d | 81 | this->adc5 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); |
ommpy | 2:b7fdc74e5c5d | 82 | offset += sizeof(this->adc5); |
ommpy | 2:b7fdc74e5c5d | 83 | return offset; |
ommpy | 2:b7fdc74e5c5d | 84 | } |
ommpy | 2:b7fdc74e5c5d | 85 | |
ommpy | 2:b7fdc74e5c5d | 86 | const char * getType(){ return "rosserial_mbed/Adc"; }; |
ommpy | 2:b7fdc74e5c5d | 87 | const char * getMD5(){ return "6d7853a614e2e821319068311f2af25b"; }; |
ommpy | 2:b7fdc74e5c5d | 88 | |
ommpy | 2:b7fdc74e5c5d | 89 | }; |
ommpy | 2:b7fdc74e5c5d | 90 | |
ommpy | 2:b7fdc74e5c5d | 91 | } |
ommpy | 2:b7fdc74e5c5d | 92 | #endif |