class pah8011 for mbed
Diff: pixart_pah8011.h
- Revision:
- 0:242cf8f28bf2
- Child:
- 1:4e43ab5ba1e2
diff -r 000000000000 -r 242cf8f28bf2 pixart_pah8011.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pixart_pah8011.h Thu Oct 26 02:49:44 2017 +0000 @@ -0,0 +1,53 @@ +#ifndef __pixart_pah8011_h__ +#define __pixart_pah8011_h__ + + +#include <mbed.h> + +#include <cstdint> + + +namespace pixart { + + + class pah8011 { + public: + struct task_result { + // ppg + uint8_t *data; + uint32_t num_per_ch; + uint32_t ch_num; + + // touch + bool is_touched; + }; + + public: + pah8011(); + ~pah8011(); + + bool init(I2C &i2c, Serial *serial = NULL, uint8_t slave_id = 0x15); + + // operations + bool enable_ppg(); + bool disable_ppg(); + bool enable_touch(); + bool disable_touch(); + + // tasking + bool task(); + bool get_result(task_result &result); + + private: + bool select_mode(); + + bool m_is_ppg_enabled; + bool m_is_touch_enabled; + + }; + + +} + + +#endif // header guard