Data Sheet

Pseudo-Code Example of Reading Data from FIFO
First transaction: Get the FIFO_WR_PTR:
START;
Send device address + write mode
Send address of FIFO_WR_PTR;
REPEATED_START;
Send device address + read mode
Read FIFO_WR_PTR;
STOP;
The central processor evaluates the number of samples to be read from the FIFO:
NUM_AVAILABLE_SAMPLES = FIFO_WR_PTR – FIFO_RD_PTR
(Note: pointer wrap around should be taken into account)
NUM_SAMPLES_TO_READ = < less than or equal to NUM_AVAILABLE_SAMPLES >
Second transaction: Read NUM_SAMPLES_TO_READ samples from the FIFO:
START;
Send device address + write mode
Send address of FIFO_DATA;
REPEATED_START;
Send device address + read mode
for (i = 0; i < NUM_SAMPLES_TO_READ; i++) {
Read FIFO_DATA;
Save LED1[23:16];
Read FIFO_DATA;
Save LED1[15:8];
Read FIFO_DATA;
Save LED1[7:0];
Read FIFO_DATA;
Save LED2[23:16];
Read FIFO_DATA;
Save LED2[15:8];
Read FIFO_DATA;
Save LED2[7:0];
Read FIFO_DATA;
Save LED3[23:16];
Read FIFO_DATA;
Save LED3[15:8];
Read FIFO_DATA;
Save LED3[7:0];
Read FIFO_DATA;
}
STOP;
www.maximintegrated.com
Maxim Integrated
17
MAX30105 High-Sensitivity Optical Sensor
for Smoke Detection Applications