class pah8011 for mbed
Diff: pixart_pah8011.h
- Revision:
- 6:d196b612b14a
- Parent:
- 5:37451de228e4
diff -r 37451de228e4 -r d196b612b14a pixart_pah8011.h --- a/pixart_pah8011.h Fri Oct 27 08:21:32 2017 +0000 +++ b/pixart_pah8011.h Wed Jan 23 08:01:57 2019 +0000 @@ -25,12 +25,13 @@ }; public: - pah8011(); + pah8011(I2C &i2c, uint8_t slave_id = 0x15); + pah8011(SPI &spi, DigitalOut &cs); ~pah8011(); void enable_debug_print(DEBUG_PRINT_HANDLE handler); - bool init(I2C &i2c, uint8_t slave_id = 0x15); + bool init(); // operations bool enable_ppg(); @@ -41,6 +42,12 @@ // tasking bool task(); bool get_result(task_result &result); + + // access + I2C* get_i2c() const; + uint8_t get_i2c_slave_id() const; + SPI* get_spi() const; + DigitalOut* get_spi_cs() const; private: pah8011(const pah8011&); // = delete; @@ -49,8 +56,17 @@ bool select_mode(); private: - bool m_is_ppg_enabled; - bool m_is_touch_enabled; + // i2c + I2C *m_i2c; + uint8_t m_i2c_slave_id; + + // spi + SPI *m_spi; + DigitalOut *m_spi_cs; + + // state + bool m_is_ppg_enabled; + bool m_is_touch_enabled; };