![]() |
MAX30102 Library 1.0.0
This is a library for the MAX30102
|
#include <MAX30102-Heart-Rate-Library-SOLDERED.h>
Inherits SparkFun_Bio_Sensor_Hub.
Public Member Functions | |
| MAX30102 (uint16_t, uint16_t, uint8_t address=0x55) | |
Public Member Functions inherited from SparkFun_Bio_Sensor_Hub | |
| 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 () |
Additional Inherited Members | |
Public Attributes inherited from SparkFun_Bio_Sensor_Hub | |
| 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] |
| MAX30102::MAX30102 | ( | uint16_t | resetPin, |
| uint16_t | mfioPin, | ||
| uint8_t | address = 0x55 |
||
| ) |