rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
lps25.h
Go to the documentation of this file.
1/**
2 * @file lps25.h
3 * @brief Driver for the ST LPS22HB and LPS25HB pressure sensor
4 *
5 * @date February 6, 2020
6 * @author Matthew Kennedy, (c) 2020
7 */
8
9#pragma once
10
11#include "i2c_bb.h"
12
13class Lps25 {
14public:
15 // Returns true if the sensor was initialized successfully.
16 bool init(brain_pin_e scl, brain_pin_e sda);
17
18 expected<float> readPressureKpa();
19 bool hasInit() const {
20 return m_hasInit;
21 }
22
23private:
25
26 enum class Type {
27 Lps22,
28 Lps25,
29 };
30
32
33 bool m_hasInit = false;
34
35 uint8_t regCr1() const;
36};
Definition lps25.h:13
bool init(brain_pin_e scl, brain_pin_e sda)
Definition lps25.cpp:37
bool hasInit() const
Definition lps25.h:19
uint8_t regCr1() const
Definition lps25.cpp:116
Type
Definition lps25.h:26
expected< float > readPressureKpa()
Definition lps25.cpp:76
BitbangI2c m_i2c
Definition lps25.h:24
Type m_type
Definition lps25.h:31
bool m_hasInit
Definition lps25.h:33
Bit-banged I2C driver.