LoRa-BLE-Sensor
|
This is a library to keep track of sensor data, using the sensor_reading library to collect data from the sensors. This library will also handle the data storage and retrieval. More...
#include "sensor_data.h"
#include "sensor_power.h"
#include "sensor_reading.h"
#include <stdint.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
Classes | |
struct | sensor_data_config_t |
Functions | |
LOG_MODULE_REGISTER (sensor_data, LOG_LEVEL_INF) | |
int | sensor_data_setup (sensor_data_t *sensor_data, enum sensor_types type, enum sensor_voltage voltage_enum) |
Setup the sensor data. If the sensor chosen has continuous power, the power will be turned on when the sensor is setup. If not the power will be turned on only when the data is read. PULSE_SENSORs use continuous power. To disable a sensor, set the type to NULL_SENSOR. This is important when using a sensor with continuous power, as it will turn off the power when the sensor is deinitialized. | |
int | sensor_data_read (sensor_data_t *sensor_data, int timestamp) |
Read the sensor data, and store the data in the buffer. It adds a tinestamp to the data buffer. | |
int | sensor_data_print_data (sensor_data_t *sensor_data) |
Print the sensor data from data and timestamp ring buffers. Displaying it from the oldest to newest. | |
int | sensor_data_clear (sensor_data_t *sensor_data) |
Clear the sensor data. | |
int | sensor_data_format_for_lorawan (sensor_data_t *sensor_data, uint8_t *data, uint8_t *data_len) |
Format the sensor data for LoRaWAN, this breaks the data into a uint8_t array. | |
Variables | |
sensor_reading_config_t | sensor1_reading_config |
sensor_reading_config_t | sensor2_reading_config |
This is a library to keep track of sensor data, using the sensor_reading library to collect data from the sensors. This library will also handle the data storage and retrieval.
int sensor_data_clear | ( | sensor_data_t * | sensor_data | ) |
Clear the sensor data.
sensor_data | The sensor data to clear. |
int sensor_data_format_for_lorawan | ( | sensor_data_t * | sensor_data, |
uint8_t * | data, | ||
uint8_t * | data_len | ||
) |
Format the sensor data for LoRaWAN, this breaks the data into a uint8_t array.
sensor_data | The sensor data to format. |
data | The data to format. |
data_len | The length of the data. |
int sensor_data_print_data | ( | sensor_data_t * | sensor_data | ) |
Print the sensor data from data and timestamp ring buffers. Displaying it from the oldest to newest.
sensor_data | The sensor data to print. |
int sensor_data_read | ( | sensor_data_t * | sensor_data, |
int | timestamp | ||
) |
Read the sensor data, and store the data in the buffer. It adds a tinestamp to the data buffer.
sensor_data | The sensor data to read. |
timestamp | The timestamp to add to the data buffer. |
int sensor_data_setup | ( | sensor_data_t * | sensor_data, |
enum sensor_types | type, | ||
enum sensor_voltage | voltage_enum | ||
) |
Setup the sensor data. If the sensor chosen has continuous power, the power will be turned on when the sensor is setup. If not the power will be turned on only when the data is read. PULSE_SENSORs use continuous power. To disable a sensor, set the type to NULL_SENSOR. This is important when using a sensor with continuous power, as it will turn off the power when the sensor is deinitialized.
sensor_data | The sensor data to setup holding the sensor id and power id. |
type | The type of sensor to setup. |
voltage_enum | The voltage to use for the sensor. |
sensor_reading_config_t sensor1_reading_config |
sensor_reading_config_t sensor2_reading_config |