Set blackbox file handler to NULL after closing file
[inav.git] / src / main / sensors / temperature.h
blob401a140f889eb082384ca770d6010a2fefa60492
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #include "config/parameter_group.h"
22 #define TEMPERATURE_LABEL_LEN 4
23 #define MAX_TEMP_SENSORS 8
25 #define TEMPERATURE_INVALID_VALUE -1250
27 typedef enum {
28 TEMP_SENSOR_NONE = 0,
29 TEMP_SENSOR_LM75,
30 TEMP_SENSOR_DS18B20
31 } tempSensorType_e;
33 typedef struct {
34 tempSensorType_e type;
35 uint64_t address;
36 int16_t alarm_min;
37 int16_t alarm_max;
38 uint8_t osdSymbol;
39 char label[TEMPERATURE_LABEL_LEN];
40 } tempSensorConfig_t;
42 PG_DECLARE_ARRAY(tempSensorConfig_t, MAX_TEMP_SENSORS, tempSensorConfig);
44 // Temperature is returned in degC*10
45 bool getIMUTemperature(int16_t *temperature);
46 bool getBaroTemperature(int16_t *temperature);
47 void temperatureUpdate(void);
49 #ifdef USE_TEMPERATURE_SENSOR
50 void temperatureInit(void);
52 bool getSensorTemperature(uint8_t sensorIndex, int16_t *temperature);
54 void tempSensorAddressToString(uint64_t address, char *hex_address);
55 bool tempSensorStringToAddress(const char *hex_address, uint64_t *address);
56 #endif
58 void resetTempSensorConfig(void);