class pah8011 for mbed

pixart_pah8011.h

Committer:
bell_huang
Date:
2017-10-26
Revision:
1:4e43ab5ba1e2
Parent:
0:242cf8f28bf2
Child:
4:cbc49829af39

File content as of revision 1:4e43ab5ba1e2:

#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:
        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