MRAS
Multi Rocket Avionics System
|
#include <Sensor_MS5607.h>
Public Member Functions | |
Sensor_MS5607 (uint8_t id, byte i2c_address, TwoWire &i2c_bus, uint32_t frequency) | |
int8_t | setup () override |
int8_t | loop () override |
Public Member Functions inherited from Subsystem | |
virtual const char * | get_name ()=0 |
virtual int8_t | setup ()=0 |
virtual int8_t | loop ()=0 |
uint8_t | get_id () const |
int8_t | get_status () const |
int8_t | self_test () const |
bool | add_subscriber (Subsystem *subscriber) |
Subsystem (uint8_t id) | |
Additional Inherited Members | |
Protected Member Functions inherited from Subsystem | |
void | log (const char fmt[],...) |
virtual void | on_message (SystemMessage *msg)=0 |
void | publish (SystemMessage *msg) |
Static Protected Member Functions inherited from Subsystem | |
static void | buzzer (uint16_t frequency, uint32_t duration, bool block=false) |
Protected Attributes inherited from Subsystem | |
int8_t | status = 0 |
int8_t | self_test_result = -1 |
Sensor_MS5607 class is a C++ driver for the MS5607 barometric pressure sensor. It is a child class of the Subsystem base class and is responsible for communicating with the sensor over I2C, reading and interpreting the sensor's data, and providing that data to the system.
The setup()
method initializes the I2C bus and reads the sensor's calibration coefficients from its PROM (Programmable Read-Only Memory). It returns 0 on success and a non-zero value on failure.
The loop()
method reads pressure and temperature data from the sensor. It uses a finite state machine to control the timing of the pressure and temperature measurements. It returns different status codes depending on the state of the sensor and the outcome of the measurements.
The class has several private variables, such as the i2c address of the sensor, the i2c bus object, and the sensor's calibration coefficients. It also has several private constants, such as the OSR (Oversampling Ratio), which determines the resolution of the sensor's measurements, and the CONV_D1, CONV_D2, and CONV_Delay constants, which determine the timing of the pressure and temperature measurements.
read_ADC()
method is called to read the digital value of the pressure measurement from the sensor's ADC (Analog-to-Digital Converter).
|
overridevirtual |
Implements Subsystem.
|
overridevirtual |
Implements Subsystem.