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_Baro/AP_Baro_SPL06.h
Views: 1798
1
#pragma once
2
3
#include "AP_Baro_Backend.h"
4
5
#if AP_BARO_SPL06_ENABLED
6
7
#include <AP_HAL/AP_HAL.h>
8
#include <AP_HAL/Device.h>
9
#include <AP_HAL/utility/OwnPtr.h>
10
11
#ifndef HAL_BARO_SPL06_I2C_ADDR
12
#define HAL_BARO_SPL06_I2C_ADDR (0x76)
13
#endif
14
#ifndef HAL_BARO_SPL06_I2C_ADDR2
15
#define HAL_BARO_SPL06_I2C_ADDR2 (0x77)
16
#endif
17
18
class AP_Baro_SPL06 : public AP_Baro_Backend
19
{
20
public:
21
enum class Type {
22
UNKNOWN,
23
SPL06,
24
SPA06,
25
};
26
AP_Baro_SPL06(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> dev);
27
28
/* AP_Baro public interface: */
29
void update() override;
30
31
static AP_Baro_Backend *probe(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> dev);
32
33
private:
34
35
bool _init(void);
36
void _timer(void);
37
void _update_temperature(int32_t);
38
void _update_pressure(int32_t);
39
40
int32_t raw_value_scale_factor(uint8_t);
41
42
AP_HAL::OwnPtr<AP_HAL::Device> _dev;
43
44
int8_t _timer_counter;
45
uint8_t _instance;
46
float _temp_raw;
47
float _pressure_sum;
48
uint32_t _pressure_count;
49
float _temperature;
50
51
// Internal calibration registers
52
int32_t _c00, _c10;
53
int16_t _c0, _c1, _c01, _c11, _c20, _c21, _c30, _c31, _c40;
54
55
Type type;
56
};
57
58
#endif // AP_BARO_SPL06_ENABLED
59
60