Go to the documentation of this file.00001 #ifndef MICROSTRAINLIB_HPP_
00002 #define MICROSTRAINLIB_HPP_
00003
00004
00005
00006
00007
00008
00009 #include <LABUSTTypes.h>
00010 #include <initializer_list>
00011 #include <boost/array.hpp>
00012
00013 namespace LABUST
00014 {
00015 namespace MICROSTRAIN
00016 {
00029 namespace GX3COMMS
00030 {
00034 template <class Type> inline Type byte_swap(Type value)
00035 {
00036 Type retVal;
00037 char* po = reinterpret_cast<char*>(&value);
00038 char* ps = reinterpret_cast<char*>(&retVal);
00039
00040 for(int i=0; i<sizeof(Type); ++i)
00041 {
00042 ps[sizeof(Type) - i - 1] = po[i];
00043 }
00044
00045
00046 return retVal;
00047 }
00048
00049 template <LABUST::TYPES::uint8 cmd_byte, size_t data_count, class data_type = float>
00050 struct GX3Message
00051 {
00055 static const LABUST::TYPES::uint8 command = cmd_byte;
00059 boost::array<data_type, data_count> data;
00063 float timer;
00064 };
00065
00066 typedef GX3Message<0xE9,7> ReadFirmwareVersion;
00067 }
00068 }
00069 }
00070
00071 #endif