Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_Baro/AP_Baro_SPL06.h
9784 views
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
10
#ifndef HAL_BARO_SPL06_I2C_ADDR
11
#define HAL_BARO_SPL06_I2C_ADDR (0x76)
12
#endif
13
#ifndef HAL_BARO_SPL06_I2C_ADDR2
14
#define HAL_BARO_SPL06_I2C_ADDR2 (0x77)
15
#endif
16
17
class AP_Baro_SPL06 : public AP_Baro_Backend
18
{
19
public:
20
enum class Type {
21
UNKNOWN,
22
SPL06,
23
SPA06,
24
};
25
AP_Baro_SPL06(AP_Baro &baro, AP_HAL::Device &dev);
26
27
/* AP_Baro public interface: */
28
void update() override;
29
30
static AP_Baro_Backend *probe(AP_Baro &baro, AP_HAL::Device &dev);
31
32
private:
33
34
bool _init(void);
35
void _timer(void);
36
void _update_temperature(int32_t);
37
void _update_pressure(int32_t);
38
39
int32_t raw_value_scale_factor(uint8_t);
40
41
AP_HAL::Device *_dev;
42
43
int8_t _timer_counter;
44
uint8_t _instance;
45
float _temp_raw;
46
float _pressure_sum;
47
uint32_t _pressure_count;
48
float _temperature;
49
50
// Internal calibration registers
51
int32_t _c00, _c10;
52
int16_t _c0, _c1, _c01, _c11, _c20, _c21, _c30, _c31, _c40;
53
54
Type type;
55
};
56
57
#endif // AP_BARO_SPL06_ENABLED
58
59