add skip calibration and wakeup channel, fix isr in sleep mode

This commit is contained in:
Kang Zuoling
2021-03-31 19:57:54 +08:00
committed by laokaiyao
parent 24e63fd2c0
commit 82bf6c0935
12 changed files with 612 additions and 12 deletions

View File

@@ -10,6 +10,8 @@
#include "touch_element/touch_button.h"
#include "touch_element/touch_slider.h"
#include "touch_element/touch_matrix.h"
#include "esp_pm.h"
#include "sdkconfig.h"
#ifdef __cplusplus
extern "C" {
@@ -54,6 +56,9 @@ typedef struct {
touch_pad_t channel; //!< Touch channel number(index)
te_dev_type_t type; //!< Touch channel type TODO: need to refactor as te_class_type_t
te_dev_state_t state; //!< Touch channel current state
#ifdef CONFIG_TE_SKIP_DSLEEP_WAKEUP_CALIBRATION
bool is_use_last_threshold;
#endif
} te_dev_t;
typedef enum {
@@ -69,6 +74,7 @@ typedef struct {
esp_err_t (*set_threshold) (void);
void (*process_state) (void);
void (*update_state) (touch_pad_t, te_state_t);
touch_elem_handle_t (*search_channel_handle) (touch_pad_t);
} te_object_methods_t;
/* -------------------------------------------- Waterproof basic type --------------------------------------------- */
@@ -79,6 +85,16 @@ struct te_waterproof_s {
bool is_shield_level_set; //Waterproof shield level setting bit
};
typedef struct te_waterproof_s* te_waterproof_handle_t;
/* -------------------------------------------- Sleep basic type --------------------------------------------- */
struct te_sleep_s {
touch_elem_handle_t wakeup_handle;
esp_pm_lock_handle_t pm_lock;
#ifdef CONFIG_TE_SKIP_DSLEEP_WAKEUP_CALIBRATION
uint32_t *non_volatile_threshold;
#endif
};
typedef struct te_sleep_s* te_sleep_handle_t;
/* -------------------------------------------- Button basic type --------------------------------------------- */
typedef struct {
touch_elem_dispatch_t dispatch_method; //Button dispatch method
@@ -170,6 +186,18 @@ void te_object_method_register(te_object_methods_t *object_methods, te_class_typ
void te_object_method_unregister(te_class_type_t object_type);
bool te_object_check_channel(const touch_pad_t *channel_array, uint8_t channel_sum);
bool waterproof_check_mask_handle(touch_elem_handle_t te_handle);
bool te_is_touch_dsleep_wakeup(void);
inline touch_pad_t te_get_sleep_channel(void);
bool button_object_handle_check(touch_elem_handle_t element_handle);
bool slider_object_handle_check(touch_elem_handle_t element_handle);
bool matrix_object_handle_check(touch_elem_handle_t element_handle);
#ifdef CONFIG_TE_SKIP_DSLEEP_WAKEUP_CALIBRATION
void button_config_wakeup_calibration(te_button_handle_t button_handle, bool en);
void slider_config_wakeup_calibration(te_slider_handle_t slider_handle, bool en);
void matrix_config_wakeup_calibration(te_matrix_handle_t matrix_handle, bool en);
#endif
/* ------------------------------------------------------------------------------------------------------------------ */
#ifdef __cplusplus