| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- /*
- Unitemp - Universal temperature reader
- Copyright (C) 2022-2023 Victor Nikitchuk (https://github.com/quen0n)
- Contributed by g0gg0 (https://github.com/g3gg0)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
- #ifndef UNITEMP_BME680
- #define UNITEMP_BME680
- #include "../unitemp.h"
- #include "../Sensors.h"
- #include "../interfaces/I2CSensor.h"
- typedef struct {
- uint16_t dig_T1;
- int16_t dig_T2;
- int16_t dig_T3;
- } BME680_temp_cal;
- typedef struct {
- uint16_t dig_GH1;
- int16_t dig_GH2;
- int16_t dig_GH3;
- } BME680_gas_cal;
- typedef struct {
- uint16_t dig_P1;
- int16_t dig_P2;
- int16_t dig_P3;
- int16_t dig_P4;
- int16_t dig_P5;
- int16_t dig_P6;
- int16_t dig_P7;
- int16_t dig_P8;
- int16_t dig_P9;
- int16_t dig_P10;
- } BME680_press_cal;
- typedef struct {
- uint16_t dig_H1;
- uint16_t dig_H2;
- int8_t dig_H3;
- int8_t dig_H4;
- int8_t dig_H5;
- uint8_t dig_H6;
- int8_t dig_H7;
- } BME680_hum_cal;
- typedef struct {
- //Калибровочные значения температуры
- BME680_temp_cal temp_cal;
- //Калибровочные значения давления
- BME680_press_cal press_cal;
- //Калибровочные значения влажности воздуха
- BME680_hum_cal hum_cal;
- BME680_gas_cal gas_cal;
- //Время последнего обновления калибровочных значений
- uint32_t last_cal_update_time;
- //Индификатор датчика
- uint8_t chip_id;
- //Корректировочное значение температуры
- int32_t t_fine;
- } BME680_instance;
- extern const SensorType BME680;
- /**
- * @brief Выделение памяти и установка начальных значений датчика BME680
- * @param sensor Указатель на создаваемый датчик
- * @return Истина при успехе
- */
- bool unitemp_BME680_alloc(Sensor* sensor, char* args);
- /**
- * @brief Инициализации датчика BME680
- * @param sensor Указатель на датчик
- * @return Истина если инициализация упспешная
- */
- bool unitemp_BME680_init(Sensor* sensor);
- /**
- * @brief Деинициализация датчика
- * @param sensor Указатель на датчик
- */
- bool unitemp_BME680_deinit(Sensor* sensor);
- /**
- * @brief Обновление значений из датчика
- * @param sensor Указатель на датчик
- * @return Статус опроса датчика
- */
- UnitempStatus unitemp_BME680_update(Sensor* sensor);
- /**
- * @brief Высвободить память датчика
- * @param sensor Указатель на датчик
- */
- bool unitemp_BME680_free(Sensor* sensor);
- #endif
|