Code for our FYDP -only one IMU works right now -RTOS is working
Embed:
(wiki syntax)
Show/hide line numbers
ADNS5090.h
00001 #ifndef ADNS5090_H 00002 #define ADNS5090_H 00003 00004 #include "stdint.h" 00005 #include "mbed.h" 00006 #include "SWSPI.h" 00007 00008 #define ADNS5090_WRITE_VAL (0x80) 00009 #define ADNS5090_MOTION_ST_REG (0x02) 00010 #define ADNS5090_MOTION_BURST_REG (0x63) 00011 #define ADNS5090_RESET_REG (0x3a) 00012 #define ADNS5090_RESET_VAL (0x5a) 00013 #define ADNS5090_MOUSE_CTRL_REG (0x0d) 00014 #define ADNS5090_POWERDOWN_VAL (0x02) 00015 00016 00017 class ADNS5090 00018 { 00019 private: 00020 00021 SWSPI spi; 00022 DigitalOut ncs; 00023 00024 public: 00025 00026 ADNS5090(PinName mosi_pin, PinName miso_pin, PinName sclk_pin, PinName ncs_pin, float pxPerMM_); 00027 00028 int8_t dx_px, dy_px; 00029 uint8_t sq; //surface quality, higher better, ~30 is good, 0= no surface 00030 float pxPerMM; 00031 00032 float dx(); 00033 float dy(); 00034 00035 bool updateMotion(); 00036 void reset(); 00037 void powerDown(); 00038 void setDPI(); 00039 }; 00040 00041 #endif
Generated on Wed Jul 13 2022 10:32:23 by
1.7.2