forked from Mccpie01/Model-Rocket-Flight-Computer-microcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sac2020_LPS_baro.h
55 lines (48 loc) · 1.14 KB
/
sac2020_LPS_baro.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* *
* Flight software; The configurability of the
* software--combined with modularity and all-in-one-package style of the
* Generation 2 flight computer--means the software can be easily adapted to run
* in any high-power rocket.
*
* @file sac2020__LPS_baro.h
* @purpose Device wrapper for the flight computer's barometer.
* @author Pierre McCarragher
* @updated 2024/01/04
*/
#ifndef SAC2020_LPS_BARO_H
#define SAC2020_LPS_BARO_H
#include <Wire.h>
#include <LPS.h>
#include "photic.h"
class Sac2020LPSBarometer final : public photic::Barometer
{
public:
/**
* Initializes the lps.
*
* @ret True if successful, false otherwise.
*/
bool init()
{
return m_lps.init();
}
/**
* Reads in all data from the lps.
*
* @ret Always returns true.
*/
bool update()
{
m_data.pressure = m_lps.readPressureMillibars();
m_data.temperature = m_lps.readTemperatureC();
m_data.altitude = m_lps.pressureToAltitudeMeters(m_data.pressure);;
return true;
}
private:
/**
* lps driver.
*/
LPS m_lps;
};
#endif