Skyward boardcore
|
#include <MS5803I2C.h>
Public Types | |
enum | FSMStates { STATE_INIT = 0 , STATE_SAMPLED_TEMP , STATE_SAMPLED_PRESS } |
enum | MS5803Registers : uint8_t { REG_RESET = 0x1E , REG_CONVERT_D1_256 = 0x40 , REG_CONVERT_D1_512 = 0x42 , REG_CONVERT_D1_1024 = 0x44 , REG_CONVERT_D1_2048 = 0x46 , REG_CONVERT_D1_4096 = 0x48 , REG_CONVERT_D2_256 = 0x50 , REG_CONVERT_D2_512 = 0x52 , REG_CONVERT_D2_1024 = 0x54 , REG_CONVERT_D2_2048 = 0x56 , REG_CONVERT_D2_4096 = 0x58 , REG_ADC_READ = 0x00 , REG_PROM_SENS_MASK = 0xA2 , REG_PROM_OFF_MASK = 0xA4 , REG_PROM_TCS_MASK = 0xA6 , REG_PROM_TCO_MASK = 0xA8 , REG_PROM_TREF_MASK = 0xAA , REG_PROM_TEMPSENS_MASK = 0xAC } |
![]() | |
using | DataType |
Public Member Functions | |
MS5803I2C (I2C &bus, uint16_t temperatureDivider=1) | |
bool | init () override |
Initialize the sensor. | |
bool | selfTest () override |
Check if the sensor is working. | |
![]() | |
Sensor () | |
Sensor (Sensor &&other) | |
virtual | ~Sensor () |
void | sample () override |
Sample the sensor. | |
virtual MS5803Data | getLastSample () |
![]() | |
virtual | ~AbstractSensor () |
SensorErrors | getLastError () |
Get last error for debugging purposes. Avoid silent fails. | |
Static Public Attributes | |
static constexpr uint8_t | TIMEOUT = 5 |
Protected Member Functions | |
MS5803Data | sampleImpl () override |
Additional Inherited Members | |
![]() | |
DataType | lastSample |
miosix::FastMutex | mutex |
![]() | |
SensorErrors | lastError = SensorErrors::NO_ERRORS |
Definition at line 34 of file MS5803I2C.h.
Enumerator | |
---|---|
STATE_INIT | |
STATE_SAMPLED_TEMP | |
STATE_SAMPLED_PRESS |
Definition at line 37 of file MS5803I2C.h.
enum Boardcore::MS5803I2C::MS5803Registers : uint8_t |
Definition at line 44 of file MS5803I2C.h.
|
explicit |
Definition at line 31 of file MS5803I2C.cpp.
|
overridevirtual |
Initialize the sensor.
Implements Boardcore::AbstractSensor.
Definition at line 36 of file MS5803I2C.cpp.
|
overrideprotectedvirtual |
Implements a state machines composed of 3 states:
After the first call to sample() (state 1), the machine transitions between states 2 and 3: The effective sampling rate is half the rate at which this function is called. Example: call sample() at 100 Hz -> Pressure & Temperature sample Rate = 50 Hz
Implements Boardcore::Sensor< MS5803Data >.
Definition at line 57 of file MS5803I2C.cpp.
|
overridevirtual |
Check if the sensor is working.
Implements Boardcore::AbstractSensor.
Definition at line 55 of file MS5803I2C.cpp.
|
staticconstexpr |
Definition at line 73 of file MS5803I2C.h.