M5Unit-HEART 0.0.2 git rev:70607f7
Loading...
Searching...
No Matches
m5::unit::UnitMAX30100 Class Reference

Pulse oximetry and heart-rate sensor. More...

#include <unit_MAX30100.hpp>

Inheritance diagram for m5::unit::UnitMAX30100:

Classes

struct  config_t
 Settings for begin. More...
 

Public Member Functions

 UnitMAX30100 (const uint8_t addr=DEFAULT_ADDRESS)
 
virtual bool begin () override
 
virtual void update (const bool force=false) override
 
bool resetFIFO ()
 Reset FIFO buffer.
 
bool reset ()
 Reset.
 
Settings for begin
config_t config ()
 Gets the configration.
 
void config (const config_t &cfg)
 Set the configration.
 
Measurement data by periodic
uint16_t ir () const
 Oldest IR.
 
uint16_t red () const
 Oldest Red.
 
uint8_t retrived () const
 Number of data last retrieved.
 
uint8_t overflow () const
 The number of samples lost.
 
Periodic measurement
bool startPeriodicMeasurement ()
 Start periodic measurement in the current settings.
 
bool startPeriodicMeasurement (const max30100::Mode mode, const max30100::Sampling sample_rate, const max30100::LedPulseWidth pulse_width, const max30100::CurrentControl ir_current, const bool high_resolution=false, const max30100::CurrentControl red_current=max30100::CurrentControl::mA0_0)
 Start periodic measurement.
 
bool stopPeriodicMeasurement ()
 Stop periodic measurement.
 
Mode Configuration
Warning
Note that there are different combinations that can be set depending on the mode See also m5::unit::max30100::SpO2Configuration
bool readModeConfiguration (max30100::ModeConfiguration &mc)
 Read Mode configuration.
 
bool writeModeConfiguration (const max30100::ModeConfiguration mc)
 Write Mode configuration.
 
bool writeMode (const max30100::Mode mode)
 Write Mode.
 
bool writePowerSaveEnable ()
 Write power save mode to enable.
 
bool writePowerSaveDisable ()
 Write power save mode to disable.
 
SpO2 Configuration
Warning
Note that there are different combinations that can be set depending on the mode See also m5::unit::max30100::SpO2Configuration
bool readSpO2Configuration (max30100::SpO2Configuration &sc)
 Read SpO2 configrartion.
 
bool writeSpO2Configuration (const max30100::SpO2Configuration sc)
 Write SpO2 configrartion.
 
bool writeSamplingRate (const max30100::Sampling rate)
 Write sample rate.
 
bool writeLedPulseWidth (const max30100::LedPulseWidth width)
 Write LED pulse width.
 
bool writeHighResolutionEnable ()
 Writee SpO2 high resolution mode to enable.
 
bool writeHighResolutionDisable ()
 Write SpO2 high resolution mode to disable.
 
LED Configuration
Warning
In the heart-rate only mode, the red LED is inactive. and only the IR LED is used to capture optical data and determine the heart rate.
bool readLedConfiguration (max30100::LedConfiguration &lc)
 Read Led configrartion.
 
bool writeLedConfiguration (const max30100::LedConfiguration lc)
 Write Led configrartion.
 
bool writeLedCurrent (const max30100::CurrentControl ir, const max30100::CurrentControl red)
 Write IR/RED current.
 
Measurement temperature
Note
The temperature sensor data can be used to compensate the SpO2 error with ambient temperature changes
bool measureTemperatureSingleshot (max30100::TemperatureData &td)
 Measure tempeature single shot.
 

Protected Member Functions

bool start_periodic_measurement ()
 
bool start_periodic_measurement (const max30100::Mode mode, const max30100::Sampling sample_rate, const max30100::LedPulseWidth pulse_width, const max30100::CurrentControl ir_current, const bool high_resolution, const max30100::CurrentControl red_current)
 
bool stop_periodic_measurement ()
 
bool read_FIFO ()
 
bool read_measurement_temperature (max30100::TemperatureData &td)
 
 M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER (UnitMAX30100, max30100::Data)
 
bool read_mode_configration (uint8_t &c)
 
bool write_mode_configration (const uint8_t c)
 
bool enable_power_save (const bool enabled)
 
bool read_spo2_configration (uint8_t &c)
 
bool write_spo2_configration (const uint8_t c)
 
bool enable_high_resolution (const bool enabled)
 
bool read_led_configration (uint8_t &c)
 
bool write_led_configration (const uint8_t c)
 
bool read_register (const uint8_t reg, uint8_t *buf, const size_t len)
 
bool read_register8 (const uint8_t reg, uint8_t &v)
 

Protected Attributes

max30100::Mode _mode {max30100::Mode::None}
 
uint8_t _retrived {}
 
uint8_t _overflow {}
 
std::unique_ptr< m5::container::CircularBuffer< max30100::Data > > _data {}
 
config_t _cfg {}
 

Detailed Description

Pulse oximetry and heart-rate sensor.

Note
The only single measurement is temperature; other data is constantly measured and stored

Member Function Documentation

◆ measureTemperatureSingleshot()

bool m5::unit::UnitMAX30100::measureTemperatureSingleshot ( max30100::TemperatureData & td)

Measure tempeature single shot.

Parameters
[out]tempTemperature(Celsius)
Returns
True if successful
Warning
Blocking until measured about 29 ms

◆ overflow()

uint8_t m5::unit::UnitMAX30100::overflow ( ) const
inline

The number of samples lost.

Note
It saturates at 15

◆ readLedConfiguration()

bool m5::unit::UnitMAX30100::readLedConfiguration ( max30100::LedConfiguration & lc)

Read Led configrartion.

Parameters
[out]lcLedConfigration
Returns
True if successful

◆ readModeConfiguration()

bool m5::unit::UnitMAX30100::readModeConfiguration ( max30100::ModeConfiguration & mc)

Read Mode configuration.

Parameters
[out]mcModeConfigration
Returns
True if successful

◆ readSpO2Configuration()

bool m5::unit::UnitMAX30100::readSpO2Configuration ( max30100::SpO2Configuration & sc)

Read SpO2 configrartion.

Parameters
[out]scSpO2Configration
Returns
True if successful

◆ reset()

bool m5::unit::UnitMAX30100::reset ( )

Reset.

Returns
True if successful
Warning
Blocked until the reset process is completed

◆ resetFIFO()

bool m5::unit::UnitMAX30100::resetFIFO ( )

Reset FIFO buffer.

Returns
True if successful

◆ retrived()

uint8_t m5::unit::UnitMAX30100::retrived ( ) const
inline

Number of data last retrieved.

Note
The number of data retrieved by the latest update, not all data accumulated
See also
available()

◆ startPeriodicMeasurement() [1/2]

bool m5::unit::UnitMAX30100::startPeriodicMeasurement ( )
inline

Start periodic measurement in the current settings.

Returns
True if successful

◆ startPeriodicMeasurement() [2/2]

bool m5::unit::UnitMAX30100::startPeriodicMeasurement ( const max30100::Mode mode,
const max30100::Sampling sample_rate,
const max30100::LedPulseWidth pulse_width,
const max30100::CurrentControl ir_current,
const bool high_resolution = false,
const max30100::CurrentControl red_current = max30100::CurrentControl::mA0_0 )
inline

Start periodic measurement.

Parameters
modeOperation mode
sample_rateSampling rate
pulse_widthPulse width
ir_currentIR Led control
high_resolution(only SpO2)
red_currentRED Led control (only SpO2)
Returns
True if successful
Warning
Note that some combinations of sample_rate and pulse_width are invalid. See also datasheet

◆ stopPeriodicMeasurement()

bool m5::unit::UnitMAX30100::stopPeriodicMeasurement ( )
inline

Stop periodic measurement.

Returns
True if successful

◆ writeLedConfiguration()

bool m5::unit::UnitMAX30100::writeLedConfiguration ( const max30100::LedConfiguration lc)

Write Led configrartion.

Parameters
lcLedConfigration
Returns
True if successful

◆ writeModeConfiguration()

bool m5::unit::UnitMAX30100::writeModeConfiguration ( const max30100::ModeConfiguration mc)

Write Mode configuration.

Parameters
mcModeConfigration
Returns
True if successful

◆ writeSpO2Configuration()

bool m5::unit::UnitMAX30100::writeSpO2Configuration ( const max30100::SpO2Configuration sc)

Write SpO2 configrartion.

Parameters
scSpO2Configration
Returns
True if successful