Reference firmware for PixArt's PAA5100 sensor and evaluation board. "Hello World" and "Library" contain the exact same files. Please import just one of the two into your mBed compiler as a new program and not as a library.

Revision:
1:782127a132a3
Parent:
0:c8a2256e02c2
--- a/commHeaders/SPIcommFunctions.h	Tue Apr 03 20:04:39 2018 +0000
+++ b/commHeaders/SPIcommFunctions.h	Wed Jul 18 18:37:03 2018 +0000
@@ -26,7 +26,7 @@
 //This function takes an 8-bit address and 8-bit data. Writes the given data to the given address.
 
 void startupCheck(void);
-//Sets all of the registers needed for initialization and performance optimization.
+//Checks whether or not the sensor was started up properly.
 
 void initializeSensor(void);
 //Sets all of the registers needed for initialization and performance optimization.
@@ -80,12 +80,15 @@
     writeRegister(0x7F, 0x0E);
     writeRegister(0x43, 0x10);
     
-    for(int i=0; i<3; i++)
+    if(readRegister(0x47) != 0x08)
     {
-        if(readRegister(0x47) != 0x08)
+        for(int i=0; i<3; i++)          //Checks register 0x47 three times. If the value is incorrect 3 times, throw a fail condition.
         {
-            writeRegister(0x43, 0x10)
-            startupFail++;
+            if(readRegister(0x47) != 0x08)
+            {
+                writeRegister(0x43, 0x10)
+                startupFail++;
+            }
         }
     }
 }