Post Go back to editing

Read 32 samples fifo

Category: Hardware
Product Number: MAX30102

I'm using the maxim firmware available to estimate the spo2 and hr from MAX30102. From what I have analyzed, they're reading sample by sample from the sensor. I would like to understand how would I first read the 32 samples from its fifo and then save them in my buffer.

I have this now, but how can I update the read and write pointers, in order to do not mix sample data etc.

  for (i = 0; i < samples_to_read; i++) {
        // Read LED1 data
        un_temp = Wire.read();
        un_temp <<= 16;
        *pun_red_led += un_temp;

        un_temp = Wire.read();
        un_temp <<= 8;
        *pun_red_led += un_temp;

        un_temp = Wire.read();
        *pun_red_led += un_temp;

        // Read LED2 data
        un_temp = Wire.read();
        un_temp <<= 16;
        *pun_ir_led += un_temp;

        un_temp = Wire.read();
        un_temp <<= 8;
        *pun_ir_led += un_temp;

        un_temp = Wire.read();
        *pun_ir_led += un_temp;

  }