|
ENTS-tock
Environmental NeTworked Sensor firmware on Tock OS
|
Sensor interface for the BME280 sensor. More...
#include <bme280.h>#include <stddef.h>#include <stdint.h>#include "../../proto/sensor.pb.h"Go to the source code of this file.
Typedefs | |
| typedef struct bme280_data | BME280Data |
| Struct to store data from sensor. | |
Enumerations | |
| enum | BME280Status { BME280_STATUS_OK = BME280_OK , BME280_STATUS_NULL_PTR = BME280_E_NULL_PTR , BME280_STATUS_COMM_FAIL = BME280_E_COMM_FAIL , BME280_STATUS_INVALID_LEN = BME280_E_INVALID_LEN , BME280_STATUS_DEV_NOT_FOUND = BME280_E_DEV_NOT_FOUND , BME280_STATUS_SLEEP_MODE_FAIL = BME280_E_SLEEP_MODE_FAIL , BME280_STATUS_NVM_COPY_FAILED = BME280_E_NVM_COPY_FAILED , BME280_STATUS_ERROR = -7 } |
| BME280 error codes. More... | |
Functions | |
| BME280Status | BME280Init (void) |
| BME280Status | BME280Deinit (void) |
| BME280Status | BME280MeasureAll (BME280Data *data) |
| Measures temperature, pressure, and humidity. | |
| uint8_t | BME280MeasureTemperature (uint8_t *data, Metadata meta, uint32_t idx) |
| BME280 sensor library function. | |
| uint8_t | BME280MeasurePressure (uint8_t *data, Metadata meta, uint32_t idx) |
| uint8_t | BME280MeasureHumidity (uint8_t *data, Metadata meta, uint32_t idx) |
Sensor interface for the BME280 sensor.
This is the user code file that allows for interaction with the BME280 sensor. It provides a function for reading each measurement and a function for a function that can be integrated with the sensors api.
Definition in file bme280_sensor.h.
| typedef struct bme280_data BME280Data |
Struct to store data from sensor.
Definition at line 33 of file bme280_sensor.h.
| enum BME280Status |
BME280 error codes.
The enum constants are defined to match error codes in bme280_defs.h
Definition at line 40 of file bme280_sensor.h.
| BME280Status BME280Deinit | ( | void | ) |
| BME280Status BME280Init | ( | void | ) |
Definition at line 29 of file bme280_sensor.c.
| BME280Status BME280MeasureAll | ( | BME280Data * | data | ) |
Measures temperature, pressure, and humidity.
If you only need a single measurement channel, take all measurements and only take the needed measurement. Internally all channels need to be measured to get the value of a single channel.
| data |
Definition at line 85 of file bme280_sensor.c.
References data.
Referenced by BME280MeasureHumidity(), BME280MeasurePressure(), BME280MeasureTemperature(), and main().
| uint8_t BME280MeasureHumidity | ( | uint8_t * | data, |
| Metadata | meta, | ||
| uint32_t | idx | ||
| ) |
Definition at line 175 of file bme280_sensor.c.
References BME280_STATUS_OK, BME280MeasureAll(), data, data_len, EncodeDoubleMeasurement(), and SENSOR_OK.
Referenced by main().
| uint8_t BME280MeasurePressure | ( | uint8_t * | data, |
| Metadata | meta, | ||
| uint32_t | idx | ||
| ) |
Definition at line 152 of file bme280_sensor.c.
References BME280_STATUS_OK, BME280MeasureAll(), data, data_len, EncodeDoubleMeasurement(), and SENSOR_OK.
Referenced by main().
| uint8_t BME280MeasureTemperature | ( | uint8_t * | data, |
| Metadata | meta, | ||
| uint32_t | idx | ||
| ) |
BME280 sensor library function.
All three measurements (temperature, pressure, humidity) are measured and appropriate calibration are applied. Data gets encoded into a serialized measurement.
| data | Buffer to store measurement |
| ts | System time of measurement |
| idx | Sensor index |
Definition at line 129 of file bme280_sensor.c.
References BME280_STATUS_OK, BME280MeasureAll(), data, data_len, EncodeDoubleMeasurement(), and SENSOR_OK.
Referenced by main().