class pah8011 for mbed

Committer:
bell_huang
Date:
Thu Oct 26 02:49:44 2017 +0000
Revision:
0:242cf8f28bf2
Child:
1:4e43ab5ba1e2
Init version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bell_huang 0:242cf8f28bf2 1 #ifndef __pixart_pah8011_h__
bell_huang 0:242cf8f28bf2 2 #define __pixart_pah8011_h__
bell_huang 0:242cf8f28bf2 3
bell_huang 0:242cf8f28bf2 4
bell_huang 0:242cf8f28bf2 5 #include <mbed.h>
bell_huang 0:242cf8f28bf2 6
bell_huang 0:242cf8f28bf2 7 #include <cstdint>
bell_huang 0:242cf8f28bf2 8
bell_huang 0:242cf8f28bf2 9
bell_huang 0:242cf8f28bf2 10 namespace pixart {
bell_huang 0:242cf8f28bf2 11
bell_huang 0:242cf8f28bf2 12
bell_huang 0:242cf8f28bf2 13 class pah8011 {
bell_huang 0:242cf8f28bf2 14 public:
bell_huang 0:242cf8f28bf2 15 struct task_result {
bell_huang 0:242cf8f28bf2 16 // ppg
bell_huang 0:242cf8f28bf2 17 uint8_t *data;
bell_huang 0:242cf8f28bf2 18 uint32_t num_per_ch;
bell_huang 0:242cf8f28bf2 19 uint32_t ch_num;
bell_huang 0:242cf8f28bf2 20
bell_huang 0:242cf8f28bf2 21 // touch
bell_huang 0:242cf8f28bf2 22 bool is_touched;
bell_huang 0:242cf8f28bf2 23 };
bell_huang 0:242cf8f28bf2 24
bell_huang 0:242cf8f28bf2 25 public:
bell_huang 0:242cf8f28bf2 26 pah8011();
bell_huang 0:242cf8f28bf2 27 ~pah8011();
bell_huang 0:242cf8f28bf2 28
bell_huang 0:242cf8f28bf2 29 bool init(I2C &i2c, Serial *serial = NULL, uint8_t slave_id = 0x15);
bell_huang 0:242cf8f28bf2 30
bell_huang 0:242cf8f28bf2 31 // operations
bell_huang 0:242cf8f28bf2 32 bool enable_ppg();
bell_huang 0:242cf8f28bf2 33 bool disable_ppg();
bell_huang 0:242cf8f28bf2 34 bool enable_touch();
bell_huang 0:242cf8f28bf2 35 bool disable_touch();
bell_huang 0:242cf8f28bf2 36
bell_huang 0:242cf8f28bf2 37 // tasking
bell_huang 0:242cf8f28bf2 38 bool task();
bell_huang 0:242cf8f28bf2 39 bool get_result(task_result &result);
bell_huang 0:242cf8f28bf2 40
bell_huang 0:242cf8f28bf2 41 private:
bell_huang 0:242cf8f28bf2 42 bool select_mode();
bell_huang 0:242cf8f28bf2 43
bell_huang 0:242cf8f28bf2 44 bool m_is_ppg_enabled;
bell_huang 0:242cf8f28bf2 45 bool m_is_touch_enabled;
bell_huang 0:242cf8f28bf2 46
bell_huang 0:242cf8f28bf2 47 };
bell_huang 0:242cf8f28bf2 48
bell_huang 0:242cf8f28bf2 49
bell_huang 0:242cf8f28bf2 50 }
bell_huang 0:242cf8f28bf2 51
bell_huang 0:242cf8f28bf2 52
bell_huang 0:242cf8f28bf2 53 #endif // header guard