No description

Dependencies:   BufferedSerial

Committer:
garyservin
Date:
Sat Dec 31 00:48:34 2016 +0000
Revision:
0:9e9b7db60fd5
Initial commit, generated based on a clean kinetic-desktop-full

Who changed what in which revision?

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