class pah8011 for mbed
pixart_pah8011.h@4:cbc49829af39, 2017-10-27 (annotated)
- Committer:
- bell_huang
- Date:
- Fri Oct 27 06:05:38 2017 +0000
- Revision:
- 4:cbc49829af39
- Parent:
- 1:4e43ab5ba1e2
- Child:
- 5:37451de228e4
QQQ
Who changed what in which revision?
User | Revision | Line number | New 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 | 4:cbc49829af39 | 17 | int32_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 | 1:4e43ab5ba1e2 | 42 | pah8011(const pah8011&); // = delete; |
bell_huang | 1:4e43ab5ba1e2 | 43 | pah8011& operator=(const pah8011&); // = delete; |
bell_huang | 1:4e43ab5ba1e2 | 44 | |
bell_huang | 0:242cf8f28bf2 | 45 | bool select_mode(); |
bell_huang | 0:242cf8f28bf2 | 46 | |
bell_huang | 1:4e43ab5ba1e2 | 47 | private: |
bell_huang | 0:242cf8f28bf2 | 48 | bool m_is_ppg_enabled; |
bell_huang | 0:242cf8f28bf2 | 49 | bool m_is_touch_enabled; |
bell_huang | 0:242cf8f28bf2 | 50 | |
bell_huang | 0:242cf8f28bf2 | 51 | }; |
bell_huang | 0:242cf8f28bf2 | 52 | |
bell_huang | 0:242cf8f28bf2 | 53 | |
bell_huang | 0:242cf8f28bf2 | 54 | } |
bell_huang | 0:242cf8f28bf2 | 55 | |
bell_huang | 0:242cf8f28bf2 | 56 | |
bell_huang | 0:242cf8f28bf2 | 57 | #endif // header guard |