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

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
aplatanado
Date:
Mon Jun 25 16:33:14 2012 +0000
Parent:
6:1969574dee8b
Child:
8:97e5df54b8bb
Commit message:
minor changes in int16 and unint16 conversion macros

Changed in this revision

adns9500.hpp Show annotated file Show diff for this revision Revisions of this file
--- a/adns9500.hpp	Wed Jun 13 23:59:47 2012 +0000
+++ b/adns9500.hpp	Mon Jun 25 16:33:14 2012 +0000
@@ -33,8 +33,8 @@
 #define ADNS9500_IF_RUNNING_SROM_CODE(x)    (bool)(x & 0x80)
 #define ADNS9500_IF_FRAME_FIRST_PIXEL(x)    (bool)(x & 0x01)
 #define ADNS9500_IF_OBSERVATION_TEST(x)     (bool)(x & ADNS9500_OBSERVATION_CHECK_BITS)
-#define ADNS9500_UINT16(ub, lb)             (((uint16_t)ub << 8) + (uint16_t)lb)
-#define ADNS9500_INT16(ub, lb)              ((((int16_t)(int8_t)ub) << 8) + (int16_t)lb)
+#define ADNS9500_UINT16(ub, lb)             (uint16_t)(((ub & 0xff) << 8) | (lb & 0xff))
+#define ADNS9500_INT16(ub, lb)              (int16_t)(((ub & 0xff) << 8) | (lb & 0xff))
 
 namespace adns9500
 {