class pah8011 for mbed

pixart_pah8011.h

Committer:
bell_huang
Date:
2017-10-27
Revision:
5:37451de228e4
Parent:
4:cbc49829af39
Child:
6:d196b612b14a

File content as of revision 5:37451de228e4:

#ifndef __pixart_pah8011_h__
#define __pixart_pah8011_h__


#include <mbed.h>

#include <cstdint>


namespace pixart {


    class pah8011 {
    public:
        typedef void (*DEBUG_PRINT_HANDLE)(const char *fmt, ...);
        
        struct task_result {
            // ppg
            int32_t     *data;
            uint32_t    num_per_ch;
            uint32_t    ch_num;
            
            // touch
            bool        is_touched;
        };
    
    public:
        pah8011();
        ~pah8011();
        
        void    enable_debug_print(DEBUG_PRINT_HANDLE handler);
        
        bool    init(I2C &i2c, 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:
        pah8011(const pah8011&); // = delete;
        pah8011& operator=(const pah8011&); // = delete;
    
        bool    select_mode();

    private:
        bool    m_is_ppg_enabled;
        bool    m_is_touch_enabled;

    };
    
    
}


#endif // header guard