ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
Sensor

Functions

bool rd_sensor_run_integration_test (const rd_test_print_fp printfp, rt_sensor_ctx_t *p_sensor_ctx)
 
void rd_sensor_data_print (const rd_sensor_data_t *const p_data, const rd_test_print_fp printfp)
 Print Ruuvi Sensor data in human readable JSON. More...
 

Detailed Description

Function Documentation

◆ rd_sensor_data_print()

void rd_sensor_data_print ( const rd_sensor_data_t *const  p_data,
const rd_test_print_fp  printfp 
)

Print Ruuvi Sensor data in human readable JSON.

Takes Ruuvi sensor data as input, checks the provided fields and LOGs valid data if available and "NAN" if no valid data is available. Pseudocode example:

float values[3];
rd_sensor_t data = {0};
data.values = values;
data.provided = { // Query H, P, T
.datas.humidity_rh = 1,
.datas.pressure_pa = 1,
.datas.temperature_c = 1
};
shtcx->data_get(&data); // Provides only H, T
// Output, char array, \r\n as newline
// {
// "timestamp_ms": 2341242,
// "humidity_rh":"34.561%",
// "pressure_pa":"NAN",
// "temperature_c":"23.456"
// }
void rd_sensor_data_print(const rd_sensor_data_t *const p_data, const rd_test_print_fp printfp)
Print Ruuvi Sensor data in human readable JSON.
Interface to sensor. Some sensors can implement additional functions. The additional functions are de...
rd_sensor_data_fp data_get
rd_sensor_data_fp
Parameters
[in]p_dataPointer to data to print.
[in]printfpFunction to print data with, returns void and takes const char* const as param.

◆ rd_sensor_run_integration_test()

bool rd_sensor_run_integration_test ( const rd_test_print_fp  printfp,
rt_sensor_ctx_t p_sensor_ctx 
)