137typedef struct sensor_t {
151 errno_t (*open)(
struct sensor_t *sensor);
161 errno_t (*read)(
struct sensor_t *sensor,
const SensorTag tag,
void *buf,
size_t *nbytes);
164void memcpy_be(
void *dest,
const void *src,
const size_t nbytes);
SensorTagDType
Definition: sensor_api.h:59
@ TYPE_FLOAT
Definition: sensor_api.h:60
@ TYPE_U8
Definition: sensor_api.h:63
@ TYPE_I16
Definition: sensor_api.h:65
@ TYPE_U16
Definition: sensor_api.h:62
@ TYPE_U32
Definition: sensor_api.h:61
@ TYPE_VEC2D
Definition: sensor_api.h:69
@ TYPE_I32
Definition: sensor_api.h:64
@ TYPE_I8
Definition: sensor_api.h:66
@ TYPE_VEC2D_I32
Definition: sensor_api.h:68
@ TYPE_VEC3D
Definition: sensor_api.h:67
SensorPrecision
Definition: sensor_api.h:106
@ PRECISION_HIGH
Definition: sensor_api.h:107
@ PRECISION_MED
Definition: sensor_api.h:108
@ PRECISION_LOW
Definition: sensor_api.h:109
void sensor_set_precision(Sensor sensor, const SensorPrecision precision)
void sensor_set_ctx(Sensor *sensor, void *buf)
size_t sensor_get_ctx_size(Sensor sensor)
void memcpy_be(void *dest, const void *src, const size_t nbytes)
Definition: sensor_api.c:88
errno_t sensor_open(Sensor sensor)
size_t sensor_max_dsize(const Sensor *sensor)
Definition: sensor_api.c:145
errno_t sensor_read(Sensor sensor, const SensorTag tag, void *buf, size_t *nbytes)
const char * sensor_strtag(const SensorTag tag)
void sensor_write_data(FILE *stream, const common_t *msg)
Definition: sensor_api.c:168
SensorTag
Definition: sensor_api.h:44
@ TAG_TEMPERATURE
Definition: sensor_api.h:45
@ TAG_VOLTAGE
Definition: sensor_api.h:55
@ TAG_LINEAR_ACCEL_REL
Definition: sensor_api.h:52
@ TAG_ALTITUDE_SEA
Definition: sensor_api.h:49
@ TAG_LINEAR_ACCEL_ABS
Definition: sensor_api.h:53
@ TAG_TIME
Definition: sensor_api.h:48
@ TAG_ANGULAR_VEL
Definition: sensor_api.h:51
@ TAG_ALTITUDE_REL
Definition: sensor_api.h:50
@ TAG_COORDS
Definition: sensor_api.h:54
@ TAG_PRESSURE
Definition: sensor_api.h:46
@ TAG_HUMIDITY
Definition: sensor_api.h:47
Definition: sensor_api.h:121
size_t size
Definition: sensor_api.h:125
void * data
Definition: sensor_api.h:123
Definition: sensor_api.h:129
i2c_addr_t addr
Definition: sensor_api.h:131
int bus
Definition: sensor_api.h:133
Definition: sensor_api.h:91
const uint8_t has_id
Definition: sensor_api.h:103
const SensorTagDType dtype
Definition: sensor_api.h:101
const size_t dsize
Definition: sensor_api.h:99
const char * fmt_str
Definition: sensor_api.h:97
const char * unit
Definition: sensor_api.h:95
const char * name
Definition: sensor_api.h:93
Definition: sensor_api.h:113
uint8_t len
Definition: sensor_api.h:117
const SensorTag * tags
Definition: sensor_api.h:115
Definition: sensor_api.h:137
SensorTagList tag_list
Definition: sensor_api.h:141
SensorContext context
Definition: sensor_api.h:143
SensorPrecision precision
Definition: sensor_api.h:145
SensorLocation loc
Definition: sensor_api.h:139
Definition: sensor_api.h:73
uint8_t type
Definition: sensor_api.h:74
vec2d_i32_t VEC2D_I32
Definition: sensor_api.h:85
uint8_t U8
Definition: sensor_api.h:80
int8_t I8
Definition: sensor_api.h:83
vec3d_t VEC3D
Definition: sensor_api.h:84
uint16_t U16
Definition: sensor_api.h:79
int32_t I32
Definition: sensor_api.h:81
uint32_t U32
Definition: sensor_api.h:78
vec2d_t VEC2D
Definition: sensor_api.h:86
uint8_t id
Definition: sensor_api.h:75
float FLOAT
Definition: sensor_api.h:77
int16_t I16
Definition: sensor_api.h:82
Definition: sensor_api.h:26
int32_t y
Definition: sensor_api.h:30
int32_t x
Definition: sensor_api.h:28
Definition: sensor_api.h:18
float y
Definition: sensor_api.h:22
float x
Definition: sensor_api.h:20
Definition: sensor_api.h:34
float x
Definition: sensor_api.h:36
float z
Definition: sensor_api.h:40
float y
Definition: sensor_api.h:38