Interface to access to Avago ADNS-9500 laser mouse sensors.
Fork of ADNS9500 by
Diff: adns9500.hpp
- Revision:
- 15:85ea51a56fdc
- Parent:
- 10:bbf9ff378632
- Child:
- 16:de76a70defb3
--- a/adns9500.hpp Wed Oct 17 12:27:40 2012 +0000 +++ b/adns9500.hpp Sun Dec 09 05:27:51 2012 +0000 @@ -22,6 +22,7 @@ #include <mbed.h> #include <stdint.h> #include <string> +#include "adns9500_firmware.hpp" #define ADNS9500_CONFIGURATION_II_RPT_MOD (1 << 2) #define ADNS9500_CONFIGURATION_IV_SROM_SIZE (1 << 1) @@ -36,6 +37,17 @@ #define ADNS9500_UINT16(ub, lb) (uint16_t)(((ub & 0xff) << 8) | (lb & 0xff)) #define ADNS9500_INT16(ub, lb) (int16_t)(((ub & 0xff) << 8) | (lb & 0xff)) +#define BYTETOBINARYPATTERN "%d%d%d%d%d%d%d%d" +#define BYTETOBINARY(byte) \ + (byte & 0x80 ? 1 : 0), \ + (byte & 0x40 ? 1 : 0), \ + (byte & 0x20 ? 1 : 0), \ + (byte & 0x10 ? 1 : 0), \ + (byte & 0x08 ? 1 : 0), \ + (byte & 0x04 ? 1 : 0), \ + (byte & 0x02 ? 1 : 0), \ + (byte & 0x01 ? 1 : 0) + namespace adns9500 { // Maximum SPI clock frequency supported by the sensor @@ -160,7 +172,7 @@ // @param firmware If the firmware has to be downloaded, C-string containing the name // of the file where it is stored, or NULL in other case // - void reset(const char* firmware = NULL); + void reset(const uint8_t* fw = NULL, uint16_t fw_len = 0 ); // // Shutdown the sensor @@ -202,7 +214,7 @@ // @param filename The name of the file which contains the sensor firmware // @return The SROM CRC value // - int sromDownload(const char* filename); + int sromDownload(const uint8_t*, uint16_t); // // Enable the laser @@ -210,6 +222,7 @@ // @param enable True if laser must be enabled, or false if laser must be disabled // void enableLaser(bool enable=true); + void getLaser(void); // // Get motion deltas from sensor