class pah8011 for mbed

Committer:
bell_huang
Date:
Fri Oct 27 08:21:32 2017 +0000
Revision:
5:37451de228e4
Parent:
4:cbc49829af39
Child:
6:d196b612b14a
Change debug printf

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 5:37451de228e4 15 typedef void (*DEBUG_PRINT_HANDLE)(const char *fmt, ...);
bell_huang 5:37451de228e4 16
bell_huang 0:242cf8f28bf2 17 struct task_result {
bell_huang 0:242cf8f28bf2 18 // ppg
bell_huang 4:cbc49829af39 19 int32_t *data;
bell_huang 0:242cf8f28bf2 20 uint32_t num_per_ch;
bell_huang 0:242cf8f28bf2 21 uint32_t ch_num;
bell_huang 0:242cf8f28bf2 22
bell_huang 0:242cf8f28bf2 23 // touch
bell_huang 0:242cf8f28bf2 24 bool is_touched;
bell_huang 0:242cf8f28bf2 25 };
bell_huang 0:242cf8f28bf2 26
bell_huang 0:242cf8f28bf2 27 public:
bell_huang 0:242cf8f28bf2 28 pah8011();
bell_huang 0:242cf8f28bf2 29 ~pah8011();
bell_huang 0:242cf8f28bf2 30
bell_huang 5:37451de228e4 31 void enable_debug_print(DEBUG_PRINT_HANDLE handler);
bell_huang 5:37451de228e4 32
bell_huang 5:37451de228e4 33 bool init(I2C &i2c, uint8_t slave_id = 0x15);
bell_huang 0:242cf8f28bf2 34
bell_huang 0:242cf8f28bf2 35 // operations
bell_huang 0:242cf8f28bf2 36 bool enable_ppg();
bell_huang 0:242cf8f28bf2 37 bool disable_ppg();
bell_huang 0:242cf8f28bf2 38 bool enable_touch();
bell_huang 0:242cf8f28bf2 39 bool disable_touch();
bell_huang 0:242cf8f28bf2 40
bell_huang 0:242cf8f28bf2 41 // tasking
bell_huang 0:242cf8f28bf2 42 bool task();
bell_huang 0:242cf8f28bf2 43 bool get_result(task_result &result);
bell_huang 0:242cf8f28bf2 44
bell_huang 0:242cf8f28bf2 45 private:
bell_huang 1:4e43ab5ba1e2 46 pah8011(const pah8011&); // = delete;
bell_huang 1:4e43ab5ba1e2 47 pah8011& operator=(const pah8011&); // = delete;
bell_huang 1:4e43ab5ba1e2 48
bell_huang 0:242cf8f28bf2 49 bool select_mode();
bell_huang 0:242cf8f28bf2 50
bell_huang 1:4e43ab5ba1e2 51 private:
bell_huang 0:242cf8f28bf2 52 bool m_is_ppg_enabled;
bell_huang 0:242cf8f28bf2 53 bool m_is_touch_enabled;
bell_huang 0:242cf8f28bf2 54
bell_huang 0:242cf8f28bf2 55 };
bell_huang 0:242cf8f28bf2 56
bell_huang 0:242cf8f28bf2 57
bell_huang 0:242cf8f28bf2 58 }
bell_huang 0:242cf8f28bf2 59
bell_huang 0:242cf8f28bf2 60
bell_huang 0:242cf8f28bf2 61 #endif // header guard