-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathimu.h
44 lines (37 loc) · 844 Bytes
/
imu.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
typedef const char error;
typedef enum {
IMU_ACC_RANGE_2G,
IMU_ACC_RANGE_4G,
IMU_ACC_RANGE_8G,
IMU_ACC_RANGE_16G,
} imu_acc_range;
typedef enum {
IMU_GYRO_RANGE_250DPS,
IMU_GYRO_RANGE_500DPS,
IMU_GYRO_RANGE_1000DPS,
IMU_GYRO_RANGE_2000DPS,
} imu_gyro_range;
typedef struct {
union {
struct {
double x;
double y;
double z;
} acc;
double acc_array[3];
};
union {
struct {
double x;
double y;
double z;
} gyro;
double gyro_array[3];
};
} imu_output;
typedef void imut;
error *imu_init(imut **pobj, const char *path, imu_acc_range acc_range,
imu_gyro_range gyro_range);
void imu_destroy(imut *obj);
error *imu_read(imut *obj, imu_output *out);