Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Pixart_9123_Nucleo_Library by
OTC.h
00001 00002 /* The callback function when motion happen 00003 00004 */ 00005 typedef void (*OTSCallback)(int16_t value); 00006 00007 // Helper macro 00008 #define BIT_CLEAR(REG,MASK) (REG &= ~MASK) 00009 #define BIT_SET(REG,MASK) (REG |= MASK) 00010 #define IS_BIT_CLEAR(REG,MASK) ((REG & MASK)==0x00) 00011 #define IS_BIT_SET(REG,MASK) ((REG & MASK)==MASK) 00012 00013 class Pixart_OTS 00014 { 00015 private: 00016 Ticker m_ticker; 00017 I2C *m_i2c; 00018 //Serial *m_pc; 00019 int m_Period; 00020 uint8_t m_Address; 00021 bool m_WriteEnable; 00022 00023 OTSCallback m_OTSCallback; 00024 void periodicCallback(void); 00025 bool PMT9123_init(); 00026 void PMT9123_ReadMotion(); 00027 00028 // Internal read and write function that is only single transaction 00029 void writeRegister(uint8_t addr, uint8_t data); 00030 uint8_t readRegister(uint8_t addr); 00031 00032 public: 00033 /* 00034 * The initial function for Gesture class 00035 * i2c ==> The I2C object from outside, the clock rate should be 400k 00036 * Period ==> The polling rate for gesture, in ms 00037 * callback ==> The call back function for gesture status 00038 * Result ==> The result for initialize 00039 */ 00040 Pixart_OTS(I2C *i2c, int Period,OTSCallback callback,bool &Result); 00041 00042 // Public register read and write function, which include steps to ensure successful write and read 00043 uint8_t Register_Write(uint8_t addr, uint8_t data); 00044 uint8_t Register_Read(uint8_t addr); 00045 };
Generated on Mon Jul 18 2022 03:20:59 by
1.7.2

Low Power Right Angle Optical Track Sensor PMT9123