![](/media/cache/profiles/2e74a7ac5ae99bce3c891f74bcbfd0ee.50x50_q85.jpg)
Interface to access to Avago ADNS-9500 laser mouse sensors.
Revision 16:0f8e730f3272, committed 2013-04-20
- Comitter:
- aplatanado
- Date:
- Sat Apr 20 12:50:42 2013 +0000
- Parent:
- 15:096f5e07d159
- Commit message:
- apply some coding style rules to macros
Changed in this revision
adns9500.cpp | Show annotated file Show diff for this revision Revisions of this file |
adns9500.hpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 096f5e07d159 -r 0f8e730f3272 adns9500.cpp --- a/adns9500.cpp Fri Apr 19 14:39:45 2013 +0000 +++ b/adns9500.cpp Sat Apr 20 12:50:42 2013 +0000 @@ -91,7 +91,7 @@ // check observation register bits [5:0] int observation = spiReceive(OBSERVATION); - if (! ADNS9500_IF_OBSERVATION_TEST(observation)) { + if (! ADNS9500_PASS_OBSERVATION_TEST(observation)) { WAIT_TSCLKNCS(); ncs_.write(1); @@ -247,7 +247,7 @@ WAIT_TSCLKNCS(); ncs_.write(1); - if (ADNS9500_IF_LASER_FAULT(motion)) + if (ADNS9500_HAS_LASER_FAULT(motion)) error("ADNS9500::sromDownload : laser fault condition detected\n"); // return the SROM CRC value @@ -300,7 +300,7 @@ dy = 0; int motion = spiReceive(MOTION); - if (ADNS9500_IF_MOTION(motion)) { + if (ADNS9500_HAS_MOTION_DETECTED(motion)) { WAIT_TSRR(); int dxl = spiReceive(DELTA_X_L); WAIT_TSRR(); @@ -315,7 +315,7 @@ WAIT_TSCLKNCS(); ncs_.write(1); - return ADNS9500_IF_MOTION(motion); + return ADNS9500_HAS_MOTION_DETECTED(motion); } bool ADNS9500::getMotionDeltaMM(float& dx, float& dy) @@ -378,7 +378,7 @@ WAIT_TSCLKNCS(); ncs_.write(1); - return ADNS9500_IF_MOTION(data.motion); + return ADNS9500_HAS_MOTION_DETECTED(data.motion); } void ADNS9500::setResolution(Resolution xy_resolution) @@ -451,7 +451,7 @@ // check for first pixel reading motion bit int motion = spiReceive(MOTION); WAIT_TSRR(); - while(! ADNS9500_IF_FRAME_FIRST_PIXEL(motion)) { + while(! ADNS9500_HAS_FIRST_PIXEL(motion)) { int motion = spiReceive(MOTION); WAIT_TSRR(); }
diff -r 096f5e07d159 -r 0f8e730f3272 adns9500.hpp --- a/adns9500.hpp Fri Apr 19 14:39:45 2013 +0000 +++ b/adns9500.hpp Sat Apr 20 12:50:42 2013 +0000 @@ -28,11 +28,11 @@ #define ADNS9500_LASER_CTRL0_FORCE_DISABLED (1 << 0) #define ADNS9500_OBSERVATION_CHECK_BITS 0x3f -#define ADNS9500_IF_MOTION(x) (bool)(x & 0x80) -#define ADNS9500_IF_LASER_FAULT(x) (bool)(x & 0x40) -#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_HAS_MOTION_DETECTED(x) (bool)(x & 0x80) +#define ADNS9500_HAS_LASER_FAULT(x) (bool)(x & 0x40) +#define ADNS9500_IS_RUNNING_SROM_CODE(x) (bool)(x & 0x80) +#define ADNS9500_HAS_FIRST_PIXEL(x) (bool)(x & 0x01) +#define ADNS9500_PASS_OBSERVATION_TEST(x) (bool)(x & ADNS9500_OBSERVATION_CHECK_BITS) #define ADNS9500_UINT16(ub, lb) (uint16_t)(((ub & 0xff) << 8) | (lb & 0xff)) #define ADNS9500_INT16(ub, lb) (int16_t)(((ub & 0xff) << 8) | (lb & 0xff))