The objective of this question is to connect to the MAX30100 chip and retrieve SP02 information (Red LED and IR LED) from the FIFO buffer. We also wish to capture the interrupt and toggle the onboard LED every time a measurement is received.
1. Read the relevant parts of the attached datasheet to familiarize yourself with the device. Specifically, focus on the serial communications part (pages 23-26) and the register map shown on page 10.
2. Using the pin diagram on Page 8, sketch a schematic that connects your STM32F429 development board's I2C bus (review the STM datasheet for SCL/SDA pin information) to the correct pins on the MAX30100. Don't forget pull-up resistors. Also, connect the INT pin from the sensor to a generic GPIO pin (you can capture when an SP02 measurement is ready).
3. Start a new project in PlatformIO, choose your STM32F429 board, and select the MBED framework.
4. In your void main(), write the code to:
a. Setup the DigitalOut for the onboard LED.
b. Configure the sensor:
i. Using the I2C object (i.e., i2c.transfer), configure register address 0x01 to enable only the SP02 interrupt.
ii. Set sensor mode to SP02 (See register address 0x06, MODE BITS).
iii. Leave default settings in SP02 Config register (0x07). Using MBED Interruptin, set up the pin on your microcontroller to receive the INT from the sensor when an SP02 measurement is ready.
5. Write a function called GetData that communicates via I2C to the chip and retrieves (and returns) the values of the sensor's Red LED and the IR LED. This involves:
* Reading the FIFO Data register (0x05). Be sure to fully read the DATASHEET pages 12-15 to understand fully how the FIFO works and how the data for the 2 sensor LEDs is provided. Pseudo code is provided in the datasheet as well. You can use any of the I2C functions provided in the MBED I2C API.
6. Write the ISR for the function specified in Interruptln that you configured to receive the SPo2 measurement RDY interrupt. You can call GetData from 5. Also, write the code to display the SHORT value of both the Red LED and the IR LED to the terminal. You should also blink the onboard LED each time the interrupt is received.
7. Submit 2 files, your schematic and your code file with full comments.