00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <usb.h>
00023 #include <stdint.h>
00024 #include <stdio.h>
00025 #include <arpa/inet.h>
00026
00027
00028 #define NIMU_VENDORID 0x10c4
00029 #define NIMU_PRODUCTID 0xEA61
00030
00031 #define NIMU_DATA_SIZE 38
00032
00033 typedef unsigned char uint8_t;
00034 typedef unsigned short uint16_t;
00035
00036
00037
00038 class nimu_data
00039 {
00040 public:
00041 uint8_t DeviceID;
00042 uint8_t MessageID;
00043 uint16_t SampleTimer;
00044 short GyroX;
00045 short GyroY;
00046 short GyroZ;
00047 short AccelX;
00048 short AccelY;
00049 short AccelZ;
00050 short MagX;
00051 short MagY;
00052 short MagZ;
00053 short GyroTempX;
00054 short GyroTempY;
00055 short GyroTempZ;
00056
00057 void Print() {
00058 printf("%04X %04X %04X,%04X %04X %04X\n",GyroX,GyroY,GyroZ,AccelX,AccelY,AccelZ);
00059 }
00060 };
00061
00062 class nimu
00063 {
00064 public:
00065 nimu();
00066 ~nimu();
00067
00068 int Open();
00069 int Close();
00070
00071 nimu_data GetData();
00072
00073 private:
00074 usb_dev_handle * nimu_dev;
00075
00076 };
00077