MAX30102 Library 1.0.0
This is a library for the MAX30102
Loading...
Searching...
No Matches
SparkFun_Bio_Sensor_Hub Class Reference

#include <SparkFun_Bio_Sensor_Hub_Library.h>

Inherited by MAX30102.

Public Member Functions

 SparkFun_Bio_Sensor_Hub (uint16_t, uint16_t, uint8_t address=0x55)
 Overloaded constructor.
 
uint8_t begin (TwoWire &wirePort=Wire)
 The following function initializes the sensor. To place the MAX32664 into application mode, the MFIO pin must be pulled HIGH while the board is held in reset for 10ms. After 50 addtional ms have elapsed the board should be in application mode and will return two bytes, the first 0x00 is a successful communcation byte, followed by 0x00 which is the byte indicating which mode the IC is in.

 
uint8_t beginBootloader (TwoWire &wirePort=Wire)
 The following function puts the MAX32664 into bootloader mode. To place the MAX32664 into bootloader mode, the MFIO pin must be pulled LOW while the board is held in reset for 10ms. After 50 addtional ms have elapsed the board should be in bootloader mode and will return two bytes, the first 0x00 is a successful communcation byte, followed by 0x08 which is the byte indicating that the board is in bootloader mode.
 
uint8_t readSensorHubStatus ()
 The following function checks the status of the FIFO.
 
uint8_t setOperatingMode (uint8_t)
 The following function is an alternate way to set the mode of the of MAX32664. It can take three parameters: Enter and Exit Bootloader Mode, as well as reset. INCOMPLETE.
 
uint8_t configBpm (uint8_t)
 This function sets very basic settings to get sensor and biometric data. The biometric data includes data about heartrate, the confidence level, SpO2 levels, and whether the sensor has detected a finger or not.
 
uint8_t configSensor ()
 This function sets very basic settings to get LED count values from the MAX30101. Sensor data includes 24 bit LED values for the three LED channels: Red, IR, and Green.
 
uint8_t configSensorBpm (uint8_t)
 This function sets very basic settings to get sensor and biometric data. Sensor data includes 24 bit LED values for the two LED channels: Red and IR. The biometric data includes data about heartrate, the confidence level, SpO2 levels, and whether the sensor has detected a finger or not. Of note, the number of samples is set to one.
 
bioData readBpm ()
 This function takes the 8 bytes from the FIFO buffer related to the wrist heart rate algortihm: heart rate (uint16_t), confidence (uint8_t) , SpO2 (uint16_t), and the finger detected status (uint8_t). Note that the the algorithm is stated as "wrist" though the sensor only works with the finger. The data is loaded into the whrmFifo and returned.
 
bioData readSensor ()
 This function takes 9 bytes of LED values from the MAX30101 associated with the RED, IR, and GREEN LEDs. In addition it gets the 8 bytes from the FIFO buffer related to the wrist heart rate algortihm: heart rate (uint16_t), confidence (uint8_t), SpO2 (uint16_t), and the finger detected status (uint8_t). Note that the the algorithm is stated as "wrist" though the sensor only works with the finger. The data is loaded into the whrmFifo and returned.

 
bioData readSensorBpm ()
 This function takes the information of both the LED value and the biometric data from the MAX32664's FIFO. In essence it combines the two functions above into a single function call.
 
uint8_t setPulseWidth (uint16_t)
 This function modifies the pulse width of the MAX30101 LEDs. All of the LEDs are modified to the same width. This will affect the number of samples that can be collected and will also affect the ADC resolution. Default: 69us - 15 resolution - 50 samples per second. Register: 0x0A, bits [1:0] Width(us) - Resolution - Sample Rate 69us - 15 - <= 3200 (fastest - least resolution) 118us - 16 - <= 1600 215us - 17 - <= 1600 411us - 18 - <= 1000 (slowest - highest resolution)
 
uint16_t readPulseWidth ()
 This function reads the CONFIGURATION_REGISTER (0x0A), bits [1:0] from the MAX30101 Sensor. It returns one of the four settings in microseconds.
 
uint8_t setSampleRate (uint16_t)
 This function changes the sample rate of the MAX30101 sensor. The sample rate is affected by the set pulse width of the MAX30101 LEDs. Default: 69us - 15 resolution - 50 samples per second. Register: 0x0A, bits [4:2] Width(us) - Resolution - Sample Rate 69us - 15 - <= 3200 (fastest - least resolution) 118us - 16 - <= 1600 215us - 17 - <= 1600 411us - 18 - <= 1000 (slowest - highest resolution)
 
uint16_t readSampleRate ()
 This function reads the CONFIGURATION_REGISTER (0x0A), bits [4:2] from the MAX30101 Sensor. It returns one of the 8 possible sample rates.
 
uint8_t setAdcRange (uint16_t)
 MAX30101 Register: CONFIGURATION_REGISTER (0x0A), bits [6:5] This functions sets the dynamic range of the MAX30101's ADC. The function accepts the higher range as a parameter. Default Range: 7.81pA - 2048nA Possible Ranges: 7.81pA - 2048nA 15.63pA - 4096nA 32.25pA - 8192nA 62.5pA - 16384nA.
 
uint16_t readAdcRange ()
 MAX30101 Register: CONFIGURATION_REGISTER (0x0A), bits [6:5] This function returns the set ADC range of the MAX30101 sensor.
 
uint8_t getMcuType ()
 The following function returns a byte that signifies the microcontoller that is in communcation with your host microcontroller. Returns 0x00 for the MAX32625 and 0x01 for the MAX32660/MAX32664.
 
int32_t getBootloaderInf ()
 This function checks the version number of the bootloader on the chip and returns a four bytes: Major version Byte, Minor version Byte, Space Byte, and the Revision Byte.
 
uint8_t max30101Control (uint8_t)
 This function enables the MAX30101.
 
uint8_t readMAX30101State ()
 This function checks if the MAX30101 is enabled or not.
 
uint8_t accelControl (uint8_t)
 This function enables the Accelerometer.
 
uint8_t setOutputMode (uint8_t)
 This function enables the Accelerometer.
 
uint8_t setFifoThreshold (uint8_t)
 This function changes the threshold for the FIFO interrupt bit/pin. The interrupt pin is the MFIO pin which is set to INPUT after IC initialization (begin).
 
uint8_t numSamplesOutFifo ()
 This function returns the number of samples available in the FIFO.
 
uint8_t * getDataOutFifo (uint8_t data[])
 This function returns the data in the FIFO.
 
uint8_t numSamplesExternalSensor ()
 This function adds support for the acceleromter that is NOT included on SparkFun's product, The Family Registery of 0x13 and 0x14 is skipped for now.
 
void writeRegisterMAX30101 (uint8_t, uint8_t)
 This function writes the given register value at the given register address for the MAX30101 sensor and returns a boolean indicating a successful or non-successful write.
 
void writeRegisterAccel (uint8_t, uint8_t)
 This function writes the given register value at the given register address for the Accelerometer and returns a boolean indicating a successful or non-successful write.
 
uint8_t readRegisterMAX30101 (uint8_t)
 This function reads the given register address for the MAX30101 Sensor and returns the values at that register.
 
uint8_t readRegisterAccel (uint8_t)
 This function reads the given register address for the MAX30101 Sensor and returns the values at that register.
 
sensorAttr getAfeAttributesMAX30101 ()
 This function retrieves the attributes of the AFE (Analog Front End) of the MAX30101 sensor. It returns the number of bytes in a word for the sensor and the number of registers available.
 
sensorAttr getAfeAttributesAccelerometer ()
 This function retrieves the attributes of the AFE (Analog Front End) of the Accelerometer. It returns the number of bytes in a word for the sensor and the number of registers available.
 
uint8_t * dumpRegisterMAX30101 (uint8_t, uint8_t regArray[255])
 This function returns all registers and register values sequentially of the MAX30101 sensor: register zero and register value zero to register n and register value n.
 
uint8_t * dumpRegisterAccelerometer (uint8_t, uint8_t regArray[])
 This function returns all registers and register values sequentially of the Accelerometer: register zero and register value zero to register n and register value n.
 
uint8_t setAlgoRange (uint8_t)
 This function sets the target percentage of the full-scale ADC range that the automatic gain control algorithm uses. It takes a paramater of zero to 100 percent.
 
uint8_t setAlgoStepSize (uint8_t)
 This function changes the step size toward the target for the AGC algorithm. It takes a paramater of zero to 100 percent.
 
uint8_t setAlgoSensitivity (uint8_t)
 This function changes the sensitivity of the AGC algorithm.
 
uint8_t setAlgoSamples (uint8_t)
 This function changes the number of samples that are averaged. It takes a paramater of zero to 255.
 
uint8_t setMaximFastCoef (int32_t, int32_t, int32_t)
 This function takes three values that are used as the Sp02 coefficients. These three values are multiplied by 100,000; default values are in order: 159584, -3465966, and 11268987.
 
uint8_t readAlgoRange ()
 This function reads and returns the currently set target percentage of the full-scale ADC range that the Automatic Gain Control algorithm is using.
 
uint8_t readAlgoStepSize ()
 This function returns the step size toward the target for the AGC algorithm. It returns a value between zero and 100 percent.
 
uint8_t readAlgoSensitivity ()
 This function returns the sensitivity (percentage) of the automatic gain control.
 
uint8_t readAlgoSamples ()
 This function reads the number of samples that are averaged.
 
int32_t * readMaximFastCoef (int32_t coefArr[3])
 This function reads the maximum age for the wrist heart rate monitor (WHRM) algorithm. It returns three uint32_t integers that are multiplied by 100,000.
 
uint8_t agcAlgoControl (uint8_t)
 This function enables (one) or disables (zero) the automatic gain control algorithm.
 
uint8_t maximFastAlgoControl (uint8_t)
 This function enables (one) or disables (zero) the wrist heart rate monitor algorithm.
 
bool setNumPages (uint8_t)
 
bool eraseFlash ()
 
version readBootloaderVers ()
 
version readSensorHubVersion ()
 
version readAlgorithmVersion ()
 

Public Attributes

uint8_t bpmArr [MAXFAST_ARRAY_SIZE]
 
uint8_t bpmArrTwo [MAXFAST_ARRAY_SIZE+MAXFAST_EXTENDED_DATA]
 
uint8_t senArr [MAX30101_LED_ARRAY]
 
uint8_t bpmSenArr [MAXFAST_ARRAY_SIZE+MAX30101_LED_ARRAY]
 
uint8_t bpmSenArrTwo [MAXFAST_ARRAY_SIZE+MAXFAST_EXTENDED_DATA+MAX30101_LED_ARRAY]
 

Private Member Functions

uint8_t enableWrite (uint8_t, uint8_t, uint8_t)
 
uint8_t writeByte (uint8_t, uint8_t, uint8_t)
 
uint8_t writeByte (uint8_t, uint8_t, uint8_t, uint8_t)
 
uint8_t writeByte (uint8_t, uint8_t, uint8_t, uint16_t)
 
uint8_t writeLongBytes (uint8_t, uint8_t, uint8_t, int32_t _writeVal[3])
 
uint8_t readByte (uint8_t, uint8_t)
 
uint8_t readByte (uint8_t, uint8_t, uint8_t)
 
uint16_t readIntByte (uint8_t, uint8_t, uint8_t)
 
uint32_t readLongByte (uint8_t, uint8_t, uint8_t)
 
int32_t * readMultipleBytes (uint8_t, uint8_t, uint8_t, uint8_t, int32_t *)
 
uint8_t * readFillArray (uint8_t, uint8_t, uint8_t, uint8_t array[])
 

Private Attributes

uint8_t _resetPin
 
uint8_t _mfioPin
 
uint8_t _address
 
uint32_t _writeCoefArr [3]
 
uint8_t _userSelectedMode
 
uint8_t _sampleRate = 100
 
TwoWire * _i2cPort
 

Constructor & Destructor Documentation

◆ SparkFun_Bio_Sensor_Hub()

SparkFun_Bio_Sensor_Hub::SparkFun_Bio_Sensor_Hub ( uint16_t  resetPin,
uint16_t  mfioPin,
uint8_t  address = 0x55 
)

Overloaded constructor.

Parameters
boolresetPin - Reset pin
boolmfioPin - MFIO pin
booladdress - I2C address of the device

Member Function Documentation

◆ accelControl()

uint8_t SparkFun_Bio_Sensor_Hub::accelControl ( uint8_t  accelSwitch)

This function enables the Accelerometer.

Parameters
uint8_taccelSwitch - Switch accelometer on or off (1 or 0)
Returns
SUCCESS or an error code

◆ agcAlgoControl()

uint8_t SparkFun_Bio_Sensor_Hub::agcAlgoControl ( uint8_t  enable)

This function enables (one) or disables (zero) the automatic gain control algorithm.

Parameters
enable- array to store coefficients
Returns
Error code or SUCCESS

◆ begin()

uint8_t SparkFun_Bio_Sensor_Hub::begin ( TwoWire &  wirePort = Wire)

The following function initializes the sensor. To place the MAX32664 into application mode, the MFIO pin must be pulled HIGH while the board is held in reset for 10ms. After 50 addtional ms have elapsed the board should be in application mode and will return two bytes, the first 0x00 is a successful communcation byte, followed by 0x00 which is the byte indicating which mode the IC is in.

Parameters
TwoWire&wirePort - Address of I2C handler
Returns
Returns response from sensor

◆ beginBootloader()

uint8_t SparkFun_Bio_Sensor_Hub::beginBootloader ( TwoWire &  wirePort = Wire)

The following function puts the MAX32664 into bootloader mode. To place the MAX32664 into bootloader mode, the MFIO pin must be pulled LOW while the board is held in reset for 10ms. After 50 addtional ms have elapsed the board should be in bootloader mode and will return two bytes, the first 0x00 is a successful communcation byte, followed by 0x08 which is the byte indicating that the board is in bootloader mode.

Parameters
TwoWire&wirePort - Address of I2C handler
Returns
Returns response from sensor

◆ configBpm()

uint8_t SparkFun_Bio_Sensor_Hub::configBpm ( uint8_t  mode)

This function sets very basic settings to get sensor and biometric data. The biometric data includes data about heartrate, the confidence level, SpO2 levels, and whether the sensor has detected a finger or not.

Parameters
uint8_tmode - Sets mode 1 or mode 2
Returns
Returns SUCCESS or error code

◆ configSensor()

uint8_t SparkFun_Bio_Sensor_Hub::configSensor ( )

This function sets very basic settings to get LED count values from the MAX30101. Sensor data includes 24 bit LED values for the three LED channels: Red, IR, and Green.

Returns
Returns SUCCESS or error code

◆ configSensorBpm()

uint8_t SparkFun_Bio_Sensor_Hub::configSensorBpm ( uint8_t  mode)

This function sets very basic settings to get sensor and biometric data. Sensor data includes 24 bit LED values for the two LED channels: Red and IR. The biometric data includes data about heartrate, the confidence level, SpO2 levels, and whether the sensor has detected a finger or not. Of note, the number of samples is set to one.

Parameters
uint8_tmode - Mode 1 or mode 2
Returns
Returns SUCCESS or error code

◆ dumpRegisterAccelerometer()

uint8_t * SparkFun_Bio_Sensor_Hub::dumpRegisterAccelerometer ( uint8_t  numReg,
uint8_t  regArray[] 
)

This function returns all registers and register values sequentially of the Accelerometer: register zero and register value zero to register n and register value n.

Parameters
numReg- Number of registers to return
regArray- Array to dump registers into
Returns
returns all registers and register values sequentially of the Accelerometer sensor: register zero and register value zero to register n and register value n.

◆ dumpRegisterMAX30101()

uint8_t * SparkFun_Bio_Sensor_Hub::dumpRegisterMAX30101 ( uint8_t  numReg,
uint8_t  regArray[255] 
)

This function returns all registers and register values sequentially of the MAX30101 sensor: register zero and register value zero to register n and register value n.

Parameters
numReg- Number of registers to return
regArray- Array to dump registers into
Returns
returns all registers and register values sequentially of the MAX30101 sensor: register zero and register value zero to register n and register value n.

◆ enableWrite()

uint8_t SparkFun_Bio_Sensor_Hub::enableWrite ( uint8_t  ,
uint8_t  ,
uint8_t   
)
private

◆ eraseFlash()

bool SparkFun_Bio_Sensor_Hub::eraseFlash ( )

◆ getAfeAttributesAccelerometer()

sensorAttr SparkFun_Bio_Sensor_Hub::getAfeAttributesAccelerometer ( )

This function retrieves the attributes of the AFE (Analog Front End) of the Accelerometer. It returns the number of bytes in a word for the sensor and the number of registers available.

Returns
returns the number of bytes in a word for the sensor and the number of registers available.

◆ getAfeAttributesMAX30101()

sensorAttr SparkFun_Bio_Sensor_Hub::getAfeAttributesMAX30101 ( )

This function retrieves the attributes of the AFE (Analog Front End) of the MAX30101 sensor. It returns the number of bytes in a word for the sensor and the number of registers available.

Returns
returns the number of bytes in a word for the sensor and the number of registers available.

◆ getBootloaderInf()

int32_t SparkFun_Bio_Sensor_Hub::getBootloaderInf ( )

This function checks the version number of the bootloader on the chip and returns a four bytes: Major version Byte, Minor version Byte, Space Byte, and the Revision Byte.

Returns
Major version Byte, Minor version Byte, Space Byte, and the Revision Byte.

◆ getDataOutFifo()

uint8_t * SparkFun_Bio_Sensor_Hub::getDataOutFifo ( uint8_t  data[])

This function returns the data in the FIFO.

Parameters
uint8_tdata[] - Array to store data
Returns
Pointer to array with stored data

◆ getMcuType()

uint8_t SparkFun_Bio_Sensor_Hub::getMcuType ( )

The following function returns a byte that signifies the microcontoller that is in communcation with your host microcontroller. Returns 0x00 for the MAX32625 and 0x01 for the MAX32660/MAX32664.

Returns
Returns a byte that signifies the microcontoller that is in communcation with your host microcontroller

◆ max30101Control()

uint8_t SparkFun_Bio_Sensor_Hub::max30101Control ( uint8_t  senSwitch)

This function enables the MAX30101.

Parameters
uint8_tsenSwitch - enable or disable MAX30101
Returns
SUCCESS or an error code

◆ maximFastAlgoControl()

uint8_t SparkFun_Bio_Sensor_Hub::maximFastAlgoControl ( uint8_t  mode)

This function enables (one) or disables (zero) the wrist heart rate monitor algorithm.

Parameters
mode- Enable or disable (0 or 1)
Returns
Error code or SUCCESS

◆ numSamplesExternalSensor()

uint8_t SparkFun_Bio_Sensor_Hub::numSamplesExternalSensor ( )

This function adds support for the acceleromter that is NOT included on SparkFun's product, The Family Registery of 0x13 and 0x14 is skipped for now.

Returns
Pointer to array with stored data

◆ numSamplesOutFifo()

uint8_t SparkFun_Bio_Sensor_Hub::numSamplesOutFifo ( )

This function returns the number of samples available in the FIFO.

Returns
returns the number of samples available in the FIFO

◆ readAdcRange()

uint16_t SparkFun_Bio_Sensor_Hub::readAdcRange ( )

MAX30101 Register: CONFIGURATION_REGISTER (0x0A), bits [6:5] This function returns the set ADC range of the MAX30101 sensor.

Parameters
uint16_tadcVal - Dynamic range of ADC
Returns
SUCCESS or error code

◆ readAlgoRange()

uint8_t SparkFun_Bio_Sensor_Hub::readAlgoRange ( )

This function reads and returns the currently set target percentage of the full-scale ADC range that the Automatic Gain Control algorithm is using.

Returns
returns the currently set target percentage of the full-scale ADC range that the Automatic Gain Control algorithm is using.

◆ readAlgorithmVersion()

version SparkFun_Bio_Sensor_Hub::readAlgorithmVersion ( )

◆ readAlgoSamples()

uint8_t SparkFun_Bio_Sensor_Hub::readAlgoSamples ( )

This function reads the number of samples that are averaged.

Returns
returns the number of samples.

◆ readAlgoSensitivity()

uint8_t SparkFun_Bio_Sensor_Hub::readAlgoSensitivity ( )

This function returns the sensitivity (percentage) of the automatic gain control.

Returns
returns the sensitivity (percentage) of the automatic gain control.

◆ readAlgoStepSize()

uint8_t SparkFun_Bio_Sensor_Hub::readAlgoStepSize ( )

This function returns the step size toward the target for the AGC algorithm. It returns a value between zero and 100 percent.

Returns
returns the step size toward the target for the AGC algorithm.

◆ readBootloaderVers()

version SparkFun_Bio_Sensor_Hub::readBootloaderVers ( )

◆ readBpm()

bioData SparkFun_Bio_Sensor_Hub::readBpm ( )

This function takes the 8 bytes from the FIFO buffer related to the wrist heart rate algortihm: heart rate (uint16_t), confidence (uint8_t) , SpO2 (uint16_t), and the finger detected status (uint8_t). Note that the the algorithm is stated as "wrist" though the sensor only works with the finger. The data is loaded into the whrmFifo and returned.

Returns
Returns structure containing data such as Heart rate, Blood oxygen saturation...

◆ readByte() [1/2]

uint8_t SparkFun_Bio_Sensor_Hub::readByte ( uint8_t  _familyByte,
uint8_t  _indexByte 
)
private

◆ readByte() [2/2]

uint8_t SparkFun_Bio_Sensor_Hub::readByte ( uint8_t  ,
uint8_t  ,
uint8_t   
)
private

◆ readFillArray()

uint8_t * SparkFun_Bio_Sensor_Hub::readFillArray ( uint8_t  ,
uint8_t  ,
uint8_t  ,
uint8_t  array[] 
)
private

◆ readIntByte()

uint16_t SparkFun_Bio_Sensor_Hub::readIntByte ( uint8_t  ,
uint8_t  ,
uint8_t   
)
private

◆ readLongByte()

uint32_t SparkFun_Bio_Sensor_Hub::readLongByte ( uint8_t  ,
uint8_t  ,
uint8_t   
)
private

◆ readMAX30101State()

uint8_t SparkFun_Bio_Sensor_Hub::readMAX30101State ( )

This function checks if the MAX30101 is enabled or not.

Returns
State of MAX30101

◆ readMaximFastCoef()

int32_t * SparkFun_Bio_Sensor_Hub::readMaximFastCoef ( int32_t  coefArr[3])

This function reads the maximum age for the wrist heart rate monitor (WHRM) algorithm. It returns three uint32_t integers that are multiplied by 100,000.

Parameters
coefArr- array to store coefficients
Returns
reads the maximum age for the wrist heart rate monitor (WHRM) algorithm.

◆ readMultipleBytes()

int32_t * SparkFun_Bio_Sensor_Hub::readMultipleBytes ( uint8_t  ,
uint8_t  ,
uint8_t  ,
uint8_t  ,
int32_t *   
)
private

◆ readPulseWidth()

uint16_t SparkFun_Bio_Sensor_Hub::readPulseWidth ( )

This function reads the CONFIGURATION_REGISTER (0x0A), bits [1:0] from the MAX30101 Sensor. It returns one of the four settings in microseconds.

Returns
SUCCESS or error code

◆ readRegisterAccel()

uint8_t SparkFun_Bio_Sensor_Hub::readRegisterAccel ( uint8_t  regAddr)

This function reads the given register address for the MAX30101 Sensor and returns the values at that register.

Parameters
uint8_tregAddr - Register to read
Returns
Content of register

◆ readRegisterMAX30101()

uint8_t SparkFun_Bio_Sensor_Hub::readRegisterMAX30101 ( uint8_t  regAddr)

This function reads the given register address for the MAX30101 Sensor and returns the values at that register.

Parameters
uint8_tregAddr - Register to read
Returns
Content of register

◆ readSampleRate()

uint16_t SparkFun_Bio_Sensor_Hub::readSampleRate ( )

This function reads the CONFIGURATION_REGISTER (0x0A), bits [4:2] from the MAX30101 Sensor. It returns one of the 8 possible sample rates.

Returns
Returns sample rate

◆ readSensor()

bioData SparkFun_Bio_Sensor_Hub::readSensor ( )

This function takes 9 bytes of LED values from the MAX30101 associated with the RED, IR, and GREEN LEDs. In addition it gets the 8 bytes from the FIFO buffer related to the wrist heart rate algortihm: heart rate (uint16_t), confidence (uint8_t), SpO2 (uint16_t), and the finger detected status (uint8_t). Note that the the algorithm is stated as "wrist" though the sensor only works with the finger. The data is loaded into the whrmFifo and returned.

Returns
Returns structure containing data such as Heart rate, Blood oxygen saturation...

◆ readSensorBpm()

bioData SparkFun_Bio_Sensor_Hub::readSensorBpm ( )

This function takes the information of both the LED value and the biometric data from the MAX32664's FIFO. In essence it combines the two functions above into a single function call.

Returns
Returns structure containing data such as Heart rate, Blood oxygen saturation...

◆ readSensorHubStatus()

uint8_t SparkFun_Bio_Sensor_Hub::readSensorHubStatus ( )

The following function checks the status of the FIFO.

Returns
Returns status register

◆ readSensorHubVersion()

version SparkFun_Bio_Sensor_Hub::readSensorHubVersion ( )

◆ setAdcRange()

uint8_t SparkFun_Bio_Sensor_Hub::setAdcRange ( uint16_t  adcVal)

MAX30101 Register: CONFIGURATION_REGISTER (0x0A), bits [6:5] This functions sets the dynamic range of the MAX30101's ADC. The function accepts the higher range as a parameter. Default Range: 7.81pA - 2048nA Possible Ranges: 7.81pA - 2048nA 15.63pA - 4096nA 32.25pA - 8192nA 62.5pA - 16384nA.

Parameters
uint16_tadcVal - Dynamic range of ADC
Returns
SUCCESS or error code

◆ setAlgoRange()

uint8_t SparkFun_Bio_Sensor_Hub::setAlgoRange ( uint8_t  perc)

This function sets the target percentage of the full-scale ADC range that the automatic gain control algorithm uses. It takes a paramater of zero to 100 percent.

Parameters
perc- Target percentage
Returns
SUCCES or an error code.

◆ setAlgoSamples()

uint8_t SparkFun_Bio_Sensor_Hub::setAlgoSamples ( uint8_t  avg)

This function changes the number of samples that are averaged. It takes a paramater of zero to 255.

Parameters
avg- Number of samples
Returns
SUCCES or an error code.

◆ setAlgoSensitivity()

uint8_t SparkFun_Bio_Sensor_Hub::setAlgoSensitivity ( uint8_t  sense)

This function changes the sensitivity of the AGC algorithm.

Parameters
sense- sensitivity (0 -100)
Returns
SUCCES or an error code.

◆ setAlgoStepSize()

uint8_t SparkFun_Bio_Sensor_Hub::setAlgoStepSize ( uint8_t  step)

This function changes the step size toward the target for the AGC algorithm. It takes a paramater of zero to 100 percent.

Parameters
step- step size (0 -100)
Returns
SUCCES or an error code.

◆ setFifoThreshold()

uint8_t SparkFun_Bio_Sensor_Hub::setFifoThreshold ( uint8_t  intThresh)

This function changes the threshold for the FIFO interrupt bit/pin. The interrupt pin is the MFIO pin which is set to INPUT after IC initialization (begin).

Parameters
uint8_tintTresh - Value to set treshold
Returns
SUCCESS or an error code

◆ setMaximFastCoef()

uint8_t SparkFun_Bio_Sensor_Hub::setMaximFastCoef ( int32_t  coef1,
int32_t  coef2,
int32_t  coef3 
)

This function takes three values that are used as the Sp02 coefficients. These three values are multiplied by 100,000; default values are in order: 159584, -3465966, and 11268987.

Parameters
coef1- First coefficient
coef2- Second coefficient
coef3- Third coefficient
Returns
SUCCES or an error code.

◆ setNumPages()

bool SparkFun_Bio_Sensor_Hub::setNumPages ( uint8_t  totalPages)

◆ setOperatingMode()

uint8_t SparkFun_Bio_Sensor_Hub::setOperatingMode ( uint8_t  selection)

The following function is an alternate way to set the mode of the of MAX32664. It can take three parameters: Enter and Exit Bootloader Mode, as well as reset. INCOMPLETE.

Parameters
uint8_tselection - Enter ir Exit bootloader
Returns
Content of response register

◆ setOutputMode()

uint8_t SparkFun_Bio_Sensor_Hub::setOutputMode ( uint8_t  outputType)

This function enables the Accelerometer.

Parameters
uint8_toutputType - Bytes between 0 and 7
Returns
SUCCESS or an error code

◆ setPulseWidth()

uint8_t SparkFun_Bio_Sensor_Hub::setPulseWidth ( uint16_t  width)

This function modifies the pulse width of the MAX30101 LEDs. All of the LEDs are modified to the same width. This will affect the number of samples that can be collected and will also affect the ADC resolution. Default: 69us - 15 resolution - 50 samples per second. Register: 0x0A, bits [1:0] Width(us) - Resolution - Sample Rate 69us - 15 - <= 3200 (fastest - least resolution) 118us - 16 - <= 1600 215us - 17 - <= 1600 411us - 18 - <= 1000 (slowest - highest resolution)

Parameters
uint16_twidth - Width of IR LED pulse in microseconds
Returns
SUCCESS or error code

◆ setSampleRate()

uint8_t SparkFun_Bio_Sensor_Hub::setSampleRate ( uint16_t  sampRate)

This function changes the sample rate of the MAX30101 sensor. The sample rate is affected by the set pulse width of the MAX30101 LEDs. Default: 69us - 15 resolution - 50 samples per second. Register: 0x0A, bits [4:2] Width(us) - Resolution - Sample Rate 69us - 15 - <= 3200 (fastest - least resolution) 118us - 16 - <= 1600 215us - 17 - <= 1600 411us - 18 - <= 1000 (slowest - highest resolution)

Returns
SUCCESS or error code

◆ writeByte() [1/3]

uint8_t SparkFun_Bio_Sensor_Hub::writeByte ( uint8_t  ,
uint8_t  ,
uint8_t   
)
private

◆ writeByte() [2/3]

uint8_t SparkFun_Bio_Sensor_Hub::writeByte ( uint8_t  ,
uint8_t  ,
uint8_t  ,
uint16_t   
)
private

◆ writeByte() [3/3]

uint8_t SparkFun_Bio_Sensor_Hub::writeByte ( uint8_t  ,
uint8_t  ,
uint8_t  ,
uint8_t   
)
private

◆ writeLongBytes()

uint8_t SparkFun_Bio_Sensor_Hub::writeLongBytes ( uint8_t  ,
uint8_t  ,
uint8_t  ,
int32_t  _writeVal[3] 
)
private

◆ writeRegisterAccel()

void SparkFun_Bio_Sensor_Hub::writeRegisterAccel ( uint8_t  regAddr,
uint8_t  regVal 
)

This function writes the given register value at the given register address for the Accelerometer and returns a boolean indicating a successful or non-successful write.

Parameters
uint8_tregAddr - Address of register to write
uint8_tregVal - Value to write in register

◆ writeRegisterMAX30101()

void SparkFun_Bio_Sensor_Hub::writeRegisterMAX30101 ( uint8_t  regAddr,
uint8_t  regVal 
)

This function writes the given register value at the given register address for the MAX30101 sensor and returns a boolean indicating a successful or non-successful write.

Parameters
uint8_tregAddr - Address of register to write
uint8_tregVal - Value to write in register

Member Data Documentation

◆ _address

uint8_t SparkFun_Bio_Sensor_Hub::_address
private

◆ _i2cPort

TwoWire* SparkFun_Bio_Sensor_Hub::_i2cPort
private

◆ _mfioPin

uint8_t SparkFun_Bio_Sensor_Hub::_mfioPin
private

◆ _resetPin

uint8_t SparkFun_Bio_Sensor_Hub::_resetPin
private

◆ _sampleRate

uint8_t SparkFun_Bio_Sensor_Hub::_sampleRate = 100
private

◆ _userSelectedMode

uint8_t SparkFun_Bio_Sensor_Hub::_userSelectedMode
private

◆ _writeCoefArr

uint32_t SparkFun_Bio_Sensor_Hub::_writeCoefArr[3]
private

◆ bpmArr

uint8_t SparkFun_Bio_Sensor_Hub::bpmArr[MAXFAST_ARRAY_SIZE]

◆ bpmArrTwo

uint8_t SparkFun_Bio_Sensor_Hub::bpmArrTwo[MAXFAST_ARRAY_SIZE+MAXFAST_EXTENDED_DATA]

◆ bpmSenArr

uint8_t SparkFun_Bio_Sensor_Hub::bpmSenArr[MAXFAST_ARRAY_SIZE+MAX30101_LED_ARRAY]

◆ bpmSenArrTwo

uint8_t SparkFun_Bio_Sensor_Hub::bpmSenArrTwo[MAXFAST_ARRAY_SIZE+MAXFAST_EXTENDED_DATA+MAX30101_LED_ARRAY]

◆ senArr

uint8_t SparkFun_Bio_Sensor_Hub::senArr[MAX30101_LED_ARRAY]

The documentation for this class was generated from the following files: