CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_Airspeed/AP_Airspeed_ASP5033.h
Views: 1798
1
/*
2
This program is free software: you can redistribute it and/or modify
3
it under the terms of the GNU General Public License as published by
4
the Free Software Foundation, either version 3 of the License, or
5
(at your option) any later version.
6
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
11
12
You should have received a copy of the GNU General Public License
13
along with this program. If not, see <http://www.gnu.org/licenses/>.
14
*/
15
#pragma once
16
17
#include "AP_Airspeed_config.h"
18
19
#if AP_AIRSPEED_ASP5033_ENABLED
20
21
/*
22
backend driver for airspeed from I2C
23
*/
24
#include "AP_Airspeed_Backend.h"
25
26
class AP_Airspeed_ASP5033 : public AP_Airspeed_Backend
27
{
28
public:
29
using AP_Airspeed_Backend::AP_Airspeed_Backend;
30
bool init() override;
31
32
// return the current differential_pressure in Pascal
33
bool get_differential_pressure(float &_pressure) override;
34
35
// return the current temperature in degrees C, if available
36
bool get_temperature(float &_temperature) override;
37
38
private:
39
void timer();
40
bool confirm_sensor_id(void);
41
float temp_sum;
42
float press_sum;
43
float last_pressure;
44
float last_temperature;
45
uint32_t press_count;
46
uint32_t temp_count;
47
uint32_t last_sample_ms;
48
49
AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev;
50
};
51
52
#endif // AP_AIRSPEED_ASP5033_ENABLED
53
54