AVRly - AVR Development Resources
bme280.h
Go to the documentation of this file.
1/******************************************************************************
2 @copyright Copyright © 2022 by Jason Duffy.
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21******************************************************************************/
22
23/**
24 * @file bme280.h
25 * @ingroup bme280
26 * @author Jason Duffy
27 * @date 22nd June 2022
28 * @brief
29 * @bug No known bugs.
30 * @see
31 */
32
33#ifndef BME_TWO_EIGHTY_DOT_H
34#define BME_TWO_EIGHTY_DOT_H
35
36/*
37 * Burst_read is from registers 0xF7 to 0xFE (temperature, pressure and
38 * humidity. Pressure and temperature are read out in 20 bit unsigned format.
39 * Humidity is read out in 16 bit unsigned format.
40 */
41
42#include <stdint.h>
43
44/**
45 * @brief Initialise the device ready for measurements to be taken.
46 */
47void init_bme280(void);
48
49
50/**
51 * @brief Fetches the latest temperature data from the sensor, compensates and
52 * formats the data in degrees Celcius * 100.
53 * @returns eg. A return value of 5123 = 51.23˚C (Degrees Celcius).
54 */
55int16_t bme280_get_temperature(void);
56
57
58/**
59 * @brief Fetches the latest humidity data from the sensor, compensates and
60 * formats the data as %RH * 100.
61 * @returns eg. A return value of 2852 = 28.50 %RH (Relative Humidity).
62 */
63uint16_t bme280_get_humidity(void);
64
65
66/**
67 * @brief Fetches the latest pressure data from the sensor, compensates and
68 * formats the data as Pa * 100.
69 * @returns eg. A return value of 96386 = 963.86 Pa (Pascals).
70 */
71uint16_t bme280_get_pressure(void);
72
73
74#endif // BME_TWO_EIGHTY_DOT_H
uint16_t bme280_get_humidity(void)
Fetches the latest humidity data from the sensor, compensates and formats the data as RH * 100.
Definition: bme280.c:207
void init_bme280(void)
Initialise the device ready for measurements to be taken.
Definition: bme280.c:125
int16_t bme280_get_temperature(void)
Fetches the latest temperature data from the sensor, compensates and formats the data in degrees Celc...
Definition: bme280.c:164
uint16_t bme280_get_pressure(void)
Fetches the latest pressure data from the sensor, compensates and formats the data as Pa * 100.
Definition: bme280.c:228