ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
ruuvi_driver_sensor.c File Reference
#include "ruuvi_driver_error.h"
#include "ruuvi_driver_sensor.h"
#include <stddef.h>
#include <string.h>

Go to the source code of this file.

Macros

#define BITS_PER_BYTE   (8U)
 Number of bits in a byte. More...
 

Functions

rd_status_t rd_sensor_configuration_set (const rd_sensor_t *sensor, rd_sensor_configuration_t *config)
 Implementation of ref rd_configuration_fp. More...
 
rd_status_t rd_sensor_configuration_get (const rd_sensor_t *sensor, rd_sensor_configuration_t *config)
 Implementation of ref rd_configuration_fp. More...
 
rd_status_t rd_sensor_timestamp_function_set (rd_sensor_timestamp_fp timestamp_fp)
 Setup timestamping. Set to NULL to disable timestamps. More...
 
uint64_t rd_sensor_timestamp_get (void)
 Calls the timestamp function and returns its value. More...
 
void rd_sensor_initialize (rd_sensor_t *const p_sensor)
 Initialize sensor struct with non-null pointers which return RD_ERROR_NOT_INITIALIZED. More...
 
void rd_sensor_uninitialize (rd_sensor_t *const p_sensor)
 Mark sensor as uninitialized by calling the generic initialization. Will not clear the name of the sensor. More...
 
float rd_sensor_data_parse (const rd_sensor_data_t *const provided, const rd_sensor_data_fields_t requested)
 Parse data from provided struct. More...
 
void rd_sensor_data_set (rd_sensor_data_t *const target, const rd_sensor_data_fields_t field, const float value)
 Set a desired value to target data. More...
 
bool rd_sensor_has_valid_data (const rd_sensor_data_t *const target, const uint8_t index)
 Check if sensor has valid data at given index. More...
 
rd_sensor_data_bitfield_t rd_sensor_field_type (const rd_sensor_data_t *const target, const uint8_t index)
 Check the type of data at given index. More...
 
void rd_sensor_data_populate (rd_sensor_data_t *const target, const rd_sensor_data_t *const provided, const rd_sensor_data_fields_t requested)
 Populate given target data with data provided by sensor as requested. More...
 
uint8_t rd_sensor_data_fieldcount (const rd_sensor_data_t *const target)
 Count number of floats required for this data structure. More...
 
rd_status_t validate_default_input_set (uint8_t *const input, const uint8_t mode)
 Validate that given setting can be set on a sensor which supports only default value. More...
 
rd_status_t validate_default_input_get (uint8_t *const input)
 Validate and get input when only allowed value is default. More...
 
bool rd_sensor_is_init (const rd_sensor_t *const sensor)
 Check if given sensor structure is already initialized. More...
 

Macro Definition Documentation

◆ BITS_PER_BYTE

#define BITS_PER_BYTE   (8U)

Number of bits in a byte.

Definition at line 6 of file ruuvi_driver_sensor.c.