fetcher 0.0.0
A command line utility for reading sensor data over I2C and providing it over stdout.
|
Types and function prototypes for the sensor API used to communicate with I2C bus sensors. More...
#include <errno.h>
#include <hw/i2c.h>
#include <stdint.h>
#include <stdio.h>
Go to the source code of this file.
Data Structures | |
struct | vec2d_t |
struct | vec2d_i32_t |
struct | vec3d_t |
struct | common_t |
struct | SensorTagData |
struct | SensorTagList |
struct | SensorContext |
struct | SensorLocation |
struct | Sensor |
Enumerations | |
enum | SensorTag { TAG_TEMPERATURE = 0x0 , TAG_PRESSURE = 0x1 , TAG_HUMIDITY = 0x2 , TAG_TIME = 0x3 , TAG_ALTITUDE_SEA = 0x4 , TAG_ALTITUDE_REL = 0x5 , TAG_ANGULAR_VEL = 0x6 , TAG_LINEAR_ACCEL_REL = 0x7 , TAG_LINEAR_ACCEL_ABS = 0x8 , TAG_COORDS = 0x9 , TAG_VOLTAGE = 0xa } |
enum | SensorTagDType { TYPE_FLOAT , TYPE_U32 , TYPE_U16 , TYPE_U8 , TYPE_I32 , TYPE_I16 , TYPE_I8 , TYPE_VEC3D , TYPE_VEC2D_I32 , TYPE_VEC2D } |
enum | SensorPrecision { PRECISION_HIGH , PRECISION_MED , PRECISION_LOW } |
Functions | |
void | memcpy_be (void *dest, const void *src, const size_t nbytes) |
size_t | sensor_max_dsize (const Sensor *sensor) |
const char * | sensor_strtag (const SensorTag tag) |
void | sensor_write_data (FILE *stream, const common_t *msg) |
void | sensor_set_precision (Sensor sensor, const SensorPrecision precision) |
errno_t | sensor_open (Sensor sensor) |
errno_t | sensor_read (Sensor sensor, const SensorTag tag, void *buf, size_t *nbytes) |
size_t | sensor_get_ctx_size (Sensor sensor) |
void | sensor_set_ctx (Sensor *sensor, void *buf) |
Types and function prototypes for the sensor API used to communicate with I2C bus sensors.
Types and function prototypes for the sensor API used to communicate with I2C bus sensors. This API provides a way to set up and read sensors easily. Sensors can read multiple data types in standard measurements. Sensors also have a configurable precision.
enum SensorPrecision |
enum SensorTag |
Describes possible data types that fetcher is capable of producing.
enum SensorTagDType |
void memcpy_be | ( | void * | dest, |
const void * | src, | ||
const size_t | nbytes | ||
) |
Utility function for copying memory in big-endian format.
dest | The destination buffer for data copied from src. |
src | The source buffer for data to be copied into dest. |
nbytes | The number of bytes to copy from src into dest. |
size_t sensor_get_ctx_size | ( | Sensor | sensor | ) |
size_t sensor_max_dsize | ( | const Sensor * | sensor | ) |
Gets the maximum data size returned when reading the sensor.
sensor | The sensor to find the maximum data size of. |
errno_t sensor_open | ( | Sensor | sensor | ) |
void sensor_set_ctx | ( | Sensor * | sensor, |
void * | buf | ||
) |
void sensor_set_precision | ( | Sensor | sensor, |
const SensorPrecision | precision | ||
) |
const char * sensor_strtag | ( | const SensorTag | tag | ) |
void sensor_write_data | ( | FILE * | stream, |
const common_t * | msg | ||
) |
Writes sensor data in a standard format.
stream | The output stream for writing sensor data. |
tag | The tag describing the kind of sensor data. |
data | A pointer to the sensor data to be printed. |