-
Notifications
You must be signed in to change notification settings - Fork 4
/
dev_iio.h
60 lines (40 loc) · 1.49 KB
/
dev_iio.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once
#include "imu_message.h"
#include "input_dev.h"
#define DEV_IIO_HAS_ACCEL 0x00000001U
#define DEV_IIO_HAS_ANGLVEL 0x00000002U
#define ACCEL_SCALE ((double)(255.0)/(double)(9.81)) // convert m/s^2 to g's, and scale x255 to increase precision when passed to evdev as an int
#define GYRO_SCALE ((double)(180.0)/(double)(M_PI)) // convert radians/s to degrees/s
typedef struct dev_iio {
char* path;
char* dev_path;
char* name;
uint32_t flags;
int fd;
double accel_scale_x;
double accel_scale_y;
double accel_scale_z;
double outer_accel_scale_x;
double outer_accel_scale_y;
double outer_accel_scale_z;
double anglvel_scale_x;
double anglvel_scale_y;
double anglvel_scale_z;
double outer_anglvel_scale_x;
double outer_anglvel_scale_y;
double outer_anglvel_scale_z;
double temp_scale;
double outer_temp_scale;
} dev_iio_t;
int dev_iio_open(
const iio_filters_t *const in_filters,
dev_iio_t **const out_dev
);
void dev_iio_close(dev_iio_t *const iio);
int dev_iio_get_buffer_fd(const dev_iio_t *const iio);
const char* dev_iio_get_name(const dev_iio_t* iio);
const char* dev_iio_get_path(const dev_iio_t* iio);
int dev_iio_has_anglvel(const dev_iio_t* iio);
int dev_iio_has_accel(const dev_iio_t* iio);
int dev_iio_change_anglvel_sampling_freq(const dev_iio_t *const iio, const char *const freq_str_hz);
int dev_iio_change_accel_sampling_freq(const dev_iio_t *const iio, const char *const freq_str_hz);