NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
barometer.h
Go to the documentation of this file.
1 /*
2  * This file is part of Ninjaflight.
3  *
4  * Ninjaflight 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.
8  *
9  * Ninjaflight 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.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Ninjaflight. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #pragma once
19 
20 #include "../config/barometer.h"
21 
22 typedef enum {
24  BARO_NONE = 1,
28 } baroSensor_e;
29 
30 #define BARO_SAMPLE_COUNT_MAX 48
31 #define BARO_MAX BARO_BMP280
32 
33 struct baro {
34  int32_t BaroAlt;
35  int32_t baroTemperature; // Use temperature for telemetry
36 
37  const struct config *config;
38 };
39 
40 void baro_init(struct baro *self, const struct config *config);
41 bool baro_is_calibrated(struct baro *self);
42 void baro_start_calibration(struct baro *self);
43 uint32_t baro_update(struct baro *self);
44 bool baro_is_ready(struct baro *self);
45 int32_t baro_calc_altitude(struct baro *self);
uint32_t baro_update(struct baro *self)
Definition: barometer.c:134
int32_t baroTemperature
Definition: barometer.h:35
Definition: config.h:81
void baro_start_calibration(struct baro *self)
const struct config * config
Definition: barometer.h:37
Definition: barometer.h:23
Definition: barometer.h:25
baroSensor_e
Definition: barometer.h:22
Definition: barometer.h:24
Definition: barometer.h:26
bool baro_is_ready(struct baro *self)
Definition: barometer.h:27
int32_t baro_calc_altitude(struct baro *self)
Definition: barometer.c:157
bool baro_is_calibrated(struct baro *self)
int32_t BaroAlt
Definition: barometer.h:34
void baro_init(struct baro *self, const struct config *config)
Definition: barometer.c:116
Definition: barometer.h:33