nimu.h
1/*
2 * Player - One Hell of a Robot Server
3 * Copyright (C) 2006
4 * Toby Collett
5 *
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include <usb.h>
23#include <stdint.h>
24#include <stdio.h>
25#include <arpa/inet.h>
26
27
28#define NIMU_VENDORID 0x10c4
29#define NIMU_PRODUCTID 0xEA61
30
31#define NIMU_DATA_SIZE 38
32
33typedef unsigned char uint8_t;
34typedef unsigned short uint16_t;
35
36
37
39{
40 public:
41 uint8_t DeviceID;
42 uint8_t MessageID;
43 uint16_t SampleTimer;
44 short GyroX;
45 short GyroY;
46 short GyroZ;
47 short AccelX;
48 short AccelY;
49 short AccelZ;
50 short MagX;
51 short MagY;
52 short MagZ;
53 short GyroTempX;
54 short GyroTempY;
55 short GyroTempZ;
56
57 void Print() {
58 printf("%04X %04X %04X,%04X %04X %04X\n",GyroX,GyroY,GyroZ,AccelX,AccelY,AccelZ);
59 }
60};
61
62class nimu
63{
64 public:
65 nimu();
66 ~nimu();
67
68 int Open();
69 int Close();
70
71 nimu_data GetData();
72
73 private:
74 usb_dev_handle * nimu_dev;
75
76};
77
Definition nimu.h:39
Definition nimu.h:63