AVRly - AVR Development Resources
|
Go to the source code of this file.
Macros | |
#define | BME280_ADDRESS_W 0xEC |
#define | BME280_ADDRESS_R 0xED |
#define | CONFIG_REG 0xF5 |
#define | CTRL_MEAS_REG 0xF4 |
#define | STATUS_REG 0xF3 |
#define | CTRL_HUM_REG 0xF2 |
#define | SOFT_RESET_REG 0xE0 |
#define | CHIP_ID_REG 0xD0 |
#define | SKIPPED 0 |
#define | OVERSAMPLE_x1 1 |
#define | OVERSAMPLE_x2 2 |
#define | OVERSAMPLE_x4 3 |
#define | OVERSAMPLE_x8 4 |
#define | OVERSAMPLE_x16 5 |
#define | SLEEP_MODE 0 |
#define | FORCED_MODE 1 |
#define | NORMAL_MODE 3 |
#define | BUS_SPEED_100KHZ 100000U |
Functions | |
void | bme280_write_byte (uint8_t reg, uint8_t byte) |
Writes a single byte to a specified reguster. More... | |
void | bme280_write_word (uint8_t reg1, uint8_t reg2, uint8_t msb, uint8_t lsb) |
uint16_t | bme280_read_word (uint8_t start_address) |
Reads a 16bit unsigned integer from a specified register. More... | |
uint8_t | bme280_read_byte (uint8_t reg) |
void | bme280_read_comp_data (void) |
Reads in all compensation data from the device and stores it in a buffer. More... | |
uint32_t | bme280_get_raw_temp_val (void) |
uint32_t | bme280_get_raw_hum_val (void) |
void | bme280_burst_read (uint8_t start_addr, uint8_t start_position, uint8_t length) |
int32_t | bme280_compensate_temp (int32_t adc_T) |
Returns temperature in DegC, resolution is 0.01 DegC. More... | |
int32_t | bme280_compensate_pressure (int32_t adc_P) |
Returns pressure in Pa as unsigned 32 bit integer. More... | |
uint32_t | bme280_compensate_humidity (int32_t adc_H) |
Returns humidity in RH as unsigned 32 bit integer in Q22.10 format (22 integer and 10 fractional bits). More... | |
void | init_bme280 (void) |
Initialise the device ready for measurements to be taken. More... | |
int16_t | bme280_get_temperature (void) |
Fetches the latest temperature data from the sensor, compensates and formats the data in degrees Celcius * 100. More... | |
uint16_t | bme280_get_humidity (void) |
Fetches the latest humidity data from the sensor, compensates and formats the data as RH * 100. More... | |
uint16_t | bme280_get_pressure (void) |
Fetches the latest pressure data from the sensor, compensates and formats the data as Pa * 100. More... | |
Variables | |
log_system_config_t | bme280_log |
int32_t | t_fine |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition in file bme280.c.
void bme280_write_byte | ( | uint8_t | reg, |
uint8_t | byte | ||
) |
Writes a single byte to a specified reguster.
reg | is the reguster to be written to. |
byte | is the data to be sent. |
Definition at line 244 of file bme280.c.
uint16_t bme280_read_word | ( | uint8_t | start_address | ) |
Reads a 16bit unsigned integer from a specified register.
start_address | is the first memory location to be read from. |
Definition at line 295 of file bme280.c.
uint8_t bme280_read_byte | ( | uint8_t | reg | ) |
void bme280_read_comp_data | ( | void | ) |
Reads in all compensation data from the device and stores it in a buffer.
Definition at line 322 of file bme280.c.
uint32_t bme280_get_raw_temp_val | ( | void | ) |
Definition at line 364 of file bme280.c.
uint32_t bme280_get_raw_hum_val | ( | void | ) |
Definition at line 388 of file bme280.c.
void bme280_burst_read | ( | uint8_t | start_addr, |
uint8_t | start_position, | ||
uint8_t | length | ||
) |
Definition at line 269 of file bme280.c.
int32_t bme280_compensate_temp | ( | int32_t | adc_T | ) |
Returns temperature in DegC, resolution is 0.01 DegC.
Output value of "5123" equals 51.23 DegC.
Definition at line 420 of file bme280.c.
int32_t bme280_compensate_pressure | ( | int32_t | adc_P | ) |
Returns pressure in Pa as unsigned 32 bit integer.
Output value of "96386" equals 96386 Pa = 963.86 hPa.
Definition at line 436 of file bme280.c.
uint32_t bme280_compensate_humidity | ( | int32_t | adc_H | ) |
Returns humidity in RH as unsigned 32 bit integer in Q22.10 format (22 integer and 10 fractional bits).
Output value of "47445" represents 47445/1024 = 46.333 RH.
Definition at line 477 of file bme280.c.
void init_bme280 | ( | void | ) |
Initialise the device ready for measurements to be taken.
Definition at line 125 of file bme280.c.
int16_t bme280_get_temperature | ( | void | ) |
Fetches the latest temperature data from the sensor, compensates and formats the data in degrees Celcius * 100.
Definition at line 164 of file bme280.c.
uint16_t bme280_get_humidity | ( | void | ) |
Fetches the latest humidity data from the sensor, compensates and formats the data as RH * 100.
Definition at line 207 of file bme280.c.
uint16_t bme280_get_pressure | ( | void | ) |
log_system_config_t bme280_log |