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 IR[15:8]; Read FIFO_DATA; Save IR[7:0]; Read FIFO_DATA; Save R[15:8]; Read FIFO_DATA; Save R[7:0]; } STOP;
|