Interface to access to Avago ADNS-9500 laser mouse sensors.
Fork of ADNS9500 by
Diff: adns9500.cpp
- Revision:
- 9:8b1e889e94fe
- Parent:
- 8:97e5df54b8bb
- Child:
- 10:bbf9ff378632
--- a/adns9500.cpp Tue Jul 10 13:29:45 2012 +0000 +++ b/adns9500.cpp Wed Jul 11 13:39:21 2012 +0000 @@ -81,7 +81,7 @@ ncs_.write(0); WAIT_TNCSSCLK(); - // send 0x3a to POWER_UP_RESET and wait for at least 50ms + // send 0x5a to POWER_UP_RESET and wait for at least 50ms spiSend(POWER_UP_RESET, 0x5a); LONG_WAIT_MS(50); @@ -89,18 +89,16 @@ spiSend(OBSERVATION, 0x00); LONG_WAIT_US(DEFAULT_MAX_FRAME_PERIOD); - WAIT_TSCLKNCS(); - ncs_.write(1); - // check observation register bits [5:0] int observation = spiReceive(OBSERVATION); - if (! ADNS9500_IF_OBSERVATION_TEST(observation)) + if (! ADNS9500_IF_OBSERVATION_TEST(observation)) { + WAIT_TSCLKNCS(); + ncs_.write(1); + error("ADNS9500::reset : observation register test failed: 0x%x\n", observation); + } // read motion data - ncs_.write(0); - WAIT_TNCSSCLK(); - WAIT_TSRR(); spiReceive(MOTION); WAIT_TSRR(); @@ -149,7 +147,7 @@ ncs_.write(0); WAIT_TNCSSCLK(); - // send 0x3a to POWER_UP_RESET + // send 0x5a to POWER_UP_RESET spiSend(POWER_UP_RESET, 0x5a); WAIT_TSCLKNCS();