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