Datasheet MAXM86161 (Maxim) - 21

ManufacturerMaxim
DescriptionSingle-Supply Integrated Optical Module for HR and SpO2 Measurement
Pages / Page66 / 21 — Pseudo-Code for Interrupt Handling with FIFO_A_FULL. Pseudo-Code Example …
File Format / SizePDF / 1.8 Mb
Document LanguageEnglish

Pseudo-Code for Interrupt Handling with FIFO_A_FULL. Pseudo-Code Example of Reading Data from FIFO

Pseudo-Code for Interrupt Handling with FIFO_A_FULL Pseudo-Code Example of Reading Data from FIFO

Model Line for this Datasheet

Text Version of Document

MAXM86161 Single-Supply Integrated Optical Module for HR and SpO2 Measurement
Pseudo-Code for Interrupt Handling with FIFO_A_FULL
The following pseudo-code shows an example on handling the Interrupt when using the A_FULL Interrupt. Interrupt handlervoid irqHandler(void) { uint8_t intStatus; //Read Status ReadReg(0x00, &intStatus); if ( intStatus& 0x80 ) { //A FULL RDY device_data_read(); //Data Read Routine }
Pseudo-Code Example of Reading Data from FIFO
Example pseudo-code for reading data from FIFO when using a single photodiode channel and two LED channels. void device_data_read(void) { uint8_t sampleCnt; uint8_t regVal; uint8_t dataBuf[128*2*3]; //128 FIFO samples, 2 channel, 3 byte/channel int led1[32]; int led2[32]; ReadReg(0x07, &sampleCnt); //Read FIFO ReadFifo(dataBuf, sampleCnt * 3); int i = 0; for ( i = 0; i < sampleCnt; i++ ) { led1[i] = ((dataBuf[i*6+0] << 16 ) | (dataBuf[i*6+1] << 8) | (dataBuf[i*6+2])) & 0x7ffff; led2[i] = ((dataBuf[i*6+3] << 16 ) | (dataBuf[i*6+4] << 8) | (dataBuf[i*6+5])) & 0x7ffff; } } Example pseudo-code for reading data from FIFO when using dual photodiode channels and two LED channels. void device_data_read(void) { uint8_t sampleCnt; uint8_t regVal; uint8_t dataBuf[128*2*2*3]; //128 FIFO samples, 2 channel, 2 PD, 3 byte/channel int led1A[32]; int led1B[32]; int led2A[32]; int led2B[32]; ReadReg(0x07, &sampleCnt); www.maximintegrated.com Maxim Integrated │ 21 Document Outline General Description Applications Benefits and Features Simplified Block Diagram Absolute Maximum Ratings Package Information Electrical Characteristics Typical Operating Characteristics Pin Configuration Pin Description Detailed Description Optical Subsystem LED Driver FIFO Configuration LED Sequence Control (0x20 to 0x22) Pseudo-Code Example of Initialize the Optical AFE Pseudo-Code for Interrupt Handling with FIFO_A_FULL Pseudo-Code Example of Reading Data from FIFO Optical Timing One LED Pulsing with No Direct Ambient Sampling One LED Pulsing with Direct Ambient Sampling Two LEDs Pulsing Sequentially with Direct Ambient Sampling All LEDs Pulsing Sequentially with Direct Ambient Sampling ADC Architecture and Transfer Function Non-Linearity (XNL) Trim Proximity Mode Function Picket Fence Detect-and-Replace Function Layout Guidelines I2C/SMBus Compatible Serial Interface Detailed I2C Timing Diagram Bit Transfer START and STOP Conditions Early STOP Conditions Slave Address Acknowledge Bit I2C Write Data Format I2C Read Data Format Register Map Register Details INTERRUPT STATUS 1 (0x00) INTERRUPT STATUS 2 (0X01) INTERRUPT ENABLE 1 (0X02) INTERRUPT ENABLE 2 (0X03) FIFO WRITE POINTER (0X04) FIFO READ POINTER (0X05) OVER FLOW COUNTER (0X06) FIFO DATA COUNTER (0X07) FIFO DATA REGISTER (0X08) FIFO CONFIGURATION 1 (0X09) FIFO CONFIGURATION 2 (0X0A) SYSTEM CONTROL (0X0D) PPG SYNC CONTROL (0X10) PPG CONFIGURATION 1 (0X11) PPG CONFIGURATION 2 (0X12) PPG CONFIGURATION 3 (0X13) PROX INTERRUPT THRESHOLD (0X14) PHOTO DIODE BIAS (0X15) PICKET FENCE (0X16) LED SEQUENCE REGISTER 1 (0X20) LED SEQUENCE REGISTER 2 (0X21) LED SEQUENCE REGISTER 3 (0X22) LED1 PA (0x23) LED2 PA (0x24) LED3_PA (0x25) LED PILOT PA (0x29) LED RANGE 1 (0X2A) S1 HI RES DAC1 (0x2C) S2 HI RES DAC1 (0x2D) S3 HI RES DAC1 (0x2E) S4 HI RES DAC1 (0x2F) S5 HI RES DAC1 (0x30) S6 HI RES DAC1 (0x31) DIE TEMPERATURE CONFIGURATION (0X40) DIE TEMPERATURE INTEGER (0X41) DIE TEMPERATURE FRACTION (0X42) DAC CALIBRATION ENABLE (0X50) SHA COMMAND (0XF0) SHA CONFIGURATION (0XF1) MEMORY CONTROL (0XF2) MEMORY INDEX (0XF3) MEMORY DATA (0XF4) PART ID (0XFF) Ordering Information Revision History