Maxim Integrated's IoT development kit

Dependencies:   MAX30101 MAX30003 MAX113XX_Pixi MAX30205 max32630fthr USBDevice

Files at this revision

API Documentation at this revision

Comitter:
Mahir Ozturk
Date:
Tue Mar 20 16:28:33 2018 +0300
Parent:
5:ff721fa88519
Child:
7:2c9c8b6a28a7
Commit message:
Add a workaround for __possibly__ a bug in the Max30101 driver

Change-Id: I180ff670ba0dc48663e5be2b73a268c402c74759

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Mar 19 17:22:37 2018 +0300
+++ b/main.cpp	Tue Mar 20 16:28:33 2018 +0300
@@ -509,18 +509,13 @@
 					/* Convert read bytes into samples */
 					for (idx = 0; idx < readBytes; idx+=9) {
 						if (r >= 500 || ir >= 500 || g >= 500) {
-							daplink.printf("Overflow!");
-						}
-
-						if (readBytes >= (idx + 2)) {
-							redData[r++] = ((fifoData[idx] << 16) | (fifoData[idx + 1] << 8) | (fifoData[idx + 2])) & 0x03FFFF;
-						}
-
-						if (readBytes >= (idx + 5)) {
-							irData[ir++] = ((fifoData[idx + 3] << 16) | (fifoData[idx + 4] << 8) | (fifoData[idx + 5])) & 0x03FFFF;
+							daplink.printf("Overflow! r=%d ir=%d g=%d\r\n", r, ir, g);
+							break;
 						}
 
 						if (readBytes >= (idx + 8)) {
+							redData[r++] = ((fifoData[idx] << 16) | (fifoData[idx + 1] << 8) | (fifoData[idx + 2])) & 0x03FFFF;
+							irData[ir++] = ((fifoData[idx + 3] << 16) | (fifoData[idx + 4] << 8) | (fifoData[idx + 5])) & 0x03FFFF;
 							greenData[g++] = ((fifoData[idx + 6] << 16) | (fifoData[idx + 7] << 8) | (fifoData[idx + 8])) & 0x03FFFF;
 						}
 					}