Interface to access to Avago ADNS-9500 laser mouse sensors.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
aplatanado
Date:
Fri Apr 19 14:39:45 2013 +0000
Parent:
14:dc9badf3c6e9
Child:
16:0f8e730f3272
Commit message:
close firmware file after downloading and some other changes related with coding style.

Changed in this revision

adns9500.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/adns9500.cpp	Wed Oct 17 12:27:40 2012 +0000
+++ b/adns9500.cpp	Fri Apr 19 14:39:45 2013 +0000
@@ -129,7 +129,7 @@
 
         enabled_ = true;
 
-        if (firmware) {
+        if (firmware != NULL) {
             sromDownload(firmware);
             enableLaser();
         }
@@ -208,7 +208,7 @@
 
         // we expect a line per byte in hex without 0x prefix
         FILE *fp = fopen(filename, "r");
-        if (! fp)
+        if (fp == NULL)
             error("ADNS9500::sromDownload : file %s could not be opened\n", filename);
 
         unsigned int byte;
@@ -223,6 +223,8 @@
         if (ferror(fp))
             error("ADNS9500::sromDownload : error reading from file: %s\n", filename);
 
+        fclose(fp);
+
         // test if SROM was downloaded successfully
         wait_us(160);
         ncs_.write(0);
@@ -233,7 +235,7 @@
         WAIT_TSCLKNCS();
         ncs_.write(1);
         
-        if (! srom_id)
+        if (srom_id == 0x00)
             error("ADNS9500::sromDownload : the firmware was not successful downloaded\n");
 
         // test laser fault condition
--- a/mbed.bld	Wed Oct 17 12:27:40 2012 +0000
+++ b/mbed.bld	Fri Apr 19 14:39:45 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/5e5da4a5990b
\ No newline at end of file