Merge branch 'feature/fix_touch_driver_for_esp32s2' into 'master'
driver(touch): fix touch sensor driver for esp32s2 See merge request espressif/esp-idf!7664
This commit is contained in:
commit
42c552242b
40 changed files with 5005 additions and 834 deletions
|
@ -18,6 +18,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "driver/touch_sensor_common.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configure touch pad interrupt threshold.
|
* @brief Configure touch pad interrupt threshold.
|
||||||
*
|
*
|
||||||
|
@ -51,7 +53,7 @@ esp_err_t touch_pad_config(touch_pad_t touch_num, uint16_t threshold);
|
||||||
* - ESP_ERR_INVALID_STATE This touch pad hardware connection is error, the value of "touch_value" is 0.
|
* - ESP_ERR_INVALID_STATE This touch pad hardware connection is error, the value of "touch_value" is 0.
|
||||||
* - ESP_FAIL Touch pad not initialized
|
* - ESP_FAIL Touch pad not initialized
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_read(touch_pad_t touch_num, uint16_t * touch_value);
|
esp_err_t touch_pad_read(touch_pad_t touch_num, uint16_t *touch_value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get filtered touch sensor counter value by IIR filter.
|
* @brief get filtered touch sensor counter value by IIR filter.
|
||||||
|
@ -121,7 +123,7 @@ esp_err_t touch_pad_set_filter_read_cb(filter_cb_t read_cb);
|
||||||
* - ESP_ERR_INVALID_ARG GPIO error
|
* - ESP_ERR_INVALID_ARG GPIO error
|
||||||
* - ESP_ERR_NO_MEM No memory
|
* - ESP_ERR_NO_MEM No memory
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_isr_register(intr_handler_t fn, void* arg);
|
esp_err_t touch_pad_isr_register(intr_handler_t fn, void *arg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set touch sensor measurement and sleep time.
|
* @brief Set touch sensor measurement and sleep time.
|
||||||
|
@ -267,6 +269,13 @@ esp_err_t touch_pad_intr_enable(void);
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_intr_disable(void);
|
esp_err_t touch_pad_intr_disable(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief To clear touch pad interrupt
|
||||||
|
* @return
|
||||||
|
* - ESP_OK on success
|
||||||
|
*/
|
||||||
|
esp_err_t touch_pad_intr_clear(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief set touch pad filter calibration period, in ms.
|
* @brief set touch pad filter calibration period, in ms.
|
||||||
* Need to call touch_pad_filter_start before all touch filter APIs
|
* Need to call touch_pad_filter_start before all touch filter APIs
|
||||||
|
@ -287,7 +296,7 @@ esp_err_t touch_pad_set_filter_period(uint32_t new_period_ms);
|
||||||
* - ESP_ERR_INVALID_STATE driver state error
|
* - ESP_ERR_INVALID_STATE driver state error
|
||||||
* - ESP_ERR_INVALID_ARG parameter error
|
* - ESP_ERR_INVALID_ARG parameter error
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_get_filter_period(uint32_t* p_period_ms);
|
esp_err_t touch_pad_get_filter_period(uint32_t *p_period_ms);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief start touch pad filter function
|
* @brief start touch pad filter function
|
||||||
|
|
|
@ -49,7 +49,7 @@ typedef struct {
|
||||||
bool enable;
|
bool enable;
|
||||||
} touch_pad_filter_t;
|
} touch_pad_filter_t;
|
||||||
static touch_pad_filter_t *s_touch_pad_filter = NULL;
|
static touch_pad_filter_t *s_touch_pad_filter = NULL;
|
||||||
// check if touch pad be inited.
|
// check if touch pad be initialized.
|
||||||
static uint16_t s_touch_pad_init_bit = 0x0000;
|
static uint16_t s_touch_pad_init_bit = 0x0000;
|
||||||
static filter_cb_t s_filter_cb = NULL;
|
static filter_cb_t s_filter_cb = NULL;
|
||||||
static SemaphoreHandle_t rtc_touch_mux = NULL;
|
static SemaphoreHandle_t rtc_touch_mux = NULL;
|
||||||
|
@ -227,7 +227,7 @@ esp_err_t touch_pad_clear_group_mask(uint16_t set1_mask, uint16_t set2_mask, uin
|
||||||
esp_err_t touch_pad_intr_enable(void)
|
esp_err_t touch_pad_intr_enable(void)
|
||||||
{
|
{
|
||||||
TOUCH_ENTER_CRITICAL();
|
TOUCH_ENTER_CRITICAL();
|
||||||
touch_hal_enable_interrupt();
|
touch_hal_intr_enable();
|
||||||
TOUCH_EXIT_CRITICAL();
|
TOUCH_EXIT_CRITICAL();
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
@ -235,11 +235,24 @@ esp_err_t touch_pad_intr_enable(void)
|
||||||
esp_err_t touch_pad_intr_disable(void)
|
esp_err_t touch_pad_intr_disable(void)
|
||||||
{
|
{
|
||||||
TOUCH_ENTER_CRITICAL();
|
TOUCH_ENTER_CRITICAL();
|
||||||
touch_hal_disable_interrupt();
|
touch_hal_intr_disable();
|
||||||
TOUCH_EXIT_CRITICAL();
|
TOUCH_EXIT_CRITICAL();
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t touch_pad_intr_clear(void)
|
||||||
|
{
|
||||||
|
TOUCH_ENTER_CRITICAL();
|
||||||
|
touch_hal_intr_clear();
|
||||||
|
TOUCH_EXIT_CRITICAL();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool touch_pad_meas_is_done(void)
|
||||||
|
{
|
||||||
|
return touch_hal_meas_is_done();
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t touch_pad_config(touch_pad_t touch_num, uint16_t threshold)
|
esp_err_t touch_pad_config(touch_pad_t touch_num, uint16_t threshold)
|
||||||
{
|
{
|
||||||
TOUCH_CHECK(rtc_touch_mux != NULL, "Touch pad not initialized", ESP_FAIL);
|
TOUCH_CHECK(rtc_touch_mux != NULL, "Touch pad not initialized", ESP_FAIL);
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
@ -18,10 +17,12 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "driver/touch_sensor_common.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set touch sensor FSM start
|
* @brief Set touch sensor FSM start
|
||||||
* @note Start FSM after the touch sensor FSM mode is set.
|
* @note Start FSM after the touch sensor FSM mode is set.
|
||||||
* @note Call this function will reset beseline of all touch channels.
|
* @note Call this function will reset baseline of all touch channels.
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
*/
|
*/
|
||||||
|
@ -51,22 +52,22 @@ esp_err_t touch_pad_sw_start(void);
|
||||||
* sleep_cycle decide the interval between each measurement.
|
* sleep_cycle decide the interval between each measurement.
|
||||||
* t_sleep = sleep_cycle / (RTC_SLOW_CLK frequency).
|
* t_sleep = sleep_cycle / (RTC_SLOW_CLK frequency).
|
||||||
* The approximate frequency value of RTC_SLOW_CLK can be obtained using rtc_clk_slow_freq_get_hz function.
|
* The approximate frequency value of RTC_SLOW_CLK can be obtained using rtc_clk_slow_freq_get_hz function.
|
||||||
* @param meas_time The time of charge and discharge in each measure process of touch channels.
|
* @param meas_times The times of charge and discharge in each measure process of touch channels.
|
||||||
* The timer frequency is 8Mhz. Range: 0 ~ 0xffff.
|
* The timer frequency is 8Mhz. Range: 0 ~ 0xffff.
|
||||||
* Recommended typical value: Modify this value to make the measurement time around 1ms.
|
* Recommended typical value: Modify this value to make the measurement time around 1ms.
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_set_meas_time(uint16_t sleep_cycle, uint16_t meas_time);
|
esp_err_t touch_pad_set_meas_time(uint16_t sleep_cycle, uint16_t meas_times);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get touch sensor times of charge and discharge and sleep time
|
* @brief Get touch sensor times of charge and discharge and sleep time
|
||||||
* @param sleep_cycle Pointer to accept sleep cycle number
|
* @param sleep_cycle Pointer to accept sleep cycle number
|
||||||
* @param meas_time Pointer to accept measurement time count.
|
* @param meas_times Pointer to accept measurement times count.
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_get_meas_time(uint16_t *sleep_cycle, uint16_t *meas_time);
|
esp_err_t touch_pad_get_meas_time(uint16_t *sleep_cycle, uint16_t *meas_times);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set connection type of touch channel in idle status.
|
* @brief Set connection type of touch channel in idle status.
|
||||||
|
@ -79,7 +80,7 @@ esp_err_t touch_pad_get_meas_time(uint16_t *sleep_cycle, uint16_t *meas_time);
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_set_inactive_connect(touch_pad_conn_type_t type);
|
esp_err_t touch_pad_set_idle_channel_connect(touch_pad_conn_type_t type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set connection type of touch channel in idle status.
|
* @brief Set connection type of touch channel in idle status.
|
||||||
|
@ -92,13 +93,13 @@ esp_err_t touch_pad_set_inactive_connect(touch_pad_conn_type_t type);
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_get_inactive_connect(touch_pad_conn_type_t *type);
|
esp_err_t touch_pad_get_idle_channel_connect(touch_pad_conn_type_t *type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the trigger threshold of touch sensor.
|
* @brief Set the trigger threshold of touch sensor.
|
||||||
* The threshold determines the sensitivity of the touch sensor.
|
* The threshold determines the sensitivity of the touch sensor.
|
||||||
* The threshold is the original value of the trigger state minus the baseline value.
|
* The threshold is the original value of the trigger state minus the baseline value.
|
||||||
* @note If set "TOUCH_PAD_THRESHOLD_MAX", the touch is never be trigered.
|
* @note If set "TOUCH_PAD_THRESHOLD_MAX", the touch is never be triggered.
|
||||||
* @param touch_num touch pad index
|
* @param touch_num touch pad index
|
||||||
* @param threshold threshold of touch sensor. Should be less than the max change value of touch.
|
* @param threshold threshold of touch sensor. Should be less than the max change value of touch.
|
||||||
* @return
|
* @return
|
||||||
|
@ -162,26 +163,16 @@ esp_err_t touch_pad_clear_channel_mask(uint16_t enable_mask);
|
||||||
esp_err_t touch_pad_config(touch_pad_t touch_num);
|
esp_err_t touch_pad_config(touch_pad_t touch_num);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reset the whole of touch module.
|
* @brief Reset the FSM of touch module.
|
||||||
* @note Call this funtion after `touch_pad_fsm_stop`,
|
* @note Call this function after `touch_pad_fsm_stop`.
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK Success
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_reset(void);
|
esp_err_t touch_pad_reset(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check touch sensor measurement status.
|
|
||||||
* If doing measurement, the flag will be clear.
|
|
||||||
* If finish measurement. the flag will be set.
|
|
||||||
* @return
|
|
||||||
* - TRUE finish measurement
|
|
||||||
* - FALSE doing measurement
|
|
||||||
*/
|
|
||||||
bool touch_pad_meas_is_done(void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the current measure channel.
|
* @brief Get the current measure channel.
|
||||||
* Touch sensor measurement is cyclic scan mode.
|
* @note Should be called when touch sensor measurement is in cyclic scan mode.
|
||||||
* @return
|
* @return
|
||||||
* - touch channel number
|
* - touch channel number
|
||||||
*/
|
*/
|
||||||
|
@ -190,7 +181,7 @@ touch_pad_t touch_pad_get_current_meas_channel(void);
|
||||||
/**
|
/**
|
||||||
* @brief Get the touch sensor interrupt status mask.
|
* @brief Get the touch sensor interrupt status mask.
|
||||||
* @return
|
* @return
|
||||||
* - touch intrrupt bit
|
* - touch interrupt bit
|
||||||
*/
|
*/
|
||||||
uint32_t touch_pad_read_intr_status_mask(void);
|
uint32_t touch_pad_read_intr_status_mask(void);
|
||||||
|
|
||||||
|
@ -210,18 +201,54 @@ esp_err_t touch_pad_intr_enable(touch_pad_intr_mask_t int_mask);
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_intr_disable(touch_pad_intr_mask_t int_mask);
|
esp_err_t touch_pad_intr_disable(touch_pad_intr_mask_t int_mask);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clear touch sensor interrupt by bitmask.
|
||||||
|
* @param int_mask Pad mask to clear interrupts
|
||||||
|
* @return
|
||||||
|
* - ESP_OK on success
|
||||||
|
*/
|
||||||
|
esp_err_t touch_pad_intr_clear(touch_pad_intr_mask_t int_mask);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Register touch-pad ISR.
|
* @brief Register touch-pad ISR.
|
||||||
* The handler will be attached to the same CPU core that this function is running on.
|
* The handler will be attached to the same CPU core that this function is running on.
|
||||||
* @param fn Pointer to ISR handler
|
* @param fn Pointer to ISR handler
|
||||||
* @param arg Parameter for ISR
|
* @param arg Parameter for ISR
|
||||||
* @param int_mask Initial pad mask to enable interrupt for
|
* @param intr_mask Enable touch sensor interrupt handler by bitmask.
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success ;
|
* - ESP_OK Success
|
||||||
* - ESP_ERR_INVALID_ARG GPIO error
|
* - ESP_ERR_INVALID_ARG Arguments error
|
||||||
* - ESP_ERR_NO_MEM No memory
|
* - ESP_ERR_NO_MEM No memory
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_isr_register(intr_handler_t fn, void* arg, touch_pad_intr_mask_t int_mask);
|
esp_err_t touch_pad_isr_register(intr_handler_t fn, void *arg, touch_pad_intr_mask_t intr_mask);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable/disable the timeout check and set timeout threshold for all touch sensor channels measurements.
|
||||||
|
* If enable: When the touch reading of a touch channel exceeds the measurement threshold, a timeout interrupt will be generated.
|
||||||
|
* If disable: the FSM does not check if the channel under measurement times out.
|
||||||
|
*
|
||||||
|
* @note The threshold compared with touch readings.
|
||||||
|
* @note In order to avoid abnormal short circuit of some touch channels. This function should be turned on.
|
||||||
|
* Ensure the normal operation of other touch channels.
|
||||||
|
*
|
||||||
|
* @param enable true(default): Enable the timeout check; false: Disable the timeout check.
|
||||||
|
* @param threshold For all channels, the maximum value that will not be exceeded during normal operation.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK Success
|
||||||
|
*/
|
||||||
|
esp_err_t touch_pad_timeout_set(bool enable, uint32_t threshold);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Call this interface after timeout to make the touch channel resume normal work. Point on the next channel to measure.
|
||||||
|
* If this API is not called, the touch FSM will stop the measurement after timeout interrupt.
|
||||||
|
*
|
||||||
|
* @note Call this API after finishes the exception handling by user.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK Success
|
||||||
|
*/
|
||||||
|
esp_err_t touch_pad_timeout_resume(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get raw data of touch sensor.
|
* @brief get raw data of touch sensor.
|
||||||
|
@ -231,7 +258,7 @@ esp_err_t touch_pad_isr_register(intr_handler_t fn, void* arg, touch_pad_intr_ma
|
||||||
* @param raw_data pointer to accept touch sensor value
|
* @param raw_data pointer to accept touch sensor value
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK Success
|
||||||
* - ESP_FAIL Touch channel 0 havent this parameter.
|
* - ESP_FAIL Touch channel 0 haven't this parameter.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
esp_err_t touch_pad_read_raw_data(touch_pad_t touch_num, uint32_t *raw_data);
|
esp_err_t touch_pad_read_raw_data(touch_pad_t touch_num, uint32_t *raw_data);
|
||||||
|
@ -243,10 +270,18 @@ esp_err_t touch_pad_read_raw_data(touch_pad_t touch_num, uint32_t *raw_data);
|
||||||
* @param basedata pointer to accept touch sensor baseline value
|
* @param basedata pointer to accept touch sensor baseline value
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK Success
|
||||||
* - ESP_ERR_INVALID_ARG Touch channel 0 havent this parameter.
|
* - ESP_ERR_INVALID_ARG Touch channel 0 haven't this parameter.
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_filter_read_baseline(touch_pad_t touch_num, uint32_t *basedata);
|
esp_err_t touch_pad_filter_read_baseline(touch_pad_t touch_num, uint32_t *basedata);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get smoothed data that obtained by filtering the raw data.
|
||||||
|
*
|
||||||
|
* @param touch_num touch pad index
|
||||||
|
* @param smooth pointer to smoothed data
|
||||||
|
*/
|
||||||
|
esp_err_t touch_pad_filter_read_smooth(touch_pad_t touch_num, uint32_t *smooth);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Force reset baseline to raw data of touch sensor.
|
* @brief Force reset baseline to raw data of touch sensor.
|
||||||
* @param touch_num touch pad index
|
* @param touch_num touch pad index
|
||||||
|
@ -283,7 +318,7 @@ esp_err_t touch_pad_filter_get_config(touch_filter_config_t *filter_info);
|
||||||
esp_err_t touch_pad_filter_enable(void);
|
esp_err_t touch_pad_filter_enable(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief diaable touch sensor filter for detection algorithm.
|
* @brief disable touch sensor filter for detection algorithm.
|
||||||
* For more details on the detection algorithm, please refer to the application documentation.
|
* For more details on the detection algorithm, please refer to the application documentation.
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK Success
|
||||||
|
@ -295,8 +330,8 @@ esp_err_t touch_pad_filter_disable(void);
|
||||||
* T0 is an internal channel that does not have a corresponding external GPIO.
|
* T0 is an internal channel that does not have a corresponding external GPIO.
|
||||||
* T0 will work simultaneously with the measured channel Tn. Finally, the actual
|
* T0 will work simultaneously with the measured channel Tn. Finally, the actual
|
||||||
* measured value of Tn is the value after subtracting lower bits of T0.
|
* measured value of Tn is the value after subtracting lower bits of T0.
|
||||||
* This denoise function filters out interference introduced on all channels,
|
* The noise reduction function filters out interference introduced simultaneously on all channels,
|
||||||
* such as noise introduced by the power supply and external EMI.
|
* such as noise introduced by power supplies and external EMI.
|
||||||
* @param denoise parameter of denoise
|
* @param denoise parameter of denoise
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK Success
|
||||||
|
@ -316,8 +351,8 @@ esp_err_t touch_pad_denoise_get_config(touch_pad_denoise_t *denoise);
|
||||||
* T0 is an internal channel that does not have a corresponding external GPIO.
|
* T0 is an internal channel that does not have a corresponding external GPIO.
|
||||||
* T0 will work simultaneously with the measured channel Tn. Finally, the actual
|
* T0 will work simultaneously with the measured channel Tn. Finally, the actual
|
||||||
* measured value of Tn is the value after subtracting lower bits of T0.
|
* measured value of Tn is the value after subtracting lower bits of T0.
|
||||||
* This denoise function filters out interference introduced on all channels,
|
* The noise reduction function filters out interference introduced simultaneously on all channels,
|
||||||
* such as noise introduced by the power supply and external EMI.
|
* such as noise introduced by power supplies and external EMI.
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK Success
|
||||||
*/
|
*/
|
||||||
|
@ -384,34 +419,44 @@ esp_err_t touch_pad_waterproof_enable(void);
|
||||||
esp_err_t touch_pad_waterproof_disable(void);
|
esp_err_t touch_pad_waterproof_disable(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set parameter of proximity channel. Three proximity sensing channels can be set.
|
* @brief Enable/disable proximity function of touch channels.
|
||||||
* The proximity sensor measurement is the accumulation of touch channel measurements.
|
* The proximity sensor measurement is the accumulation of touch channel measurements.
|
||||||
* @note If stop the proximity function for the channel, point this proximity channel to `TOUCH_PAD_NUM0`.
|
*
|
||||||
* @param proximity parameter of proximity
|
* @note Supports up to three touch channels configured as proximity sensors.
|
||||||
|
* @param touch_num touch pad index
|
||||||
|
* @param enabled true: enable the proximity function; false: disable the proximity function
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK: Configured correctly.
|
||||||
|
* - ESP_ERR_INVALID_ARG: Touch channel number error.
|
||||||
|
* - ESP_ERR_NOT_SUPPORTED: Don't support configured.
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_proximity_set_config(touch_pad_proximity_t *proximity);
|
esp_err_t touch_pad_proximity_enable(touch_pad_t touch_num, bool enabled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get parameter of proximity channel. Three proximity sensing channels can be set.
|
* @brief Set measure count of proximity channel.
|
||||||
* The proximity sensor measurement is the accumulation of touch channel measurements.
|
* The proximity sensor measurement is the accumulation of touch channel measurements.
|
||||||
* @param proximity parameter of proximity
|
*
|
||||||
|
* @note All proximity channels use the same `count` value. So please pass the parameter `TOUCH_PAD_MAX`.
|
||||||
|
* @param touch_num Touch pad index. In this version, pass the parameter `TOUCH_PAD_MAX`.
|
||||||
|
* @param count The cumulative times of measurements for proximity pad. Range: 0 ~ 255.
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK: Configured correctly.
|
||||||
|
* - ESP_ERR_INVALID_ARG: Touch channel number error.
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_proximity_get_config(touch_pad_proximity_t *proximity);
|
esp_err_t touch_pad_proximity_set_count(touch_pad_t touch_num, uint32_t count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get measure count of proximity channel.
|
* @brief Get measure count of proximity channel.
|
||||||
* The proximity sensor measurement is the accumulation of touch channel measurements.
|
* The proximity sensor measurement is the accumulation of touch channel measurements.
|
||||||
* @param touch_num touch pad index
|
*
|
||||||
* @param cnt Pointer to receive proximity channel measurement count
|
* @note All proximity channels use the same `count` value. So please pass the parameter `TOUCH_PAD_MAX`.
|
||||||
|
* @param touch_num Touch pad index. In this version, pass the parameter `TOUCH_PAD_MAX`.
|
||||||
|
* @param count The cumulative times of measurements for proximity pad. Range: 0 ~ 255.
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK: Configured correctly.
|
||||||
* - ESP_ERR_INVALID_ARG parameter is NULL
|
* - ESP_ERR_INVALID_ARG: Touch channel number error.
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_proximity_read_meas_cnt(touch_pad_t touch_num, uint32_t *cnt);
|
esp_err_t touch_pad_proximity_get_count(touch_pad_t touch_num, uint32_t *count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the accumulated measurement of the proximity sensor.
|
* @brief Get the accumulated measurement of the proximity sensor.
|
||||||
|
@ -420,46 +465,125 @@ esp_err_t touch_pad_proximity_read_meas_cnt(touch_pad_t touch_num, uint32_t *cnt
|
||||||
* @param measure_out If the accumulation process does not end, the `measure_out` is the process value.
|
* @param measure_out If the accumulation process does not end, the `measure_out` is the process value.
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK Success
|
||||||
|
* - ESP_ERR_INVALID_ARG Touch num is not proximity
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_proximity_data_get(touch_pad_t touch_num, uint32_t *measure_out);
|
esp_err_t touch_pad_proximity_get_data(touch_pad_t touch_num, uint32_t *measure_out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set parameter of touch sensor in sleep mode.
|
* @brief Get parameter of touch sensor sleep channel.
|
||||||
* In order to achieve low power consumption in sleep mode, other circuits except the RTC part of the register are in a power-off state.
|
* The touch sensor can works in sleep mode to wake up sleep.
|
||||||
* Only one touch channel is supported in the sleep state, which can be used as a wake-up function.
|
*
|
||||||
* If in non-sleep mode, the sleep parameters do not work.
|
* @note After the sleep channel is configured, Please use special functions for sleep channel.
|
||||||
* @param slp_config touch pad config
|
* e.g. The user should uses `touch_pad_sleep_channel_read_data` instead of `touch_pad_read_raw_data` to obtain the sleep channel reading.
|
||||||
|
*
|
||||||
|
* @param slp_config touch sleep pad config.
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK Success
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_sleep_channel_config(touch_pad_sleep_channel_t *slp_config);
|
esp_err_t touch_pad_sleep_channel_get_info(touch_pad_sleep_channel_t *slp_config);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read baseline of touch sensor in sleep mode.
|
* @brief Enable/Disable sleep channel function for touch sensor.
|
||||||
|
* The touch sensor can works in sleep mode to wake up sleep.
|
||||||
|
*
|
||||||
|
* @note ESP32S2 only support one sleep channel.
|
||||||
|
* @note After the sleep channel is configured, Please use special functions for sleep channel.
|
||||||
|
* e.g. The user should uses `touch_pad_sleep_channel_read_data` instead of `touch_pad_read_raw_data` to obtain the sleep channel reading.
|
||||||
|
*
|
||||||
|
* @param pad_num Set touch channel number for sleep pad. Only one touch sensor channel is supported in deep sleep mode.
|
||||||
|
* @param enable true: enable sleep pad for touch sensor; false: disable sleep pad for touch sensor;
|
||||||
|
* @return
|
||||||
|
* - ESP_OK Success
|
||||||
|
*/
|
||||||
|
esp_err_t touch_pad_sleep_channel_enable(touch_pad_t pad_num, bool enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable/Disable proximity function for sleep channel.
|
||||||
|
* The touch sensor can works in sleep mode to wake up sleep.
|
||||||
|
*
|
||||||
|
* @note ESP32S2 only support one sleep channel.
|
||||||
|
*
|
||||||
|
* @param pad_num Set touch channel number for sleep pad. Only one touch sensor channel is supported in deep sleep mode.
|
||||||
|
* @param enable true: enable proximity for sleep channel; false: disable proximity for sleep channel;
|
||||||
|
* @return
|
||||||
|
* - ESP_OK Success
|
||||||
|
*/
|
||||||
|
esp_err_t touch_pad_sleep_channel_enable_proximity(touch_pad_t pad_num, bool enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the trigger threshold of touch sensor in deep sleep.
|
||||||
|
* The threshold determines the sensitivity of the touch sensor.
|
||||||
|
*
|
||||||
|
* @note In general, the touch threshold during sleep can use the threshold parameter parameters before sleep.
|
||||||
|
*
|
||||||
|
* @param pad_num Set touch channel number for sleep pad. Only one touch sensor channel is supported in deep sleep mode.
|
||||||
|
* @param touch_thres touch sleep pad threshold
|
||||||
|
* @return
|
||||||
|
* - ESP_OK Success
|
||||||
|
*/
|
||||||
|
esp_err_t touch_pad_sleep_set_threshold(touch_pad_t pad_num, uint32_t touch_thres);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the trigger threshold of touch sensor in deep sleep.
|
||||||
|
* The threshold determines the sensitivity of the touch sensor.
|
||||||
|
*
|
||||||
|
* @note In general, the touch threshold during sleep can use the threshold parameter parameters before sleep.
|
||||||
|
*
|
||||||
|
* @param pad_num Set touch channel number for sleep pad. Only one touch sensor channel is supported in deep sleep mode.
|
||||||
|
* @param touch_thres touch sleep pad threshold
|
||||||
|
* @return
|
||||||
|
* - ESP_OK Success
|
||||||
|
*/
|
||||||
|
esp_err_t touch_pad_sleep_get_threshold(touch_pad_t pad_num, uint32_t *touch_thres);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read baseline of touch sensor sleep channel.
|
||||||
|
* @param pad_num Set touch channel number for sleep pad. Only one touch sensor channel is supported in deep sleep mode.
|
||||||
* @param baseline pointer to accept touch sensor baseline value
|
* @param baseline pointer to accept touch sensor baseline value
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK Success
|
||||||
* - ESP_ERR_INVALID_ARG parameter is NULL
|
* - ESP_ERR_INVALID_ARG parameter is NULL
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_sleep_channel_read_baseline(uint32_t *baseline);
|
esp_err_t touch_pad_sleep_channel_read_baseline(touch_pad_t pad_num, uint32_t *baseline);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read debounce of touch sensor in sleep mode.
|
* @brief Read smoothed data of touch sensor sleep channel.
|
||||||
* @param debounce pointer to accept touch sensor debounce value
|
* Smoothed data is filtered from the raw data.
|
||||||
|
* @param pad_num Set touch channel number for sleep pad. Only one touch sensor channel is supported in deep sleep mode.
|
||||||
|
* @param smooth_data pointer to accept touch sensor smoothed data
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK Success
|
||||||
* - ESP_ERR_INVALID_ARG parameter is NULL
|
* - ESP_ERR_INVALID_ARG parameter is NULL
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_sleep_channel_read_debounce(uint32_t *debounce);
|
esp_err_t touch_pad_sleep_channel_read_smooth(touch_pad_t pad_num, uint32_t *smooth_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read proximity count of touch sensor in sleep mode.
|
* @brief Read raw data of touch sensor sleep channel.
|
||||||
|
* @param pad_num Set touch channel number for sleep pad. Only one touch sensor channel is supported in deep sleep mode.
|
||||||
|
* @param raw_data pointer to accept touch sensor raw data
|
||||||
|
* @return
|
||||||
|
* - ESP_OK Success
|
||||||
|
* - ESP_ERR_INVALID_ARG parameter is NULL
|
||||||
|
*/
|
||||||
|
esp_err_t touch_pad_sleep_channel_read_data(touch_pad_t pad_num, uint32_t *raw_data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reset baseline of touch sensor sleep channel.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK Success
|
||||||
|
*/
|
||||||
|
esp_err_t touch_pad_sleep_channel_reset_baseline(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read proximity count of touch sensor sleep channel.
|
||||||
|
* @param pad_num Set touch channel number for sleep pad. Only one touch sensor channel is supported in deep sleep mode.
|
||||||
* @param proximity_cnt pointer to accept touch sensor proximity count value
|
* @param proximity_cnt pointer to accept touch sensor proximity count value
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK Success
|
||||||
* - ESP_ERR_INVALID_ARG parameter is NULL
|
* - ESP_ERR_INVALID_ARG parameter is NULL
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_sleep_channel_read_proximity_cnt(uint32_t *proximity_cnt);
|
esp_err_t touch_pad_sleep_channel_read_proximity_cnt(touch_pad_t pad_num, uint32_t *proximity_cnt);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ static SemaphoreHandle_t rtc_tsens_mux = NULL;
|
||||||
|
|
||||||
esp_err_t temp_sensor_set_config(temp_sensor_config_t tsens)
|
esp_err_t temp_sensor_set_config(temp_sensor_config_t tsens)
|
||||||
{
|
{
|
||||||
SENS.sar_tctrl.tsens_dac = dac_offset[tsens.dac_offset].set_val;
|
// SENS.sar_tctrl.tsens_dac = dac_offset[tsens.dac_offset].set_val; // TODO: others MR resolve it.
|
||||||
SENS.sar_tctrl.tsens_clk_div = tsens.clk_div;
|
SENS.sar_tctrl.tsens_clk_div = tsens.clk_div;
|
||||||
SENS.sar_tctrl.tsens_power_up_force = 1;
|
SENS.sar_tctrl.tsens_power_up_force = 1;
|
||||||
SENS.sar_tctrl2.tsens_xpd_wait = TSENS_XPD_WAIT_DEFAULT;
|
SENS.sar_tctrl2.tsens_xpd_wait = TSENS_XPD_WAIT_DEFAULT;
|
||||||
|
@ -77,7 +77,7 @@ esp_err_t temp_sensor_set_config(temp_sensor_config_t tsens)
|
||||||
esp_err_t temp_sensor_get_config(temp_sensor_config_t *tsens)
|
esp_err_t temp_sensor_get_config(temp_sensor_config_t *tsens)
|
||||||
{
|
{
|
||||||
TSENS_CHECK(tsens != NULL, ESP_ERR_INVALID_ARG);
|
TSENS_CHECK(tsens != NULL, ESP_ERR_INVALID_ARG);
|
||||||
tsens->dac_offset = SENS.sar_tctrl.tsens_dac;
|
// tsens->dac_offset = SENS.sar_tctrl.tsens_dac; // TODO: others MR resolve it.
|
||||||
for(int i=TSENS_DAC_L0; i<TSENS_DAC_MAX; i++) {
|
for(int i=TSENS_DAC_L0; i<TSENS_DAC_MAX; i++) {
|
||||||
if(tsens->dac_offset == dac_offset[i].set_val) {
|
if(tsens->dac_offset == dac_offset[i].set_val) {
|
||||||
tsens->dac_offset = dac_offset[i].index;
|
tsens->dac_offset = dac_offset[i].index;
|
||||||
|
|
|
@ -59,6 +59,8 @@ static const char *TOUCH_TAG = "TOUCH_SENSOR";
|
||||||
#define TOUCH_PARAM_CHECK_STR(s) ""s" parameter error"
|
#define TOUCH_PARAM_CHECK_STR(s) ""s" parameter error"
|
||||||
|
|
||||||
extern portMUX_TYPE rtc_spinlock; //TODO: Will be placed in the appropriate position after the rtc module is finished.
|
extern portMUX_TYPE rtc_spinlock; //TODO: Will be placed in the appropriate position after the rtc module is finished.
|
||||||
|
#define TOUCH_ENTER_CRITICAL_SAFE() portENTER_CRITICAL_SAFE(&rtc_spinlock) // Can be called in isr and task.
|
||||||
|
#define TOUCH_EXIT_CRITICAL_SAFE() portEXIT_CRITICAL_SAFE(&rtc_spinlock)
|
||||||
#define TOUCH_ENTER_CRITICAL() portENTER_CRITICAL(&rtc_spinlock)
|
#define TOUCH_ENTER_CRITICAL() portENTER_CRITICAL(&rtc_spinlock)
|
||||||
#define TOUCH_EXIT_CRITICAL() portEXIT_CRITICAL(&rtc_spinlock)
|
#define TOUCH_EXIT_CRITICAL() portEXIT_CRITICAL(&rtc_spinlock)
|
||||||
|
|
||||||
|
@ -68,8 +70,29 @@ static SemaphoreHandle_t rtc_touch_mux = NULL;
|
||||||
Touch Pad
|
Touch Pad
|
||||||
---------------------------------------------------------------*/
|
---------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** Workaround for scan done interrupt issue. */
|
||||||
|
static void touch_pad_workaround_isr_internal(void *arg)
|
||||||
|
{
|
||||||
|
uint16_t ch_mask = 0;
|
||||||
|
uint32_t intr_mask = touch_hal_read_intr_status_mask();
|
||||||
|
uint32_t pad_num = touch_hal_get_current_meas_channel();
|
||||||
|
/* Make sure that the scan done interrupt is generated after the last channel measurement is completed. */
|
||||||
|
if (intr_mask & TOUCH_PAD_INTR_MASK_SCAN_DONE) {
|
||||||
|
touch_hal_get_channel_mask(&ch_mask);
|
||||||
|
for (int i = TOUCH_PAD_MAX - 1; i >= 0; i--) {
|
||||||
|
if (BIT(i) & ch_mask) {
|
||||||
|
if (pad_num != i) {
|
||||||
|
touch_hal_intr_clear(TOUCH_PAD_INTR_MASK_SCAN_DONE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t touch_pad_isr_register(intr_handler_t fn, void *arg, touch_pad_intr_mask_t intr_mask)
|
esp_err_t touch_pad_isr_register(intr_handler_t fn, void *arg, touch_pad_intr_mask_t intr_mask)
|
||||||
{
|
{
|
||||||
|
static bool reg_flag = false;
|
||||||
TOUCH_CHECK(fn != NULL, TOUCH_PARAM_CHECK_STR("intr_mask"), ESP_ERR_INVALID_ARG);
|
TOUCH_CHECK(fn != NULL, TOUCH_PARAM_CHECK_STR("intr_mask"), ESP_ERR_INVALID_ARG);
|
||||||
TOUCH_INTR_MASK_CHECK(intr_mask);
|
TOUCH_INTR_MASK_CHECK(intr_mask);
|
||||||
|
|
||||||
|
@ -83,7 +106,20 @@ esp_err_t touch_pad_isr_register(intr_handler_t fn, void *arg, touch_pad_intr_ma
|
||||||
if (intr_mask & TOUCH_PAD_INTR_MASK_INACTIVE) {
|
if (intr_mask & TOUCH_PAD_INTR_MASK_INACTIVE) {
|
||||||
en_msk |= RTC_CNTL_TOUCH_INACTIVE_INT_ST_M;
|
en_msk |= RTC_CNTL_TOUCH_INACTIVE_INT_ST_M;
|
||||||
}
|
}
|
||||||
return rtc_isr_register(fn, arg, en_msk);
|
if (intr_mask & TOUCH_PAD_INTR_MASK_SCAN_DONE) {
|
||||||
|
en_msk |= RTC_CNTL_TOUCH_SCAN_DONE_INT_ST_M;
|
||||||
|
}
|
||||||
|
if (intr_mask & TOUCH_PAD_INTR_MASK_TIMEOUT) {
|
||||||
|
en_msk |= RTC_CNTL_TOUCH_TIMEOUT_INT_ST_M;
|
||||||
|
}
|
||||||
|
esp_err_t ret = rtc_isr_register(fn, arg, en_msk);
|
||||||
|
/* Must ensure: After being registered, it is executed first. */
|
||||||
|
if ( (ret == ESP_OK) && (reg_flag == false) && (intr_mask & (TOUCH_PAD_INTR_MASK_SCAN_DONE | TOUCH_PAD_INTR_MASK_TIMEOUT)) ) {
|
||||||
|
rtc_isr_register(touch_pad_workaround_isr_internal, NULL, RTC_CNTL_TOUCH_SCAN_DONE_INT_ST_M | RTC_CNTL_TOUCH_TIMEOUT_INT_ST_M);
|
||||||
|
reg_flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t touch_pad_set_meas_time(uint16_t sleep_cycle, uint16_t meas_times)
|
esp_err_t touch_pad_set_meas_time(uint16_t sleep_cycle, uint16_t meas_times)
|
||||||
|
@ -106,18 +142,18 @@ esp_err_t touch_pad_get_meas_time(uint16_t *sleep_cycle, uint16_t *meas_times)
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t touch_pad_set_inactive_connect(touch_pad_conn_type_t type)
|
esp_err_t touch_pad_set_idle_channel_connect(touch_pad_conn_type_t type)
|
||||||
{
|
{
|
||||||
TOUCH_CHECK(type < TOUCH_PAD_CONN_MAX, TOUCH_PARAM_CHECK_STR("type"), ESP_ERR_INVALID_ARG);
|
TOUCH_CHECK(type < TOUCH_PAD_CONN_MAX, TOUCH_PARAM_CHECK_STR("type"), ESP_ERR_INVALID_ARG);
|
||||||
TOUCH_ENTER_CRITICAL();
|
TOUCH_ENTER_CRITICAL();
|
||||||
touch_hal_set_inactive_connect(type);
|
touch_hal_set_idle_channel_connect(type);
|
||||||
TOUCH_EXIT_CRITICAL();
|
TOUCH_EXIT_CRITICAL();
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t touch_pad_get_inactive_connect(touch_pad_conn_type_t *type)
|
esp_err_t touch_pad_get_idle_channel_connect(touch_pad_conn_type_t *type)
|
||||||
{
|
{
|
||||||
touch_hal_get_inactive_connect(type);
|
touch_hal_get_idle_channel_connect(type);
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,11 +213,49 @@ esp_err_t touch_pad_intr_disable(touch_pad_intr_mask_t int_mask)
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t touch_pad_intr_clear(touch_pad_intr_mask_t int_mask)
|
||||||
|
{
|
||||||
|
TOUCH_INTR_MASK_CHECK(int_mask);
|
||||||
|
TOUCH_ENTER_CRITICAL();
|
||||||
|
touch_hal_intr_clear(int_mask);
|
||||||
|
TOUCH_EXIT_CRITICAL();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t touch_pad_read_intr_status_mask(void)
|
uint32_t touch_pad_read_intr_status_mask(void)
|
||||||
{
|
{
|
||||||
return touch_hal_read_intr_status_mask();
|
return touch_hal_read_intr_status_mask();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t touch_pad_timeout_set(bool enable, uint32_t threshold)
|
||||||
|
{
|
||||||
|
TOUCH_ENTER_CRITICAL();
|
||||||
|
if (enable) {
|
||||||
|
touch_hal_timeout_enable();
|
||||||
|
} else {
|
||||||
|
touch_hal_timeout_disable();
|
||||||
|
}
|
||||||
|
touch_hal_timeout_set_threshold(threshold);
|
||||||
|
TOUCH_EXIT_CRITICAL();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t touch_pad_timeout_get_threshold(uint32_t *threshold)
|
||||||
|
{
|
||||||
|
TOUCH_ENTER_CRITICAL();
|
||||||
|
touch_hal_timeout_get_threshold(threshold);
|
||||||
|
TOUCH_EXIT_CRITICAL();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t touch_pad_timeout_resume(void)
|
||||||
|
{
|
||||||
|
TOUCH_ENTER_CRITICAL();
|
||||||
|
touch_hal_timer_force_done();
|
||||||
|
TOUCH_EXIT_CRITICAL();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t touch_pad_config(touch_pad_t touch_num)
|
esp_err_t touch_pad_config(touch_pad_t touch_num)
|
||||||
{
|
{
|
||||||
TOUCH_CHANNEL_CHECK(touch_num);
|
TOUCH_CHANNEL_CHECK(touch_num);
|
||||||
|
@ -232,15 +306,28 @@ esp_err_t touch_pad_reset(void)
|
||||||
|
|
||||||
esp_err_t IRAM_ATTR touch_pad_read_raw_data(touch_pad_t touch_num, uint32_t *raw_data)
|
esp_err_t IRAM_ATTR touch_pad_read_raw_data(touch_pad_t touch_num, uint32_t *raw_data)
|
||||||
{
|
{
|
||||||
TOUCH_CHANNEL_CHECK(touch_num);
|
TOUCH_CHECK(touch_num < TOUCH_PAD_MAX && touch_num >= 0, "Touch channel error", ESP_ERR_INVALID_ARG);
|
||||||
|
TOUCH_ENTER_CRITICAL_SAFE();
|
||||||
*raw_data = touch_hal_read_raw_data(touch_num);
|
*raw_data = touch_hal_read_raw_data(touch_num);
|
||||||
|
TOUCH_EXIT_CRITICAL_SAFE();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t IRAM_ATTR touch_pad_filter_read_smooth(touch_pad_t touch_num, uint32_t *smooth_data)
|
||||||
|
{
|
||||||
|
TOUCH_CHANNEL_CHECK(touch_num);
|
||||||
|
TOUCH_ENTER_CRITICAL_SAFE();
|
||||||
|
touch_hal_filter_read_smooth(touch_num, smooth_data);
|
||||||
|
TOUCH_EXIT_CRITICAL_SAFE();
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t IRAM_ATTR touch_pad_filter_read_baseline(touch_pad_t touch_num, uint32_t *basedata)
|
esp_err_t IRAM_ATTR touch_pad_filter_read_baseline(touch_pad_t touch_num, uint32_t *basedata)
|
||||||
{
|
{
|
||||||
TOUCH_CHANNEL_CHECK(touch_num);
|
TOUCH_CHANNEL_CHECK(touch_num);
|
||||||
|
TOUCH_ENTER_CRITICAL_SAFE();
|
||||||
touch_hal_filter_read_baseline(touch_num, basedata);
|
touch_hal_filter_read_baseline(touch_num, basedata);
|
||||||
|
TOUCH_EXIT_CRITICAL_SAFE();
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,6 +350,7 @@ esp_err_t touch_pad_filter_set_config(touch_filter_config_t *filter_info)
|
||||||
TOUCH_CHECK(filter_info->noise_neg_thr <= TOUCH_NOISE_NEG_THR_MAX, TOUCH_PARAM_CHECK_STR("noise"), ESP_ERR_INVALID_ARG);
|
TOUCH_CHECK(filter_info->noise_neg_thr <= TOUCH_NOISE_NEG_THR_MAX, TOUCH_PARAM_CHECK_STR("noise"), ESP_ERR_INVALID_ARG);
|
||||||
TOUCH_CHECK(filter_info->neg_noise_limit <= TOUCH_NEG_NOISE_CNT_LIMIT, TOUCH_PARAM_CHECK_STR("noise_limit"), ESP_ERR_INVALID_ARG);
|
TOUCH_CHECK(filter_info->neg_noise_limit <= TOUCH_NEG_NOISE_CNT_LIMIT, TOUCH_PARAM_CHECK_STR("noise_limit"), ESP_ERR_INVALID_ARG);
|
||||||
TOUCH_CHECK(filter_info->jitter_step <= TOUCH_JITTER_STEP_MAX, TOUCH_PARAM_CHECK_STR("jitter_step"), ESP_ERR_INVALID_ARG);
|
TOUCH_CHECK(filter_info->jitter_step <= TOUCH_JITTER_STEP_MAX, TOUCH_PARAM_CHECK_STR("jitter_step"), ESP_ERR_INVALID_ARG);
|
||||||
|
TOUCH_CHECK(filter_info->smh_lvl < TOUCH_PAD_SMOOTH_MAX, TOUCH_PARAM_CHECK_STR("smooth level"), ESP_ERR_INVALID_ARG);
|
||||||
|
|
||||||
TOUCH_ENTER_CRITICAL();
|
TOUCH_ENTER_CRITICAL();
|
||||||
touch_hal_filter_set_config(filter_info);
|
touch_hal_filter_set_config(filter_info);
|
||||||
|
@ -379,66 +467,163 @@ esp_err_t touch_pad_waterproof_disable(void)
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t touch_pad_proximity_set_config(touch_pad_proximity_t *proximity)
|
esp_err_t touch_pad_proximity_enable(touch_pad_t touch_num, bool enabled)
|
||||||
{
|
{
|
||||||
for (int i=0; i<SOC_TOUCH_PROXIMITY_CHANNEL_NUM; i++) {
|
esp_err_t ret = ESP_OK;
|
||||||
TOUCH_CHECK(proximity->select_pad[i] < SOC_TOUCH_SENSOR_NUM, TOUCH_PARAM_CHECK_STR("pad"), ESP_ERR_INVALID_ARG);
|
TOUCH_CHECK(touch_num < TOUCH_PAD_MAX, "Touch channel error", ESP_ERR_INVALID_ARG);
|
||||||
|
|
||||||
|
TOUCH_ENTER_CRITICAL();
|
||||||
|
if (!touch_hal_enable_proximity(touch_num, enabled)) {
|
||||||
|
ret = ESP_ERR_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
TOUCH_CHECK(proximity->meas_num <= TOUCH_PROXIMITY_MEAS_NUM_MAX, TOUCH_PARAM_CHECK_STR("meas_num"), ESP_ERR_INVALID_ARG);
|
|
||||||
|
|
||||||
TOUCH_ENTER_CRITICAL();
|
|
||||||
touch_hal_proximity_set_config(proximity);
|
|
||||||
TOUCH_EXIT_CRITICAL();
|
TOUCH_EXIT_CRITICAL();
|
||||||
return ESP_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t touch_pad_proximity_get_config(touch_pad_proximity_t *proximity)
|
esp_err_t touch_pad_proximity_set_count(touch_pad_t touch_num, uint32_t count)
|
||||||
{
|
{
|
||||||
|
TOUCH_CHECK(count <= TOUCH_PROXIMITY_MEAS_NUM_MAX, TOUCH_PARAM_CHECK_STR("measure count"), ESP_ERR_INVALID_ARG);
|
||||||
|
|
||||||
TOUCH_ENTER_CRITICAL();
|
TOUCH_ENTER_CRITICAL();
|
||||||
touch_hal_proximity_get_config(proximity);
|
touch_hal_proximity_set_meas_times(count);
|
||||||
TOUCH_EXIT_CRITICAL();
|
TOUCH_EXIT_CRITICAL();
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t touch_pad_proximity_get_count(touch_pad_t touch_num, uint32_t *count)
|
||||||
|
{
|
||||||
|
TOUCH_CHECK(count != NULL, TOUCH_PARAM_CHECK_STR("measure count"), ESP_ERR_INVALID_ARG);
|
||||||
|
|
||||||
|
TOUCH_ENTER_CRITICAL_SAFE();
|
||||||
|
touch_hal_proximity_get_meas_times(count);
|
||||||
|
TOUCH_EXIT_CRITICAL_SAFE();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get measure count of proximity channel.
|
||||||
|
* The proximity sensor measurement is the accumulation of touch channel measurements.
|
||||||
|
* @param touch_num touch pad index
|
||||||
|
* @param cnt Pointer to receive proximity channel measurement count
|
||||||
|
* @return
|
||||||
|
* - ESP_OK Success
|
||||||
|
* - ESP_ERR_INVALID_ARG parameter is NULL
|
||||||
|
*/
|
||||||
esp_err_t touch_pad_proximity_read_meas_cnt(touch_pad_t touch_num, uint32_t *cnt)
|
esp_err_t touch_pad_proximity_read_meas_cnt(touch_pad_t touch_num, uint32_t *cnt)
|
||||||
{
|
{
|
||||||
TOUCH_CHECK(touch_hal_proximity_pad_check(touch_num), "touch_num is not proximity", ESP_ERR_INVALID_ARG);
|
TOUCH_CHECK(touch_hal_proximity_pad_check(touch_num), "touch num is not proximity", ESP_ERR_INVALID_ARG);
|
||||||
|
TOUCH_ENTER_CRITICAL_SAFE();
|
||||||
touch_hal_proximity_read_meas_cnt(touch_num, cnt);
|
touch_hal_proximity_read_meas_cnt(touch_num, cnt);
|
||||||
|
TOUCH_EXIT_CRITICAL_SAFE();
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t touch_pad_proximity_data_get(touch_pad_t touch_num, uint32_t *measure_out)
|
esp_err_t touch_pad_proximity_get_data(touch_pad_t touch_num, uint32_t *measure_out)
|
||||||
{
|
{
|
||||||
TOUCH_CHECK(touch_hal_proximity_pad_check(touch_num), "touch_num is not proximity", ESP_ERR_INVALID_ARG);
|
TOUCH_CHECK(touch_hal_proximity_pad_check(touch_num), "touch num is not proximity", ESP_ERR_INVALID_ARG);
|
||||||
|
TOUCH_ENTER_CRITICAL_SAFE();
|
||||||
touch_hal_filter_read_baseline(touch_num, measure_out);
|
touch_hal_filter_read_baseline(touch_num, measure_out);
|
||||||
|
TOUCH_EXIT_CRITICAL_SAFE();
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************** sleep pad setting ***********************/
|
/************** sleep pad setting ***********************/
|
||||||
|
|
||||||
esp_err_t touch_pad_sleep_channel_config(touch_pad_sleep_channel_t *slp_config)
|
esp_err_t touch_pad_sleep_channel_get_info(touch_pad_sleep_channel_t *slp_config)
|
||||||
{
|
{
|
||||||
TOUCH_CHECK(slp_config->touch_num < SOC_TOUCH_SENSOR_NUM, TOUCH_PARAM_CHECK_STR("pad"), ESP_ERR_INVALID_ARG);
|
TOUCH_ENTER_CRITICAL_SAFE();
|
||||||
|
touch_hal_sleep_channel_get_config(slp_config);
|
||||||
|
TOUCH_EXIT_CRITICAL_SAFE();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t touch_pad_sleep_channel_enable(touch_pad_t pad_num, bool enable)
|
||||||
|
{
|
||||||
|
TOUCH_CHANNEL_CHECK(pad_num);
|
||||||
|
|
||||||
TOUCH_ENTER_CRITICAL();
|
TOUCH_ENTER_CRITICAL();
|
||||||
touch_hal_sleep_channel_config(slp_config);
|
touch_hal_sleep_channel_enable(pad_num, enable);
|
||||||
TOUCH_EXIT_CRITICAL();
|
TOUCH_EXIT_CRITICAL();
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t touch_pad_sleep_channel_read_baseline(uint32_t *baseline)
|
esp_err_t touch_pad_sleep_channel_enable_proximity(touch_pad_t pad_num, bool enable)
|
||||||
{
|
{
|
||||||
touch_hal_sleep_read_baseline(baseline);
|
TOUCH_CHANNEL_CHECK(pad_num);
|
||||||
|
|
||||||
|
TOUCH_ENTER_CRITICAL();
|
||||||
|
if (enable) {
|
||||||
|
touch_hal_sleep_enable_approach();
|
||||||
|
} else {
|
||||||
|
touch_hal_sleep_disable_approach();
|
||||||
|
}
|
||||||
|
TOUCH_EXIT_CRITICAL();
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t touch_pad_sleep_channel_read_debounce(uint32_t *debounce)
|
esp_err_t touch_pad_sleep_get_channel_num(touch_pad_t *pad_num)
|
||||||
|
{
|
||||||
|
TOUCH_ENTER_CRITICAL();
|
||||||
|
touch_hal_sleep_get_channel_num(pad_num);
|
||||||
|
TOUCH_EXIT_CRITICAL();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t touch_pad_sleep_set_threshold(touch_pad_t pad_num, uint32_t touch_thres)
|
||||||
|
{
|
||||||
|
TOUCH_ENTER_CRITICAL();
|
||||||
|
touch_hal_sleep_set_threshold(touch_thres);
|
||||||
|
TOUCH_EXIT_CRITICAL();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t touch_pad_sleep_get_threshold(touch_pad_t pad_num, uint32_t *touch_thres)
|
||||||
|
{
|
||||||
|
TOUCH_ENTER_CRITICAL();
|
||||||
|
touch_hal_sleep_get_threshold(touch_thres);
|
||||||
|
TOUCH_EXIT_CRITICAL();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t touch_pad_sleep_channel_read_baseline(touch_pad_t pad_num, uint32_t *baseline)
|
||||||
|
{
|
||||||
|
TOUCH_ENTER_CRITICAL_SAFE();
|
||||||
|
touch_hal_sleep_read_baseline(baseline);
|
||||||
|
TOUCH_EXIT_CRITICAL_SAFE();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t touch_pad_sleep_channel_read_smooth(touch_pad_t pad_num, uint32_t *smooth_data)
|
||||||
|
{
|
||||||
|
TOUCH_ENTER_CRITICAL_SAFE();
|
||||||
|
touch_hal_sleep_read_smooth(smooth_data);
|
||||||
|
TOUCH_EXIT_CRITICAL_SAFE();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t touch_pad_sleep_channel_read_data(touch_pad_t pad_num, uint32_t *raw_data)
|
||||||
|
{
|
||||||
|
TOUCH_ENTER_CRITICAL_SAFE();
|
||||||
|
touch_hal_sleep_read_data(raw_data);
|
||||||
|
TOUCH_EXIT_CRITICAL_SAFE();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t touch_pad_sleep_channel_reset_baseline(void)
|
||||||
|
{
|
||||||
|
TOUCH_ENTER_CRITICAL();
|
||||||
|
touch_hal_sleep_reset_baseline();
|
||||||
|
TOUCH_EXIT_CRITICAL();
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t touch_pad_sleep_channel_read_debounce(touch_pad_t pad_num, uint32_t *debounce)
|
||||||
{
|
{
|
||||||
touch_hal_sleep_read_debounce(debounce);
|
touch_hal_sleep_read_debounce(debounce);
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t touch_pad_sleep_channel_read_proximity_cnt(uint32_t *approach_cnt)
|
esp_err_t touch_pad_sleep_channel_read_proximity_cnt(touch_pad_t pad_num, uint32_t *approach_cnt)
|
||||||
{
|
{
|
||||||
touch_hal_sleep_read_proximity_cnt(approach_cnt);
|
touch_hal_sleep_read_proximity_cnt(approach_cnt);
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
|
|
@ -14,4 +14,4 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "touch_sensor_common.h"
|
#include "touch_sensor.h"
|
|
@ -16,9 +16,7 @@
|
||||||
|
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_intr_alloc.h"
|
#include "esp_intr_alloc.h"
|
||||||
#include "soc/touch_sensor_periph.h"
|
|
||||||
#include "hal/touch_sensor_types.h"
|
#include "hal/touch_sensor_types.h"
|
||||||
#include "touch_sensor.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -141,22 +139,32 @@ esp_err_t touch_pad_get_fsm_mode(touch_fsm_mode_t *mode);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief To clear the touch status register, usually use this function in touch ISR to clear status.
|
* @brief To clear the touch sensor channel active status.
|
||||||
*
|
*
|
||||||
* @note Generally no manual removal is required.
|
* @note The FSM automatically updates the touch sensor status. It is generally not necessary to call this API to clear the status.
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
*/
|
*/
|
||||||
esp_err_t touch_pad_clear_status(void);
|
esp_err_t touch_pad_clear_status(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the touch sensor status, usually used in ISR to decide which pads are 'touched'.
|
* @brief Get the touch sensor channel active status mask.
|
||||||
|
* The bit position represents the channel number. The 0/1 status of the bit represents the trigger status.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* - The touch sensor status. e.g. Touch1 trigger status is `status_mask & (BIT1)`.
|
* - The touch sensor status. e.g. Touch1 trigger status is `status_mask & (BIT1)`.
|
||||||
*/
|
*/
|
||||||
uint32_t touch_pad_get_status(void);
|
uint32_t touch_pad_get_status(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check touch sensor measurement status.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - True measurement is under way
|
||||||
|
* - False measurement done
|
||||||
|
*/
|
||||||
|
bool touch_pad_meas_is_done(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -1,3 +1,3 @@
|
||||||
idf_component_register(SRC_DIRS . param_test
|
idf_component_register(SRC_DIRS . param_test touch_sensor_test
|
||||||
PRIV_INCLUDE_DIRS include param_test/include
|
PRIV_INCLUDE_DIRS include param_test/include
|
||||||
PRIV_REQUIRES unity test_utils driver nvs_flash esp_serial_slave_link infrared_tools)
|
PRIV_REQUIRES unity test_utils driver nvs_flash esp_serial_slave_link infrared_tools)
|
||||||
|
|
376
components/driver/test/touch_sensor_test/test_esp32.c
Normal file
376
components/driver/test/touch_sensor_test/test_esp32.c
Normal file
|
@ -0,0 +1,376 @@
|
||||||
|
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
/*
|
||||||
|
Tests for the touch sensor device driver
|
||||||
|
*/
|
||||||
|
#include "esp_system.h"
|
||||||
|
#include "driver/touch_pad.h"
|
||||||
|
#include "unity.h"
|
||||||
|
#include "esp_system.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "freertos/task.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include "nvs_flash.h"
|
||||||
|
#include "test_utils.h"
|
||||||
|
#include "soc/rtc_cntl_reg.h"
|
||||||
|
#include "soc/rtc_cntl_struct.h"
|
||||||
|
#include "soc/sens_reg.h"
|
||||||
|
#include "soc/sens_struct.h"
|
||||||
|
#include "soc/rtc_cntl_reg.h"
|
||||||
|
#include "soc/rtc_cntl_struct.h"
|
||||||
|
#include "soc/rtc_io_reg.h"
|
||||||
|
#include "soc/rtc_io_struct.h"
|
||||||
|
|
||||||
|
#if !DISABLED_FOR_TARGETS(ESP8266, ESP32S2) // This testcase for ESP32
|
||||||
|
|
||||||
|
static const char *TAG = "test_touch";
|
||||||
|
|
||||||
|
#define TOUCH_READ_INVALID_VAL (0)
|
||||||
|
#define TOUCHPAD_FILTER_TOUCH_PERIOD (10)
|
||||||
|
|
||||||
|
#define TOUCH_REG_BASE_TEST() ({ \
|
||||||
|
TEST_ASSERT_EQUAL_UINT32(RTC_CNTL_BROWN_OUT_REG, &RTCCNTL.brown_out.val); \
|
||||||
|
TEST_ASSERT_EQUAL_UINT32(REG_GET_FIELD(SENS_SARDATE_REG, SENS_SAR_DATE), SENS.sardate.sar_date); \
|
||||||
|
TEST_ASSERT_EQUAL_UINT32(REG_GET_FIELD(RTC_IO_DATE_REG, RTC_IO_IO_DATE), RTCIO.date.date); \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define TOUCH_READ_ERROR (100)
|
||||||
|
#define TEST_TOUCH_COUNT_NUM (10)
|
||||||
|
#define TEST_TOUCH_CHANNEL (3)
|
||||||
|
static touch_pad_t touch_list[TEST_TOUCH_CHANNEL] = {
|
||||||
|
// TOUCH_PAD_NUM0,
|
||||||
|
// TOUCH_PAD_NUM1 is GPIO0, for download.
|
||||||
|
// TOUCH_PAD_NUM2,
|
||||||
|
// TOUCH_PAD_NUM3,
|
||||||
|
// TOUCH_PAD_NUM4,
|
||||||
|
// TOUCH_PAD_NUM5,
|
||||||
|
// TOUCH_PAD_NUM6,
|
||||||
|
TOUCH_PAD_NUM7,
|
||||||
|
TOUCH_PAD_NUM8,
|
||||||
|
TOUCH_PAD_NUM9,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void printf_touch_hw_read(const char *str)
|
||||||
|
{
|
||||||
|
uint16_t touch_value;
|
||||||
|
printf("[%s] ", str);
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
while (!touch_pad_meas_is_done()) ;
|
||||||
|
touch_pad_read_raw_data(touch_list[i], &touch_value);
|
||||||
|
printf("[%d]%d ", touch_list[i], touch_value);
|
||||||
|
}
|
||||||
|
printf("\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Change the slope to get larger value from touch sensor.
|
||||||
|
*/
|
||||||
|
static void test_press_fake(touch_pad_t pad_num)
|
||||||
|
{
|
||||||
|
touch_pad_set_cnt_mode(pad_num, TOUCH_PAD_SLOPE_2, TOUCH_PAD_TIE_OPT_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Change the slope to get smaller value from touch sensor.
|
||||||
|
*/
|
||||||
|
static void test_release_fake(touch_pad_t pad_num)
|
||||||
|
{
|
||||||
|
touch_pad_set_cnt_mode(pad_num, TOUCH_PAD_SLOPE_7, TOUCH_PAD_TIE_OPT_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static esp_err_t test_touch_sw_read_test_runner(void)
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "%s", __func__);
|
||||||
|
uint16_t touch_value;
|
||||||
|
|
||||||
|
TEST_ESP_OK( touch_pad_init() );
|
||||||
|
TEST_ESP_OK( touch_pad_set_fsm_mode(TOUCH_FSM_MODE_SW) );
|
||||||
|
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
TEST_ESP_OK( touch_pad_config(touch_list[i], TOUCH_READ_INVALID_VAL) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start task to read values sensed by pads
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
printf("test T%d\n", touch_list[i]);
|
||||||
|
touch_pad_read(touch_list[i], &touch_value);
|
||||||
|
printf("T%d:[%4d] ", touch_list[i], touch_value);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
TEST_ESP_OK( touch_pad_deinit() );
|
||||||
|
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static esp_err_t test_touch_sw_read(void)
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "%s", __func__);
|
||||||
|
uint16_t touch_value;
|
||||||
|
|
||||||
|
TEST_ESP_OK( touch_pad_init() );
|
||||||
|
TEST_ESP_OK( touch_pad_set_fsm_mode(TOUCH_FSM_MODE_SW) );
|
||||||
|
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
TEST_ESP_OK( touch_pad_config(touch_list[i], TOUCH_READ_INVALID_VAL) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start task to read values sensed by pads
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
printf("test T%d\n", touch_list[i]);
|
||||||
|
TEST_ESP_OK( touch_pad_read(touch_list[i], &touch_value) );
|
||||||
|
printf("T%d:[%4d] ", touch_list[i], touch_value);
|
||||||
|
TEST_ASSERT_NOT_EQUAL(TOUCH_READ_INVALID_VAL, touch_value);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
TEST_ESP_OK( touch_pad_deinit() );
|
||||||
|
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static esp_err_t test_touch_timer_read(void)
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "%s", __func__);
|
||||||
|
uint16_t touch_value[TEST_TOUCH_CHANNEL], touch_temp[TEST_TOUCH_CHANNEL];
|
||||||
|
int t_cnt = TEST_TOUCH_COUNT_NUM;
|
||||||
|
|
||||||
|
TEST_ESP_OK( touch_pad_init() );
|
||||||
|
TEST_ESP_OK( touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER) );
|
||||||
|
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
TEST_ESP_OK( touch_pad_config(touch_list[i], TOUCH_READ_INVALID_VAL) );
|
||||||
|
}
|
||||||
|
// Start task to read values sensed by pads
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
TEST_ESP_OK( touch_pad_read(touch_list[i], &touch_value[i]) );
|
||||||
|
printf("T%d:[%4d] ", touch_list[i], touch_value[i]);
|
||||||
|
TEST_ASSERT_NOT_EQUAL(TOUCH_READ_INVALID_VAL, touch_value[i]);
|
||||||
|
}
|
||||||
|
while (t_cnt--) {
|
||||||
|
// Start task to read values sensed by pads
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
TEST_ESP_OK( touch_pad_read(touch_list[i], &touch_temp[i]) );
|
||||||
|
TEST_ASSERT_NOT_EQUAL(TOUCH_READ_INVALID_VAL, touch_temp[i]);
|
||||||
|
TEST_ASSERT_UINT32_WITHIN(TOUCH_READ_ERROR, touch_temp[i], touch_value[i]);
|
||||||
|
}
|
||||||
|
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_ESP_OK( touch_pad_deinit() );
|
||||||
|
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static esp_err_t test_touch_filtered_read(void)
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "%s", __func__);
|
||||||
|
uint16_t touch_value, touch_temp;
|
||||||
|
int t_cnt = TEST_TOUCH_COUNT_NUM;
|
||||||
|
|
||||||
|
TEST_ESP_OK( touch_pad_init() );
|
||||||
|
TEST_ESP_OK( touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER) );
|
||||||
|
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
TEST_ESP_OK( touch_pad_config(touch_list[i], TOUCH_READ_INVALID_VAL) );
|
||||||
|
}
|
||||||
|
// Initialize and start a software filter to detect slight change of capacitance.
|
||||||
|
touch_pad_filter_start(TOUCHPAD_FILTER_TOUCH_PERIOD);
|
||||||
|
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||||
|
|
||||||
|
while (t_cnt--) {
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
TEST_ESP_OK( touch_pad_read(touch_list[i], &touch_value) );
|
||||||
|
TEST_ASSERT_NOT_EQUAL(TOUCH_READ_INVALID_VAL, touch_value);
|
||||||
|
TEST_ESP_OK( touch_pad_read_raw_data(touch_list[i], &touch_value) );
|
||||||
|
TEST_ASSERT_NOT_EQUAL(TOUCH_READ_INVALID_VAL, touch_value);
|
||||||
|
TEST_ESP_OK( touch_pad_read_filtered(touch_list[i], &touch_temp) );
|
||||||
|
TEST_ASSERT_NOT_EQUAL(TOUCH_READ_INVALID_VAL, touch_temp);
|
||||||
|
TEST_ASSERT_UINT32_WITHIN(TOUCH_READ_ERROR, touch_temp, touch_value);
|
||||||
|
printf("T%d:[%4d] ", touch_list[i], touch_value);
|
||||||
|
}
|
||||||
|
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
TEST_ESP_OK( touch_pad_deinit() );
|
||||||
|
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// test the basic configuration function with right parameters and error parameters
|
||||||
|
TEST_CASE("Touch Sensor all channel read test", "[touch]")
|
||||||
|
{
|
||||||
|
TOUCH_REG_BASE_TEST();
|
||||||
|
test_touch_sw_read_test_runner();
|
||||||
|
TEST_ESP_OK( test_touch_sw_read() );
|
||||||
|
TEST_ESP_OK( test_touch_timer_read() );
|
||||||
|
TEST_ESP_OK( test_touch_filtered_read() );
|
||||||
|
}
|
||||||
|
|
||||||
|
static int test_touch_parameter(touch_pad_t pad_num, int meas_time, int slp_time, int vol_h, int vol_l, int vol_a, int slope)
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "%s", __func__);
|
||||||
|
uint16_t touch_value;
|
||||||
|
TEST_ESP_OK( touch_pad_init() );
|
||||||
|
TEST_ESP_OK( touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER) );
|
||||||
|
TEST_ESP_OK( touch_pad_config(pad_num, TOUCH_READ_INVALID_VAL) );
|
||||||
|
|
||||||
|
touch_pad_set_meas_time(slp_time, meas_time);
|
||||||
|
touch_pad_set_voltage(vol_h, vol_l, vol_a);
|
||||||
|
touch_pad_set_cnt_mode(pad_num, slope, TOUCH_PAD_TIE_OPT_DEFAULT);
|
||||||
|
|
||||||
|
// Initialize and start a software filter to detect slight change of capacitance.
|
||||||
|
touch_pad_filter_start(TOUCHPAD_FILTER_TOUCH_PERIOD);
|
||||||
|
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||||
|
|
||||||
|
// Start task to read values sensed by pads
|
||||||
|
TEST_ESP_OK( touch_pad_read(pad_num, &touch_value) );
|
||||||
|
TEST_ASSERT_NOT_EQUAL(TOUCH_READ_INVALID_VAL, touch_value);
|
||||||
|
printf("T%d:[%4d] ", pad_num, touch_value);
|
||||||
|
TEST_ESP_OK( touch_pad_read_raw_data(pad_num, &touch_value) );
|
||||||
|
TEST_ASSERT_NOT_EQUAL(TOUCH_READ_INVALID_VAL, touch_value);
|
||||||
|
printf("T%d:[%4d] ", pad_num, touch_value);
|
||||||
|
TEST_ESP_OK( touch_pad_read_filtered(pad_num, &touch_value) );
|
||||||
|
TEST_ASSERT_NOT_EQUAL(TOUCH_READ_INVALID_VAL, touch_value);
|
||||||
|
printf("T%d:[%4d] \n", pad_num, touch_value);
|
||||||
|
|
||||||
|
TEST_ESP_OK( touch_pad_deinit() );
|
||||||
|
|
||||||
|
return touch_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Touch Sensor parameters test", "[touch]")
|
||||||
|
{
|
||||||
|
int touch_val[5] = {0};
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "Charge / incharge voltage level test");
|
||||||
|
touch_val[0] = test_touch_parameter(touch_list[2], TOUCH_PAD_MEASURE_CYCLE_DEFAULT, TOUCH_PAD_SLEEP_CYCLE_DEFAULT,
|
||||||
|
TOUCH_HVOLT_2V7, TOUCH_LVOLT_0V5, TOUCH_HVOLT_ATTEN_0V,
|
||||||
|
TOUCH_PAD_SLOPE_DEFAULT);
|
||||||
|
touch_val[1] = test_touch_parameter(touch_list[2], TOUCH_PAD_MEASURE_CYCLE_DEFAULT, TOUCH_PAD_SLEEP_CYCLE_DEFAULT,
|
||||||
|
TOUCH_HVOLT_2V5, TOUCH_LVOLT_0V6, TOUCH_HVOLT_ATTEN_1V,
|
||||||
|
TOUCH_PAD_SLOPE_DEFAULT);
|
||||||
|
touch_val[2] = test_touch_parameter(touch_list[0], TOUCH_PAD_MEASURE_CYCLE_DEFAULT, TOUCH_PAD_SLEEP_CYCLE_DEFAULT,
|
||||||
|
TOUCH_HVOLT_2V4, TOUCH_LVOLT_0V8, TOUCH_HVOLT_ATTEN_1V5,
|
||||||
|
TOUCH_PAD_SLOPE_DEFAULT);
|
||||||
|
|
||||||
|
TEST_ASSERT_GREATER_OR_EQUAL(touch_val[0], touch_val[1]);
|
||||||
|
TEST_ASSERT_GREATER_OR_EQUAL(touch_val[1], touch_val[2]);
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "Measure time / sleep time test");
|
||||||
|
touch_val[0] = test_touch_parameter(touch_list[0], 0xff, 0xa,
|
||||||
|
TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD, TOUCH_PAD_LOW_VOLTAGE_THRESHOLD, TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD, TOUCH_PAD_SLOPE_DEFAULT);
|
||||||
|
touch_val[1] = test_touch_parameter(touch_list[0], 0x1ff, 0xf,
|
||||||
|
TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD, TOUCH_PAD_LOW_VOLTAGE_THRESHOLD, TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD, TOUCH_PAD_SLOPE_DEFAULT);
|
||||||
|
touch_val[2] = test_touch_parameter(touch_list[0], 0x2fff, 0x1f,
|
||||||
|
TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD, TOUCH_PAD_LOW_VOLTAGE_THRESHOLD, TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD, TOUCH_PAD_SLOPE_DEFAULT);
|
||||||
|
|
||||||
|
TEST_ASSERT_GREATER_OR_EQUAL(touch_val[0], touch_val[1]);
|
||||||
|
TEST_ASSERT_GREATER_OR_EQUAL(touch_val[1], touch_val[2]);
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "Charge / incharge slope level test");
|
||||||
|
touch_val[0] = test_touch_parameter(touch_list[1], TOUCH_PAD_MEASURE_CYCLE_DEFAULT, TOUCH_PAD_SLEEP_CYCLE_DEFAULT,
|
||||||
|
TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD, TOUCH_PAD_LOW_VOLTAGE_THRESHOLD, TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD, 1);
|
||||||
|
touch_val[1] = test_touch_parameter(touch_list[1], TOUCH_PAD_MEASURE_CYCLE_DEFAULT, TOUCH_PAD_SLEEP_CYCLE_DEFAULT,
|
||||||
|
TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD, TOUCH_PAD_LOW_VOLTAGE_THRESHOLD, TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD, 3);
|
||||||
|
touch_val[2] = test_touch_parameter(touch_list[1], TOUCH_PAD_MEASURE_CYCLE_DEFAULT, TOUCH_PAD_SLEEP_CYCLE_DEFAULT,
|
||||||
|
TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD, TOUCH_PAD_LOW_VOLTAGE_THRESHOLD, TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD, 7);
|
||||||
|
|
||||||
|
TEST_ASSERT_GREATER_OR_EQUAL(touch_val[0], touch_val[1]);
|
||||||
|
TEST_ASSERT_GREATER_OR_EQUAL(touch_val[1], touch_val[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool s_pad_activated[TOUCH_PAD_MAX];
|
||||||
|
|
||||||
|
static void test_touch_intr_cb(void *arg)
|
||||||
|
{
|
||||||
|
uint32_t pad_intr = touch_pad_get_status();
|
||||||
|
ets_printf("T%x ", pad_intr);
|
||||||
|
//clear interrupt
|
||||||
|
touch_pad_clear_status();
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
if ((pad_intr >> touch_list[i]) & 0x1) {
|
||||||
|
s_pad_activated[touch_list[i]] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static esp_err_t test_touch_interrupt(void)
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "%s", __func__);
|
||||||
|
uint16_t touch_value;
|
||||||
|
|
||||||
|
TEST_ESP_OK( touch_pad_init() );
|
||||||
|
TEST_ESP_OK( touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER) );
|
||||||
|
touch_pad_set_voltage(TOUCH_HVOLT_2V7, TOUCH_LVOLT_0V5, TOUCH_HVOLT_ATTEN_1V);
|
||||||
|
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
TEST_ESP_OK( touch_pad_config(touch_list[i], TOUCH_READ_INVALID_VAL) );
|
||||||
|
}
|
||||||
|
// Initialize and start a software filter to detect slight change of capacitance.
|
||||||
|
touch_pad_filter_start(TOUCHPAD_FILTER_TOUCH_PERIOD);
|
||||||
|
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||||
|
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
//read filtered value
|
||||||
|
TEST_ESP_OK( touch_pad_read_filtered(touch_list[i], &touch_value) );
|
||||||
|
ESP_LOGI(TAG, "test init: touch pad [%d] val is %d", touch_list[i], touch_value);
|
||||||
|
//set interrupt threshold.
|
||||||
|
TEST_ESP_OK( touch_pad_set_thresh(touch_list[i], touch_value * 2 / 3) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register touch interrupt ISR
|
||||||
|
TEST_ESP_OK( touch_pad_isr_register(test_touch_intr_cb, NULL) );
|
||||||
|
TEST_ESP_OK( touch_pad_clear_status() );
|
||||||
|
TEST_ESP_OK( touch_pad_intr_enable() );
|
||||||
|
|
||||||
|
int test_cnt = TEST_TOUCH_COUNT_NUM;
|
||||||
|
while (test_cnt--) {
|
||||||
|
ESP_LOGI(TAG, "touch push");
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
test_press_fake(touch_list[i]);
|
||||||
|
}
|
||||||
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
|
printf_touch_hw_read("push");
|
||||||
|
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
if (s_pad_activated[touch_list[i]] == false) {
|
||||||
|
ESP_LOGE(TAG, "touch%d not active", touch_list[i]);
|
||||||
|
TEST_FAIL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
s_pad_activated[touch_list[i]] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "touch release");
|
||||||
|
for (int i = 0; i < TEST_TOUCH_CHANNEL; i++) {
|
||||||
|
test_release_fake(touch_list[i]);
|
||||||
|
}
|
||||||
|
printf_touch_hw_read("release");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_ESP_OK( touch_pad_deinit() );
|
||||||
|
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Touch Sensor interrupt test", "[touch]")
|
||||||
|
{
|
||||||
|
TEST_ESP_OK( test_touch_interrupt() );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !DISABLED_FOR_TARGETS(ESP8266, ESP32)
|
2174
components/driver/test/touch_sensor_test/test_esp32s2.c
Normal file
2174
components/driver/test/touch_sensor_test/test_esp32s2.c
Normal file
File diff suppressed because it is too large
Load diff
196
components/driver/test/touch_sensor_test/touch_scope.c
Normal file
196
components/driver/test/touch_sensor_test/touch_scope.c
Normal file
|
@ -0,0 +1,196 @@
|
||||||
|
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "esp_err.h"
|
||||||
|
#include "driver/uart.h"
|
||||||
|
#include "esp32s2/rom/uart.h"
|
||||||
|
|
||||||
|
#define ROM_UART_DRIVER_ENABLE 0
|
||||||
|
|
||||||
|
#if ROM_UART_DRIVER_ENABLE
|
||||||
|
static uint8_t scope_uart_num = 0;
|
||||||
|
static int8_t uart_used = 0;
|
||||||
|
#else
|
||||||
|
static uint8_t scope_uart_num = 255;
|
||||||
|
static int8_t uart_used = -1;
|
||||||
|
#endif
|
||||||
|
static int scope_tx_io_num = 0;
|
||||||
|
static int scope_rx_io_num = 0;
|
||||||
|
static int scope_debug_baud_rate = 256000;
|
||||||
|
static unsigned char datascope_output_buffer[42] = {0}; // Data buff.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Translate a float data to four unsigned char data for uart TX.
|
||||||
|
* @param target target float data address.
|
||||||
|
* @param buf save translated data.
|
||||||
|
* @param offset the start position in buf.
|
||||||
|
* @return
|
||||||
|
* - void
|
||||||
|
*/
|
||||||
|
static void float_to_byte(float *target, unsigned char *buf, unsigned char offset)
|
||||||
|
{
|
||||||
|
memcpy(buf + offset, (uint8_t*)target, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add data to channel buff.
|
||||||
|
* @param Data target data.
|
||||||
|
* @param Channel target channel (1 - 10).
|
||||||
|
* @return
|
||||||
|
* - void
|
||||||
|
*/
|
||||||
|
static void datascope_get_channel_data(float data, unsigned char channel)
|
||||||
|
{
|
||||||
|
if ( (channel > 10) || (channel == 0) ) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
switch (channel) {
|
||||||
|
case 1: float_to_byte(&data,datascope_output_buffer, channel*4-3); break;
|
||||||
|
case 2: float_to_byte(&data,datascope_output_buffer, channel*4-3); break;
|
||||||
|
case 3: float_to_byte(&data,datascope_output_buffer, channel*4-3); break;
|
||||||
|
case 4: float_to_byte(&data,datascope_output_buffer, channel*4-3); break;
|
||||||
|
case 5: float_to_byte(&data,datascope_output_buffer, channel*4-3); break;
|
||||||
|
case 6: float_to_byte(&data,datascope_output_buffer, channel*4-3); break;
|
||||||
|
case 7: float_to_byte(&data,datascope_output_buffer, channel*4-3); break;
|
||||||
|
case 8: float_to_byte(&data,datascope_output_buffer, channel*4-3); break;
|
||||||
|
case 9: float_to_byte(&data,datascope_output_buffer, channel*4-3); break;
|
||||||
|
case 10: float_to_byte(&data,datascope_output_buffer, channel*4-3); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Transform float data to DataScopeV1.0 data format.
|
||||||
|
* @param channel_num the number of channel that wait to be translated.
|
||||||
|
* @return
|
||||||
|
* - The number of the UART TX data.
|
||||||
|
*/
|
||||||
|
static unsigned char datascope_data_generate(unsigned char channel_num)
|
||||||
|
{
|
||||||
|
if ( (channel_num > 10) || (channel_num == 0) ) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
datascope_output_buffer[0] = '$'; //frame header
|
||||||
|
switch(channel_num) {
|
||||||
|
case 1: datascope_output_buffer[channel_num*4+1] = channel_num*4+1; return channel_num*4+2; break;
|
||||||
|
case 2: datascope_output_buffer[channel_num*4+1] = channel_num*4+1; return channel_num*4+2; break;
|
||||||
|
case 3: datascope_output_buffer[channel_num*4+1] = channel_num*4+1; return channel_num*4+2; break;
|
||||||
|
case 4: datascope_output_buffer[channel_num*4+1] = channel_num*4+1; return channel_num*4+2; break;
|
||||||
|
case 5: datascope_output_buffer[channel_num*4+1] = channel_num*4+1; return channel_num*4+2; break;
|
||||||
|
case 6: datascope_output_buffer[channel_num*4+1] = channel_num*4+1; return channel_num*4+2; break;
|
||||||
|
case 7: datascope_output_buffer[channel_num*4+1] = channel_num*4+1; return channel_num*4+2; break;
|
||||||
|
case 8: datascope_output_buffer[channel_num*4+1] = channel_num*4+1; return channel_num*4+2; break;
|
||||||
|
case 9: datascope_output_buffer[channel_num*4+1] = channel_num*4+1; return channel_num*4+2; break;
|
||||||
|
case 10: datascope_output_buffer[channel_num*4+1] = channel_num*4+1; return channel_num*4+2; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Send touch sensor data to HMI in PC via UART.
|
||||||
|
* @param uart_num Choose uart port (0, 1).
|
||||||
|
* @param data The addr of the touch sensor data.
|
||||||
|
* @param channel_num The number of channel that wait to be translated.
|
||||||
|
* @return
|
||||||
|
* - ESP_FAIL Error
|
||||||
|
* - The number of the UART TX data.
|
||||||
|
*/
|
||||||
|
int test_tp_print_to_scope(float *data, unsigned char channel_num)
|
||||||
|
{
|
||||||
|
uint8_t uart_num = scope_uart_num;
|
||||||
|
|
||||||
|
if (uart_num >= UART_NUM_MAX) {
|
||||||
|
return ESP_FAIL;
|
||||||
|
}
|
||||||
|
if ( (channel_num > 10) || (channel_num == 0) || (NULL == data) ) {
|
||||||
|
return ESP_FAIL;
|
||||||
|
}
|
||||||
|
for(uint8_t i = 0 ; i < channel_num; i++) {
|
||||||
|
datascope_get_channel_data(data[i] , i+1); // write data x into channel 1~10.
|
||||||
|
}
|
||||||
|
unsigned char out_len = datascope_data_generate(channel_num); // Generate n number data.
|
||||||
|
unsigned char *out_data = datascope_output_buffer;
|
||||||
|
// Init uart.
|
||||||
|
if(uart_num != uart_used) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
#if ROM_UART_DRIVER_ENABLE
|
||||||
|
uart_tx_wait_idle(uart_num); // Default print uart mumber is 0.
|
||||||
|
for(int i=0; i<out_len; i++) {
|
||||||
|
uart_tx_one_char(out_data[i]);
|
||||||
|
}
|
||||||
|
return out_len;
|
||||||
|
#else
|
||||||
|
uart_wait_tx_done(uart_num, portMAX_DELAY);
|
||||||
|
return uart_write_bytes(uart_num, (const char *)out_data, out_len);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable scope debug function. Print the touch sensor raw data to "DataScope" tool via UART.
|
||||||
|
* "DataScope" tool is touch sensor tune tool. User can monitor the data of each touch channel,
|
||||||
|
* evaluate the touch system's touch performance (sensitivity, SNR, stability, channel coupling)
|
||||||
|
* and determine the threshold for each channel.
|
||||||
|
*
|
||||||
|
* @attention 1. Choose a UART port that will only be used for scope debug.
|
||||||
|
* @attention 2. Use this feature only during the testing phase.
|
||||||
|
* @attention 3. "DataScope" tool can be downloaded from Espressif's official website.
|
||||||
|
*
|
||||||
|
* @param uart_num The uart port to send touch sensor raw data.
|
||||||
|
* @param tx_io_num set UART TXD IO.
|
||||||
|
* @param rx_io_num set UART RXD IO.
|
||||||
|
* @param baud_rate set debug port baud rate.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK: succeed
|
||||||
|
* - ESP_FAIL: the param uart_num is error
|
||||||
|
*/
|
||||||
|
esp_err_t test_tp_scope_debug_init(uint8_t uart_num, int tx_io_num, int rx_io_num, int baud_rate)
|
||||||
|
{
|
||||||
|
#if ROM_UART_DRIVER_ENABLE
|
||||||
|
uart_tx_wait_idle(0); // Default print uart mumber is 0.
|
||||||
|
if(uart_num != 0) {
|
||||||
|
uart_tx_switch(uart_num);
|
||||||
|
// uart_div_modify(uart_num, baud_rate); //DivLatchValue : (clock << 4)/baudrate.
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if(uart_used == uart_num) {
|
||||||
|
return ESP_FAIL;
|
||||||
|
}
|
||||||
|
if (uart_num >= UART_NUM_MAX) {
|
||||||
|
return ESP_FAIL;
|
||||||
|
}
|
||||||
|
scope_uart_num = uart_num;
|
||||||
|
scope_tx_io_num = tx_io_num;
|
||||||
|
scope_rx_io_num = rx_io_num;
|
||||||
|
scope_debug_baud_rate = baud_rate;
|
||||||
|
uart_config_t uart_config = {
|
||||||
|
.baud_rate = scope_debug_baud_rate,
|
||||||
|
.data_bits = UART_DATA_8_BITS,
|
||||||
|
.parity = UART_PARITY_DISABLE,
|
||||||
|
.stop_bits = UART_STOP_BITS_1,
|
||||||
|
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
|
||||||
|
};
|
||||||
|
uart_param_config(uart_num, &uart_config);
|
||||||
|
// Set UART pins using UART0 default pins i.e. no changes
|
||||||
|
uart_set_pin(uart_num, scope_tx_io_num, scope_rx_io_num,
|
||||||
|
UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
|
||||||
|
uart_driver_install(uart_num, 1024, 2048, 0, NULL, 0);
|
||||||
|
uart_used = uart_num;
|
||||||
|
#endif
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
31
components/driver/test/touch_sensor_test/touch_scope.h
Normal file
31
components/driver/test/touch_sensor_test/touch_scope.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Send data info to digital scope.
|
||||||
|
* @param data Pointer to send buff.
|
||||||
|
* @param channel_num The number of channels to be displayed.
|
||||||
|
* @return the length of successfully transmitted data.
|
||||||
|
*/
|
||||||
|
int test_tp_print_to_scope(float *data, unsigned char channel_num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize the UART so that the touch sensor data is output to the digital scope.
|
||||||
|
* @return
|
||||||
|
* - ESP_OK Success
|
||||||
|
* - ESP_FAIL UART error
|
||||||
|
*/
|
||||||
|
esp_err_t test_tp_scope_debug_init(uint8_t uart_num, int tx_io_num, int rx_io_num, int baud_rate);
|
|
@ -96,6 +96,7 @@ static uint32_t get_power_down_flags(void);
|
||||||
static void ext0_wakeup_prepare(void);
|
static void ext0_wakeup_prepare(void);
|
||||||
static void ext1_wakeup_prepare(void);
|
static void ext1_wakeup_prepare(void);
|
||||||
static void timer_wakeup_prepare(void);
|
static void timer_wakeup_prepare(void);
|
||||||
|
static void touch_wakeup_prepare(void);
|
||||||
|
|
||||||
/* Wake from deep sleep stub
|
/* Wake from deep sleep stub
|
||||||
See esp_deepsleep.h esp_wake_deep_sleep() comments for details.
|
See esp_deepsleep.h esp_wake_deep_sleep() comments for details.
|
||||||
|
@ -188,6 +189,10 @@ static uint32_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags)
|
||||||
if (s_config.wakeup_triggers & RTC_ULP_TRIG_EN) {
|
if (s_config.wakeup_triggers & RTC_ULP_TRIG_EN) {
|
||||||
// no-op for esp32s2
|
// no-op for esp32s2
|
||||||
}
|
}
|
||||||
|
// Enable Touch wakeup
|
||||||
|
if (s_config.wakeup_triggers & RTC_TOUCH_TRIG_EN) {
|
||||||
|
touch_wakeup_prepare();
|
||||||
|
}
|
||||||
|
|
||||||
// Enter sleep
|
// Enter sleep
|
||||||
rtc_sleep_config_t config = RTC_SLEEP_CONFIG_DEFAULT(pd_flags);
|
rtc_sleep_config_t config = RTC_SLEEP_CONFIG_DEFAULT(pd_flags);
|
||||||
|
@ -409,6 +414,17 @@ static void timer_wakeup_prepare(void)
|
||||||
SET_PERI_REG_MASK(RTC_CNTL_SLP_TIMER1_REG, RTC_CNTL_MAIN_TIMER_ALARM_EN_M);
|
SET_PERI_REG_MASK(RTC_CNTL_SLP_TIMER1_REG, RTC_CNTL_MAIN_TIMER_ALARM_EN_M);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* In deep sleep mode, only the sleep channel is supported, and other touch channels should be turned off. */
|
||||||
|
static void touch_wakeup_prepare(void)
|
||||||
|
{
|
||||||
|
touch_pad_sleep_channel_t slp_config;
|
||||||
|
touch_pad_fsm_stop();
|
||||||
|
touch_pad_clear_channel_mask(SOC_TOUCH_SENSOR_BIT_MASK_MAX);
|
||||||
|
touch_pad_sleep_channel_get_info(&slp_config);
|
||||||
|
touch_pad_set_channel_mask(BIT(slp_config.touch_num));
|
||||||
|
touch_pad_fsm_start();
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t esp_sleep_enable_touchpad_wakeup(void)
|
esp_err_t esp_sleep_enable_touchpad_wakeup(void)
|
||||||
{
|
{
|
||||||
if (s_config.wakeup_triggers & (RTC_EXT0_TRIG_EN)) {
|
if (s_config.wakeup_triggers & (RTC_EXT0_TRIG_EN)) {
|
||||||
|
@ -572,7 +588,7 @@ esp_sleep_wakeup_cause_t esp_sleep_get_wakeup_cause(void)
|
||||||
return ESP_SLEEP_WAKEUP_UNDEFINED;
|
return ESP_SLEEP_WAKEUP_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t wakeup_cause = REG_GET_FIELD(RTC_CNTL_WAKEUP_STATE_REG, RTC_CNTL_WAKEUP_CAUSE);
|
uint32_t wakeup_cause = REG_GET_FIELD(RTC_CNTL_SLP_WAKEUP_CAUSE_REG, RTC_CNTL_WAKEUP_CAUSE);
|
||||||
if (wakeup_cause & RTC_EXT0_TRIG_EN) {
|
if (wakeup_cause & RTC_EXT0_TRIG_EN) {
|
||||||
return ESP_SLEEP_WAKEUP_EXT0;
|
return ESP_SLEEP_WAKEUP_EXT0;
|
||||||
} else if (wakeup_cause & RTC_EXT1_TRIG_EN) {
|
} else if (wakeup_cause & RTC_EXT1_TRIG_EN) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ typedef struct {
|
||||||
touch_high_volt_t refh;
|
touch_high_volt_t refh;
|
||||||
touch_low_volt_t refl;
|
touch_low_volt_t refl;
|
||||||
touch_volt_atten_t atten;
|
touch_volt_atten_t atten;
|
||||||
}touch_hal_volt_t;
|
} touch_hal_volt_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
touch_cnt_slope_t slope; /*!<Set touch sensor charge/discharge speed(currents) for each pad.*/
|
touch_cnt_slope_t slope; /*!<Set touch sensor charge/discharge speed(currents) for each pad.*/
|
||||||
|
@ -112,16 +112,12 @@ void touch_hal_get_meas_mode(touch_pad_t touch_num, touch_hal_meas_mode_t *meas)
|
||||||
/**
|
/**
|
||||||
* Start touch sensor FSM timer.
|
* Start touch sensor FSM timer.
|
||||||
* The measurement action can be triggered by the hardware timer, as well as by the software instruction.
|
* The measurement action can be triggered by the hardware timer, as well as by the software instruction.
|
||||||
*
|
|
||||||
* @param mode FSM mode.
|
|
||||||
*/
|
*/
|
||||||
#define touch_hal_start_fsm() touch_ll_start_fsm()
|
#define touch_hal_start_fsm() touch_ll_start_fsm()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop touch sensor FSM timer.
|
* Stop touch sensor FSM timer.
|
||||||
* The measurement action can be triggered by the hardware timer, as well as by the software instruction.
|
* The measurement action can be triggered by the hardware timer, as well as by the software instruction.
|
||||||
*
|
|
||||||
* @param mode FSM mode.
|
|
||||||
*/
|
*/
|
||||||
#define touch_hal_stop_fsm() touch_ll_stop_fsm()
|
#define touch_hal_stop_fsm() touch_ll_stop_fsm()
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
|
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "soc/touch_sensor_caps.h"
|
#include "soc/touch_sensor_caps.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
#include "esp_attr.h"
|
||||||
|
|
||||||
/** Touch pad channel */
|
/** Touch pad channel */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -117,7 +118,7 @@ typedef enum {
|
||||||
#define TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD (TOUCH_HVOLT_2V7)
|
#define TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD (TOUCH_HVOLT_2V7)
|
||||||
#define TOUCH_PAD_LOW_VOLTAGE_THRESHOLD (TOUCH_LVOLT_0V5)
|
#define TOUCH_PAD_LOW_VOLTAGE_THRESHOLD (TOUCH_LVOLT_0V5)
|
||||||
#define TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD (TOUCH_HVOLT_ATTEN_0V5)
|
#define TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD (TOUCH_HVOLT_ATTEN_0V5)
|
||||||
#define TOUCH_PAD_INACTIVE_CONNECT_DEFAULT (TOUCH_PAD_CONN_GND)
|
#define TOUCH_PAD_IDLE_CH_CONNECT_DEFAULT (TOUCH_PAD_CONN_GND)
|
||||||
#define TOUCH_PAD_THRESHOLD_MAX (SOC_TOUCH_PAD_THRESHOLD_MAX) /*!<If set touch threshold max value, The touch sensor can't be in touched status */
|
#define TOUCH_PAD_THRESHOLD_MAX (SOC_TOUCH_PAD_THRESHOLD_MAX) /*!<If set touch threshold max value, The touch sensor can't be in touched status */
|
||||||
|
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||||
|
@ -147,20 +148,19 @@ typedef enum {
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP32S2
|
#ifdef CONFIG_IDF_TARGET_ESP32S2
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TOUCH_PAD_INTR_DONE = 0, /*!<Each enabled channel measure done */
|
TOUCH_PAD_INTR_MASK_DONE = BIT(0), /*!<Measurement done for one of the enabled channels. */
|
||||||
TOUCH_PAD_INTR_ACTIVE = 1, /*!<Each enabled channel be touched */
|
TOUCH_PAD_INTR_MASK_ACTIVE = BIT(1), /*!<Active for one of the enabled channels. */
|
||||||
TOUCH_PAD_INTR_INACTIVE = 2,/*!<Each enabled channel be released */
|
TOUCH_PAD_INTR_MASK_INACTIVE = BIT(2), /*!<Inactive for one of the enabled channels. */
|
||||||
TOUCH_PAD_INTR_ALL, /*!<All touch interrupt measure done & touched & released */
|
TOUCH_PAD_INTR_MASK_SCAN_DONE = BIT(3), /*!<Measurement done for all the enabled channels. */
|
||||||
TOUCH_PAD_INTR_MAX
|
TOUCH_PAD_INTR_MASK_TIMEOUT = BIT(4), /*!<Timeout for one of the enabled channels. */
|
||||||
} touch_pad_intr_type_t;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
TOUCH_PAD_INTR_MASK_DONE = BIT(0), /*!<Each enabled channel measure done */
|
|
||||||
TOUCH_PAD_INTR_MASK_ACTIVE = BIT(1), /*!<Each enabled channel be touched */
|
|
||||||
TOUCH_PAD_INTR_MASK_INACTIVE = BIT(2), /*!<Each enabled channel be released */
|
|
||||||
TOUCH_PAD_INTR_MASK_ALL = BIT(2) | BIT(1) | BIT(0), /*!<All touch interrupt measure done & touched & released */
|
|
||||||
TOUCH_PAD_INTR_MASK_MAX
|
TOUCH_PAD_INTR_MASK_MAX
|
||||||
|
#define TOUCH_PAD_INTR_MASK_ALL (TOUCH_PAD_INTR_MASK_TIMEOUT \
|
||||||
|
| TOUCH_PAD_INTR_MASK_SCAN_DONE \
|
||||||
|
| TOUCH_PAD_INTR_MASK_INACTIVE \
|
||||||
|
| TOUCH_PAD_INTR_MASK_ACTIVE \
|
||||||
|
| TOUCH_PAD_INTR_MASK_DONE) /*!<All touch interrupt type enable. */
|
||||||
} touch_pad_intr_mask_t;
|
} touch_pad_intr_mask_t;
|
||||||
|
FLAG_ATTR(touch_pad_intr_mask_t)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TOUCH_PAD_DENOISE_BIT12 = 0, /*!<Denoise range is 12bit */
|
TOUCH_PAD_DENOISE_BIT12 = 0, /*!<Denoise range is 12bit */
|
||||||
|
@ -171,15 +171,15 @@ typedef enum {
|
||||||
} touch_pad_denoise_grade_t;
|
} touch_pad_denoise_grade_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TOUCH_PAD_DENOISE_CAP_L0 = 0, /*!<Denoise channel internal reference capacitance is 0pf */
|
TOUCH_PAD_DENOISE_CAP_L0 = 0, /*!<Denoise channel internal reference capacitance is 5pf */
|
||||||
TOUCH_PAD_DENOISE_CAP_L1 = 4, /*!<Denoise channel internal reference capacitance is 1.4pf */
|
TOUCH_PAD_DENOISE_CAP_L1 = 1, /*!<Denoise channel internal reference capacitance is 6.4pf */
|
||||||
TOUCH_PAD_DENOISE_CAP_L2 = 2, /*!<Denoise channel internal reference capacitance is 2.8pf */
|
TOUCH_PAD_DENOISE_CAP_L2 = 2, /*!<Denoise channel internal reference capacitance is 7.8pf */
|
||||||
TOUCH_PAD_DENOISE_CAP_L3 = 6, /*!<Denoise channel internal reference capacitance is 4.2pf */
|
TOUCH_PAD_DENOISE_CAP_L3 = 3, /*!<Denoise channel internal reference capacitance is 9.2pf */
|
||||||
TOUCH_PAD_DENOISE_CAP_L4 = 1, /*!<Denoise channel internal reference capacitance is 5.6pf */
|
TOUCH_PAD_DENOISE_CAP_L4 = 4, /*!<Denoise channel internal reference capacitance is 10.6pf */
|
||||||
TOUCH_PAD_DENOISE_CAP_L5 = 5, /*!<Denoise channel internal reference capacitance is 7.0pf */
|
TOUCH_PAD_DENOISE_CAP_L5 = 5, /*!<Denoise channel internal reference capacitance is 12.0pf */
|
||||||
TOUCH_PAD_DENOISE_CAP_L6 = 3, /*!<Denoise channel internal reference capacitance is 8.4pf */
|
TOUCH_PAD_DENOISE_CAP_L6 = 6, /*!<Denoise channel internal reference capacitance is 13.4pf */
|
||||||
TOUCH_PAD_DENOISE_CAP_L7 = 7, /*!<Denoise channel internal reference capacitance is 9.8pf */
|
TOUCH_PAD_DENOISE_CAP_L7 = 7, /*!<Denoise channel internal reference capacitance is 14.8pf */
|
||||||
TOUCH_PAD_DENOISE_CAP_MAX
|
TOUCH_PAD_DENOISE_CAP_MAX = 8
|
||||||
} touch_pad_denoise_cap_t;
|
} touch_pad_denoise_cap_t;
|
||||||
|
|
||||||
/** Touch sensor denoise configuration */
|
/** Touch sensor denoise configuration */
|
||||||
|
@ -187,6 +187,8 @@ typedef struct touch_pad_denoise {
|
||||||
touch_pad_denoise_grade_t grade; /*!<Select denoise range of denoise channel.
|
touch_pad_denoise_grade_t grade; /*!<Select denoise range of denoise channel.
|
||||||
Determined by measuring the noise amplitude of the denoise channel. */
|
Determined by measuring the noise amplitude of the denoise channel. */
|
||||||
touch_pad_denoise_cap_t cap_level; /*!<Select internal reference capacitance of denoise channel.
|
touch_pad_denoise_cap_t cap_level; /*!<Select internal reference capacitance of denoise channel.
|
||||||
|
Ensure that the denoise readings are closest to the readings of the channel being measured.
|
||||||
|
Use `touch_pad_denoise_read_data` to get the reading of denoise channel.
|
||||||
The equivalent capacitance of the shielded channel can be calculated
|
The equivalent capacitance of the shielded channel can be calculated
|
||||||
from the reading of denoise channel. */
|
from the reading of denoise channel. */
|
||||||
} touch_pad_denoise_t;
|
} touch_pad_denoise_t;
|
||||||
|
@ -206,18 +208,13 @@ typedef enum {
|
||||||
/** Touch sensor waterproof configuration */
|
/** Touch sensor waterproof configuration */
|
||||||
typedef struct touch_pad_waterproof {
|
typedef struct touch_pad_waterproof {
|
||||||
touch_pad_t guard_ring_pad; /*!<Waterproof. Select touch channel use for guard pad */
|
touch_pad_t guard_ring_pad; /*!<Waterproof. Select touch channel use for guard pad */
|
||||||
touch_pad_shield_driver_t shield_driver;/*!<Waterproof. Select max equivalent capacitance for sheild pad
|
touch_pad_shield_driver_t shield_driver;/*!<Waterproof. Select max equivalent capacitance for shield pad
|
||||||
Config the Touch14 to the touch sensor and compare the measured
|
Config the Touch14 to the touch sensor and compare the measured
|
||||||
reading to the Touch0 reading to estimate the equivalent capacitance.*/
|
reading to the Touch0 reading to estimate the equivalent capacitance.*/
|
||||||
} touch_pad_waterproof_t;
|
} touch_pad_waterproof_t;
|
||||||
|
|
||||||
/** Touch sensor proximity detection configuration */
|
/** Touch sensor proximity detection configuration */
|
||||||
typedef struct touch_pad_proximity {
|
|
||||||
touch_pad_t select_pad[SOC_TOUCH_PROXIMITY_CHANNEL_NUM]; /*!<Set touch channel number for proximity pad.
|
|
||||||
If clear the proximity channel, point this pad to `TOUCH_PAD_NUM0` */
|
|
||||||
uint32_t meas_num; /*!<Set cumulative times of measurements for proximity pad */
|
|
||||||
#define TOUCH_PROXIMITY_MEAS_NUM_MAX (0xFF)
|
#define TOUCH_PROXIMITY_MEAS_NUM_MAX (0xFF)
|
||||||
} touch_pad_proximity_t;
|
|
||||||
|
|
||||||
/** Touch channel idle state configuration */
|
/** Touch channel idle state configuration */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -226,37 +223,62 @@ typedef enum {
|
||||||
TOUCH_PAD_CONN_MAX
|
TOUCH_PAD_CONN_MAX
|
||||||
} touch_pad_conn_type_t;
|
} touch_pad_conn_type_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Touch channel IIR filter coefficient configuration.
|
||||||
|
* @note On ESP32S2. There is an error in the IIR calculation. The magnitude of the error is twice the filter coefficient.
|
||||||
|
* So please select a smaller filter coefficient on the basis of meeting the filtering requirements.
|
||||||
|
* Recommended filter coefficient selection `IIR_16`.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TOUCH_PAD_FILTER_IIR_2 = 0, /*!<The filter mode is first-order IIR filter. The coefficient is 2 */
|
TOUCH_PAD_FILTER_IIR_4 = 0, /*!<The filter mode is first-order IIR filter. The coefficient is 4. */
|
||||||
TOUCH_PAD_FILTER_IIR_4, /*!<The filter mode is first-order IIR filter. The coefficient is 4 */
|
TOUCH_PAD_FILTER_IIR_8, /*!<The filter mode is first-order IIR filter. The coefficient is 8. */
|
||||||
TOUCH_PAD_FILTER_IIR_8, /*!<The filter mode is first-order IIR filter. The coefficient is 8 */
|
TOUCH_PAD_FILTER_IIR_16, /*!<The filter mode is first-order IIR filter. The coefficient is 16 (Typical value). */
|
||||||
|
TOUCH_PAD_FILTER_IIR_32, /*!<The filter mode is first-order IIR filter. The coefficient is 32. */
|
||||||
|
TOUCH_PAD_FILTER_IIR_64, /*!<The filter mode is first-order IIR filter. The coefficient is 64. */
|
||||||
|
TOUCH_PAD_FILTER_IIR_128, /*!<The filter mode is first-order IIR filter. The coefficient is 128. */
|
||||||
|
TOUCH_PAD_FILTER_IIR_256, /*!<The filter mode is first-order IIR filter. The coefficient is 256. */
|
||||||
TOUCH_PAD_FILTER_JITTER, /*!<The filter mode is jitter filter */
|
TOUCH_PAD_FILTER_JITTER, /*!<The filter mode is jitter filter */
|
||||||
TOUCH_PAD_FILTER_MAX
|
TOUCH_PAD_FILTER_MAX
|
||||||
} touch_filter_mode_t;
|
} touch_filter_mode_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Level of filter applied on the original data against large noise interference.
|
||||||
|
* @note On ESP32S2. There is an error in the IIR calculation. The magnitude of the error is twice the filter coefficient.
|
||||||
|
* So please select a smaller filter coefficient on the basis of meeting the filtering requirements.
|
||||||
|
* Recommended filter coefficient selection `IIR_2`.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
TOUCH_PAD_SMOOTH_OFF = 0, /*!<No filtering of raw data. */
|
||||||
|
TOUCH_PAD_SMOOTH_IIR_2 = 1, /*!<Filter the raw data. The coefficient is 2 (Typical value). */
|
||||||
|
TOUCH_PAD_SMOOTH_IIR_4 = 2, /*!<Filter the raw data. The coefficient is 4. */
|
||||||
|
TOUCH_PAD_SMOOTH_IIR_8 = 3, /*!<Filter the raw data. The coefficient is 8. */
|
||||||
|
TOUCH_PAD_SMOOTH_MAX,
|
||||||
|
} touch_smooth_mode_t;
|
||||||
|
|
||||||
/** Touch sensor filter configuration */
|
/** Touch sensor filter configuration */
|
||||||
typedef struct touch_filter_config {
|
typedef struct touch_filter_config {
|
||||||
touch_filter_mode_t mode; /*!<Set filter mode. The input to the filter is raw data and the output is the baseline value.
|
touch_filter_mode_t mode; /*!<Set filter mode. The input to the filter is raw data and the output is the baseline value.
|
||||||
Larger filter coefficients increase the stability of the baseline. */
|
Larger filter coefficients increase the stability of the baseline. */
|
||||||
uint32_t debounce_cnt; /*!<Set debounce count, such as `n`. If the measured values continue to exceed
|
uint32_t debounce_cnt; /*!<Set debounce count, such as `n`. If the measured values continue to exceed
|
||||||
the threshold for `n` times, it is determined that the touch sensor state changes.
|
the threshold for `n+1` times, the touch sensor state changes.
|
||||||
Range: 0 ~ 7 */
|
Range: 0 ~ 7 */
|
||||||
uint32_t hysteresis_thr; /*!<Hysteresis threshold coefficient. hysteresis = hysteresis_thr * touch_threshold.
|
uint32_t hysteresis_thr; /*!<Hysteresis threshold coefficient. hysteresis = hysteresis coefficient * touch threshold.
|
||||||
If (raw data - baseline) > (touch threshold + hysteresis), the touch channel be touched.
|
If (raw data - baseline) > (touch threshold + hysteresis), the touch channel be touched.
|
||||||
If (raw data - baseline) < (touch threshold - hysteresis), the touch channel be released.
|
If (raw data - baseline) < (touch threshold - hysteresis), the touch channel be released.
|
||||||
Range: 0 ~ 3. The coefficient is 0: 1/8; 1: 3/32; 2: 1/16; 3: 1/32 */
|
Range: 0 ~ 3. The coefficient is 0: 4/32; 1: 3/32; 2: 2/32; 3: OFF */
|
||||||
uint32_t noise_thr; /*!<Noise threshold coefficient. noise = noise_thr * touch threshold.
|
uint32_t noise_thr; /*!<Noise threshold coefficient. noise = noise coefficient * touch threshold.
|
||||||
If (raw data - baseline) > (noise), the baseline stop updating.
|
If (raw data - baseline) > (noise), the baseline stop updating.
|
||||||
If (raw data - baseline) < (noise), the baseline start updating.
|
If (raw data - baseline) < (noise), the baseline start updating.
|
||||||
Range: 0 ~ 3. The coefficient is 0: 1/2; 1: 3/8; 2: 1/4; 3: 1/8; */
|
Range: 0 ~ 3. The coefficient is 0: 4/8; 1: 3/8; 2: 2/8; 3: 1; */
|
||||||
uint32_t noise_neg_thr; /*!<Negative noise threshold coefficient. negative noise = noise_neg_thr * touch threshold.
|
uint32_t noise_neg_thr; /*!<Negative noise threshold coefficient. negative noise = noise coefficient * touch threshold.
|
||||||
If (baseline - raw data) > (negative noise), the baseline restart reset process(refer to `baseline_reset`).
|
If (baseline - raw data) > (negative noise), the baseline restart reset process(refer to `baseline_reset`).
|
||||||
If (baseline - raw data) < (negative noise), the baseline stop reset process(refer to `baseline_reset`).
|
If (baseline - raw data) < (negative noise), the baseline stop reset process(refer to `baseline_reset`).
|
||||||
Range: 0 ~ 3. The coefficient is 0: 1/2; 1: 3/8; 2: 1/4; 3: 1/8; */
|
Range: 0 ~ 3. The coefficient is 0: 4/8; 1: 3/8; 2: 2/8; 3: 1/8; */
|
||||||
uint32_t neg_noise_limit; /*!<Set the cumulative number of baseline reset processes. such as `n`. If the measured values continue to exceed
|
uint32_t neg_noise_limit; /*!<Set the cumulative number of baseline reset processes. such as `n`. If the measured values continue to exceed
|
||||||
the negative noise threshold for `n` times, the baseline reset to raw data.
|
the negative noise threshold for `n+1` times, the baseline reset to raw data.
|
||||||
Range: 0 ~ 15 */
|
Range: 0 ~ 15 */
|
||||||
uint32_t jitter_step; /*!<Set jitter filter step size. Range: 0 ~ 15 */
|
uint32_t jitter_step; /*!<Set jitter filter step size. Range: 0 ~ 15 */
|
||||||
|
touch_smooth_mode_t smh_lvl;/*!<Level of filter applied on the original data against large noise interference. */
|
||||||
#define TOUCH_DEBOUNCE_CNT_MAX (7)
|
#define TOUCH_DEBOUNCE_CNT_MAX (7)
|
||||||
#define TOUCH_HYSTERESIS_THR_MAX (3)
|
#define TOUCH_HYSTERESIS_THR_MAX (3)
|
||||||
#define TOUCH_NOISE_THR_MAX (3)
|
#define TOUCH_NOISE_THR_MAX (3)
|
||||||
|
@ -269,8 +291,6 @@ typedef struct touch_filter_config {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
touch_pad_t touch_num; /*!<Set touch channel number for sleep pad.
|
touch_pad_t touch_num; /*!<Set touch channel number for sleep pad.
|
||||||
Only one touch sensor channel is supported in deep sleep mode. */
|
Only one touch sensor channel is supported in deep sleep mode. */
|
||||||
uint32_t sleep_pad_threshold; /*!<Set the trigger threshold of touch sensor in deep sleep.
|
|
||||||
The threshold at sleep is the same as the threshold before sleep. */
|
|
||||||
bool en_proximity; /*!<enable proximity function for sleep pad */
|
bool en_proximity; /*!<enable proximity function for sleep pad */
|
||||||
} touch_pad_sleep_channel_t;
|
} touch_pad_sleep_channel_t;
|
||||||
|
|
||||||
|
|
540
components/soc/soc/esp32s2/include/soc/mcp_reg.h
Normal file
540
components/soc/soc/esp32s2/include/soc/mcp_reg.h
Normal file
|
@ -0,0 +1,540 @@
|
||||||
|
// Copyright 2017-2020 Espressif Systems (Shanghai) PTE LTD
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
#ifndef _SOC_MCP_REG_H_
|
||||||
|
#define _SOC_MCP_REG_H_
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
#include "soc.h"
|
||||||
|
#define MCP_INT_RAW_REG (DR_REG_MCP_BASE + 0x0000)
|
||||||
|
/* MCP_CRC_DONE_INT_RAW : RO ;bitpos:[8] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_CRC_DONE_INT_RAW (BIT(8))
|
||||||
|
#define MCP_CRC_DONE_INT_RAW_M (BIT(8))
|
||||||
|
#define MCP_CRC_DONE_INT_RAW_V 0x1
|
||||||
|
#define MCP_CRC_DONE_INT_RAW_S 8
|
||||||
|
/* MCP_OUT_TOTAL_EOF_INT_RAW : RO ;bitpos:[7] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_RAW (BIT(7))
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_RAW_M (BIT(7))
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_RAW_V 0x1
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_RAW_S 7
|
||||||
|
/* MCP_IN_DSCR_EMPTY_INT_RAW : RO ;bitpos:[6] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_RAW (BIT(6))
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_RAW_M (BIT(6))
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_RAW_V 0x1
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_RAW_S 6
|
||||||
|
/* MCP_OUT_DSCR_ERR_INT_RAW : RO ;bitpos:[5] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_RAW (BIT(5))
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_RAW_M (BIT(5))
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_RAW_V 0x1
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_RAW_S 5
|
||||||
|
/* MCP_IN_DSCR_ERR_INT_RAW : RO ;bitpos:[4] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_RAW (BIT(4))
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_RAW_M (BIT(4))
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_RAW_V 0x1
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_RAW_S 4
|
||||||
|
/* MCP_OUT_EOF_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_EOF_INT_RAW (BIT(3))
|
||||||
|
#define MCP_OUT_EOF_INT_RAW_M (BIT(3))
|
||||||
|
#define MCP_OUT_EOF_INT_RAW_V 0x1
|
||||||
|
#define MCP_OUT_EOF_INT_RAW_S 3
|
||||||
|
/* MCP_OUT_DONE_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_DONE_INT_RAW (BIT(2))
|
||||||
|
#define MCP_OUT_DONE_INT_RAW_M (BIT(2))
|
||||||
|
#define MCP_OUT_DONE_INT_RAW_V 0x1
|
||||||
|
#define MCP_OUT_DONE_INT_RAW_S 2
|
||||||
|
/* MCP_IN_SUC_EOF_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_SUC_EOF_INT_RAW (BIT(1))
|
||||||
|
#define MCP_IN_SUC_EOF_INT_RAW_M (BIT(1))
|
||||||
|
#define MCP_IN_SUC_EOF_INT_RAW_V 0x1
|
||||||
|
#define MCP_IN_SUC_EOF_INT_RAW_S 1
|
||||||
|
/* MCP_IN_DONE_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_DONE_INT_RAW (BIT(0))
|
||||||
|
#define MCP_IN_DONE_INT_RAW_M (BIT(0))
|
||||||
|
#define MCP_IN_DONE_INT_RAW_V 0x1
|
||||||
|
#define MCP_IN_DONE_INT_RAW_S 0
|
||||||
|
|
||||||
|
#define MCP_INT_ST_REG (DR_REG_MCP_BASE + 0x0004)
|
||||||
|
/* MCP_CRC_DONE_INT_ST : RO ;bitpos:[8] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_CRC_DONE_INT_ST (BIT(8))
|
||||||
|
#define MCP_CRC_DONE_INT_ST_M (BIT(8))
|
||||||
|
#define MCP_CRC_DONE_INT_ST_V 0x1
|
||||||
|
#define MCP_CRC_DONE_INT_ST_S 8
|
||||||
|
/* MCP_OUT_TOTAL_EOF_INT_ST : RO ;bitpos:[7] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_ST (BIT(7))
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_ST_M (BIT(7))
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_ST_V 0x1
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_ST_S 7
|
||||||
|
/* MCP_IN_DSCR_EMPTY_INT_ST : RO ;bitpos:[6] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_ST (BIT(6))
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_ST_M (BIT(6))
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_ST_V 0x1
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_ST_S 6
|
||||||
|
/* MCP_OUT_DSCR_ERR_INT_ST : RO ;bitpos:[5] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_ST (BIT(5))
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_ST_M (BIT(5))
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_ST_V 0x1
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_ST_S 5
|
||||||
|
/* MCP_IN_DSCR_ERR_INT_ST : RO ;bitpos:[4] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_ST (BIT(4))
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_ST_M (BIT(4))
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_ST_V 0x1
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_ST_S 4
|
||||||
|
/* MCP_OUT_EOF_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_EOF_INT_ST (BIT(3))
|
||||||
|
#define MCP_OUT_EOF_INT_ST_M (BIT(3))
|
||||||
|
#define MCP_OUT_EOF_INT_ST_V 0x1
|
||||||
|
#define MCP_OUT_EOF_INT_ST_S 3
|
||||||
|
/* MCP_OUT_DONE_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_DONE_INT_ST (BIT(2))
|
||||||
|
#define MCP_OUT_DONE_INT_ST_M (BIT(2))
|
||||||
|
#define MCP_OUT_DONE_INT_ST_V 0x1
|
||||||
|
#define MCP_OUT_DONE_INT_ST_S 2
|
||||||
|
/* MCP_IN_SUC_EOF_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_SUC_EOF_INT_ST (BIT(1))
|
||||||
|
#define MCP_IN_SUC_EOF_INT_ST_M (BIT(1))
|
||||||
|
#define MCP_IN_SUC_EOF_INT_ST_V 0x1
|
||||||
|
#define MCP_IN_SUC_EOF_INT_ST_S 1
|
||||||
|
/* MCP_IN_DONE_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_DONE_INT_ST (BIT(0))
|
||||||
|
#define MCP_IN_DONE_INT_ST_M (BIT(0))
|
||||||
|
#define MCP_IN_DONE_INT_ST_V 0x1
|
||||||
|
#define MCP_IN_DONE_INT_ST_S 0
|
||||||
|
|
||||||
|
#define MCP_INT_ENA_REG (DR_REG_MCP_BASE + 0x008)
|
||||||
|
/* MCP_CRC_DONE_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_CRC_DONE_INT_ENA (BIT(8))
|
||||||
|
#define MCP_CRC_DONE_INT_ENA_M (BIT(8))
|
||||||
|
#define MCP_CRC_DONE_INT_ENA_V 0x1
|
||||||
|
#define MCP_CRC_DONE_INT_ENA_S 8
|
||||||
|
/* MCP_OUT_TOTAL_EOF_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_ENA (BIT(7))
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_ENA_M (BIT(7))
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_ENA_V 0x1
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_ENA_S 7
|
||||||
|
/* MCP_IN_DSCR_EMPTY_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_ENA (BIT(6))
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_ENA_M (BIT(6))
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_ENA_V 0x1
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_ENA_S 6
|
||||||
|
/* MCP_OUT_DSCR_ERR_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_ENA (BIT(5))
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_ENA_M (BIT(5))
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_ENA_V 0x1
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_ENA_S 5
|
||||||
|
/* MCP_IN_DSCR_ERR_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_ENA (BIT(4))
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_ENA_M (BIT(4))
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_ENA_V 0x1
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_ENA_S 4
|
||||||
|
/* MCP_OUT_EOF_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_EOF_INT_ENA (BIT(3))
|
||||||
|
#define MCP_OUT_EOF_INT_ENA_M (BIT(3))
|
||||||
|
#define MCP_OUT_EOF_INT_ENA_V 0x1
|
||||||
|
#define MCP_OUT_EOF_INT_ENA_S 3
|
||||||
|
/* MCP_OUT_DONE_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_DONE_INT_ENA (BIT(2))
|
||||||
|
#define MCP_OUT_DONE_INT_ENA_M (BIT(2))
|
||||||
|
#define MCP_OUT_DONE_INT_ENA_V 0x1
|
||||||
|
#define MCP_OUT_DONE_INT_ENA_S 2
|
||||||
|
/* MCP_IN_SUC_EOF_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_SUC_EOF_INT_ENA (BIT(1))
|
||||||
|
#define MCP_IN_SUC_EOF_INT_ENA_M (BIT(1))
|
||||||
|
#define MCP_IN_SUC_EOF_INT_ENA_V 0x1
|
||||||
|
#define MCP_IN_SUC_EOF_INT_ENA_S 1
|
||||||
|
/* MCP_IN_DONE_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_DONE_INT_ENA (BIT(0))
|
||||||
|
#define MCP_IN_DONE_INT_ENA_M (BIT(0))
|
||||||
|
#define MCP_IN_DONE_INT_ENA_V 0x1
|
||||||
|
#define MCP_IN_DONE_INT_ENA_S 0
|
||||||
|
|
||||||
|
#define MCP_INT_CLR_REG (DR_REG_MCP_BASE + 0x000c)
|
||||||
|
/* MCP_CRC_DONE_INT_CLR : WO ;bitpos:[8] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_CRC_DONE_INT_CLR (BIT(8))
|
||||||
|
#define MCP_CRC_DONE_INT_CLR_M (BIT(8))
|
||||||
|
#define MCP_CRC_DONE_INT_CLR_V 0x1
|
||||||
|
#define MCP_CRC_DONE_INT_CLR_S 8
|
||||||
|
/* MCP_OUT_TOTAL_EOF_INT_CLR : WO ;bitpos:[7] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_CLR (BIT(7))
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_CLR_M (BIT(7))
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_CLR_V 0x1
|
||||||
|
#define MCP_OUT_TOTAL_EOF_INT_CLR_S 7
|
||||||
|
/* MCP_IN_DSCR_EMPTY_INT_CLR : WO ;bitpos:[6] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_CLR (BIT(6))
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_CLR_M (BIT(6))
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_CLR_V 0x1
|
||||||
|
#define MCP_IN_DSCR_EMPTY_INT_CLR_S 6
|
||||||
|
/* MCP_OUT_DSCR_ERR_INT_CLR : WO ;bitpos:[5] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_CLR (BIT(5))
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_CLR_M (BIT(5))
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_CLR_V 0x1
|
||||||
|
#define MCP_OUT_DSCR_ERR_INT_CLR_S 5
|
||||||
|
/* MCP_IN_DSCR_ERR_INT_CLR : WO ;bitpos:[4] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_CLR (BIT(4))
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_CLR_M (BIT(4))
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_CLR_V 0x1
|
||||||
|
#define MCP_IN_DSCR_ERR_INT_CLR_S 4
|
||||||
|
/* MCP_OUT_EOF_INT_CLR : WO ;bitpos:[3] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_EOF_INT_CLR (BIT(3))
|
||||||
|
#define MCP_OUT_EOF_INT_CLR_M (BIT(3))
|
||||||
|
#define MCP_OUT_EOF_INT_CLR_V 0x1
|
||||||
|
#define MCP_OUT_EOF_INT_CLR_S 3
|
||||||
|
/* MCP_OUT_DONE_INT_CLR : WO ;bitpos:[2] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_DONE_INT_CLR (BIT(2))
|
||||||
|
#define MCP_OUT_DONE_INT_CLR_M (BIT(2))
|
||||||
|
#define MCP_OUT_DONE_INT_CLR_V 0x1
|
||||||
|
#define MCP_OUT_DONE_INT_CLR_S 2
|
||||||
|
/* MCP_IN_SUC_EOF_INT_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_SUC_EOF_INT_CLR (BIT(1))
|
||||||
|
#define MCP_IN_SUC_EOF_INT_CLR_M (BIT(1))
|
||||||
|
#define MCP_IN_SUC_EOF_INT_CLR_V 0x1
|
||||||
|
#define MCP_IN_SUC_EOF_INT_CLR_S 1
|
||||||
|
/* MCP_IN_DONE_INT_CLR : WO ;bitpos:[0] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_DONE_INT_CLR (BIT(0))
|
||||||
|
#define MCP_IN_DONE_INT_CLR_M (BIT(0))
|
||||||
|
#define MCP_IN_DONE_INT_CLR_V 0x1
|
||||||
|
#define MCP_IN_DONE_INT_CLR_S 0
|
||||||
|
|
||||||
|
#define MCP_OUT_LINK_REG (DR_REG_MCP_BASE + 0x0010)
|
||||||
|
/* MCP_OUTLINK_PARK : RO ;bitpos:[31] ;default: 1'h0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUTLINK_PARK (BIT(31))
|
||||||
|
#define MCP_OUTLINK_PARK_M (BIT(31))
|
||||||
|
#define MCP_OUTLINK_PARK_V 0x1
|
||||||
|
#define MCP_OUTLINK_PARK_S 31
|
||||||
|
/* MCP_OUTLINK_RESTART : R/W ;bitpos:[30] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUTLINK_RESTART (BIT(30))
|
||||||
|
#define MCP_OUTLINK_RESTART_M (BIT(30))
|
||||||
|
#define MCP_OUTLINK_RESTART_V 0x1
|
||||||
|
#define MCP_OUTLINK_RESTART_S 30
|
||||||
|
/* MCP_OUTLINK_START : R/W ;bitpos:[29] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUTLINK_START (BIT(29))
|
||||||
|
#define MCP_OUTLINK_START_M (BIT(29))
|
||||||
|
#define MCP_OUTLINK_START_V 0x1
|
||||||
|
#define MCP_OUTLINK_START_S 29
|
||||||
|
/* MCP_OUTLINK_STOP : R/W ;bitpos:[28] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUTLINK_STOP (BIT(28))
|
||||||
|
#define MCP_OUTLINK_STOP_M (BIT(28))
|
||||||
|
#define MCP_OUTLINK_STOP_V 0x1
|
||||||
|
#define MCP_OUTLINK_STOP_S 28
|
||||||
|
/* MCP_OUTLINK_ADDR : R/W ;bitpos:[19:0] ;default: 20'h0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUTLINK_ADDR 0x000FFFFF
|
||||||
|
#define MCP_OUTLINK_ADDR_M ((MCP_OUTLINK_ADDR_V)<<(MCP_OUTLINK_ADDR_S))
|
||||||
|
#define MCP_OUTLINK_ADDR_V 0xFFFFF
|
||||||
|
#define MCP_OUTLINK_ADDR_S 0
|
||||||
|
|
||||||
|
#define MCP_IN_LINK_REG (DR_REG_MCP_BASE + 0x0014)
|
||||||
|
/* MCP_INLINK_PARK : RO ;bitpos:[31] ;default: 1'h0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_INLINK_PARK (BIT(31))
|
||||||
|
#define MCP_INLINK_PARK_M (BIT(31))
|
||||||
|
#define MCP_INLINK_PARK_V 0x1
|
||||||
|
#define MCP_INLINK_PARK_S 31
|
||||||
|
/* MCP_INLINK_RESTART : R/W ;bitpos:[30] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_INLINK_RESTART (BIT(30))
|
||||||
|
#define MCP_INLINK_RESTART_M (BIT(30))
|
||||||
|
#define MCP_INLINK_RESTART_V 0x1
|
||||||
|
#define MCP_INLINK_RESTART_S 30
|
||||||
|
/* MCP_INLINK_START : R/W ;bitpos:[29] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_INLINK_START (BIT(29))
|
||||||
|
#define MCP_INLINK_START_M (BIT(29))
|
||||||
|
#define MCP_INLINK_START_V 0x1
|
||||||
|
#define MCP_INLINK_START_S 29
|
||||||
|
/* MCP_INLINK_STOP : R/W ;bitpos:[28] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_INLINK_STOP (BIT(28))
|
||||||
|
#define MCP_INLINK_STOP_M (BIT(28))
|
||||||
|
#define MCP_INLINK_STOP_V 0x1
|
||||||
|
#define MCP_INLINK_STOP_S 28
|
||||||
|
/* MCP_INLINK_ADDR : R/W ;bitpos:[19:0] ;default: 20'h0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_INLINK_ADDR 0x000FFFFF
|
||||||
|
#define MCP_INLINK_ADDR_M ((MCP_INLINK_ADDR_V)<<(MCP_INLINK_ADDR_S))
|
||||||
|
#define MCP_INLINK_ADDR_V 0xFFFFF
|
||||||
|
#define MCP_INLINK_ADDR_S 0
|
||||||
|
|
||||||
|
#define MCP_OUT_EOF_DES_ADDR_REG (DR_REG_MCP_BASE + 0x0018)
|
||||||
|
/* MCP_OUT_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_EOF_DES_ADDR 0xFFFFFFFF
|
||||||
|
#define MCP_OUT_EOF_DES_ADDR_M ((MCP_OUT_EOF_DES_ADDR_V)<<(MCP_OUT_EOF_DES_ADDR_S))
|
||||||
|
#define MCP_OUT_EOF_DES_ADDR_V 0xFFFFFFFF
|
||||||
|
#define MCP_OUT_EOF_DES_ADDR_S 0
|
||||||
|
|
||||||
|
#define MCP_IN_EOF_DES_ADDR_REG (DR_REG_MCP_BASE + 0x001c)
|
||||||
|
/* MCP_IN_SUC_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_SUC_EOF_DES_ADDR 0xFFFFFFFF
|
||||||
|
#define MCP_IN_SUC_EOF_DES_ADDR_M ((MCP_IN_SUC_EOF_DES_ADDR_V)<<(MCP_IN_SUC_EOF_DES_ADDR_S))
|
||||||
|
#define MCP_IN_SUC_EOF_DES_ADDR_V 0xFFFFFFFF
|
||||||
|
#define MCP_IN_SUC_EOF_DES_ADDR_S 0
|
||||||
|
|
||||||
|
#define MCP_OUT_EOF_BFR_DES_ADDR_REG (DR_REG_MCP_BASE + 0x0020)
|
||||||
|
/* MCP_OUT_EOF_BFR_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_EOF_BFR_DES_ADDR 0xFFFFFFFF
|
||||||
|
#define MCP_OUT_EOF_BFR_DES_ADDR_M ((MCP_OUT_EOF_BFR_DES_ADDR_V)<<(MCP_OUT_EOF_BFR_DES_ADDR_S))
|
||||||
|
#define MCP_OUT_EOF_BFR_DES_ADDR_V 0xFFFFFFFF
|
||||||
|
#define MCP_OUT_EOF_BFR_DES_ADDR_S 0
|
||||||
|
|
||||||
|
#define MCP_INLINK_DSCR_REG (DR_REG_MCP_BASE + 0x0024)
|
||||||
|
/* MCP_INLINK_DSCR : RO ;bitpos:[31:0] ;default: 32'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_INLINK_DSCR 0xFFFFFFFF
|
||||||
|
#define MCP_INLINK_DSCR_M ((MCP_INLINK_DSCR_V)<<(MCP_INLINK_DSCR_S))
|
||||||
|
#define MCP_INLINK_DSCR_V 0xFFFFFFFF
|
||||||
|
#define MCP_INLINK_DSCR_S 0
|
||||||
|
|
||||||
|
#define MCP_INLINK_DSCR_BF0_REG (DR_REG_MCP_BASE + 0x0028)
|
||||||
|
/* MCP_INLINK_DSCR_BF0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_INLINK_DSCR_BF0 0xFFFFFFFF
|
||||||
|
#define MCP_INLINK_DSCR_BF0_M ((MCP_INLINK_DSCR_BF0_V)<<(MCP_INLINK_DSCR_BF0_S))
|
||||||
|
#define MCP_INLINK_DSCR_BF0_V 0xFFFFFFFF
|
||||||
|
#define MCP_INLINK_DSCR_BF0_S 0
|
||||||
|
|
||||||
|
#define MCP_INLINK_DSCR_BF1_REG (DR_REG_MCP_BASE + 0x002c)
|
||||||
|
/* MCP_INLINK_DSCR_BF1 : RO ;bitpos:[31:0] ;default: 32'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_INLINK_DSCR_BF1 0xFFFFFFFF
|
||||||
|
#define MCP_INLINK_DSCR_BF1_M ((MCP_INLINK_DSCR_BF1_V)<<(MCP_INLINK_DSCR_BF1_S))
|
||||||
|
#define MCP_INLINK_DSCR_BF1_V 0xFFFFFFFF
|
||||||
|
#define MCP_INLINK_DSCR_BF1_S 0
|
||||||
|
|
||||||
|
#define MCP_OUTLINK_DSCR_REG (DR_REG_MCP_BASE + 0x0030)
|
||||||
|
/* MCP_OUTLINK_DSCR : RO ;bitpos:[31:0] ;default: 32'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUTLINK_DSCR 0xFFFFFFFF
|
||||||
|
#define MCP_OUTLINK_DSCR_M ((MCP_OUTLINK_DSCR_V)<<(MCP_OUTLINK_DSCR_S))
|
||||||
|
#define MCP_OUTLINK_DSCR_V 0xFFFFFFFF
|
||||||
|
#define MCP_OUTLINK_DSCR_S 0
|
||||||
|
|
||||||
|
#define MCP_OUTLINK_DSCR_BF0_REG (DR_REG_MCP_BASE + 0x0034)
|
||||||
|
/* MCP_OUTLINK_DSCR_BF0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUTLINK_DSCR_BF0 0xFFFFFFFF
|
||||||
|
#define MCP_OUTLINK_DSCR_BF0_M ((MCP_OUTLINK_DSCR_BF0_V)<<(MCP_OUTLINK_DSCR_BF0_S))
|
||||||
|
#define MCP_OUTLINK_DSCR_BF0_V 0xFFFFFFFF
|
||||||
|
#define MCP_OUTLINK_DSCR_BF0_S 0
|
||||||
|
|
||||||
|
#define MCP_OUTLINK_DSCR_BF1_REG (DR_REG_MCP_BASE + 0x0038)
|
||||||
|
/* MCP_OUTLINK_DSCR_BF1 : RO ;bitpos:[31:0] ;default: 32'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUTLINK_DSCR_BF1 0xFFFFFFFF
|
||||||
|
#define MCP_OUTLINK_DSCR_BF1_M ((MCP_OUTLINK_DSCR_BF1_V)<<(MCP_OUTLINK_DSCR_BF1_S))
|
||||||
|
#define MCP_OUTLINK_DSCR_BF1_V 0xFFFFFFFF
|
||||||
|
#define MCP_OUTLINK_DSCR_BF1_S 0
|
||||||
|
|
||||||
|
#define MCP_CONF_REG (DR_REG_MCP_BASE + 0x003c)
|
||||||
|
/* MCP_CLK_EN : R/W ;bitpos:[31] ;default: 1'h0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_CLK_EN (BIT(31))
|
||||||
|
#define MCP_CLK_EN_M (BIT(31))
|
||||||
|
#define MCP_CLK_EN_V 0x1
|
||||||
|
#define MCP_CLK_EN_S 31
|
||||||
|
/* MCP_CRC_OUT_REVERSE_EN : R/W ;bitpos:[11] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_CRC_OUT_REVERSE_EN (BIT(11))
|
||||||
|
#define MCP_CRC_OUT_REVERSE_EN_M (BIT(11))
|
||||||
|
#define MCP_CRC_OUT_REVERSE_EN_V 0x1
|
||||||
|
#define MCP_CRC_OUT_REVERSE_EN_S 11
|
||||||
|
/* MCP_CRC_BIG_ENDIAN_EN : R/W ;bitpos:[10] ;default: 1'b0 ; */
|
||||||
|
/*description: Set this bit to reorder the bit of data which will be send to excute crc.*/
|
||||||
|
#define MCP_CRC_BIG_ENDIAN_EN (BIT(10))
|
||||||
|
#define MCP_CRC_BIG_ENDIAN_EN_M (BIT(10))
|
||||||
|
#define MCP_CRC_BIG_ENDIAN_EN_V 0x1
|
||||||
|
#define MCP_CRC_BIG_ENDIAN_EN_S 10
|
||||||
|
/* MCP_CRC_CAL_EN : R/W ;bitpos:[9] ;default: 1'b0 ; */
|
||||||
|
/*description: Set this bit enable crc calculation function.*/
|
||||||
|
#define MCP_CRC_CAL_EN (BIT(9))
|
||||||
|
#define MCP_CRC_CAL_EN_M (BIT(9))
|
||||||
|
#define MCP_CRC_CAL_EN_V 0x1
|
||||||
|
#define MCP_CRC_CAL_EN_S 9
|
||||||
|
/* MCP_CRC_CAL_RESET : R/W ;bitpos:[8] ;default: 1'b0 ; */
|
||||||
|
/*description: Set this bit to reset crc calculation.*/
|
||||||
|
#define MCP_CRC_CAL_RESET (BIT(8))
|
||||||
|
#define MCP_CRC_CAL_RESET_M (BIT(8))
|
||||||
|
#define MCP_CRC_CAL_RESET_V 0x1
|
||||||
|
#define MCP_CRC_CAL_RESET_S 8
|
||||||
|
/* MCP_CHECK_OWNER : R/W ;bitpos:[7] ;default: 1'b0 ; */
|
||||||
|
/*description: Set this bit to enable owner bit check in descriptor.*/
|
||||||
|
#define MCP_CHECK_OWNER (BIT(7))
|
||||||
|
#define MCP_CHECK_OWNER_M (BIT(7))
|
||||||
|
#define MCP_CHECK_OWNER_V 0x1
|
||||||
|
#define MCP_CHECK_OWNER_S 7
|
||||||
|
/* MCP_OUT_AUTO_WRBACK : R/W ;bitpos:[6] ;default: 1'b0 ; */
|
||||||
|
/*description: this bit is used to write back out descriptor when hardware has
|
||||||
|
already used this descriptor.*/
|
||||||
|
#define MCP_OUT_AUTO_WRBACK (BIT(6))
|
||||||
|
#define MCP_OUT_AUTO_WRBACK_M (BIT(6))
|
||||||
|
#define MCP_OUT_AUTO_WRBACK_V 0x1
|
||||||
|
#define MCP_OUT_AUTO_WRBACK_S 6
|
||||||
|
/* MCP_IN_OWNER : R/W ;bitpos:[5] ;default: 1'b0 ; */
|
||||||
|
/*description: This is used to configure the owner bit in IN descriptor.*/
|
||||||
|
#define MCP_IN_OWNER (BIT(5))
|
||||||
|
#define MCP_IN_OWNER_M (BIT(5))
|
||||||
|
#define MCP_IN_OWNER_V 0x1
|
||||||
|
#define MCP_IN_OWNER_S 5
|
||||||
|
/* MCP_OUT_OWNER : R/W ;bitpos:[4] ;default: 1'b0 ; */
|
||||||
|
/*description: This is used to configure the owner bit in OUT descriptor. This
|
||||||
|
is effective only when you set reg_out_auto_wrback.*/
|
||||||
|
#define MCP_OUT_OWNER (BIT(4))
|
||||||
|
#define MCP_OUT_OWNER_M (BIT(4))
|
||||||
|
#define MCP_OUT_OWNER_V 0x1
|
||||||
|
#define MCP_OUT_OWNER_S 4
|
||||||
|
/* MCP_FIFO_RST : R/W ;bitpos:[3] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_FIFO_RST (BIT(3))
|
||||||
|
#define MCP_FIFO_RST_M (BIT(3))
|
||||||
|
#define MCP_FIFO_RST_V 0x1
|
||||||
|
#define MCP_FIFO_RST_S 3
|
||||||
|
/* MCP_CMDFIFO_RST : R/W ;bitpos:[2] ;default: 1'b0 ; */
|
||||||
|
/*description: set this bit to reset in_cmdfifo and out_cmdfifo.*/
|
||||||
|
#define MCP_CMDFIFO_RST (BIT(2))
|
||||||
|
#define MCP_CMDFIFO_RST_M (BIT(2))
|
||||||
|
#define MCP_CMDFIFO_RST_V 0x1
|
||||||
|
#define MCP_CMDFIFO_RST_S 2
|
||||||
|
/* MCP_OUT_RST : R/W ;bitpos:[1] ;default: 1'b0 ; */
|
||||||
|
/*description: set this bit to reset out_inf state machine.*/
|
||||||
|
#define MCP_OUT_RST (BIT(1))
|
||||||
|
#define MCP_OUT_RST_M (BIT(1))
|
||||||
|
#define MCP_OUT_RST_V 0x1
|
||||||
|
#define MCP_OUT_RST_S 1
|
||||||
|
/* MCP_IN_RST : R/W ;bitpos:[0] ;default: 1'h0 ; */
|
||||||
|
/*description: set this bit to reset in_inf state machine.*/
|
||||||
|
#define MCP_IN_RST (BIT(0))
|
||||||
|
#define MCP_IN_RST_M (BIT(0))
|
||||||
|
#define MCP_IN_RST_V 0x1
|
||||||
|
#define MCP_IN_RST_S 0
|
||||||
|
|
||||||
|
#define MCP_IN_ST_REG (DR_REG_MCP_BASE + 0x0040)
|
||||||
|
/* MCP_FIFO_EMPTY : RO ;bitpos:[23] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_FIFO_EMPTY (BIT(23))
|
||||||
|
#define MCP_FIFO_EMPTY_M (BIT(23))
|
||||||
|
#define MCP_FIFO_EMPTY_V 0x1
|
||||||
|
#define MCP_FIFO_EMPTY_S 23
|
||||||
|
/* MCP_IN_STATE : RO ;bitpos:[22:20] ;default: 3'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_STATE 0x00000007
|
||||||
|
#define MCP_IN_STATE_M ((MCP_IN_STATE_V)<<(MCP_IN_STATE_S))
|
||||||
|
#define MCP_IN_STATE_V 0x7
|
||||||
|
#define MCP_IN_STATE_S 20
|
||||||
|
/* MCP_IN_DSCR_STATE : RO ;bitpos:[19:18] ;default: 2'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_IN_DSCR_STATE 0x00000003
|
||||||
|
#define MCP_IN_DSCR_STATE_M ((MCP_IN_DSCR_STATE_V)<<(MCP_IN_DSCR_STATE_S))
|
||||||
|
#define MCP_IN_DSCR_STATE_V 0x3
|
||||||
|
#define MCP_IN_DSCR_STATE_S 18
|
||||||
|
/* MCP_INLINK_DSCR_ADDR : RO ;bitpos:[17:0] ;default: 18'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_INLINK_DSCR_ADDR 0x0003FFFF
|
||||||
|
#define MCP_INLINK_DSCR_ADDR_M ((MCP_INLINK_DSCR_ADDR_V)<<(MCP_INLINK_DSCR_ADDR_S))
|
||||||
|
#define MCP_INLINK_DSCR_ADDR_V 0x3FFFF
|
||||||
|
#define MCP_INLINK_DSCR_ADDR_S 0
|
||||||
|
|
||||||
|
#define MCP_OUT_ST_REG (DR_REG_MCP_BASE + 0x0044)
|
||||||
|
/* MCP_FIFO_FULL : RO ;bitpos:[23] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_FIFO_FULL (BIT(23))
|
||||||
|
#define MCP_FIFO_FULL_M (BIT(23))
|
||||||
|
#define MCP_FIFO_FULL_V 0x1
|
||||||
|
#define MCP_FIFO_FULL_S 23
|
||||||
|
/* MCP_OUT_STATE : RO ;bitpos:[22:20] ;default: 3'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_STATE 0x00000007
|
||||||
|
#define MCP_OUT_STATE_M ((MCP_OUT_STATE_V)<<(MCP_OUT_STATE_S))
|
||||||
|
#define MCP_OUT_STATE_V 0x7
|
||||||
|
#define MCP_OUT_STATE_S 20
|
||||||
|
/* MCP_OUT_DSCR_STATE : RO ;bitpos:[19:18] ;default: 2'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUT_DSCR_STATE 0x00000003
|
||||||
|
#define MCP_OUT_DSCR_STATE_M ((MCP_OUT_DSCR_STATE_V)<<(MCP_OUT_DSCR_STATE_S))
|
||||||
|
#define MCP_OUT_DSCR_STATE_V 0x3
|
||||||
|
#define MCP_OUT_DSCR_STATE_S 18
|
||||||
|
/* MCP_OUTLINK_DSCR_ADDR : RO ;bitpos:[17:0] ;default: 18'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_OUTLINK_DSCR_ADDR 0x0003FFFF
|
||||||
|
#define MCP_OUTLINK_DSCR_ADDR_M ((MCP_OUTLINK_DSCR_ADDR_V)<<(MCP_OUTLINK_DSCR_ADDR_S))
|
||||||
|
#define MCP_OUTLINK_DSCR_ADDR_V 0x3FFFF
|
||||||
|
#define MCP_OUTLINK_DSCR_ADDR_S 0
|
||||||
|
|
||||||
|
#define MCP_CRC_OUT_REG (DR_REG_MCP_BASE + 0x0048)
|
||||||
|
/* MCP_CRC_RESULT : RO ;bitpos:[31:0] ;default: 32'h0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_CRC_RESULT 0xFFFFFFFF
|
||||||
|
#define MCP_CRC_RESULT_M ((MCP_CRC_RESULT_V)<<(MCP_CRC_RESULT_S))
|
||||||
|
#define MCP_CRC_RESULT_V 0xFFFFFFFF
|
||||||
|
#define MCP_CRC_RESULT_S 0
|
||||||
|
|
||||||
|
#define MCP_DATE_REG (DR_REG_MCP_BASE + 0x00fc)
|
||||||
|
/* MCP_DMA_DATE : R/W ;bitpos:[31:0] ;default: 32'h18082000 ; */
|
||||||
|
/*description: */
|
||||||
|
#define MCP_DMA_DATE 0xFFFFFFFF
|
||||||
|
#define MCP_DMA_DATE_M ((MCP_DMA_DATE_V)<<(MCP_DMA_DATE_S))
|
||||||
|
#define MCP_DMA_DATE_V 0xFFFFFFFF
|
||||||
|
#define MCP_DMA_DATE_S 0
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /*_SOC_MCP_REG_H_ */
|
||||||
|
|
||||||
|
|
203
components/soc/soc/esp32s2/include/soc/mcp_struct.h
Normal file
203
components/soc/soc/esp32s2/include/soc/mcp_struct.h
Normal file
|
@ -0,0 +1,203 @@
|
||||||
|
// Copyright 2017-2020 Espressif Systems (Shanghai) PTE LTD
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
#ifndef _SOC_MCP_STRUCT_H_
|
||||||
|
#define _SOC_MCP_STRUCT_H_
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef volatile struct {
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t in_done: 1;
|
||||||
|
uint32_t in_suc_eof: 1;
|
||||||
|
uint32_t out_done: 1;
|
||||||
|
uint32_t out_eof: 1;
|
||||||
|
uint32_t in_dscr_err: 1;
|
||||||
|
uint32_t out_dscr_err: 1;
|
||||||
|
uint32_t in_dscr_empty: 1;
|
||||||
|
uint32_t out_total_eof: 1;
|
||||||
|
uint32_t crc_done: 1;
|
||||||
|
uint32_t reserved9: 23;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} int_raw;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t in_done: 1;
|
||||||
|
uint32_t in_suc_eof: 1;
|
||||||
|
uint32_t out_done: 1;
|
||||||
|
uint32_t out_eof: 1;
|
||||||
|
uint32_t in_dscr_err: 1;
|
||||||
|
uint32_t out_dscr_err: 1;
|
||||||
|
uint32_t in_dscr_empty: 1;
|
||||||
|
uint32_t out_total_eof: 1;
|
||||||
|
uint32_t crc_done: 1;
|
||||||
|
uint32_t reserved9: 23;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} int_st;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t in_done: 1;
|
||||||
|
uint32_t in_suc_eof: 1;
|
||||||
|
uint32_t out_done: 1;
|
||||||
|
uint32_t out_eof: 1;
|
||||||
|
uint32_t in_dscr_err: 1;
|
||||||
|
uint32_t out_dscr_err: 1;
|
||||||
|
uint32_t in_dscr_empty: 1;
|
||||||
|
uint32_t out_total_eof: 1;
|
||||||
|
uint32_t crc_done: 1;
|
||||||
|
uint32_t reserved9: 23;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} int_ena;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t in_done: 1;
|
||||||
|
uint32_t in_suc_eof: 1;
|
||||||
|
uint32_t out_done: 1;
|
||||||
|
uint32_t out_eof: 1;
|
||||||
|
uint32_t in_dscr_err: 1;
|
||||||
|
uint32_t out_dscr_err: 1;
|
||||||
|
uint32_t in_dscr_empty: 1;
|
||||||
|
uint32_t out_total_eof: 1;
|
||||||
|
uint32_t crc_done: 1;
|
||||||
|
uint32_t reserved9: 23;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} int_clr;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t addr: 20;
|
||||||
|
uint32_t reserved20: 8;
|
||||||
|
uint32_t stop: 1;
|
||||||
|
uint32_t start: 1;
|
||||||
|
uint32_t restart: 1;
|
||||||
|
uint32_t park: 1;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} out_link;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t addr: 20;
|
||||||
|
uint32_t reserved20: 8;
|
||||||
|
uint32_t stop: 1;
|
||||||
|
uint32_t start: 1;
|
||||||
|
uint32_t restart: 1;
|
||||||
|
uint32_t park: 1;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} in_link;
|
||||||
|
uint32_t out_eof_des_addr; /**/
|
||||||
|
uint32_t in_eof_des_addr; /**/
|
||||||
|
uint32_t out_eof_bfr_des_addr; /**/
|
||||||
|
uint32_t inlink_dscr; /**/
|
||||||
|
uint32_t inlink_dscr_bf0; /**/
|
||||||
|
uint32_t inlink_dscr_bf1; /**/
|
||||||
|
uint32_t outlink_dscr; /**/
|
||||||
|
uint32_t outlink_dscr_bf0; /**/
|
||||||
|
uint32_t outlink_dscr_bf1; /**/
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t in_rst: 1; /*set this bit to reset in_inf state machine.*/
|
||||||
|
uint32_t out_rst: 1; /*set this bit to reset out_inf state machine.*/
|
||||||
|
uint32_t cmdfifo_rst: 1; /*set this bit to reset in_cmdfifo and out_cmdfifo.*/
|
||||||
|
uint32_t fifo_rst: 1;
|
||||||
|
uint32_t out_owner: 1; /*This is used to configure the owner bit in OUT descriptor. This is effective only when you set reg_out_auto_wrback.*/
|
||||||
|
uint32_t in_owner: 1; /*This is used to configure the owner bit in IN descriptor.*/
|
||||||
|
uint32_t out_auto_wrback: 1; /*this bit is used to write back out descriptor when hardware has already used this descriptor.*/
|
||||||
|
uint32_t check_owner: 1; /*Set this bit to enable owner bit check in descriptor.*/
|
||||||
|
uint32_t crc_cal_reset: 1; /*Set this bit to reset crc calculation.*/
|
||||||
|
uint32_t crc_cal_en: 1; /*Set this bit enable crc calculation function.*/
|
||||||
|
uint32_t crc_big_endian_en: 1; /*Set this bit to reorder the bit of data which will be send to excute crc.*/
|
||||||
|
uint32_t crc_out_reverse_en: 1;
|
||||||
|
uint32_t reserved12: 19;
|
||||||
|
uint32_t clk_en: 1;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} conf;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t dscr_addr: 18;
|
||||||
|
uint32_t dscr_state: 2;
|
||||||
|
uint32_t state: 3;
|
||||||
|
uint32_t fifo_empty: 1;
|
||||||
|
uint32_t reserved24: 8;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} in_st;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t dscr_addr: 18;
|
||||||
|
uint32_t dscr_state: 2;
|
||||||
|
uint32_t state: 3;
|
||||||
|
uint32_t fifo_full: 1;
|
||||||
|
uint32_t reserved24: 8;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} out_st;
|
||||||
|
uint32_t crc_out; /**/
|
||||||
|
uint32_t reserved_4c;
|
||||||
|
uint32_t reserved_50;
|
||||||
|
uint32_t reserved_54;
|
||||||
|
uint32_t reserved_58;
|
||||||
|
uint32_t reserved_5c;
|
||||||
|
uint32_t reserved_60;
|
||||||
|
uint32_t reserved_64;
|
||||||
|
uint32_t reserved_68;
|
||||||
|
uint32_t reserved_6c;
|
||||||
|
uint32_t reserved_70;
|
||||||
|
uint32_t reserved_74;
|
||||||
|
uint32_t reserved_78;
|
||||||
|
uint32_t reserved_7c;
|
||||||
|
uint32_t reserved_80;
|
||||||
|
uint32_t reserved_84;
|
||||||
|
uint32_t reserved_88;
|
||||||
|
uint32_t reserved_8c;
|
||||||
|
uint32_t reserved_90;
|
||||||
|
uint32_t reserved_94;
|
||||||
|
uint32_t reserved_98;
|
||||||
|
uint32_t reserved_9c;
|
||||||
|
uint32_t reserved_a0;
|
||||||
|
uint32_t reserved_a4;
|
||||||
|
uint32_t reserved_a8;
|
||||||
|
uint32_t reserved_ac;
|
||||||
|
uint32_t reserved_b0;
|
||||||
|
uint32_t reserved_b4;
|
||||||
|
uint32_t reserved_b8;
|
||||||
|
uint32_t reserved_bc;
|
||||||
|
uint32_t reserved_c0;
|
||||||
|
uint32_t reserved_c4;
|
||||||
|
uint32_t reserved_c8;
|
||||||
|
uint32_t reserved_cc;
|
||||||
|
uint32_t reserved_d0;
|
||||||
|
uint32_t reserved_d4;
|
||||||
|
uint32_t reserved_d8;
|
||||||
|
uint32_t reserved_dc;
|
||||||
|
uint32_t reserved_e0;
|
||||||
|
uint32_t reserved_e4;
|
||||||
|
uint32_t reserved_e8;
|
||||||
|
uint32_t reserved_ec;
|
||||||
|
uint32_t reserved_f0;
|
||||||
|
uint32_t reserved_f4;
|
||||||
|
uint32_t reserved_f8;
|
||||||
|
uint32_t date; /**/
|
||||||
|
} mcp_dev_t;
|
||||||
|
extern mcp_dev_t MCP;
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _SOC_MCP_STRUCT_H_ */
|
|
@ -13,9 +13,6 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
#ifndef _SOC_RTC_CNTL_STRUCT_H_
|
#ifndef _SOC_RTC_CNTL_STRUCT_H_
|
||||||
#define _SOC_RTC_CNTL_STRUCT_H_
|
#define _SOC_RTC_CNTL_STRUCT_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -37,15 +34,8 @@ typedef volatile struct {
|
||||||
uint32_t bbpll_force_pu: 1; /*BB_PLL force power up*/
|
uint32_t bbpll_force_pu: 1; /*BB_PLL force power up*/
|
||||||
uint32_t xtl_force_pd: 1; /*crystall force power down*/
|
uint32_t xtl_force_pd: 1; /*crystall force power down*/
|
||||||
uint32_t xtl_force_pu: 1; /*crystall force power up*/
|
uint32_t xtl_force_pu: 1; /*crystall force power up*/
|
||||||
uint32_t bias_sleep_folw_8m: 1; /*BIAS_SLEEP follow CK8M*/
|
uint32_t xtl_en_wait: 4; /*wait bias_sleep and current source wakeup*/
|
||||||
uint32_t bias_force_sleep: 1; /*BIAS_SLEEP force sleep*/
|
uint32_t reserved18: 5;
|
||||||
uint32_t bias_force_nosleep: 1; /*BIAS_SLEEP force no sleep*/
|
|
||||||
uint32_t bias_i2c_folw_8m: 1; /*BIAS_I2C follow CK8M*/
|
|
||||||
uint32_t bias_i2c_force_pd: 1; /*BIAS_I2C force power down*/
|
|
||||||
uint32_t bias_i2c_force_pu: 1; /*BIAS_I2C force power up*/
|
|
||||||
uint32_t bias_core_folw_8m: 1; /*BIAS_CORE follow CK8M*/
|
|
||||||
uint32_t bias_core_force_pd: 1; /*BIAS_CORE force power down*/
|
|
||||||
uint32_t bias_core_force_pu: 1; /*BIAS_CORE force power up*/
|
|
||||||
uint32_t xtl_force_iso: 1;
|
uint32_t xtl_force_iso: 1;
|
||||||
uint32_t pll_force_iso: 1;
|
uint32_t pll_force_iso: 1;
|
||||||
uint32_t analog_force_iso: 1;
|
uint32_t analog_force_iso: 1;
|
||||||
|
@ -155,7 +145,12 @@ typedef volatile struct {
|
||||||
} timer6;
|
} timer6;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t reserved0: 23;
|
uint32_t reserved0: 18;
|
||||||
|
uint32_t i2c_reset_por_force_pd: 1;
|
||||||
|
uint32_t i2c_reset_por_force_pu: 1;
|
||||||
|
uint32_t glitch_rst_en: 1;
|
||||||
|
uint32_t sar_i2c_force_pd: 1; /*PLLA force power down*/
|
||||||
|
uint32_t sar_i2c_force_pu: 1; /*PLLA force power up*/
|
||||||
uint32_t plla_force_pd: 1; /*PLLA force power down*/
|
uint32_t plla_force_pd: 1; /*PLLA force power down*/
|
||||||
uint32_t plla_force_pu: 1; /*PLLA force power up*/
|
uint32_t plla_force_pu: 1; /*PLLA force power up*/
|
||||||
uint32_t bbpll_cal_slp_start: 1; /*start BBPLL calibration during sleep*/
|
uint32_t bbpll_cal_slp_start: 1; /*start BBPLL calibration during sleep*/
|
||||||
|
@ -180,10 +175,8 @@ typedef volatile struct {
|
||||||
} reset_state;
|
} reset_state;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t wakeup_cause: 15; /*wakeup cause*/
|
uint32_t reserved0: 15;
|
||||||
uint32_t rtc_wakeup_ena: 15; /*wakeup enable bitmap*/
|
uint32_t rtc_wakeup_ena:17; /*wakeup enable bitmap*/
|
||||||
uint32_t gpio_wakeup_filter: 1; /*enable filter for gpio wakeup event*/
|
|
||||||
uint32_t reserved31: 1;
|
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} wakeup_state;
|
} wakeup_state;
|
||||||
|
@ -193,7 +186,7 @@ typedef volatile struct {
|
||||||
uint32_t slp_reject: 1; /*enable sleep reject interrupt*/
|
uint32_t slp_reject: 1; /*enable sleep reject interrupt*/
|
||||||
uint32_t sdio_idle: 1; /*enable SDIO idle interrupt*/
|
uint32_t sdio_idle: 1; /*enable SDIO idle interrupt*/
|
||||||
uint32_t rtc_wdt: 1; /*enable RTC WDT interrupt*/
|
uint32_t rtc_wdt: 1; /*enable RTC WDT interrupt*/
|
||||||
uint32_t reserved4: 1;
|
uint32_t rtc_touch_scan_done: 1; /*enable touch scan done interrupt*/
|
||||||
uint32_t rtc_ulp_cp: 1; /*enable ULP-coprocessor interrupt*/
|
uint32_t rtc_ulp_cp: 1; /*enable ULP-coprocessor interrupt*/
|
||||||
uint32_t rtc_touch_done: 1; /*enable touch done interrupt*/
|
uint32_t rtc_touch_done: 1; /*enable touch done interrupt*/
|
||||||
uint32_t rtc_touch_active: 1; /*enable touch active interrupt*/
|
uint32_t rtc_touch_active: 1; /*enable touch active interrupt*/
|
||||||
|
@ -205,9 +198,11 @@ typedef volatile struct {
|
||||||
uint32_t rtc_cocpu: 1; /*enable riscV cocpu interrupt*/
|
uint32_t rtc_cocpu: 1; /*enable riscV cocpu interrupt*/
|
||||||
uint32_t rtc_saradc2: 1; /*enable saradc2 interrupt*/
|
uint32_t rtc_saradc2: 1; /*enable saradc2 interrupt*/
|
||||||
uint32_t rtc_swd: 1; /*enable super watch dog interrupt*/
|
uint32_t rtc_swd: 1; /*enable super watch dog interrupt*/
|
||||||
uint32_t rtc_xtal32k_dead: 1; /*enable cocpu trap interrupt*/
|
uint32_t rtc_xtal32k_dead: 1; /*enable xtal32k_dead interrupt*/
|
||||||
uint32_t rtc_cocpu_trap: 1;
|
uint32_t rtc_cocpu_trap: 1; /*enable cocpu trap interrupt*/
|
||||||
uint32_t reserved18: 14;
|
uint32_t rtc_touch_timeout: 1; /*enable touch timeout interrupt*/
|
||||||
|
uint32_t rtc_glitch_det: 1; /*enbale gitch det interrupt*/
|
||||||
|
uint32_t reserved20: 12;
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} int_ena;
|
} int_ena;
|
||||||
|
@ -217,7 +212,7 @@ typedef volatile struct {
|
||||||
uint32_t slp_reject: 1; /*sleep reject interrupt raw*/
|
uint32_t slp_reject: 1; /*sleep reject interrupt raw*/
|
||||||
uint32_t sdio_idle: 1; /*SDIO idle interrupt raw*/
|
uint32_t sdio_idle: 1; /*SDIO idle interrupt raw*/
|
||||||
uint32_t rtc_wdt: 1; /*RTC WDT interrupt raw*/
|
uint32_t rtc_wdt: 1; /*RTC WDT interrupt raw*/
|
||||||
uint32_t reserved4: 1;
|
uint32_t rtc_touch_scan_done: 1;
|
||||||
uint32_t rtc_ulp_cp: 1; /*ULP-coprocessor interrupt raw*/
|
uint32_t rtc_ulp_cp: 1; /*ULP-coprocessor interrupt raw*/
|
||||||
uint32_t rtc_touch_done: 1; /*touch interrupt raw*/
|
uint32_t rtc_touch_done: 1; /*touch interrupt raw*/
|
||||||
uint32_t rtc_touch_active: 1; /*touch active interrupt raw*/
|
uint32_t rtc_touch_active: 1; /*touch active interrupt raw*/
|
||||||
|
@ -231,7 +226,9 @@ typedef volatile struct {
|
||||||
uint32_t rtc_swd: 1; /*super watch dog interrupt raw*/
|
uint32_t rtc_swd: 1; /*super watch dog interrupt raw*/
|
||||||
uint32_t rtc_xtal32k_dead: 1; /*xtal32k dead detection interrupt raw*/
|
uint32_t rtc_xtal32k_dead: 1; /*xtal32k dead detection interrupt raw*/
|
||||||
uint32_t rtc_cocpu_trap: 1; /*cocpu trap interrupt raw*/
|
uint32_t rtc_cocpu_trap: 1; /*cocpu trap interrupt raw*/
|
||||||
uint32_t reserved18: 14;
|
uint32_t rtc_touch_timeout: 1; /*touch timeout interrupt raw*/
|
||||||
|
uint32_t rtc_glitch_det: 1; /*glitch_det_interrupt_raw*/
|
||||||
|
uint32_t reserved20: 12;
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} int_raw;
|
} int_raw;
|
||||||
|
@ -241,7 +238,7 @@ typedef volatile struct {
|
||||||
uint32_t slp_reject: 1; /*sleep reject interrupt state*/
|
uint32_t slp_reject: 1; /*sleep reject interrupt state*/
|
||||||
uint32_t sdio_idle: 1; /*SDIO idle interrupt state*/
|
uint32_t sdio_idle: 1; /*SDIO idle interrupt state*/
|
||||||
uint32_t rtc_wdt: 1; /*RTC WDT interrupt state*/
|
uint32_t rtc_wdt: 1; /*RTC WDT interrupt state*/
|
||||||
uint32_t reserved4: 1;
|
uint32_t rtc_touch_scan_done: 1;
|
||||||
uint32_t rtc_ulp_cp: 1; /*ULP-coprocessor interrupt state*/
|
uint32_t rtc_ulp_cp: 1; /*ULP-coprocessor interrupt state*/
|
||||||
uint32_t rtc_touch_done: 1; /*touch done interrupt state*/
|
uint32_t rtc_touch_done: 1; /*touch done interrupt state*/
|
||||||
uint32_t rtc_touch_active: 1; /*touch active interrupt state*/
|
uint32_t rtc_touch_active: 1; /*touch active interrupt state*/
|
||||||
|
@ -255,7 +252,9 @@ typedef volatile struct {
|
||||||
uint32_t rtc_swd: 1; /*super watch dog interrupt state*/
|
uint32_t rtc_swd: 1; /*super watch dog interrupt state*/
|
||||||
uint32_t rtc_xtal32k_dead: 1; /*xtal32k dead detection interrupt state*/
|
uint32_t rtc_xtal32k_dead: 1; /*xtal32k dead detection interrupt state*/
|
||||||
uint32_t rtc_cocpu_trap: 1; /*cocpu trap interrupt state*/
|
uint32_t rtc_cocpu_trap: 1; /*cocpu trap interrupt state*/
|
||||||
uint32_t reserved18: 14;
|
uint32_t rtc_touch_timeout: 1; /*Touch timeout interrupt state*/
|
||||||
|
uint32_t rtc_glitch_det: 1; /*glitch_det_interrupt state*/
|
||||||
|
uint32_t reserved20: 12;
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} int_st;
|
} int_st;
|
||||||
|
@ -265,7 +264,7 @@ typedef volatile struct {
|
||||||
uint32_t slp_reject: 1; /*Clear sleep reject interrupt state*/
|
uint32_t slp_reject: 1; /*Clear sleep reject interrupt state*/
|
||||||
uint32_t sdio_idle: 1; /*Clear SDIO idle interrupt state*/
|
uint32_t sdio_idle: 1; /*Clear SDIO idle interrupt state*/
|
||||||
uint32_t rtc_wdt: 1; /*Clear RTC WDT interrupt state*/
|
uint32_t rtc_wdt: 1; /*Clear RTC WDT interrupt state*/
|
||||||
uint32_t reserved4: 1;
|
uint32_t rtc_touch_scan_done: 1;
|
||||||
uint32_t rtc_ulp_cp: 1; /*Clear ULP-coprocessor interrupt state*/
|
uint32_t rtc_ulp_cp: 1; /*Clear ULP-coprocessor interrupt state*/
|
||||||
uint32_t rtc_touch_done: 1; /*Clear touch done interrupt state*/
|
uint32_t rtc_touch_done: 1; /*Clear touch done interrupt state*/
|
||||||
uint32_t rtc_touch_active: 1; /*Clear touch active interrupt state*/
|
uint32_t rtc_touch_active: 1; /*Clear touch active interrupt state*/
|
||||||
|
@ -279,7 +278,9 @@ typedef volatile struct {
|
||||||
uint32_t rtc_swd: 1; /*Clear super watch dog interrupt state*/
|
uint32_t rtc_swd: 1; /*Clear super watch dog interrupt state*/
|
||||||
uint32_t rtc_xtal32k_dead: 1; /*Clear RTC WDT interrupt state*/
|
uint32_t rtc_xtal32k_dead: 1; /*Clear RTC WDT interrupt state*/
|
||||||
uint32_t rtc_cocpu_trap: 1; /*Clear cocpu trap interrupt state*/
|
uint32_t rtc_cocpu_trap: 1; /*Clear cocpu trap interrupt state*/
|
||||||
uint32_t reserved18: 14;
|
uint32_t rtc_touch_timeout: 1; /*Clear touch timeout interrupt state*/
|
||||||
|
uint32_t rtc_glitch_det: 1; /*Clear glitch det interrupt state*/
|
||||||
|
uint32_t reserved20: 12;
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} int_clr;
|
} int_clr;
|
||||||
|
@ -299,7 +300,8 @@ typedef volatile struct {
|
||||||
uint32_t dgm_xtal_32k: 3; /*xtal_32k gm control*/
|
uint32_t dgm_xtal_32k: 3; /*xtal_32k gm control*/
|
||||||
uint32_t dres_xtal_32k: 3; /*DRES_XTAL_32K*/
|
uint32_t dres_xtal_32k: 3; /*DRES_XTAL_32K*/
|
||||||
uint32_t xpd_xtal_32k: 1; /*XPD_XTAL_32K*/
|
uint32_t xpd_xtal_32k: 1; /*XPD_XTAL_32K*/
|
||||||
uint32_t dac_xtal_32k: 6; /*DAC_XTAL_32K*/
|
uint32_t dac_xtal_32k: 3; /*DAC_XTAL_32K*/
|
||||||
|
uint32_t rtc_wdt_state: 3; /*state of 32k_wdt*/
|
||||||
uint32_t rtc_xtal32k_gpio_sel: 1; /*XTAL_32K sel. 0: external XTAL_32K 1: CLK from RTC pad X32P_C*/
|
uint32_t rtc_xtal32k_gpio_sel: 1; /*XTAL_32K sel. 0: external XTAL_32K 1: CLK from RTC pad X32P_C*/
|
||||||
uint32_t reserved24: 6;
|
uint32_t reserved24: 6;
|
||||||
uint32_t ctr_lv: 1; /*0: power down XTAL at high level 1: power down XTAL at low level*/
|
uint32_t ctr_lv: 1; /*0: power down XTAL at high level 1: power down XTAL at low level*/
|
||||||
|
@ -309,7 +311,8 @@ typedef volatile struct {
|
||||||
} ext_xtl_conf;
|
} ext_xtl_conf;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t reserved0: 30;
|
uint32_t reserved0: 29;
|
||||||
|
uint32_t gpio_wakeup_filter: 1; /*enable filter for gpio wakeup event*/
|
||||||
uint32_t wakeup0_lv: 1; /*0: external wakeup at low level 1: external wakeup at high level*/
|
uint32_t wakeup0_lv: 1; /*0: external wakeup at low level 1: external wakeup at high level*/
|
||||||
uint32_t wakeup1_lv: 1;
|
uint32_t wakeup1_lv: 1;
|
||||||
};
|
};
|
||||||
|
@ -317,8 +320,8 @@ typedef volatile struct {
|
||||||
} ext_wakeup_conf;
|
} ext_wakeup_conf;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t reject_cause: 15; /*sleep reject cause*/
|
uint32_t reserved0: 13;
|
||||||
uint32_t rtc_sleep_reject_ena:15; /*sleep reject enable*/
|
uint32_t rtc_sleep_reject_ena:17; /*sleep reject enable*/
|
||||||
uint32_t light_slp_reject_en: 1; /*enable reject for light sleep*/
|
uint32_t light_slp_reject_en: 1; /*enable reject for light sleep*/
|
||||||
uint32_t deep_slp_reject_en: 1; /*enable reject for deep sleep*/
|
uint32_t deep_slp_reject_en: 1; /*enable reject for deep sleep*/
|
||||||
};
|
};
|
||||||
|
@ -395,8 +398,17 @@ typedef volatile struct {
|
||||||
} sdio_conf;
|
} sdio_conf;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t reserved0: 22;
|
uint32_t reserved0: 10;
|
||||||
uint32_t dbg_atten: 4; /*DBG_ATTEN*/
|
uint32_t bias_buf_idle: 1;
|
||||||
|
uint32_t bias_buf_wake: 1;
|
||||||
|
uint32_t bias_buf_deep_slp: 1;
|
||||||
|
uint32_t bias_buf_monitor: 1;
|
||||||
|
uint32_t pd_cur_deep_slp: 1; /*xpd cur when rtc in sleep_state*/
|
||||||
|
uint32_t pd_cur_monitor: 1; /*xpd cur when rtc in monitor state*/
|
||||||
|
uint32_t bias_sleep_deep_slp: 1; /*bias_sleep when rtc in sleep_state*/
|
||||||
|
uint32_t bias_sleep_monitor: 1; /*bias_sleep when rtc in monitor state*/
|
||||||
|
uint32_t dbg_atten_deep_slp: 4; /*DBG_ATTEN when rtc in sleep state*/
|
||||||
|
uint32_t dbg_atten_monitor: 4; /*DBG_ATTEN when rtc in monitor state*/
|
||||||
uint32_t enb_sck_xtal: 1; /*ENB_SCK_XTAL*/
|
uint32_t enb_sck_xtal: 1; /*ENB_SCK_XTAL*/
|
||||||
uint32_t inc_heartbeat_refresh: 1; /*INC_HEARTBEAT_REFRESH*/
|
uint32_t inc_heartbeat_refresh: 1; /*INC_HEARTBEAT_REFRESH*/
|
||||||
uint32_t dec_heartbeat_period: 1; /*DEC_HEARTBEAT_PERIOD*/
|
uint32_t dec_heartbeat_period: 1; /*DEC_HEARTBEAT_PERIOD*/
|
||||||
|
@ -659,7 +671,8 @@ typedef volatile struct {
|
||||||
uint32_t pd_rf_ena: 1; /*enable power down RF when brown out happens*/
|
uint32_t pd_rf_ena: 1; /*enable power down RF when brown out happens*/
|
||||||
uint32_t rst_wait: 10; /*brown out reset wait cycles*/
|
uint32_t rst_wait: 10; /*brown out reset wait cycles*/
|
||||||
uint32_t rst_ena: 1; /*enable brown out reset*/
|
uint32_t rst_ena: 1; /*enable brown out reset*/
|
||||||
uint32_t reserved27: 2;
|
uint32_t rst_sel: 1; /*1: 4-pos reset*/
|
||||||
|
uint32_t reserved28: 1;
|
||||||
uint32_t cnt_clr: 1; /*clear brown out counter*/
|
uint32_t cnt_clr: 1; /*clear brown out counter*/
|
||||||
uint32_t ena: 1; /*enable brown out*/
|
uint32_t ena: 1; /*enable brown out*/
|
||||||
uint32_t det: 1;
|
uint32_t det: 1;
|
||||||
|
@ -687,9 +700,7 @@ typedef volatile struct {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t ulp_cp_pc_init: 11; /*ULP-coprocessor PC initial address*/
|
uint32_t ulp_cp_pc_init: 11; /*ULP-coprocessor PC initial address*/
|
||||||
uint32_t reserved11: 1;
|
uint32_t reserved11: 18;
|
||||||
uint32_t ulp_cp_timer_slp_cycle:16; /*sleep cycles for ULP-coprocessor timer*/
|
|
||||||
uint32_t reserved28: 1;
|
|
||||||
uint32_t ulp_cp_gpio_wakeup_ena: 1; /*ULP-coprocessor wakeup by GPIO enable*/
|
uint32_t ulp_cp_gpio_wakeup_ena: 1; /*ULP-coprocessor wakeup by GPIO enable*/
|
||||||
uint32_t ulp_cp_gpio_wakeup_clr: 1; /*ULP-coprocessor wakeup by GPIO state clear*/
|
uint32_t ulp_cp_gpio_wakeup_clr: 1; /*ULP-coprocessor wakeup by GPIO state clear*/
|
||||||
uint32_t ulp_cp_slp_timer_en: 1; /*ULP-coprocessor timer enable bit*/
|
uint32_t ulp_cp_slp_timer_en: 1; /*ULP-coprocessor timer enable bit*/
|
||||||
|
@ -715,13 +726,13 @@ typedef volatile struct {
|
||||||
uint32_t cocpu_start_2_reset_dis: 6; /*time from start cocpu to pull down reset*/
|
uint32_t cocpu_start_2_reset_dis: 6; /*time from start cocpu to pull down reset*/
|
||||||
uint32_t cocpu_start_2_intr_en: 6; /*time from start cocpu to give start interrupt*/
|
uint32_t cocpu_start_2_intr_en: 6; /*time from start cocpu to give start interrupt*/
|
||||||
uint32_t cocpu_shut: 1; /*to shut cocpu*/
|
uint32_t cocpu_shut: 1; /*to shut cocpu*/
|
||||||
uint32_t cocpu_shut_2_clk_dis: 6; /*time from shut cocpu to disable clk*/
|
uint32_t cocpu_shut_2_clk_dis: 8; /*time from shut cocpu to disable clk*/
|
||||||
uint32_t cocpu_shut_reset_en: 1; /*to reset cocpu*/
|
uint32_t cocpu_shut_reset_en: 1; /*to reset cocpu*/
|
||||||
uint32_t cocpu_sel: 1; /*1: old ULP 0: new riscV*/
|
uint32_t cocpu_sel: 1; /*1: old ULP 0: new riscV*/
|
||||||
uint32_t cocpu_done_force: 1; /*1: select riscv done 0: select ulp done*/
|
uint32_t cocpu_done_force: 1; /*1: select riscv done 0: select ulp done*/
|
||||||
uint32_t cocpu_done: 1; /*done signal used by riscv to control timer.*/
|
uint32_t cocpu_done: 1; /*done signal used by riscv to control timer.*/
|
||||||
uint32_t cocpu_sw_int_trigger: 1; /*trigger cocpu register interrupt*/
|
uint32_t cocpu_sw_int_trigger: 1; /*trigger cocpu register interrupt*/
|
||||||
uint32_t reserved25: 7;
|
uint32_t reserved27: 5;
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} cocpu_ctrl;
|
} cocpu_ctrl;
|
||||||
|
@ -740,14 +751,14 @@ typedef volatile struct {
|
||||||
uint32_t touch_drefh: 2; /*TOUCH_DREFH*/
|
uint32_t touch_drefh: 2; /*TOUCH_DREFH*/
|
||||||
uint32_t touch_xpd_bias: 1; /*TOUCH_XPD_BIAS*/
|
uint32_t touch_xpd_bias: 1; /*TOUCH_XPD_BIAS*/
|
||||||
uint32_t touch_refc: 3; /*TOUCH pad0 reference cap*/
|
uint32_t touch_refc: 3; /*TOUCH pad0 reference cap*/
|
||||||
uint32_t reserved12: 1;
|
uint32_t touch_dbias: 1; /*1:use self bias 0:use bandgap bias*/
|
||||||
uint32_t touch_slp_timer_en: 1; /*touch timer enable bit*/
|
uint32_t touch_slp_timer_en: 1; /*touch timer enable bit*/
|
||||||
uint32_t touch_start_fsm_en: 1; /*1: TOUCH_START & TOUCH_XPD is controlled by touch fsm*/
|
uint32_t touch_start_fsm_en: 1; /*1: TOUCH_START & TOUCH_XPD is controlled by touch fsm*/
|
||||||
uint32_t touch_start_en: 1; /*1: start touch fsm*/
|
uint32_t touch_start_en: 1; /*1: start touch fsm*/
|
||||||
uint32_t touch_start_force: 1; /*1: to start touch fsm by SW*/
|
uint32_t touch_start_force: 1; /*1: to start touch fsm by SW*/
|
||||||
uint32_t touch_xpd_wait: 8; /*the waiting cycles (in 8MHz) between TOUCH_START and TOUCH_XPD*/
|
uint32_t touch_xpd_wait: 8; /*the waiting cycles (in 8MHz) between TOUCH_START and TOUCH_XPD*/
|
||||||
uint32_t touch_slp_cyc_div: 2; /*when a touch pad is active sleep cycle could be divided by this number*/
|
uint32_t touch_slp_cyc_div: 2; /*when a touch pad is active sleep cycle could be divided by this number*/
|
||||||
uint32_t reserved27: 2;
|
uint32_t touch_timer_force_done: 2; /*force touch timer done*/
|
||||||
uint32_t touch_reset: 1; /*reset upgrade touch*/
|
uint32_t touch_reset: 1; /*reset upgrade touch*/
|
||||||
uint32_t touch_clk_fo: 1; /*touch clock force on*/
|
uint32_t touch_clk_fo: 1; /*touch clock force on*/
|
||||||
uint32_t touch_clkgate_en: 1; /*touch clock enable*/
|
uint32_t touch_clkgate_en: 1; /*touch clock enable*/
|
||||||
|
@ -786,14 +797,15 @@ typedef volatile struct {
|
||||||
} touch_approach;
|
} touch_approach;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t reserved0: 12;
|
uint32_t reserved0: 9;
|
||||||
|
uint32_t touch_smooth_lvl: 2;
|
||||||
uint32_t touch_jitter_step: 4; /*touch jitter step*/
|
uint32_t touch_jitter_step: 4; /*touch jitter step*/
|
||||||
uint32_t touch_neg_noise_limit: 4; /*negative threshold counter limit*/
|
uint32_t touch_neg_noise_limit: 4; /*negative threshold counter limit*/
|
||||||
uint32_t touch_neg_noise_thres: 2;
|
uint32_t touch_neg_noise_thres: 2;
|
||||||
uint32_t touch_noise_thres: 2;
|
uint32_t touch_noise_thres: 2;
|
||||||
uint32_t touch_hysteresis: 2;
|
uint32_t touch_hysteresis: 2;
|
||||||
uint32_t touch_debounce: 3; /*debounce counter*/
|
uint32_t touch_debounce: 3; /*debounce counter*/
|
||||||
uint32_t touch_filter_mode: 2; /*0: IIR ? 1: IIR ? 2: IIR 1/8 3: Jitter*/
|
uint32_t touch_filter_mode: 3; /*0: IIR ? 1: IIR ? 2: IIR 1/8 3: Jitter*/
|
||||||
uint32_t touch_filter_en: 1; /*touch filter enable*/
|
uint32_t touch_filter_en: 1; /*touch filter enable*/
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
|
@ -821,8 +833,21 @@ typedef volatile struct {
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} usb_conf;
|
} usb_conf;
|
||||||
uint32_t reserved_124;
|
union {
|
||||||
uint32_t reserved_128;
|
struct {
|
||||||
|
uint32_t touch_timeout_num:22;
|
||||||
|
uint32_t touch_timeout_en: 1;
|
||||||
|
uint32_t reserved23: 9;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} touch_timeout_ctrl;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t reject_cause:17; /*sleep reject cause*/
|
||||||
|
uint32_t reserved17: 15;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} slp_reject_cause;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t force_download_boot: 1;
|
uint32_t force_download_boot: 1;
|
||||||
|
@ -830,6 +855,21 @@ typedef volatile struct {
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} option1;
|
} option1;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t wakeup_cause:17; /*sleep wakeup cause*/
|
||||||
|
uint32_t reserved17: 15;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} slp_wakeup_cause;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t reserved0: 8;
|
||||||
|
uint32_t ulp_cp_timer_slp_cycle:24; /*sleep cycles for ULP-coprocessor timer*/
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} ulp_cp_timer_1;
|
||||||
|
uint32_t reserved_134;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t date: 28;
|
uint32_t date: 28;
|
||||||
|
|
|
@ -33,7 +33,8 @@ typedef volatile struct {
|
||||||
uint32_t trans_start: 1; /*force start*/
|
uint32_t trans_start: 1; /*force start*/
|
||||||
uint32_t tx_lsb_first: 1; /*transit lsb first*/
|
uint32_t tx_lsb_first: 1; /*transit lsb first*/
|
||||||
uint32_t rx_lsb_first: 1; /*receive lsb first*/
|
uint32_t rx_lsb_first: 1; /*receive lsb first*/
|
||||||
uint32_t reserved6: 24;
|
uint32_t reserved6: 23;
|
||||||
|
uint32_t i2c_ctrl_clk_gate_en: 1;
|
||||||
uint32_t i2c_reset: 1; /*rtc i2c sw reset*/
|
uint32_t i2c_reset: 1; /*rtc i2c sw reset*/
|
||||||
uint32_t i2cclk_en: 1; /*rtc i2c reg clk gating*/
|
uint32_t i2cclk_en: 1; /*rtc i2c reg clk gating*/
|
||||||
};
|
};
|
||||||
|
|
|
@ -260,7 +260,14 @@ typedef volatile struct {
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} sar_i2c_io;
|
} sar_i2c_io;
|
||||||
uint32_t reserved_e8;
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t io_touch_bufsel: 4; /*BUF_SEL when touch work without fsm*/
|
||||||
|
uint32_t io_touch_bufmode: 1; /*BUF_MODE when touch work without fsm*/
|
||||||
|
uint32_t reserved5: 27;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} touch_ctrl;
|
||||||
uint32_t reserved_ec;
|
uint32_t reserved_ec;
|
||||||
uint32_t reserved_f0;
|
uint32_t reserved_f0;
|
||||||
uint32_t reserved_f4;
|
uint32_t reserved_f4;
|
||||||
|
|
|
@ -44,18 +44,6 @@ extern "C" {
|
||||||
#define SENS_SAR1_CLK_GATED_M (BIT(18))
|
#define SENS_SAR1_CLK_GATED_M (BIT(18))
|
||||||
#define SENS_SAR1_CLK_GATED_V 0x1
|
#define SENS_SAR1_CLK_GATED_V 0x1
|
||||||
#define SENS_SAR1_CLK_GATED_S 18
|
#define SENS_SAR1_CLK_GATED_S 18
|
||||||
/* SENS_SAR1_SAMPLE_BIT : R/W ;bitpos:[17:16] ;default: 2'd3 ; */
|
|
||||||
/*description: 00: for 9-bit width*/
|
|
||||||
#define SENS_SAR1_SAMPLE_BIT 0x00000003
|
|
||||||
#define SENS_SAR1_SAMPLE_BIT_M ((SENS_SAR1_SAMPLE_BIT_V)<<(SENS_SAR1_SAMPLE_BIT_S))
|
|
||||||
#define SENS_SAR1_SAMPLE_BIT_V 0x3
|
|
||||||
#define SENS_SAR1_SAMPLE_BIT_S 16
|
|
||||||
/* SENS_SAR1_SAMPLE_CYCLE : R/W ;bitpos:[15:8] ;default: 8'd9 ; */
|
|
||||||
/*description: sample cycles for SAR ADC1*/
|
|
||||||
#define SENS_SAR1_SAMPLE_CYCLE 0x000000FF
|
|
||||||
#define SENS_SAR1_SAMPLE_CYCLE_M ((SENS_SAR1_SAMPLE_CYCLE_V)<<(SENS_SAR1_SAMPLE_CYCLE_S))
|
|
||||||
#define SENS_SAR1_SAMPLE_CYCLE_V 0xFF
|
|
||||||
#define SENS_SAR1_SAMPLE_CYCLE_S 8
|
|
||||||
/* SENS_SAR1_CLK_DIV : R/W ;bitpos:[7:0] ;default: 8'd2 ; */
|
/* SENS_SAR1_CLK_DIV : R/W ;bitpos:[7:0] ;default: 8'd2 ; */
|
||||||
/*description: clock divider*/
|
/*description: clock divider*/
|
||||||
#define SENS_SAR1_CLK_DIV 0x000000FF
|
#define SENS_SAR1_CLK_DIV 0x000000FF
|
||||||
|
@ -99,18 +87,18 @@ extern "C" {
|
||||||
#define SENS_FORCE_XPD_AMP_FSM 0 // Use FSM to control power down
|
#define SENS_FORCE_XPD_AMP_FSM 0 // Use FSM to control power down
|
||||||
#define SENS_FORCE_XPD_AMP_PD 2 // Force power down
|
#define SENS_FORCE_XPD_AMP_PD 2 // Force power down
|
||||||
#define SENS_FORCE_XPD_AMP_PU 3 // Force power up
|
#define SENS_FORCE_XPD_AMP_PU 3 // Force power up
|
||||||
/* SENS_SAR1_STOP : R/W ;bitpos:[2] ;default: 1'b0 ; */
|
/* SENS_RTC_CLKGATE_EN : R/W ;bitpos:[23] ;default: 1'b0 ; */
|
||||||
/*description: stop SAR ADC1 conversion*/
|
/*description: */
|
||||||
#define SENS_SAR1_STOP (BIT(2))
|
#define SENS_RTC_CLKGATE_EN (BIT(23))
|
||||||
#define SENS_SAR1_STOP_M (BIT(2))
|
#define SENS_RTC_CLKGATE_EN_M (BIT(23))
|
||||||
#define SENS_SAR1_STOP_V 0x1
|
#define SENS_RTC_CLKGATE_EN_V 0x1
|
||||||
#define SENS_SAR1_STOP_S 2
|
#define SENS_RTC_CLKGATE_EN_S 23
|
||||||
/* SENS_SAR1_BIT_WIDTH : R/W ;bitpos:[1:0] ;default: 2'b11 ; */
|
/* SENS_RTC_RESET : R/W ;bitpos:[22] ;default: 1'b0 ; */
|
||||||
/*description: 00: 9 bit*/
|
/*description: */
|
||||||
#define SENS_SAR1_BIT_WIDTH 0x00000003
|
#define SENS_RTC_RESET (BIT(22))
|
||||||
#define SENS_SAR1_BIT_WIDTH_M ((SENS_SAR1_BIT_WIDTH_V)<<(SENS_SAR1_BIT_WIDTH_S))
|
#define SENS_RTC_RESET_M (BIT(22))
|
||||||
#define SENS_SAR1_BIT_WIDTH_V 0x3
|
#define SENS_RTC_RESET_V 0x1
|
||||||
#define SENS_SAR1_BIT_WIDTH_S 0
|
#define SENS_RTC_RESET_S 22
|
||||||
|
|
||||||
#define SENS_SAR_MEAS1_CTRL2_REG (DR_REG_SENS_BASE + 0x000c)
|
#define SENS_SAR_MEAS1_CTRL2_REG (DR_REG_SENS_BASE + 0x000c)
|
||||||
/* SENS_SAR1_EN_PAD_FORCE : R/W ;bitpos:[31] ;default: 1'b0 ; */
|
/* SENS_SAR1_EN_PAD_FORCE : R/W ;bitpos:[31] ;default: 1'b0 ; */
|
||||||
|
@ -299,18 +287,12 @@ extern "C" {
|
||||||
#define SENS_SAR2_CLK_GATED_M (BIT(18))
|
#define SENS_SAR2_CLK_GATED_M (BIT(18))
|
||||||
#define SENS_SAR2_CLK_GATED_V 0x1
|
#define SENS_SAR2_CLK_GATED_V 0x1
|
||||||
#define SENS_SAR2_CLK_GATED_S 18
|
#define SENS_SAR2_CLK_GATED_S 18
|
||||||
/* SENS_SAR2_SAMPLE_BIT : R/W ;bitpos:[17:16] ;default: 2'd3 ; */
|
/* SENS_SAR2_WAIT_ARB_CYCLE : R/W ;bitpos:[17:16] ;default: 2'b1 ; */
|
||||||
/*description: 00: for 9-bit width*/
|
/*description: wait arbit stable after sar_done*/
|
||||||
#define SENS_SAR2_SAMPLE_BIT 0x00000003
|
#define SENS_SAR2_WAIT_ARB_CYCLE 0x00000003
|
||||||
#define SENS_SAR2_SAMPLE_BIT_M ((SENS_SAR2_SAMPLE_BIT_V)<<(SENS_SAR2_SAMPLE_BIT_S))
|
#define SENS_SAR2_WAIT_ARB_CYCLE_M ((SENS_SAR2_WAIT_ARB_CYCLE_V)<<(SENS_SAR2_WAIT_ARB_CYCLE_S))
|
||||||
#define SENS_SAR2_SAMPLE_BIT_V 0x3
|
#define SENS_SAR2_WAIT_ARB_CYCLE_V 0x3
|
||||||
#define SENS_SAR2_SAMPLE_BIT_S 16
|
#define SENS_SAR2_WAIT_ARB_CYCLE_S 16
|
||||||
/* SENS_SAR2_SAMPLE_CYCLE : R/W ;bitpos:[15:8] ;default: 8'd9 ; */
|
|
||||||
/*description: sample cycles for SAR ADC2*/
|
|
||||||
#define SENS_SAR2_SAMPLE_CYCLE 0x000000FF
|
|
||||||
#define SENS_SAR2_SAMPLE_CYCLE_M ((SENS_SAR2_SAMPLE_CYCLE_V)<<(SENS_SAR2_SAMPLE_CYCLE_S))
|
|
||||||
#define SENS_SAR2_SAMPLE_CYCLE_V 0xFF
|
|
||||||
#define SENS_SAR2_SAMPLE_CYCLE_S 8
|
|
||||||
/* SENS_SAR2_CLK_DIV : R/W ;bitpos:[7:0] ;default: 8'd2 ; */
|
/* SENS_SAR2_CLK_DIV : R/W ;bitpos:[7:0] ;default: 8'd2 ; */
|
||||||
/*description: clock divider*/
|
/*description: clock divider*/
|
||||||
#define SENS_SAR2_CLK_DIV 0x000000FF
|
#define SENS_SAR2_CLK_DIV 0x000000FF
|
||||||
|
@ -369,18 +351,12 @@ extern "C" {
|
||||||
#define SENS_SAR2_PWDET_CAL_EN_M (BIT(3))
|
#define SENS_SAR2_PWDET_CAL_EN_M (BIT(3))
|
||||||
#define SENS_SAR2_PWDET_CAL_EN_V 0x1
|
#define SENS_SAR2_PWDET_CAL_EN_V 0x1
|
||||||
#define SENS_SAR2_PWDET_CAL_EN_S 3
|
#define SENS_SAR2_PWDET_CAL_EN_S 3
|
||||||
/* SENS_SAR2_STOP : R/W ;bitpos:[2] ;default: 1'b0 ; */
|
/* SENS_SAR2_CNTL_STATE : RO ;bitpos:[2:0] ;default: 3'b0 ; */
|
||||||
/*description: stop SAR ADC2 conversion*/
|
/*description: saradc2_cntl_fsm*/
|
||||||
#define SENS_SAR2_STOP (BIT(2))
|
#define SENS_SAR2_CNTL_STATE 0x00000007
|
||||||
#define SENS_SAR2_STOP_M (BIT(2))
|
#define SENS_SAR2_CNTL_STATE_M ((SENS_SAR2_CNTL_STATE_V)<<(SENS_SAR2_CNTL_STATE_S))
|
||||||
#define SENS_SAR2_STOP_V 0x1
|
#define SENS_SAR2_CNTL_STATE_V 0x7
|
||||||
#define SENS_SAR2_STOP_S 2
|
#define SENS_SAR2_CNTL_STATE_S 0
|
||||||
/* SENS_SAR2_BIT_WIDTH : R/W ;bitpos:[1:0] ;default: 2'b11 ; */
|
|
||||||
/*description: 00: 9 bit*/
|
|
||||||
#define SENS_SAR2_BIT_WIDTH 0x00000003
|
|
||||||
#define SENS_SAR2_BIT_WIDTH_M ((SENS_SAR2_BIT_WIDTH_V)<<(SENS_SAR2_BIT_WIDTH_S))
|
|
||||||
#define SENS_SAR2_BIT_WIDTH_V 0x3
|
|
||||||
#define SENS_SAR2_BIT_WIDTH_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_MEAS2_CTRL2_REG (DR_REG_SENS_BASE + 0x0030)
|
#define SENS_SAR_MEAS2_CTRL2_REG (DR_REG_SENS_BASE + 0x0030)
|
||||||
/* SENS_SAR2_EN_PAD_FORCE : R/W ;bitpos:[31] ;default: 1'b0 ; */
|
/* SENS_SAR2_EN_PAD_FORCE : R/W ;bitpos:[31] ;default: 1'b0 ; */
|
||||||
|
@ -459,19 +435,6 @@ extern "C" {
|
||||||
#define SENS_FORCE_XPD_SAR_FSM 0 // Use FSM to control power down
|
#define SENS_FORCE_XPD_SAR_FSM 0 // Use FSM to control power down
|
||||||
#define SENS_FORCE_XPD_SAR_PD 2 // Force power down
|
#define SENS_FORCE_XPD_SAR_PD 2 // Force power down
|
||||||
#define SENS_FORCE_XPD_SAR_PU 3 // Force power up
|
#define SENS_FORCE_XPD_SAR_PU 3 // Force power up
|
||||||
/* SENS_SAR1_DREF : R/W ;bitpos:[28:26] ;default: 3'd0 ; */
|
|
||||||
/*description: Adjust saradc1 offset*/
|
|
||||||
#define SENS_SAR1_DREF 0x00000007
|
|
||||||
#define SENS_SAR1_DREF_M ((SENS_SAR1_DREF_V)<<(SENS_SAR1_DREF_S))
|
|
||||||
#define SENS_SAR1_DREF_V 0x7
|
|
||||||
#define SENS_SAR1_DREF_S 26
|
|
||||||
/* SENS_SAR2_DREF : R/W ;bitpos:[25:23] ;default: 3'd0 ; */
|
|
||||||
/*description: Adjust saradc2 offset*/
|
|
||||||
#define SENS_SAR2_DREF 0x00000007
|
|
||||||
#define SENS_SAR2_DREF_M ((SENS_SAR2_DREF_V)<<(SENS_SAR2_DREF_S))
|
|
||||||
#define SENS_SAR2_DREF_V 0x7
|
|
||||||
#define SENS_SAR2_DREF_S 23
|
|
||||||
|
|
||||||
#define SENS_SAR_SLAVE_ADDR1_REG (DR_REG_SENS_BASE + 0x0040)
|
#define SENS_SAR_SLAVE_ADDR1_REG (DR_REG_SENS_BASE + 0x0040)
|
||||||
/* SENS_MEAS_STATUS : RO ;bitpos:[29:22] ;default: 8'h0 ; */
|
/* SENS_MEAS_STATUS : RO ;bitpos:[29:22] ;default: 8'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
|
@ -535,26 +498,6 @@ extern "C" {
|
||||||
#define SENS_I2C_SLAVE_ADDR7_S 0
|
#define SENS_I2C_SLAVE_ADDR7_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TSENS_CTRL_REG (DR_REG_SENS_BASE + 0x0050)
|
#define SENS_SAR_TSENS_CTRL_REG (DR_REG_SENS_BASE + 0x0050)
|
||||||
/* SENS_TSENS_DAC : R/W ;bitpos:[31:28] ;default: 4'hF ; */
|
|
||||||
/*description: Temperature sensor offset dac. 15 for 0 offset 5 for -2 7 for
|
|
||||||
-1 11 for 1 10 for 2*/
|
|
||||||
#define SENS_TSENS_DAC 0x0000000F
|
|
||||||
#define SENS_TSENS_DAC_M ((SENS_TSENS_DAC_V)<<(SENS_TSENS_DAC_S))
|
|
||||||
#define SENS_TSENS_DAC_V 0xF
|
|
||||||
#define SENS_TSENS_DAC_S 28
|
|
||||||
/* SENS_TSENS_DIV_CHOP : R/W ;bitpos:[27:26] ;default: 2'b10 ; */
|
|
||||||
/*description: 0 for steady phase 0 1 for steady phase 1 2 for chopping with
|
|
||||||
½ frequency of TSENS_CK 3 for chopping with ¼*/
|
|
||||||
#define SENS_TSENS_DIV_CHOP 0x00000003
|
|
||||||
#define SENS_TSENS_DIV_CHOP_M ((SENS_TSENS_DIV_CHOP_V)<<(SENS_TSENS_DIV_CHOP_S))
|
|
||||||
#define SENS_TSENS_DIV_CHOP_V 0x3
|
|
||||||
#define SENS_TSENS_DIV_CHOP_S 26
|
|
||||||
/* SENS_TSENS_DIZ : R/W ;bitpos:[25] ;default: 1'b0 ; */
|
|
||||||
/*description: ADC input short*/
|
|
||||||
#define SENS_TSENS_DIZ (BIT(25))
|
|
||||||
#define SENS_TSENS_DIZ_M (BIT(25))
|
|
||||||
#define SENS_TSENS_DIZ_V 0x1
|
|
||||||
#define SENS_TSENS_DIZ_S 25
|
|
||||||
/* SENS_TSENS_DUMP_OUT : R/W ;bitpos:[24] ;default: 1'b0 ; */
|
/* SENS_TSENS_DUMP_OUT : R/W ;bitpos:[24] ;default: 1'b0 ; */
|
||||||
/*description: temperature sensor dump out*/
|
/*description: temperature sensor dump out*/
|
||||||
#define SENS_TSENS_DUMP_OUT (BIT(24))
|
#define SENS_TSENS_DUMP_OUT (BIT(24))
|
||||||
|
@ -675,6 +618,24 @@ extern "C" {
|
||||||
#define SENS_TOUCH_APPROACH_PAD2_M ((SENS_TOUCH_APPROACH_PAD2_V)<<(SENS_TOUCH_APPROACH_PAD2_S))
|
#define SENS_TOUCH_APPROACH_PAD2_M ((SENS_TOUCH_APPROACH_PAD2_V)<<(SENS_TOUCH_APPROACH_PAD2_S))
|
||||||
#define SENS_TOUCH_APPROACH_PAD2_V 0xF
|
#define SENS_TOUCH_APPROACH_PAD2_V 0xF
|
||||||
#define SENS_TOUCH_APPROACH_PAD2_S 20
|
#define SENS_TOUCH_APPROACH_PAD2_S 20
|
||||||
|
/* SENS_TOUCH_UNIT_END : RO ;bitpos:[19] ;default: 1'd0 ; */
|
||||||
|
/*description: touch_unit_done*/
|
||||||
|
#define SENS_TOUCH_UNIT_END (BIT(19))
|
||||||
|
#define SENS_TOUCH_UNIT_END_M (BIT(19))
|
||||||
|
#define SENS_TOUCH_UNIT_END_V 0x1
|
||||||
|
#define SENS_TOUCH_UNIT_END_S 19
|
||||||
|
/* SENS_TOUCH_DENOISE_END : RO ;bitpos:[18] ;default: 1'd0 ; */
|
||||||
|
/*description: touch_denoise_done*/
|
||||||
|
#define SENS_TOUCH_DENOISE_END (BIT(18))
|
||||||
|
#define SENS_TOUCH_DENOISE_END_M (BIT(18))
|
||||||
|
#define SENS_TOUCH_DENOISE_END_V 0x1
|
||||||
|
#define SENS_TOUCH_DENOISE_END_S 18
|
||||||
|
/* SENS_TOUCH_DATA_SEL : R/W ;bitpos:[17:16] ;default: 2'd0 ; */
|
||||||
|
/*description: 3: smooth data 2: baseline 1 0: raw_data*/
|
||||||
|
#define SENS_TOUCH_DATA_SEL 0x00000003
|
||||||
|
#define SENS_TOUCH_DATA_SEL_M ((SENS_TOUCH_DATA_SEL_V)<<(SENS_TOUCH_DATA_SEL_S))
|
||||||
|
#define SENS_TOUCH_DATA_SEL_V 0x3
|
||||||
|
#define SENS_TOUCH_DATA_SEL_S 16
|
||||||
/* SENS_TOUCH_STATUS_CLR : WO ;bitpos:[15] ;default: 1'd0 ; */
|
/* SENS_TOUCH_STATUS_CLR : WO ;bitpos:[15] ;default: 1'd0 ; */
|
||||||
/*description: clear all touch active status*/
|
/*description: clear all touch active status*/
|
||||||
#define SENS_TOUCH_STATUS_CLR (BIT(15))
|
#define SENS_TOUCH_STATUS_CLR (BIT(15))
|
||||||
|
@ -800,126 +761,6 @@ extern "C" {
|
||||||
#define SENS_TOUCH_OUT_TH14_V 0x3FFFFF
|
#define SENS_TOUCH_OUT_TH14_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_OUT_TH14_S 0
|
#define SENS_TOUCH_OUT_TH14_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT0_REG (DR_REG_SENS_BASE + 0x0098)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT0 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 0*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT0 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT0_M ((SENS_TOUCH_MEAS_OUT0_V)<<(SENS_TOUCH_MEAS_OUT0_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT0_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT0_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT1_REG (DR_REG_SENS_BASE + 0x009c)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT1 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 1*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT1 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT1_M ((SENS_TOUCH_MEAS_OUT1_V)<<(SENS_TOUCH_MEAS_OUT1_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT1_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT1_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT2_REG (DR_REG_SENS_BASE + 0x00a0)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT2 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 2*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT2 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT2_M ((SENS_TOUCH_MEAS_OUT2_V)<<(SENS_TOUCH_MEAS_OUT2_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT2_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT2_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT3_REG (DR_REG_SENS_BASE + 0x00a4)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT3 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 3*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT3 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT3_M ((SENS_TOUCH_MEAS_OUT3_V)<<(SENS_TOUCH_MEAS_OUT3_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT3_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT3_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT4_REG (DR_REG_SENS_BASE + 0x00a8)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT4 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 4*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT4 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT4_M ((SENS_TOUCH_MEAS_OUT4_V)<<(SENS_TOUCH_MEAS_OUT4_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT4_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT4_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT5_REG (DR_REG_SENS_BASE + 0x00ac)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT5 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 5*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT5 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT5_M ((SENS_TOUCH_MEAS_OUT5_V)<<(SENS_TOUCH_MEAS_OUT5_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT5_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT5_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT6_REG (DR_REG_SENS_BASE + 0x00b0)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT6 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 6*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT6 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT6_M ((SENS_TOUCH_MEAS_OUT6_V)<<(SENS_TOUCH_MEAS_OUT6_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT6_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT6_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT7_REG (DR_REG_SENS_BASE + 0x00b4)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT7 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 7*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT7 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT7_M ((SENS_TOUCH_MEAS_OUT7_V)<<(SENS_TOUCH_MEAS_OUT7_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT7_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT7_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT8_REG (DR_REG_SENS_BASE + 0x00b8)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT8 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 8*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT8 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT8_M ((SENS_TOUCH_MEAS_OUT8_V)<<(SENS_TOUCH_MEAS_OUT8_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT8_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT8_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT9_REG (DR_REG_SENS_BASE + 0x00bc)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT9 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 9*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT9 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT9_M ((SENS_TOUCH_MEAS_OUT9_V)<<(SENS_TOUCH_MEAS_OUT9_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT9_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT9_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT10_REG (DR_REG_SENS_BASE + 0x00c0)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT10 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 10*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT10 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT10_M ((SENS_TOUCH_MEAS_OUT10_V)<<(SENS_TOUCH_MEAS_OUT10_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT10_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT10_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT11_REG (DR_REG_SENS_BASE + 0x00c4)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT11 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 11*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT11 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT11_M ((SENS_TOUCH_MEAS_OUT11_V)<<(SENS_TOUCH_MEAS_OUT11_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT11_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT11_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT12_REG (DR_REG_SENS_BASE + 0x00c8)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT12 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 12*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT12 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT12_M ((SENS_TOUCH_MEAS_OUT12_V)<<(SENS_TOUCH_MEAS_OUT12_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT12_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT12_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT13_REG (DR_REG_SENS_BASE + 0x00cc)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT13 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 13*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT13 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT13_M ((SENS_TOUCH_MEAS_OUT13_V)<<(SENS_TOUCH_MEAS_OUT13_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT13_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT13_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_OUT14_REG (DR_REG_SENS_BASE + 0x00d0)
|
|
||||||
/* SENS_TOUCH_MEAS_OUT14 : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
|
||||||
/*description: the counter for touch pad 14*/
|
|
||||||
#define SENS_TOUCH_MEAS_OUT14 0x003FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT14_M ((SENS_TOUCH_MEAS_OUT14_V)<<(SENS_TOUCH_MEAS_OUT14_S))
|
|
||||||
#define SENS_TOUCH_MEAS_OUT14_V 0x3FFFFF
|
|
||||||
#define SENS_TOUCH_MEAS_OUT14_S 0
|
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_CHN_ST_REG (DR_REG_SENS_BASE + 0x00d4)
|
#define SENS_SAR_TOUCH_CHN_ST_REG (DR_REG_SENS_BASE + 0x00d4)
|
||||||
/* SENS_TOUCH_MEAS_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */
|
/* SENS_TOUCH_MEAS_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
|
@ -961,12 +802,12 @@ extern "C" {
|
||||||
#define SENS_TOUCH_PAD1_DEBOUNCE_M ((SENS_TOUCH_PAD1_DEBOUNCE_V)<<(SENS_TOUCH_PAD1_DEBOUNCE_S))
|
#define SENS_TOUCH_PAD1_DEBOUNCE_M ((SENS_TOUCH_PAD1_DEBOUNCE_V)<<(SENS_TOUCH_PAD1_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_PAD1_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_PAD1_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_PAD1_DEBOUNCE_S 29
|
#define SENS_TOUCH_PAD1_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_PAD1_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_PAD1_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_PAD1_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_PAD1_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_PAD1_BASELINE_M ((SENS_TOUCH_PAD1_BASELINE_V)<<(SENS_TOUCH_PAD1_BASELINE_S))
|
#define SENS_TOUCH_PAD1_DATA_M ((SENS_TOUCH_PAD1_DATA_V)<<(SENS_TOUCH_PAD1_DATA_S))
|
||||||
#define SENS_TOUCH_PAD1_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_PAD1_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_PAD1_BASELINE_S 0
|
#define SENS_TOUCH_PAD1_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS2_REG (DR_REG_SENS_BASE + 0x00e0)
|
#define SENS_SAR_TOUCH_STATUS2_REG (DR_REG_SENS_BASE + 0x00e0)
|
||||||
/* SENS_TOUCH_PAD2_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
/* SENS_TOUCH_PAD2_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
||||||
|
@ -975,12 +816,12 @@ extern "C" {
|
||||||
#define SENS_TOUCH_PAD2_DEBOUNCE_M ((SENS_TOUCH_PAD2_DEBOUNCE_V)<<(SENS_TOUCH_PAD2_DEBOUNCE_S))
|
#define SENS_TOUCH_PAD2_DEBOUNCE_M ((SENS_TOUCH_PAD2_DEBOUNCE_V)<<(SENS_TOUCH_PAD2_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_PAD2_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_PAD2_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_PAD2_DEBOUNCE_S 29
|
#define SENS_TOUCH_PAD2_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_PAD2_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_PAD2_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_PAD2_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_PAD2_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_PAD2_BASELINE_M ((SENS_TOUCH_PAD2_BASELINE_V)<<(SENS_TOUCH_PAD2_BASELINE_S))
|
#define SENS_TOUCH_PAD2_DATA_M ((SENS_TOUCH_PAD2_DATA_V)<<(SENS_TOUCH_PAD2_DATA_S))
|
||||||
#define SENS_TOUCH_PAD2_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_PAD2_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_PAD2_BASELINE_S 0
|
#define SENS_TOUCH_PAD2_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS3_REG (DR_REG_SENS_BASE + 0x00e4)
|
#define SENS_SAR_TOUCH_STATUS3_REG (DR_REG_SENS_BASE + 0x00e4)
|
||||||
/* SENS_TOUCH_PAD3_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
/* SENS_TOUCH_PAD3_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
||||||
|
@ -989,12 +830,12 @@ extern "C" {
|
||||||
#define SENS_TOUCH_PAD3_DEBOUNCE_M ((SENS_TOUCH_PAD3_DEBOUNCE_V)<<(SENS_TOUCH_PAD3_DEBOUNCE_S))
|
#define SENS_TOUCH_PAD3_DEBOUNCE_M ((SENS_TOUCH_PAD3_DEBOUNCE_V)<<(SENS_TOUCH_PAD3_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_PAD3_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_PAD3_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_PAD3_DEBOUNCE_S 29
|
#define SENS_TOUCH_PAD3_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_PAD3_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_PAD3_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_PAD3_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_PAD3_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_PAD3_BASELINE_M ((SENS_TOUCH_PAD3_BASELINE_V)<<(SENS_TOUCH_PAD3_BASELINE_S))
|
#define SENS_TOUCH_PAD3_DATA_M ((SENS_TOUCH_PAD3_DATA_V)<<(SENS_TOUCH_PAD3_DATA_S))
|
||||||
#define SENS_TOUCH_PAD3_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_PAD3_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_PAD3_BASELINE_S 0
|
#define SENS_TOUCH_PAD3_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS4_REG (DR_REG_SENS_BASE + 0x00e8)
|
#define SENS_SAR_TOUCH_STATUS4_REG (DR_REG_SENS_BASE + 0x00e8)
|
||||||
/* SENS_TOUCH_PAD4_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
/* SENS_TOUCH_PAD4_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
||||||
|
@ -1003,12 +844,12 @@ extern "C" {
|
||||||
#define SENS_TOUCH_PAD4_DEBOUNCE_M ((SENS_TOUCH_PAD4_DEBOUNCE_V)<<(SENS_TOUCH_PAD4_DEBOUNCE_S))
|
#define SENS_TOUCH_PAD4_DEBOUNCE_M ((SENS_TOUCH_PAD4_DEBOUNCE_V)<<(SENS_TOUCH_PAD4_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_PAD4_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_PAD4_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_PAD4_DEBOUNCE_S 29
|
#define SENS_TOUCH_PAD4_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_PAD4_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_PAD4_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_PAD4_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_PAD4_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_PAD4_BASELINE_M ((SENS_TOUCH_PAD4_BASELINE_V)<<(SENS_TOUCH_PAD4_BASELINE_S))
|
#define SENS_TOUCH_PAD4_DATA_M ((SENS_TOUCH_PAD4_DATA_V)<<(SENS_TOUCH_PAD4_DATA_S))
|
||||||
#define SENS_TOUCH_PAD4_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_PAD4_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_PAD4_BASELINE_S 0
|
#define SENS_TOUCH_PAD4_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS5_REG (DR_REG_SENS_BASE + 0x00ec)
|
#define SENS_SAR_TOUCH_STATUS5_REG (DR_REG_SENS_BASE + 0x00ec)
|
||||||
/* SENS_TOUCH_PAD5_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
/* SENS_TOUCH_PAD5_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
||||||
|
@ -1017,12 +858,12 @@ extern "C" {
|
||||||
#define SENS_TOUCH_PAD5_DEBOUNCE_M ((SENS_TOUCH_PAD5_DEBOUNCE_V)<<(SENS_TOUCH_PAD5_DEBOUNCE_S))
|
#define SENS_TOUCH_PAD5_DEBOUNCE_M ((SENS_TOUCH_PAD5_DEBOUNCE_V)<<(SENS_TOUCH_PAD5_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_PAD5_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_PAD5_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_PAD5_DEBOUNCE_S 29
|
#define SENS_TOUCH_PAD5_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_PAD5_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_PAD5_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_PAD5_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_PAD5_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_PAD5_BASELINE_M ((SENS_TOUCH_PAD5_BASELINE_V)<<(SENS_TOUCH_PAD5_BASELINE_S))
|
#define SENS_TOUCH_PAD5_DATA_M ((SENS_TOUCH_PAD5_DATA_V)<<(SENS_TOUCH_PAD5_DATA_S))
|
||||||
#define SENS_TOUCH_PAD5_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_PAD5_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_PAD5_BASELINE_S 0
|
#define SENS_TOUCH_PAD5_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS6_REG (DR_REG_SENS_BASE + 0x00f0)
|
#define SENS_SAR_TOUCH_STATUS6_REG (DR_REG_SENS_BASE + 0x00f0)
|
||||||
/* SENS_TOUCH_PAD6_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
/* SENS_TOUCH_PAD6_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
||||||
|
@ -1031,12 +872,12 @@ extern "C" {
|
||||||
#define SENS_TOUCH_PAD6_DEBOUNCE_M ((SENS_TOUCH_PAD6_DEBOUNCE_V)<<(SENS_TOUCH_PAD6_DEBOUNCE_S))
|
#define SENS_TOUCH_PAD6_DEBOUNCE_M ((SENS_TOUCH_PAD6_DEBOUNCE_V)<<(SENS_TOUCH_PAD6_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_PAD6_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_PAD6_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_PAD6_DEBOUNCE_S 29
|
#define SENS_TOUCH_PAD6_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_PAD6_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_PAD6_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_PAD6_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_PAD6_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_PAD6_BASELINE_M ((SENS_TOUCH_PAD6_BASELINE_V)<<(SENS_TOUCH_PAD6_BASELINE_S))
|
#define SENS_TOUCH_PAD6_DATA_M ((SENS_TOUCH_PAD6_DATA_V)<<(SENS_TOUCH_PAD6_DATA_S))
|
||||||
#define SENS_TOUCH_PAD6_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_PAD6_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_PAD6_BASELINE_S 0
|
#define SENS_TOUCH_PAD6_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS7_REG (DR_REG_SENS_BASE + 0x00f4)
|
#define SENS_SAR_TOUCH_STATUS7_REG (DR_REG_SENS_BASE + 0x00f4)
|
||||||
/* SENS_TOUCH_PAD7_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
/* SENS_TOUCH_PAD7_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
||||||
|
@ -1045,12 +886,12 @@ extern "C" {
|
||||||
#define SENS_TOUCH_PAD7_DEBOUNCE_M ((SENS_TOUCH_PAD7_DEBOUNCE_V)<<(SENS_TOUCH_PAD7_DEBOUNCE_S))
|
#define SENS_TOUCH_PAD7_DEBOUNCE_M ((SENS_TOUCH_PAD7_DEBOUNCE_V)<<(SENS_TOUCH_PAD7_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_PAD7_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_PAD7_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_PAD7_DEBOUNCE_S 29
|
#define SENS_TOUCH_PAD7_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_PAD7_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_PAD7_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_PAD7_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_PAD7_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_PAD7_BASELINE_M ((SENS_TOUCH_PAD7_BASELINE_V)<<(SENS_TOUCH_PAD7_BASELINE_S))
|
#define SENS_TOUCH_PAD7_DATA_M ((SENS_TOUCH_PAD7_DATA_V)<<(SENS_TOUCH_PAD7_DATA_S))
|
||||||
#define SENS_TOUCH_PAD7_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_PAD7_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_PAD7_BASELINE_S 0
|
#define SENS_TOUCH_PAD7_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS8_REG (DR_REG_SENS_BASE + 0x00f8)
|
#define SENS_SAR_TOUCH_STATUS8_REG (DR_REG_SENS_BASE + 0x00f8)
|
||||||
/* SENS_TOUCH_PAD8_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
/* SENS_TOUCH_PAD8_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
||||||
|
@ -1059,12 +900,12 @@ extern "C" {
|
||||||
#define SENS_TOUCH_PAD8_DEBOUNCE_M ((SENS_TOUCH_PAD8_DEBOUNCE_V)<<(SENS_TOUCH_PAD8_DEBOUNCE_S))
|
#define SENS_TOUCH_PAD8_DEBOUNCE_M ((SENS_TOUCH_PAD8_DEBOUNCE_V)<<(SENS_TOUCH_PAD8_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_PAD8_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_PAD8_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_PAD8_DEBOUNCE_S 29
|
#define SENS_TOUCH_PAD8_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_PAD8_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_PAD8_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_PAD8_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_PAD8_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_PAD8_BASELINE_M ((SENS_TOUCH_PAD8_BASELINE_V)<<(SENS_TOUCH_PAD8_BASELINE_S))
|
#define SENS_TOUCH_PAD8_DATA_M ((SENS_TOUCH_PAD8_DATA_V)<<(SENS_TOUCH_PAD8_DATA_S))
|
||||||
#define SENS_TOUCH_PAD8_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_PAD8_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_PAD8_BASELINE_S 0
|
#define SENS_TOUCH_PAD8_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS9_REG (DR_REG_SENS_BASE + 0x00fc)
|
#define SENS_SAR_TOUCH_STATUS9_REG (DR_REG_SENS_BASE + 0x00fc)
|
||||||
/* SENS_TOUCH_PAD9_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
/* SENS_TOUCH_PAD9_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
||||||
|
@ -1073,12 +914,12 @@ extern "C" {
|
||||||
#define SENS_TOUCH_PAD9_DEBOUNCE_M ((SENS_TOUCH_PAD9_DEBOUNCE_V)<<(SENS_TOUCH_PAD9_DEBOUNCE_S))
|
#define SENS_TOUCH_PAD9_DEBOUNCE_M ((SENS_TOUCH_PAD9_DEBOUNCE_V)<<(SENS_TOUCH_PAD9_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_PAD9_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_PAD9_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_PAD9_DEBOUNCE_S 29
|
#define SENS_TOUCH_PAD9_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_PAD9_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_PAD9_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_PAD9_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_PAD9_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_PAD9_BASELINE_M ((SENS_TOUCH_PAD9_BASELINE_V)<<(SENS_TOUCH_PAD9_BASELINE_S))
|
#define SENS_TOUCH_PAD9_DATA_M ((SENS_TOUCH_PAD9_DATA_V)<<(SENS_TOUCH_PAD9_DATA_S))
|
||||||
#define SENS_TOUCH_PAD9_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_PAD9_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_PAD9_BASELINE_S 0
|
#define SENS_TOUCH_PAD9_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS10_REG (DR_REG_SENS_BASE + 0x0100)
|
#define SENS_SAR_TOUCH_STATUS10_REG (DR_REG_SENS_BASE + 0x0100)
|
||||||
/* SENS_TOUCH_PAD10_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
/* SENS_TOUCH_PAD10_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
||||||
|
@ -1087,12 +928,12 @@ extern "C" {
|
||||||
#define SENS_TOUCH_PAD10_DEBOUNCE_M ((SENS_TOUCH_PAD10_DEBOUNCE_V)<<(SENS_TOUCH_PAD10_DEBOUNCE_S))
|
#define SENS_TOUCH_PAD10_DEBOUNCE_M ((SENS_TOUCH_PAD10_DEBOUNCE_V)<<(SENS_TOUCH_PAD10_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_PAD10_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_PAD10_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_PAD10_DEBOUNCE_S 29
|
#define SENS_TOUCH_PAD10_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_PAD10_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_PAD10_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_PAD10_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_PAD10_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_PAD10_BASELINE_M ((SENS_TOUCH_PAD10_BASELINE_V)<<(SENS_TOUCH_PAD10_BASELINE_S))
|
#define SENS_TOUCH_PAD10_DATA_M ((SENS_TOUCH_PAD10_DATA_V)<<(SENS_TOUCH_PAD10_DATA_S))
|
||||||
#define SENS_TOUCH_PAD10_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_PAD10_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_PAD10_BASELINE_S 0
|
#define SENS_TOUCH_PAD10_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS11_REG (DR_REG_SENS_BASE + 0x0104)
|
#define SENS_SAR_TOUCH_STATUS11_REG (DR_REG_SENS_BASE + 0x0104)
|
||||||
/* SENS_TOUCH_PAD11_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
/* SENS_TOUCH_PAD11_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
||||||
|
@ -1101,12 +942,12 @@ extern "C" {
|
||||||
#define SENS_TOUCH_PAD11_DEBOUNCE_M ((SENS_TOUCH_PAD11_DEBOUNCE_V)<<(SENS_TOUCH_PAD11_DEBOUNCE_S))
|
#define SENS_TOUCH_PAD11_DEBOUNCE_M ((SENS_TOUCH_PAD11_DEBOUNCE_V)<<(SENS_TOUCH_PAD11_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_PAD11_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_PAD11_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_PAD11_DEBOUNCE_S 29
|
#define SENS_TOUCH_PAD11_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_PAD11_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_PAD11_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_PAD11_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_PAD11_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_PAD11_BASELINE_M ((SENS_TOUCH_PAD11_BASELINE_V)<<(SENS_TOUCH_PAD11_BASELINE_S))
|
#define SENS_TOUCH_PAD11_DATA_M ((SENS_TOUCH_PAD11_DATA_V)<<(SENS_TOUCH_PAD11_DATA_S))
|
||||||
#define SENS_TOUCH_PAD11_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_PAD11_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_PAD11_BASELINE_S 0
|
#define SENS_TOUCH_PAD11_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS12_REG (DR_REG_SENS_BASE + 0x0108)
|
#define SENS_SAR_TOUCH_STATUS12_REG (DR_REG_SENS_BASE + 0x0108)
|
||||||
/* SENS_TOUCH_PAD12_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
/* SENS_TOUCH_PAD12_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
||||||
|
@ -1115,12 +956,12 @@ extern "C" {
|
||||||
#define SENS_TOUCH_PAD12_DEBOUNCE_M ((SENS_TOUCH_PAD12_DEBOUNCE_V)<<(SENS_TOUCH_PAD12_DEBOUNCE_S))
|
#define SENS_TOUCH_PAD12_DEBOUNCE_M ((SENS_TOUCH_PAD12_DEBOUNCE_V)<<(SENS_TOUCH_PAD12_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_PAD12_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_PAD12_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_PAD12_DEBOUNCE_S 29
|
#define SENS_TOUCH_PAD12_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_PAD12_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_PAD12_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_PAD12_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_PAD12_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_PAD12_BASELINE_M ((SENS_TOUCH_PAD12_BASELINE_V)<<(SENS_TOUCH_PAD12_BASELINE_S))
|
#define SENS_TOUCH_PAD12_DATA_M ((SENS_TOUCH_PAD12_DATA_V)<<(SENS_TOUCH_PAD12_DATA_S))
|
||||||
#define SENS_TOUCH_PAD12_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_PAD12_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_PAD12_BASELINE_S 0
|
#define SENS_TOUCH_PAD12_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS13_REG (DR_REG_SENS_BASE + 0x010c)
|
#define SENS_SAR_TOUCH_STATUS13_REG (DR_REG_SENS_BASE + 0x010c)
|
||||||
/* SENS_TOUCH_PAD13_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
/* SENS_TOUCH_PAD13_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
||||||
|
@ -1129,12 +970,12 @@ extern "C" {
|
||||||
#define SENS_TOUCH_PAD13_DEBOUNCE_M ((SENS_TOUCH_PAD13_DEBOUNCE_V)<<(SENS_TOUCH_PAD13_DEBOUNCE_S))
|
#define SENS_TOUCH_PAD13_DEBOUNCE_M ((SENS_TOUCH_PAD13_DEBOUNCE_V)<<(SENS_TOUCH_PAD13_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_PAD13_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_PAD13_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_PAD13_DEBOUNCE_S 29
|
#define SENS_TOUCH_PAD13_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_PAD13_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_PAD13_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_PAD13_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_PAD13_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_PAD13_BASELINE_M ((SENS_TOUCH_PAD13_BASELINE_V)<<(SENS_TOUCH_PAD13_BASELINE_S))
|
#define SENS_TOUCH_PAD13_DATA_M ((SENS_TOUCH_PAD13_DATA_V)<<(SENS_TOUCH_PAD13_DATA_S))
|
||||||
#define SENS_TOUCH_PAD13_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_PAD13_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_PAD13_BASELINE_S 0
|
#define SENS_TOUCH_PAD13_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS14_REG (DR_REG_SENS_BASE + 0x0110)
|
#define SENS_SAR_TOUCH_STATUS14_REG (DR_REG_SENS_BASE + 0x0110)
|
||||||
/* SENS_TOUCH_PAD14_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
/* SENS_TOUCH_PAD14_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
||||||
|
@ -1143,28 +984,28 @@ extern "C" {
|
||||||
#define SENS_TOUCH_PAD14_DEBOUNCE_M ((SENS_TOUCH_PAD14_DEBOUNCE_V)<<(SENS_TOUCH_PAD14_DEBOUNCE_S))
|
#define SENS_TOUCH_PAD14_DEBOUNCE_M ((SENS_TOUCH_PAD14_DEBOUNCE_V)<<(SENS_TOUCH_PAD14_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_PAD14_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_PAD14_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_PAD14_DEBOUNCE_S 29
|
#define SENS_TOUCH_PAD14_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_PAD14_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_PAD14_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_PAD14_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_PAD14_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_PAD14_BASELINE_M ((SENS_TOUCH_PAD14_BASELINE_V)<<(SENS_TOUCH_PAD14_BASELINE_S))
|
#define SENS_TOUCH_PAD14_DATA_M ((SENS_TOUCH_PAD14_DATA_V)<<(SENS_TOUCH_PAD14_DATA_S))
|
||||||
#define SENS_TOUCH_PAD14_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_PAD14_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_PAD14_BASELINE_S 0
|
#define SENS_TOUCH_PAD14_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS15_REG (DR_REG_SENS_BASE + 0x0114)
|
#define SENS_SAR_TOUCH_SLP_STATUS_REG (DR_REG_SENS_BASE + 0x0114)
|
||||||
/* SENS_TOUCH_SLP_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
/* SENS_TOUCH_SLP_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_SLP_DEBOUNCE 0x00000007
|
#define SENS_TOUCH_SLP_DEBOUNCE 0x00000007
|
||||||
#define SENS_TOUCH_SLP_DEBOUNCE_M ((SENS_TOUCH_SLP_DEBOUNCE_V)<<(SENS_TOUCH_SLP_DEBOUNCE_S))
|
#define SENS_TOUCH_SLP_DEBOUNCE_M ((SENS_TOUCH_SLP_DEBOUNCE_V)<<(SENS_TOUCH_SLP_DEBOUNCE_S))
|
||||||
#define SENS_TOUCH_SLP_DEBOUNCE_V 0x7
|
#define SENS_TOUCH_SLP_DEBOUNCE_V 0x7
|
||||||
#define SENS_TOUCH_SLP_DEBOUNCE_S 29
|
#define SENS_TOUCH_SLP_DEBOUNCE_S 29
|
||||||
/* SENS_TOUCH_SLP_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
/* SENS_TOUCH_SLP_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_SLP_BASELINE 0x003FFFFF
|
#define SENS_TOUCH_SLP_DATA 0x003FFFFF
|
||||||
#define SENS_TOUCH_SLP_BASELINE_M ((SENS_TOUCH_SLP_BASELINE_V)<<(SENS_TOUCH_SLP_BASELINE_S))
|
#define SENS_TOUCH_SLP_DATA_M ((SENS_TOUCH_SLP_DATA_V)<<(SENS_TOUCH_SLP_DATA_S))
|
||||||
#define SENS_TOUCH_SLP_BASELINE_V 0x3FFFFF
|
#define SENS_TOUCH_SLP_DATA_V 0x3FFFFF
|
||||||
#define SENS_TOUCH_SLP_BASELINE_S 0
|
#define SENS_TOUCH_SLP_DATA_S 0
|
||||||
|
|
||||||
#define SENS_SAR_TOUCH_STATUS16_REG (DR_REG_SENS_BASE + 0x0118)
|
#define SENS_SAR_TOUCH_APPR_STATUS_REG (DR_REG_SENS_BASE + 0x0118)
|
||||||
/* SENS_TOUCH_SLP_APPROACH_CNT : RO ;bitpos:[31:24] ;default: 8'd0 ; */
|
/* SENS_TOUCH_SLP_APPROACH_CNT : RO ;bitpos:[31:24] ;default: 8'd0 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_TOUCH_SLP_APPROACH_CNT 0x000000FF
|
#define SENS_TOUCH_SLP_APPROACH_CNT 0x000000FF
|
||||||
|
@ -1191,6 +1032,18 @@ extern "C" {
|
||||||
#define SENS_TOUCH_APPROACH_PAD2_CNT_S 0
|
#define SENS_TOUCH_APPROACH_PAD2_CNT_S 0
|
||||||
|
|
||||||
#define SENS_SAR_DAC_CTRL1_REG (DR_REG_SENS_BASE + 0x011c)
|
#define SENS_SAR_DAC_CTRL1_REG (DR_REG_SENS_BASE + 0x011c)
|
||||||
|
/* SENS_DAC_CLKGATE_EN : R/W ;bitpos:[27] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define SENS_DAC_CLKGATE_EN (BIT(27))
|
||||||
|
#define SENS_DAC_CLKGATE_EN_M (BIT(27))
|
||||||
|
#define SENS_DAC_CLKGATE_EN_V 0x1
|
||||||
|
#define SENS_DAC_CLKGATE_EN_S 27
|
||||||
|
/* SENS_DAC_RESET : R/W ;bitpos:[26] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define SENS_DAC_RESET (BIT(26))
|
||||||
|
#define SENS_DAC_RESET_M (BIT(26))
|
||||||
|
#define SENS_DAC_RESET_V 0x1
|
||||||
|
#define SENS_DAC_RESET_S 26
|
||||||
/* SENS_DAC_CLK_INV : R/W ;bitpos:[25] ;default: 1'b0 ; */
|
/* SENS_DAC_CLK_INV : R/W ;bitpos:[25] ;default: 1'b0 ; */
|
||||||
/*description: 1: invert PDAC_CLK*/
|
/*description: 1: invert PDAC_CLK*/
|
||||||
#define SENS_DAC_CLK_INV (BIT(25))
|
#define SENS_DAC_CLK_INV (BIT(25))
|
||||||
|
@ -1614,8 +1467,22 @@ extern "C" {
|
||||||
#define SENS_SAR_NOUSE_V 0xFFFFFFFF
|
#define SENS_SAR_NOUSE_V 0xFFFFFFFF
|
||||||
#define SENS_SAR_NOUSE_S 0
|
#define SENS_SAR_NOUSE_S 0
|
||||||
|
|
||||||
#define SENS_SARDATE_REG (DR_REG_SENS_BASE + 0x0144)
|
#define SENS_SAR_IO_MUX_CONF_REG (DR_REG_SENS_BASE + 0x0144)
|
||||||
/* SENS_SAR_DATE : R/W ;bitpos:[27:0] ;default: 28'h1809210 ; */
|
/* SENS_IOMUX_CLK_GATE_EN : R/W ;bitpos:[31] ;default: 1'd0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define SENS_IOMUX_CLK_GATE_EN (BIT(31))
|
||||||
|
#define SENS_IOMUX_CLK_GATE_EN_M (BIT(31))
|
||||||
|
#define SENS_IOMUX_CLK_GATE_EN_V 0x1
|
||||||
|
#define SENS_IOMUX_CLK_GATE_EN_S 31
|
||||||
|
/* SENS_IOMUX_RESET : R/W ;bitpos:[30] ;default: 1'b0 ; */
|
||||||
|
/*description: */
|
||||||
|
#define SENS_IOMUX_RESET (BIT(30))
|
||||||
|
#define SENS_IOMUX_RESET_M (BIT(30))
|
||||||
|
#define SENS_IOMUX_RESET_V 0x1
|
||||||
|
#define SENS_IOMUX_RESET_S 30
|
||||||
|
|
||||||
|
#define SENS_SARDATE_REG (DR_REG_SENS_BASE + 0x0148)
|
||||||
|
/* SENS_SAR_DATE : R/W ;bitpos:[27:0] ;default: 28'h1906140 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define SENS_SAR_DATE 0x0FFFFFFF
|
#define SENS_SAR_DATE 0x0FFFFFFF
|
||||||
#define SENS_SAR_DATE_M ((SENS_SAR_DATE_V)<<(SENS_SAR_DATE_S))
|
#define SENS_SAR_DATE_M ((SENS_SAR_DATE_V)<<(SENS_SAR_DATE_S))
|
||||||
|
|
|
@ -21,8 +21,7 @@ typedef volatile struct {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t sar1_clk_div: 8; /*clock divider*/
|
uint32_t sar1_clk_div: 8; /*clock divider*/
|
||||||
uint32_t sar1_sample_cycle: 8; /*sample cycles for SAR ADC1*/
|
uint32_t reserved8: 10;
|
||||||
uint32_t sar1_sample_bit: 2; /*00: for 9-bit width*/
|
|
||||||
uint32_t sar1_clk_gated: 1;
|
uint32_t sar1_clk_gated: 1;
|
||||||
uint32_t sar1_sample_num: 8;
|
uint32_t sar1_sample_num: 8;
|
||||||
uint32_t reserved27: 1;
|
uint32_t reserved27: 1;
|
||||||
|
@ -35,9 +34,9 @@ typedef volatile struct {
|
||||||
uint32_t sar_reader1_status; /**/
|
uint32_t sar_reader1_status; /**/
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t sar1_bit_width: 2; /*00: 9 bit*/
|
uint32_t reserved0: 22;
|
||||||
uint32_t sar1_stop: 1; /*stop SAR ADC1 conversion*/
|
uint32_t rtc_saradc_reset: 1;
|
||||||
uint32_t reserved3: 21;
|
uint32_t rtc_saradc_clkgate_en: 1;
|
||||||
uint32_t force_xpd_amp: 2;
|
uint32_t force_xpd_amp: 2;
|
||||||
uint32_t amp_rst_fb_force: 2;
|
uint32_t amp_rst_fb_force: 2;
|
||||||
uint32_t amp_short_ref_force: 2;
|
uint32_t amp_short_ref_force: 2;
|
||||||
|
@ -101,8 +100,8 @@ typedef volatile struct {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t sar2_clk_div: 8; /*clock divider*/
|
uint32_t sar2_clk_div: 8; /*clock divider*/
|
||||||
uint32_t sar2_sample_cycle: 8; /*sample cycles for SAR ADC2*/
|
uint32_t reserved8: 8;
|
||||||
uint32_t sar2_sample_bit: 2; /*00: for 9-bit width*/
|
uint32_t sar2_wait_arb_cycle: 2; /*wait arbit stable after sar_done*/
|
||||||
uint32_t sar2_clk_gated: 1;
|
uint32_t sar2_clk_gated: 1;
|
||||||
uint32_t sar2_sample_num: 8;
|
uint32_t sar2_sample_num: 8;
|
||||||
uint32_t reserved27: 2;
|
uint32_t reserved27: 2;
|
||||||
|
@ -115,8 +114,7 @@ typedef volatile struct {
|
||||||
uint32_t sar_reader2_status; /**/
|
uint32_t sar_reader2_status; /**/
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t sar2_bit_width: 2; /*00: 9 bit*/
|
uint32_t sar2_cntl_state: 3; /*saradc2_cntl_fsm*/
|
||||||
uint32_t sar2_stop: 1; /*stop SAR ADC2 conversion*/
|
|
||||||
uint32_t sar2_pwdet_cal_en: 1; /*rtc control pwdet enable*/
|
uint32_t sar2_pwdet_cal_en: 1; /*rtc control pwdet enable*/
|
||||||
uint32_t sar2_pkdet_cal_en: 1; /*rtc control pkdet enable*/
|
uint32_t sar2_pkdet_cal_en: 1; /*rtc control pkdet enable*/
|
||||||
uint32_t sar2_en_test: 1; /*SAR2_EN_TEST*/
|
uint32_t sar2_en_test: 1; /*SAR2_EN_TEST*/
|
||||||
|
@ -149,9 +147,7 @@ typedef volatile struct {
|
||||||
uint32_t sar_atten2; /*2-bit attenuation for each pad*/
|
uint32_t sar_atten2; /*2-bit attenuation for each pad*/
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t reserved0: 23;
|
uint32_t reserved0: 29;
|
||||||
uint32_t sar2_dref: 3; /*Adjust saradc2 offset*/
|
|
||||||
uint32_t sar1_dref: 3; /*Adjust saradc1 offset*/
|
|
||||||
uint32_t force_xpd_sar: 2;
|
uint32_t force_xpd_sar: 2;
|
||||||
uint32_t sarclk_en: 1;
|
uint32_t sarclk_en: 1;
|
||||||
};
|
};
|
||||||
|
@ -201,9 +197,7 @@ typedef volatile struct {
|
||||||
uint32_t tsens_power_up: 1; /*temperature sensor power up*/
|
uint32_t tsens_power_up: 1; /*temperature sensor power up*/
|
||||||
uint32_t tsens_power_up_force: 1; /*1: dump out & power up controlled by SW*/
|
uint32_t tsens_power_up_force: 1; /*1: dump out & power up controlled by SW*/
|
||||||
uint32_t tsens_dump_out: 1; /*temperature sensor dump out*/
|
uint32_t tsens_dump_out: 1; /*temperature sensor dump out*/
|
||||||
uint32_t tsens_diz: 1; /*ADC input short*/
|
uint32_t reserved25: 7;
|
||||||
uint32_t tsens_div_chop: 2; /*0 for steady phase 0 1 for steady phase 1 2 for chopping with ½ frequency of TSENS_CK 3 for chopping with ¼*/
|
|
||||||
uint32_t tsens_dac: 4; /*Temperature sensor offset dac. 15 for 0 offset 5 for -2 7 for -1 11 for 1 10 for 2*/
|
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} sar_tctrl;
|
} sar_tctrl;
|
||||||
|
@ -231,7 +225,9 @@ typedef volatile struct {
|
||||||
struct {
|
struct {
|
||||||
uint32_t touch_outen: 15; /*touch controller output enable*/
|
uint32_t touch_outen: 15; /*touch controller output enable*/
|
||||||
uint32_t touch_status_clr: 1; /*clear all touch active status*/
|
uint32_t touch_status_clr: 1; /*clear all touch active status*/
|
||||||
uint32_t reserved16: 4;
|
uint32_t touch_data_sel: 2; /*3: smooth data 2: baseline 1 0: raw_data*/
|
||||||
|
uint32_t touch_denoise_end: 1; /*touch_denoise_done*/
|
||||||
|
uint32_t touch_unit_end: 1; /*touch_unit_done*/
|
||||||
uint32_t touch_approach_pad2: 4; /*indicate which pad is approach pad2*/
|
uint32_t touch_approach_pad2: 4; /*indicate which pad is approach pad2*/
|
||||||
uint32_t touch_approach_pad1: 4; /*indicate which pad is approach pad1*/
|
uint32_t touch_approach_pad1: 4; /*indicate which pad is approach pad1*/
|
||||||
uint32_t touch_approach_pad0: 4; /*indicate which pad is approach pad0*/
|
uint32_t touch_approach_pad0: 4; /*indicate which pad is approach pad0*/
|
||||||
|
@ -245,13 +241,21 @@ typedef volatile struct {
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} touch_thresh[14];
|
} touch_thresh[14];
|
||||||
union {
|
uint32_t reserved_98;
|
||||||
struct {
|
uint32_t reserved_9c;
|
||||||
uint32_t meas_out: 22; /*the counter for touch pad 1*/
|
uint32_t reserved_a0;
|
||||||
uint32_t reserved22: 10;
|
uint32_t reserved_a4;
|
||||||
};
|
uint32_t reserved_a8;
|
||||||
uint32_t val;
|
uint32_t reserved_ac;
|
||||||
} touch_meas[15];
|
uint32_t reserved_b0;
|
||||||
|
uint32_t reserved_b4;
|
||||||
|
uint32_t reserved_b8;
|
||||||
|
uint32_t reserved_bc;
|
||||||
|
uint32_t reserved_c0;
|
||||||
|
uint32_t reserved_c4;
|
||||||
|
uint32_t reserved_c8;
|
||||||
|
uint32_t reserved_cc;
|
||||||
|
uint32_t reserved_d0;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t touch_pad_active: 15; /*touch active status*/
|
uint32_t touch_pad_active: 15; /*touch active status*/
|
||||||
|
@ -271,12 +275,20 @@ typedef volatile struct {
|
||||||
} sar_touch_status0;
|
} sar_touch_status0;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t touch_pad_baseline: 22;
|
uint32_t touch_pad_data: 22;
|
||||||
uint32_t reserved22: 7;
|
uint32_t reserved22: 7;
|
||||||
uint32_t touch_pad_debounce: 3;
|
uint32_t touch_pad_debounce: 3;
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} sar_touch_status[14];
|
} sar_touch_status[14];
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t touch_slp_data: 22;
|
||||||
|
uint32_t reserved22: 7;
|
||||||
|
uint32_t touch_slp_debounce: 3;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} sar_touch_slp_status;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t touch_approach_pad2_cnt: 8;
|
uint32_t touch_approach_pad2_cnt: 8;
|
||||||
|
@ -285,7 +297,7 @@ typedef volatile struct {
|
||||||
uint32_t touch_slp_approach_cnt: 8;
|
uint32_t touch_slp_approach_cnt: 8;
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} sar_touch_status16;
|
} sar_touch_appr_status;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t sw_fstep: 16; /*frequency step for CW generator*/
|
uint32_t sw_fstep: 16; /*frequency step for CW generator*/
|
||||||
|
@ -295,7 +307,9 @@ typedef volatile struct {
|
||||||
uint32_t dac_clk_force_low: 1; /*1: force PDAC_CLK to low*/
|
uint32_t dac_clk_force_low: 1; /*1: force PDAC_CLK to low*/
|
||||||
uint32_t dac_clk_force_high: 1; /*1: force PDAC_CLK to high*/
|
uint32_t dac_clk_force_high: 1; /*1: force PDAC_CLK to high*/
|
||||||
uint32_t dac_clk_inv: 1; /*1: invert PDAC_CLK*/
|
uint32_t dac_clk_inv: 1; /*1: invert PDAC_CLK*/
|
||||||
uint32_t reserved26: 6;
|
uint32_t dac_reset: 1;
|
||||||
|
uint32_t dac_clkgate_en: 1;
|
||||||
|
uint32_t reserved28: 4;
|
||||||
};
|
};
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} sar_dac_ctrl1;
|
} sar_dac_ctrl1;
|
||||||
|
@ -407,6 +421,14 @@ typedef volatile struct {
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
} sar_hall_ctrl;
|
} sar_hall_ctrl;
|
||||||
uint32_t sar_nouse; /**/
|
uint32_t sar_nouse; /**/
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t reserved0: 30;
|
||||||
|
uint32_t iomux_reset: 1;
|
||||||
|
uint32_t iomux_clk_gate_en: 1;
|
||||||
|
};
|
||||||
|
uint32_t val;
|
||||||
|
} sar_io_mux_conf;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32_t sar_date: 28;
|
uint32_t sar_date: 28;
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
#define DR_REG_PCNT_BASE 0x3f417000
|
#define DR_REG_PCNT_BASE 0x3f417000
|
||||||
#define DR_REG_SLC_BASE 0x3f418000
|
#define DR_REG_SLC_BASE 0x3f418000
|
||||||
#define DR_REG_LEDC_BASE 0x3f419000
|
#define DR_REG_LEDC_BASE 0x3f419000
|
||||||
|
#define DR_REG_MCP_BASE 0x3f4c3000
|
||||||
#define DR_REG_EFUSE_BASE 0x3f41A000
|
#define DR_REG_EFUSE_BASE 0x3f41A000
|
||||||
#define DR_REG_NRX_BASE 0x3f41CC00
|
#define DR_REG_NRX_BASE 0x3f41CC00
|
||||||
#define DR_REG_BB_BASE 0x3f41D000
|
#define DR_REG_BB_BASE 0x3f41D000
|
||||||
|
|
|
@ -898,6 +898,10 @@ extern "C" {
|
||||||
#define DPORT_SOC_CLK_SEL_M ((DPORT_SOC_CLK_SEL_V)<<(DPORT_SOC_CLK_SEL_S))
|
#define DPORT_SOC_CLK_SEL_M ((DPORT_SOC_CLK_SEL_V)<<(DPORT_SOC_CLK_SEL_S))
|
||||||
#define DPORT_SOC_CLK_SEL_V 0x3
|
#define DPORT_SOC_CLK_SEL_V 0x3
|
||||||
#define DPORT_SOC_CLK_SEL_S 10
|
#define DPORT_SOC_CLK_SEL_S 10
|
||||||
|
#define DPORT_SOC_CLK_SEL_XTL 0
|
||||||
|
#define DPORT_SOC_CLK_SEL_PLL 1
|
||||||
|
#define DPORT_SOC_CLK_SEL_8M 2
|
||||||
|
#define DPORT_SOC_CLK_SEL_APLL 3
|
||||||
/* DPORT_PRE_DIV_CNT : R/W ;bitpos:[9:0] ;default: 10'h1 ; */
|
/* DPORT_PRE_DIV_CNT : R/W ;bitpos:[9:0] ;default: 10'h1 ; */
|
||||||
/*description: */
|
/*description: */
|
||||||
#define DPORT_PRE_DIV_CNT 0x000003FF
|
#define DPORT_PRE_DIV_CNT 0x000003FF
|
||||||
|
|
|
@ -25,25 +25,40 @@
|
||||||
#define TOUCH_PAD_GPIO2_CHANNEL TOUCH_PAD_NUM2
|
#define TOUCH_PAD_GPIO2_CHANNEL TOUCH_PAD_NUM2
|
||||||
#define TOUCH_PAD_NUM2_GPIO_NUM 2
|
#define TOUCH_PAD_NUM2_GPIO_NUM 2
|
||||||
|
|
||||||
#define TOUCH_PAD_GPIO15_CHANNEL TOUCH_PAD_NUM3
|
#define TOUCH_PAD_GPIO3_CHANNEL TOUCH_PAD_NUM3
|
||||||
#define TOUCH_PAD_NUM3_GPIO_NUM 15
|
#define TOUCH_PAD_NUM3_GPIO_NUM 3
|
||||||
|
|
||||||
#define TOUCH_PAD_GPIO13_CHANNEL TOUCH_PAD_NUM4
|
#define TOUCH_PAD_GPIO4_CHANNEL TOUCH_PAD_NUM4
|
||||||
#define TOUCH_PAD_NUM4_GPIO_NUM 13
|
#define TOUCH_PAD_NUM4_GPIO_NUM 4
|
||||||
|
|
||||||
#define TOUCH_PAD_GPIO12_CHANNEL TOUCH_PAD_NUM5
|
#define TOUCH_PAD_GPIO5_CHANNEL TOUCH_PAD_NUM5
|
||||||
#define TOUCH_PAD_NUM5_GPIO_NUM 12
|
#define TOUCH_PAD_NUM5_GPIO_NUM 5
|
||||||
|
|
||||||
#define TOUCH_PAD_GPIO14_CHANNEL TOUCH_PAD_NUM6
|
#define TOUCH_PAD_GPIO6_CHANNEL TOUCH_PAD_NUM6
|
||||||
#define TOUCH_PAD_NUM6_GPIO_NUM 14
|
#define TOUCH_PAD_NUM6_GPIO_NUM 6
|
||||||
|
|
||||||
#define TOUCH_PAD_GPIO27_CHANNEL TOUCH_PAD_NUM7
|
#define TOUCH_PAD_GPIO7_CHANNEL TOUCH_PAD_NUM7
|
||||||
#define TOUCH_PAD_NUM7_GPIO_NUM 27
|
#define TOUCH_PAD_NUM7_GPIO_NUM 7
|
||||||
|
|
||||||
#define TOUCH_PAD_GPIO33_CHANNEL TOUCH_PAD_NUM8
|
#define TOUCH_PAD_GPIO8_CHANNEL TOUCH_PAD_NUM8
|
||||||
#define TOUCH_PAD_NUM8_GPIO_NUM 33
|
#define TOUCH_PAD_NUM8_GPIO_NUM 8
|
||||||
|
|
||||||
#define TOUCH_PAD_GPIO32_CHANNEL TOUCH_PAD_NUM9
|
#define TOUCH_PAD_GPIO9_CHANNEL TOUCH_PAD_NUM9
|
||||||
#define TOUCH_PAD_NUM9_GPIO_NUM 32
|
#define TOUCH_PAD_NUM9_GPIO_NUM 9
|
||||||
|
|
||||||
|
#define TOUCH_PAD_GPIO10_CHANNEL TOUCH_PAD_NUM10
|
||||||
|
#define TOUCH_PAD_NUM10_GPIO_NUM 10
|
||||||
|
|
||||||
|
#define TOUCH_PAD_GPIO11_CHANNEL TOUCH_PAD_NUM11
|
||||||
|
#define TOUCH_PAD_NUM11_GPIO_NUM 11
|
||||||
|
|
||||||
|
#define TOUCH_PAD_GPIO12_CHANNEL TOUCH_PAD_NUM12
|
||||||
|
#define TOUCH_PAD_NUM12_GPIO_NUM 12
|
||||||
|
|
||||||
|
#define TOUCH_PAD_GPIO13_CHANNEL TOUCH_PAD_NUM13
|
||||||
|
#define TOUCH_PAD_NUM13_GPIO_NUM 13
|
||||||
|
|
||||||
|
#define TOUCH_PAD_GPIO14_CHANNEL TOUCH_PAD_NUM14
|
||||||
|
#define TOUCH_PAD_NUM14_GPIO_NUM 14
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,4 +27,9 @@ const int touch_sensor_channel_io_map[SOC_TOUCH_SENSOR_NUM] = {
|
||||||
TOUCH_PAD_NUM7_GPIO_NUM,
|
TOUCH_PAD_NUM7_GPIO_NUM,
|
||||||
TOUCH_PAD_NUM8_GPIO_NUM,
|
TOUCH_PAD_NUM8_GPIO_NUM,
|
||||||
TOUCH_PAD_NUM9_GPIO_NUM,
|
TOUCH_PAD_NUM9_GPIO_NUM,
|
||||||
|
TOUCH_PAD_NUM10_GPIO_NUM,
|
||||||
|
TOUCH_PAD_NUM11_GPIO_NUM,
|
||||||
|
TOUCH_PAD_NUM12_GPIO_NUM,
|
||||||
|
TOUCH_PAD_NUM13_GPIO_NUM,
|
||||||
|
TOUCH_PAD_NUM14_GPIO_NUM
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "soc/rtc_io_struct.h"
|
#include "soc/rtc_io_struct.h"
|
||||||
#include "soc/rtc_cntl_reg.h"
|
#include "soc/rtc_cntl_reg.h"
|
||||||
#include "soc/rtc_cntl_struct.h"
|
#include "soc/rtc_cntl_struct.h"
|
||||||
|
#include "soc/sens_struct.h"
|
||||||
#include "soc/gpio_caps.h"
|
#include "soc/gpio_caps.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -111,12 +111,17 @@ extern "C" {
|
||||||
/**
|
/**
|
||||||
* To enable touch pad interrupt.
|
* To enable touch pad interrupt.
|
||||||
*/
|
*/
|
||||||
#define touch_hal_enable_interrupt() touch_ll_enable_interrupt()
|
#define touch_hal_intr_enable() touch_ll_intr_enable()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To disable touch pad interrupt.
|
* To disable touch pad interrupt.
|
||||||
*/
|
*/
|
||||||
#define touch_hal_disable_interrupt() touch_ll_disable_interrupt()
|
#define touch_hal_intr_disable() touch_ll_intr_disable()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To clear touch pad interrupt.
|
||||||
|
*/
|
||||||
|
#define touch_hal_intr_clear() touch_ll_intr_clear()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the touch pad which caused wakeup from deep sleep.
|
* Get the touch pad which caused wakeup from deep sleep.
|
||||||
|
|
|
@ -458,7 +458,7 @@ static inline void touch_ll_clear_trigger_status_mask(void)
|
||||||
/**
|
/**
|
||||||
* To enable touch pad interrupt.
|
* To enable touch pad interrupt.
|
||||||
*/
|
*/
|
||||||
static inline void touch_ll_enable_interrupt(void)
|
static inline void touch_ll_intr_enable(void)
|
||||||
{
|
{
|
||||||
RTCCNTL.int_ena.rtc_touch = 1;
|
RTCCNTL.int_ena.rtc_touch = 1;
|
||||||
}
|
}
|
||||||
|
@ -466,11 +466,19 @@ static inline void touch_ll_enable_interrupt(void)
|
||||||
/**
|
/**
|
||||||
* To disable touch pad interrupt.
|
* To disable touch pad interrupt.
|
||||||
*/
|
*/
|
||||||
static inline void touch_ll_disable_interrupt(void)
|
static inline void touch_ll_intr_disable(void)
|
||||||
{
|
{
|
||||||
RTCCNTL.int_ena.rtc_touch = 0;
|
RTCCNTL.int_ena.rtc_touch = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To clear touch pad interrupt.
|
||||||
|
*/
|
||||||
|
static inline void touch_ll_intr_clear(void)
|
||||||
|
{
|
||||||
|
RTCCNTL.int_clr.rtc_touch = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get touch sensor raw data (touch sensor counter value) from register. No block.
|
* Get touch sensor raw data (touch sensor counter value) from register. No block.
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
void touch_hal_init(void)
|
void touch_hal_init(void)
|
||||||
{
|
{
|
||||||
touch_ll_disable_interrupt();
|
touch_ll_intr_disable();
|
||||||
touch_ll_clear_channel_mask(SOC_TOUCH_SENSOR_BIT_MASK_MAX);
|
touch_ll_clear_channel_mask(SOC_TOUCH_SENSOR_BIT_MASK_MAX);
|
||||||
touch_ll_clear_group_mask(SOC_TOUCH_SENSOR_BIT_MASK_MAX, SOC_TOUCH_SENSOR_BIT_MASK_MAX);
|
touch_ll_clear_group_mask(SOC_TOUCH_SENSOR_BIT_MASK_MAX, SOC_TOUCH_SENSOR_BIT_MASK_MAX);
|
||||||
touch_ll_set_trigger_mode(TOUCH_TRIGGER_MODE_DEFAULT);
|
touch_ll_set_trigger_mode(TOUCH_TRIGGER_MODE_DEFAULT);
|
||||||
|
@ -35,13 +35,13 @@ void touch_hal_deinit(void)
|
||||||
{
|
{
|
||||||
touch_ll_stop_fsm();
|
touch_ll_stop_fsm();
|
||||||
touch_ll_clear_trigger_status_mask();
|
touch_ll_clear_trigger_status_mask();
|
||||||
touch_ll_disable_interrupt();
|
touch_ll_intr_disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void touch_hal_get_wakeup_status(touch_pad_t *pad_num)
|
void touch_hal_get_wakeup_status(touch_pad_t *pad_num)
|
||||||
{
|
{
|
||||||
uint32_t touch_mask = 0;
|
uint32_t touch_mask = 0;
|
||||||
touch_hal_read_trigger_status_mask(&touch_mask);
|
touch_ll_read_trigger_status_mask(&touch_mask);
|
||||||
if (touch_mask == 0) {
|
if (touch_mask == 0) {
|
||||||
*pad_num = -1;
|
*pad_num = -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,11 +257,11 @@ static inline uint32_t adc_ll_pwdet_get_cct(void)
|
||||||
static inline void adc_ll_rtc_set_output_format(adc_ll_num_t adc_n, adc_bits_width_t bits)
|
static inline void adc_ll_rtc_set_output_format(adc_ll_num_t adc_n, adc_bits_width_t bits)
|
||||||
{
|
{
|
||||||
if (adc_n == ADC_NUM_1) {
|
if (adc_n == ADC_NUM_1) {
|
||||||
SENS.sar_meas1_ctrl1.sar1_bit_width = bits;
|
// SENS.sar_meas1_ctrl1.sar1_bit_width = bits;
|
||||||
SENS.sar_reader1_ctrl.sar1_sample_bit = bits;
|
// SENS.sar_reader1_ctrl.sar1_sample_bit = bits;
|
||||||
} else { // adc_n == ADC_NUM_2
|
} else { // adc_n == ADC_NUM_2
|
||||||
SENS.sar_meas2_ctrl1.sar2_bit_width = bits;
|
// SENS.sar_meas2_ctrl1.sar2_bit_width = bits;
|
||||||
SENS.sar_reader2_ctrl.sar2_sample_bit = bits;
|
// SENS.sar_reader2_ctrl.sar2_sample_bit = bits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,12 +55,14 @@ typedef enum {
|
||||||
static inline void rtcio_ll_function_select(int rtcio_num, rtcio_ll_func_t func)
|
static inline void rtcio_ll_function_select(int rtcio_num, rtcio_ll_func_t func)
|
||||||
{
|
{
|
||||||
if (func == RTCIO_FUNC_RTC) {
|
if (func == RTCIO_FUNC_RTC) {
|
||||||
|
SENS.sar_io_mux_conf.iomux_clk_gate_en = 1;
|
||||||
// 0: GPIO connected to digital GPIO module. 1: GPIO connected to analog RTC module.
|
// 0: GPIO connected to digital GPIO module. 1: GPIO connected to analog RTC module.
|
||||||
SET_PERI_REG_MASK(rtc_io_desc[rtcio_num].reg, (rtc_io_desc[rtcio_num].mux));
|
SET_PERI_REG_MASK(rtc_io_desc[rtcio_num].reg, (rtc_io_desc[rtcio_num].mux));
|
||||||
//0:RTC FUNCTION 1,2,3:Reserved
|
//0:RTC FUNCTION 1,2,3:Reserved
|
||||||
SET_PERI_REG_BITS(rtc_io_desc[rtcio_num].reg, RTC_IO_TOUCH_PAD1_FUN_SEL_V, SOC_PIN_FUNC_RTC_IO, rtc_io_desc[rtcio_num].func);
|
SET_PERI_REG_BITS(rtc_io_desc[rtcio_num].reg, RTC_IO_TOUCH_PAD1_FUN_SEL_V, SOC_PIN_FUNC_RTC_IO, rtc_io_desc[rtcio_num].func);
|
||||||
} else if (func == RTCIO_FUNC_DIGITAL) {
|
} else if (func == RTCIO_FUNC_DIGITAL) {
|
||||||
CLEAR_PERI_REG_MASK(rtc_io_desc[rtcio_num].reg, (rtc_io_desc[rtcio_num].mux));
|
CLEAR_PERI_REG_MASK(rtc_io_desc[rtcio_num].reg, (rtc_io_desc[rtcio_num].mux));
|
||||||
|
SENS.sar_io_mux_conf.iomux_clk_gate_en = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ extern "C" {
|
||||||
*
|
*
|
||||||
* @param type Select idle channel connect to high resistance state or ground.
|
* @param type Select idle channel connect to high resistance state or ground.
|
||||||
*/
|
*/
|
||||||
#define touch_hal_set_inactive_connect(type) touch_ll_set_inactive_connect(type)
|
#define touch_hal_set_idle_channel_connect(type) touch_ll_set_idle_channel_connect(type)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set connection type of touch channel in idle status.
|
* Set connection type of touch channel in idle status.
|
||||||
|
@ -75,7 +75,7 @@ extern "C" {
|
||||||
*
|
*
|
||||||
* @param type Select idle channel connect to high resistance state or ground.
|
* @param type Select idle channel connect to high resistance state or ground.
|
||||||
*/
|
*/
|
||||||
#define touch_hal_get_inactive_connect(type) touch_ll_get_inactive_connect(type)
|
#define touch_hal_get_idle_channel_connect(type) touch_ll_get_idle_channel_connect(type)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current measure channel. Touch sensor measurement is cyclic scan mode.
|
* Get the current measure channel. Touch sensor measurement is cyclic scan mode.
|
||||||
|
@ -99,6 +99,13 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define touch_hal_intr_disable(int_mask) touch_ll_intr_disable(int_mask)
|
#define touch_hal_intr_disable(int_mask) touch_ll_intr_disable(int_mask)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear touch sensor interrupt by bitmask.
|
||||||
|
*
|
||||||
|
* @param int_mask Pad mask to clear interrupts
|
||||||
|
*/
|
||||||
|
#define touch_hal_intr_clear(int_mask) touch_ll_intr_clear(int_mask)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the bitmask of touch sensor interrupt status.
|
* Get the bitmask of touch sensor interrupt status.
|
||||||
*
|
*
|
||||||
|
@ -106,6 +113,48 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define touch_hal_read_intr_status_mask() touch_ll_read_intr_status_mask()
|
#define touch_hal_read_intr_status_mask() touch_ll_read_intr_status_mask()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable the timeout check for all touch sensor channels measurements.
|
||||||
|
* When the touch reading of a touch channel exceeds the measurement threshold,
|
||||||
|
* If enable: a timeout interrupt will be generated and it will go to the next channel measurement.
|
||||||
|
* If disable: the FSM is always on the channel, until the measurement of this channel is over.
|
||||||
|
*
|
||||||
|
* @note Set the timeout threshold correctly before enabling it.
|
||||||
|
*/
|
||||||
|
#define touch_hal_timeout_enable() touch_ll_timeout_enable()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the timeout check for all touch sensor channels measurements.
|
||||||
|
* When the touch reading of a touch channel exceeds the measurement threshold,
|
||||||
|
* If enable: a timeout interrupt will be generated and it will go to the next channel measurement.
|
||||||
|
* If disable: the FSM is always on the channel, until the measurement of this channel is over.
|
||||||
|
*
|
||||||
|
* @note Set the timeout threshold correctly before enabling it.
|
||||||
|
*/
|
||||||
|
#define touch_hal_timeout_disable() touch_ll_timeout_disable()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set timeout threshold for all touch sensor channels measurements.
|
||||||
|
* Compared with touch readings.
|
||||||
|
*
|
||||||
|
* @param threshold Set to the maximum time measured on one channel.
|
||||||
|
*/
|
||||||
|
#define touch_hal_timeout_set_threshold(threshold) touch_ll_timeout_set_threshold(threshold)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get timeout threshold for all touch sensor channels measurements.
|
||||||
|
* Compared with touch readings.
|
||||||
|
*
|
||||||
|
* @param threshold Point to timeout threshold.
|
||||||
|
*/
|
||||||
|
#define touch_hal_timeout_get_threshold(threshold) touch_ll_timeout_get_threshold(threshold)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Touch timer trigger measurement and always wait measurement done.
|
||||||
|
* Force done for touch timer ensures that the timer always can get the measurement done signal.
|
||||||
|
*/
|
||||||
|
#define touch_hal_timer_force_done() touch_ll_timer_force_done()
|
||||||
|
|
||||||
/************************ Filter register setting ************************/
|
/************************ Filter register setting ************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -124,6 +173,14 @@ void touch_hal_filter_set_config(const touch_filter_config_t *filter_info);
|
||||||
*/
|
*/
|
||||||
void touch_hal_filter_get_config(touch_filter_config_t *filter_info);
|
void touch_hal_filter_get_config(touch_filter_config_t *filter_info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get smoothed data that obtained by filtering the raw data.
|
||||||
|
*
|
||||||
|
* @param touch_num touch pad index
|
||||||
|
* @param smooth_data pointer to smoothed data
|
||||||
|
*/
|
||||||
|
#define touch_hal_filter_read_smooth(touch_num, smooth_data) touch_ll_filter_read_smooth(touch_num, smooth_data)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get baseline value of touch sensor.
|
* Get baseline value of touch sensor.
|
||||||
*
|
*
|
||||||
|
@ -434,22 +491,19 @@ void touch_hal_waterproof_enable(void);
|
||||||
#define touch_hal_waterproof_disable() touch_ll_waterproof_disable()
|
#define touch_hal_waterproof_disable() touch_ll_waterproof_disable()
|
||||||
|
|
||||||
/************************ Proximity register setting ************************/
|
/************************ Proximity register setting ************************/
|
||||||
/**
|
|
||||||
* Set parameter of proximity channel. Three proximity sensing channels can be set.
|
|
||||||
* The proximity sensor measurement is the accumulation of touch channel measurements.
|
|
||||||
*
|
|
||||||
* @note If stop the proximity function for the channel, point this proximity channel to `TOUCH_PAD_NUM0`.
|
|
||||||
* @param proximity parameter of proximity
|
|
||||||
*/
|
|
||||||
void touch_hal_proximity_set_config(const touch_pad_proximity_t *proximity);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get parameter of proximity channel. Three proximity sensing channels can be set.
|
* Enable/disable proximity function of touch channels.
|
||||||
* The proximity sensor measurement is the accumulation of touch channel measurements.
|
* The proximity sensor measurement is the accumulation of touch channel measurements.
|
||||||
*
|
*
|
||||||
* @param proximity parameter of proximity.
|
* @note Supports up to three touch channels configured as proximity sensors.
|
||||||
|
* @param touch_num touch pad index
|
||||||
|
* @param enabled true: enable the proximity function; false: disable the proximity function
|
||||||
|
* @return
|
||||||
|
* - true: Configured correctly.
|
||||||
|
* - false: Configured error.
|
||||||
*/
|
*/
|
||||||
void touch_hal_proximity_get_config(touch_pad_proximity_t *proximity);
|
bool touch_hal_enable_proximity(touch_pad_t touch_num, bool enabled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set touch channel number for proximity pad.
|
* Set touch channel number for proximity pad.
|
||||||
|
@ -496,15 +550,27 @@ void touch_hal_proximity_get_config(touch_pad_proximity_t *proximity);
|
||||||
#define touch_hal_proximity_pad_check(touch_num) touch_ll_proximity_pad_check(touch_num)
|
#define touch_hal_proximity_pad_check(touch_num) touch_ll_proximity_pad_check(touch_num)
|
||||||
|
|
||||||
/************** sleep pad setting ***********************/
|
/************** sleep pad setting ***********************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set parameter of touch sensor in sleep mode.
|
* Get parameter of touch sensor sleep channel.
|
||||||
* In order to achieve low power consumption in sleep mode, other circuits except the RTC part of the register are in a power-off state.
|
* The touch sensor can works in sleep mode to wake up sleep.
|
||||||
* Only one touch channel is supported in the sleep state, which can be used as a wake-up function.
|
* After the sleep channel is configured, users should query the channel reading using a specific function.
|
||||||
* If in non-sleep mode, the sleep parameters do not work.
|
|
||||||
*
|
*
|
||||||
* @param slp_config touch pad config.
|
* @param slp_config Point to touch sleep pad config.
|
||||||
*/
|
*/
|
||||||
void touch_hal_sleep_channel_config(const touch_pad_sleep_channel_t *slp_config);
|
void touch_hal_sleep_channel_get_config(touch_pad_sleep_channel_t *slp_config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set parameter of touch sensor sleep channel.
|
||||||
|
* The touch sensor can works in sleep mode to wake up sleep.
|
||||||
|
* After the sleep channel is configured, users should query the channel reading using a specific function.
|
||||||
|
*
|
||||||
|
* @note ESP32S2 only support one channel to be set sleep channel.
|
||||||
|
*
|
||||||
|
* @param pad_num touch sleep pad number.
|
||||||
|
* @param enable Enable/disable sleep pad function.
|
||||||
|
*/
|
||||||
|
void touch_hal_sleep_channel_enable(touch_pad_t pad_num, bool enable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set touch channel number for sleep pad.
|
* Set touch channel number for sleep pad.
|
||||||
|
@ -557,6 +623,21 @@ void touch_hal_sleep_channel_config(const touch_pad_sleep_channel_t *slp_config)
|
||||||
*/
|
*/
|
||||||
#define touch_hal_sleep_read_baseline(baseline) touch_ll_sleep_read_baseline(baseline)
|
#define touch_hal_sleep_read_baseline(baseline) touch_ll_sleep_read_baseline(baseline)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read smooth data of touch sensor for sleep pad.
|
||||||
|
*/
|
||||||
|
#define touch_hal_sleep_read_smooth(smooth_data) touch_ll_sleep_read_smooth(smooth_data)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read raw data of touch sensor for sleep pad.
|
||||||
|
*/
|
||||||
|
#define touch_hal_sleep_read_data(raw_data) touch_ll_sleep_read_data(raw_data)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset baseline of touch sensor for sleep pad.
|
||||||
|
*/
|
||||||
|
#define touch_hal_sleep_reset_baseline() touch_ll_sleep_reset_baseline()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read debounce of touch sensor for sleep pad.
|
* Read debounce of touch sensor for sleep pad.
|
||||||
*
|
*
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TOUCH_LL_READ_RAW 0x0
|
||||||
|
#define TOUCH_LL_READ_BASELINE 0x2
|
||||||
|
#define TOUCH_LL_READ_SMOOTH 0x3
|
||||||
|
#define TOUCH_LL_TIMER_FORCE_DONE 0x3
|
||||||
|
#define TOUCH_LL_TIMER_DONE 0x0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set touch sensor touch sensor times of charge and discharge.
|
* Set touch sensor touch sensor times of charge and discharge.
|
||||||
|
@ -226,29 +231,62 @@ static inline void touch_ll_get_fsm_mode(touch_fsm_mode_t *mode)
|
||||||
*mode = (touch_fsm_mode_t)RTCCNTL.touch_ctrl2.touch_start_force;
|
*mode = (touch_fsm_mode_t)RTCCNTL.touch_ctrl2.touch_start_force;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/disable clock gate of touch sensor.
|
||||||
|
*
|
||||||
|
* @param enable true/false.
|
||||||
|
*/
|
||||||
|
static inline void touch_ll_clkgate(bool enable)
|
||||||
|
{
|
||||||
|
RTCCNTL.touch_ctrl2.touch_clkgate_en = enable; //enable touch clock for FSM. or force enable.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get touch sensor FSM state.
|
||||||
|
* @return
|
||||||
|
* - true: fsm state is open.
|
||||||
|
* - false: fsm state is close.
|
||||||
|
*/
|
||||||
|
static inline bool touch_ll_clkgate_get_state(void)
|
||||||
|
{
|
||||||
|
return RTCCNTL.touch_ctrl2.touch_clkgate_en;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Touch timer trigger measurement and always wait measurement done.
|
||||||
|
* Force done for touch timer ensures that the timer always can get the measurement done signal.
|
||||||
|
*/
|
||||||
|
static inline void touch_ll_timer_force_done(void)
|
||||||
|
{
|
||||||
|
RTCCNTL.touch_ctrl2.touch_timer_force_done = TOUCH_LL_TIMER_FORCE_DONE;
|
||||||
|
RTCCNTL.touch_ctrl2.touch_timer_force_done = TOUCH_LL_TIMER_DONE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start touch sensor FSM timer.
|
* Start touch sensor FSM timer.
|
||||||
* The measurement action can be triggered by the hardware timer, as well as by the software instruction.
|
* The measurement action can be triggered by the hardware timer, as well as by the software instruction.
|
||||||
*
|
|
||||||
* @param mode FSM mode.
|
|
||||||
*/
|
*/
|
||||||
static inline void touch_ll_start_fsm(void)
|
static inline void touch_ll_start_fsm(void)
|
||||||
{
|
{
|
||||||
RTCCNTL.touch_ctrl2.touch_clkgate_en = 1; //enable touch clock for FSM. or force enable.
|
/**
|
||||||
|
* Touch timer trigger measurement and always wait measurement done.
|
||||||
|
* Force done for touch timer ensures that the timer always can get the measurement done signal.
|
||||||
|
*/
|
||||||
|
RTCCNTL.touch_ctrl2.touch_timer_force_done = TOUCH_LL_TIMER_FORCE_DONE;
|
||||||
|
RTCCNTL.touch_ctrl2.touch_timer_force_done = TOUCH_LL_TIMER_DONE;
|
||||||
RTCCNTL.touch_ctrl2.touch_slp_timer_en = (RTCCNTL.touch_ctrl2.touch_start_force == TOUCH_FSM_MODE_TIMER ? 1 : 0);
|
RTCCNTL.touch_ctrl2.touch_slp_timer_en = (RTCCNTL.touch_ctrl2.touch_start_force == TOUCH_FSM_MODE_TIMER ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop touch sensor FSM timer.
|
* Stop touch sensor FSM timer.
|
||||||
* The measurement action can be triggered by the hardware timer, as well as by the software instruction.
|
* The measurement action can be triggered by the hardware timer, as well as by the software instruction.
|
||||||
*
|
|
||||||
* @param mode FSM mode.
|
|
||||||
*/
|
*/
|
||||||
static inline void touch_ll_stop_fsm(void)
|
static inline void touch_ll_stop_fsm(void)
|
||||||
{
|
{
|
||||||
RTCCNTL.touch_ctrl2.touch_start_en = 0; //stop touch fsm
|
RTCCNTL.touch_ctrl2.touch_start_en = 0; //stop touch fsm
|
||||||
RTCCNTL.touch_ctrl2.touch_slp_timer_en = 0;
|
RTCCNTL.touch_ctrl2.touch_slp_timer_en = 0;
|
||||||
RTCCNTL.touch_ctrl2.touch_clkgate_en = 0; //enable touch clock for FSM. or force enable.
|
RTCCNTL.touch_ctrl2.touch_timer_force_done = TOUCH_LL_TIMER_FORCE_DONE;
|
||||||
|
RTCCNTL.touch_ctrl2.touch_timer_force_done = TOUCH_LL_TIMER_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -356,47 +394,16 @@ static inline void touch_ll_clear_trigger_status_mask(void)
|
||||||
SENS.sar_touch_conf.touch_status_clr = 1;
|
SENS.sar_touch_conf.touch_status_clr = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* To enable touch pad interrupt.
|
|
||||||
*/
|
|
||||||
static inline void touch_ll_enable_interrupt(touch_pad_intr_mask_t int_mask)
|
|
||||||
{
|
|
||||||
if (int_mask & TOUCH_PAD_INTR_MASK_DONE) {
|
|
||||||
RTCCNTL.int_ena.rtc_touch_done = 1;
|
|
||||||
}
|
|
||||||
if (int_mask & TOUCH_PAD_INTR_MASK_ACTIVE) {
|
|
||||||
RTCCNTL.int_ena.rtc_touch_active = 1;
|
|
||||||
}
|
|
||||||
if (int_mask & TOUCH_PAD_INTR_MASK_INACTIVE) {
|
|
||||||
RTCCNTL.int_ena.rtc_touch_inactive = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To disable touch pad interrupt.
|
|
||||||
*/
|
|
||||||
static inline void touch_ll_disable_interrupt(touch_pad_intr_mask_t int_mask)
|
|
||||||
{
|
|
||||||
if (int_mask & TOUCH_PAD_INTR_MASK_DONE) {
|
|
||||||
RTCCNTL.int_ena.rtc_touch_done = 0;
|
|
||||||
}
|
|
||||||
if (int_mask & TOUCH_PAD_INTR_MASK_ACTIVE) {
|
|
||||||
RTCCNTL.int_ena.rtc_touch_active = 0;
|
|
||||||
}
|
|
||||||
if (int_mask & TOUCH_PAD_INTR_MASK_INACTIVE) {
|
|
||||||
RTCCNTL.int_ena.rtc_touch_inactive = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get touch sensor raw data (touch sensor counter value) from register. No block.
|
* Get touch sensor raw data (touch sensor counter value) from register. No block.
|
||||||
*
|
*
|
||||||
* @param touch_num touch pad index.
|
* @param touch_num touch pad index.
|
||||||
* @return touch_value pointer to accept touch sensor value.
|
* @return touch_value pointer to accept touch sensor value.
|
||||||
*/
|
*/
|
||||||
static inline uint32_t touch_ll_read_raw_data(touch_pad_t touch_num)
|
static inline uint32_t IRAM_ATTR touch_ll_read_raw_data(touch_pad_t touch_num)
|
||||||
{
|
{
|
||||||
return SENS.touch_meas[touch_num].meas_out;
|
SENS.sar_touch_conf.touch_data_sel = TOUCH_LL_READ_RAW;
|
||||||
|
return SENS.sar_touch_status[touch_num - 1].touch_pad_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -415,12 +422,13 @@ static inline bool touch_ll_meas_is_done(void)
|
||||||
/**
|
/**
|
||||||
* Reset the whole of touch module.
|
* Reset the whole of touch module.
|
||||||
*
|
*
|
||||||
* @note Call this funtion after `touch_pad_fsm_stop`,
|
* @note Call this function after `touch_pad_fsm_stop`.
|
||||||
*/
|
*/
|
||||||
static inline void touch_ll_reset(void)
|
static inline void touch_ll_reset(void)
|
||||||
{
|
{
|
||||||
RTCCNTL.touch_ctrl2.touch_reset = 0;
|
RTCCNTL.touch_ctrl2.touch_reset = 0;
|
||||||
RTCCNTL.touch_ctrl2.touch_reset = 1;
|
RTCCNTL.touch_ctrl2.touch_reset = 1;
|
||||||
|
RTCCNTL.touch_ctrl2.touch_reset = 0; // Should be set 0.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -433,7 +441,7 @@ static inline void touch_ll_reset(void)
|
||||||
*
|
*
|
||||||
* @param type Select idle channel connect to high resistance state or ground.
|
* @param type Select idle channel connect to high resistance state or ground.
|
||||||
*/
|
*/
|
||||||
static inline void touch_ll_set_inactive_connect(touch_pad_conn_type_t type)
|
static inline void touch_ll_set_idle_channel_connect(touch_pad_conn_type_t type)
|
||||||
{
|
{
|
||||||
RTCCNTL.touch_scan_ctrl.touch_inactive_connection = type;
|
RTCCNTL.touch_scan_ctrl.touch_inactive_connection = type;
|
||||||
}
|
}
|
||||||
|
@ -448,7 +456,7 @@ static inline void touch_ll_set_inactive_connect(touch_pad_conn_type_t type)
|
||||||
*
|
*
|
||||||
* @param type Select idle channel connect to high resistance state or ground.
|
* @param type Select idle channel connect to high resistance state or ground.
|
||||||
*/
|
*/
|
||||||
static inline void touch_ll_get_inactive_connect(touch_pad_conn_type_t *type)
|
static inline void touch_ll_get_idle_channel_connect(touch_pad_conn_type_t *type)
|
||||||
{
|
{
|
||||||
*type = RTCCNTL.touch_scan_ctrl.touch_inactive_connection;
|
*type = RTCCNTL.touch_scan_ctrl.touch_inactive_connection;
|
||||||
}
|
}
|
||||||
|
@ -459,7 +467,7 @@ static inline void touch_ll_get_inactive_connect(touch_pad_conn_type_t *type)
|
||||||
* @return
|
* @return
|
||||||
* - touch channel number
|
* - touch channel number
|
||||||
*/
|
*/
|
||||||
static inline touch_pad_t touch_ll_get_current_meas_channel(void)
|
static inline touch_pad_t IRAM_ATTR touch_ll_get_current_meas_channel(void)
|
||||||
{
|
{
|
||||||
return (touch_pad_t)(SENS.sar_touch_status0.touch_scan_curr);
|
return (touch_pad_t)(SENS.sar_touch_status0.touch_scan_curr);
|
||||||
}
|
}
|
||||||
|
@ -480,6 +488,12 @@ static inline void touch_ll_intr_enable(touch_pad_intr_mask_t int_mask)
|
||||||
if (int_mask & TOUCH_PAD_INTR_MASK_INACTIVE) {
|
if (int_mask & TOUCH_PAD_INTR_MASK_INACTIVE) {
|
||||||
RTCCNTL.int_ena.rtc_touch_inactive = 1;
|
RTCCNTL.int_ena.rtc_touch_inactive = 1;
|
||||||
}
|
}
|
||||||
|
if (int_mask & TOUCH_PAD_INTR_MASK_SCAN_DONE) {
|
||||||
|
RTCCNTL.int_ena.rtc_touch_scan_done = 1;
|
||||||
|
}
|
||||||
|
if (int_mask & TOUCH_PAD_INTR_MASK_TIMEOUT) {
|
||||||
|
RTCCNTL.int_ena.rtc_touch_timeout = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -498,6 +512,36 @@ static inline void touch_ll_intr_disable(touch_pad_intr_mask_t int_mask)
|
||||||
if (int_mask & TOUCH_PAD_INTR_MASK_INACTIVE) {
|
if (int_mask & TOUCH_PAD_INTR_MASK_INACTIVE) {
|
||||||
RTCCNTL.int_ena.rtc_touch_inactive = 0;
|
RTCCNTL.int_ena.rtc_touch_inactive = 0;
|
||||||
}
|
}
|
||||||
|
if (int_mask & TOUCH_PAD_INTR_MASK_SCAN_DONE) {
|
||||||
|
RTCCNTL.int_ena.rtc_touch_scan_done = 0;
|
||||||
|
}
|
||||||
|
if (int_mask & TOUCH_PAD_INTR_MASK_TIMEOUT) {
|
||||||
|
RTCCNTL.int_ena.rtc_touch_timeout = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear touch sensor interrupt by bitmask.
|
||||||
|
*
|
||||||
|
* @param int_mask Pad mask to clear interrupts
|
||||||
|
*/
|
||||||
|
static inline void touch_ll_intr_clear(touch_pad_intr_mask_t int_mask)
|
||||||
|
{
|
||||||
|
if (int_mask & TOUCH_PAD_INTR_MASK_DONE) {
|
||||||
|
RTCCNTL.int_clr.rtc_touch_done = 1;
|
||||||
|
}
|
||||||
|
if (int_mask & TOUCH_PAD_INTR_MASK_ACTIVE) {
|
||||||
|
RTCCNTL.int_clr.rtc_touch_active = 1;
|
||||||
|
}
|
||||||
|
if (int_mask & TOUCH_PAD_INTR_MASK_INACTIVE) {
|
||||||
|
RTCCNTL.int_clr.rtc_touch_inactive = 1;
|
||||||
|
}
|
||||||
|
if (int_mask & TOUCH_PAD_INTR_MASK_SCAN_DONE) {
|
||||||
|
RTCCNTL.int_clr.rtc_touch_scan_done = 1;
|
||||||
|
}
|
||||||
|
if (int_mask & TOUCH_PAD_INTR_MASK_TIMEOUT) {
|
||||||
|
RTCCNTL.int_clr.rtc_touch_timeout = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -519,12 +563,77 @@ static inline uint32_t touch_ll_read_intr_status_mask(void)
|
||||||
if (intr_st & RTC_CNTL_TOUCH_INACTIVE_INT_ST_M) {
|
if (intr_st & RTC_CNTL_TOUCH_INACTIVE_INT_ST_M) {
|
||||||
intr_msk |= TOUCH_PAD_INTR_MASK_INACTIVE;
|
intr_msk |= TOUCH_PAD_INTR_MASK_INACTIVE;
|
||||||
}
|
}
|
||||||
|
if (intr_st & RTC_CNTL_TOUCH_SCAN_DONE_INT_ST_M) {
|
||||||
|
intr_msk |= TOUCH_PAD_INTR_MASK_SCAN_DONE;
|
||||||
|
}
|
||||||
|
if (intr_st & RTC_CNTL_TOUCH_TIMEOUT_INT_ST_M) {
|
||||||
|
intr_msk |= TOUCH_PAD_INTR_MASK_TIMEOUT;
|
||||||
|
}
|
||||||
return (intr_msk & TOUCH_PAD_INTR_MASK_ALL);
|
return (intr_msk & TOUCH_PAD_INTR_MASK_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable the timeout check for all touch sensor channels measurements.
|
||||||
|
* When the touch reading of a touch channel exceeds the measurement threshold,
|
||||||
|
* If enable: a timeout interrupt will be generated and it will go to the next channel measurement.
|
||||||
|
* If disable: the FSM is always on the channel, until the measurement of this channel is over.
|
||||||
|
*
|
||||||
|
* @note Set the timeout threshold correctly before enabling it.
|
||||||
|
*/
|
||||||
|
static inline void touch_ll_timeout_enable(void)
|
||||||
|
{
|
||||||
|
RTCCNTL.touch_timeout_ctrl.touch_timeout_en = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the timeout check for all touch sensor channels measurements.
|
||||||
|
* When the touch reading of a touch channel exceeds the measurement threshold,
|
||||||
|
* If enable: a timeout interrupt will be generated and it will go to the next channel measurement.
|
||||||
|
* If disable: the FSM is always on the channel, until the measurement of this channel is over.
|
||||||
|
*
|
||||||
|
* @note Set the timeout threshold correctly before enabling it.
|
||||||
|
*/
|
||||||
|
static inline void touch_ll_timeout_disable(void)
|
||||||
|
{
|
||||||
|
RTCCNTL.touch_timeout_ctrl.touch_timeout_en = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set timeout threshold for all touch sensor channels measurements.
|
||||||
|
* Compared with touch readings.
|
||||||
|
*
|
||||||
|
* @param threshold Set to the maximum time measured on one channel.
|
||||||
|
*/
|
||||||
|
static inline void touch_ll_timeout_set_threshold(uint32_t threshold)
|
||||||
|
{
|
||||||
|
RTCCNTL.touch_timeout_ctrl.touch_timeout_num = threshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get timeout threshold for all touch sensor channels measurements.
|
||||||
|
* Compared with touch readings.
|
||||||
|
*
|
||||||
|
* @param threshold Point to timeout threshold.
|
||||||
|
*/
|
||||||
|
static inline void touch_ll_timeout_get_threshold(uint32_t *threshold)
|
||||||
|
{
|
||||||
|
*threshold = RTCCNTL.touch_timeout_ctrl.touch_timeout_num;
|
||||||
|
}
|
||||||
|
|
||||||
/************************ Filter register setting ************************/
|
/************************ Filter register setting ************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get smoothed data that obtained by filtering the raw data.
|
||||||
|
*
|
||||||
|
* @param touch_num touch pad index
|
||||||
|
* @param smooth_data pointer to smoothed data
|
||||||
|
*/
|
||||||
|
static inline void IRAM_ATTR touch_ll_filter_read_smooth(touch_pad_t touch_num, uint32_t *smooth_data)
|
||||||
|
{
|
||||||
|
SENS.sar_touch_conf.touch_data_sel = TOUCH_LL_READ_SMOOTH;
|
||||||
|
*smooth_data = SENS.sar_touch_status[touch_num - 1].touch_pad_data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get baseline value of touch sensor.
|
* Get baseline value of touch sensor.
|
||||||
*
|
*
|
||||||
|
@ -532,19 +641,23 @@ static inline uint32_t touch_ll_read_intr_status_mask(void)
|
||||||
* @param touch_num touch pad index
|
* @param touch_num touch pad index
|
||||||
* @param touch_value pointer to accept touch sensor value
|
* @param touch_value pointer to accept touch sensor value
|
||||||
*/
|
*/
|
||||||
static inline void touch_ll_filter_read_baseline(touch_pad_t touch_num, uint32_t *basedata)
|
static inline void IRAM_ATTR touch_ll_filter_read_baseline(touch_pad_t touch_num, uint32_t *basedata)
|
||||||
{
|
{
|
||||||
*basedata = SENS.sar_touch_status[touch_num - 1].touch_pad_baseline;
|
SENS.sar_touch_conf.touch_data_sel = TOUCH_LL_READ_BASELINE;
|
||||||
|
*basedata = SENS.sar_touch_status[touch_num - 1].touch_pad_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force reset baseline to raw data of touch sensor.
|
* Force reset baseline to raw data of touch sensor.
|
||||||
*
|
*
|
||||||
|
* @note If call this API, make sure enable clock gate(`touch_ll_clkgate`) first.
|
||||||
* @param touch_num touch pad index
|
* @param touch_num touch pad index
|
||||||
* - TOUCH_PAD_MAX Reset basaline of all channels.
|
* - TOUCH_PAD_MAX Reset basaline of all channels.
|
||||||
*/
|
*/
|
||||||
static inline void touch_ll_filter_reset_baseline(touch_pad_t touch_num)
|
static inline void touch_ll_filter_reset_baseline(touch_pad_t touch_num)
|
||||||
{
|
{
|
||||||
|
/* Clear touch channels to initialize the channel value (baseline, raw_data).
|
||||||
|
*/
|
||||||
if (touch_num == TOUCH_PAD_MAX) {
|
if (touch_num == TOUCH_PAD_MAX) {
|
||||||
SENS.sar_touch_chn_st.touch_channel_clr = SOC_TOUCH_SENSOR_BIT_MASK_MAX;
|
SENS.sar_touch_chn_st.touch_channel_clr = SOC_TOUCH_SENSOR_BIT_MASK_MAX;
|
||||||
} else {
|
} else {
|
||||||
|
@ -573,9 +686,30 @@ static inline void touch_ll_filter_get_filter_mode(touch_filter_mode_t *mode)
|
||||||
*mode = (touch_filter_mode_t)RTCCNTL.touch_filter_ctrl.touch_filter_mode;
|
*mode = (touch_filter_mode_t)RTCCNTL.touch_filter_ctrl.touch_filter_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set filter mode. The input to the filter is raw data and the output is the smooth data.
|
||||||
|
* The smooth data is used to determine the touch status.
|
||||||
|
*
|
||||||
|
* @param mode Filter mode type. Refer to `touch_smooth_mode_t`.
|
||||||
|
*/
|
||||||
|
static inline void touch_ll_filter_set_smooth_mode(touch_smooth_mode_t mode)
|
||||||
|
{
|
||||||
|
RTCCNTL.touch_filter_ctrl.touch_smooth_lvl = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get filter mode. The smooth data is used to determine the touch status.
|
||||||
|
*
|
||||||
|
* @param mode Filter mode type. Refer to `touch_smooth_mode_t`.
|
||||||
|
*/
|
||||||
|
static inline void touch_ll_filter_get_smooth_mode(touch_smooth_mode_t *mode)
|
||||||
|
{
|
||||||
|
*mode = RTCCNTL.touch_filter_ctrl.touch_smooth_lvl;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set debounce count, such as `n`. If the measured values continue to exceed
|
* Set debounce count, such as `n`. If the measured values continue to exceed
|
||||||
* the threshold for `n` times, it is determined that the touch sensor state changes.
|
* the threshold for `n+1` times, it is determined that the touch sensor state changes.
|
||||||
*
|
*
|
||||||
* @param dbc_cnt Debounce count value.
|
* @param dbc_cnt Debounce count value.
|
||||||
*/
|
*/
|
||||||
|
@ -598,7 +732,7 @@ static inline void touch_ll_filter_get_debounce(uint32_t *dbc_cnt)
|
||||||
* Set hysteresis threshold coefficient. hysteresis = hysteresis_thr * touch_threshold.
|
* Set hysteresis threshold coefficient. hysteresis = hysteresis_thr * touch_threshold.
|
||||||
* If (raw data - baseline) > (touch threshold + hysteresis), the touch channel be touched.
|
* If (raw data - baseline) > (touch threshold + hysteresis), the touch channel be touched.
|
||||||
* If (raw data - baseline) < (touch threshold - hysteresis), the touch channel be released.
|
* If (raw data - baseline) < (touch threshold - hysteresis), the touch channel be released.
|
||||||
* Range: 0 ~ 3. The coefficient is 0: 1/8; 1: 3/32; 2: 1/16; 3: 1/32
|
* Range: 0 ~ 3. The coefficient is 0: 4/32; 1: 3/32; 2: 2/32; 3: OFF.
|
||||||
*
|
*
|
||||||
* @param hys_thr hysteresis coefficient.
|
* @param hys_thr hysteresis coefficient.
|
||||||
*/
|
*/
|
||||||
|
@ -611,7 +745,7 @@ static inline void touch_ll_filter_set_hysteresis(uint32_t hys_thr)
|
||||||
* Get hysteresis threshold coefficient. hysteresis = hysteresis_thr * touch_threshold.
|
* Get hysteresis threshold coefficient. hysteresis = hysteresis_thr * touch_threshold.
|
||||||
* If (raw data - baseline) > (touch threshold + hysteresis), the touch channel be touched.
|
* If (raw data - baseline) > (touch threshold + hysteresis), the touch channel be touched.
|
||||||
* If (raw data - baseline) < (touch threshold - hysteresis), the touch channel be released.
|
* If (raw data - baseline) < (touch threshold - hysteresis), the touch channel be released.
|
||||||
* Range: 0 ~ 3. The coefficient is 0: 1/8; 1: 3/32; 2: 1/16; 3: 1/32
|
* Range: 0 ~ 3. The coefficient is 0: 4/32; 1: 3/32; 2: 2/32; 3: OFF.
|
||||||
*
|
*
|
||||||
* @param hys_thr hysteresis coefficient.
|
* @param hys_thr hysteresis coefficient.
|
||||||
*/
|
*/
|
||||||
|
@ -624,7 +758,7 @@ static inline void touch_ll_filter_get_hysteresis(uint32_t *hys_thr)
|
||||||
* Set noise threshold coefficient. noise = noise_thr * touch threshold.
|
* Set noise threshold coefficient. noise = noise_thr * touch threshold.
|
||||||
* If (raw data - baseline) > (noise), the baseline stop updating.
|
* If (raw data - baseline) > (noise), the baseline stop updating.
|
||||||
* If (raw data - baseline) < (noise), the baseline start updating.
|
* If (raw data - baseline) < (noise), the baseline start updating.
|
||||||
* Range: 0 ~ 3. The coefficient is 0: 1/2; 1: 3/8; 2: 1/4; 3: 1/8;
|
* Range: 0 ~ 3. The coefficient is 0: 4/8; 1: 3/8; 2: 2/8; 3: 1;
|
||||||
*
|
*
|
||||||
* @param hys_thr Noise threshold coefficient.
|
* @param hys_thr Noise threshold coefficient.
|
||||||
*/
|
*/
|
||||||
|
@ -637,7 +771,7 @@ static inline void touch_ll_filter_set_noise_thres(uint32_t noise_thr)
|
||||||
* Get noise threshold coefficient. noise = noise_thr * touch threshold.
|
* Get noise threshold coefficient. noise = noise_thr * touch threshold.
|
||||||
* If (raw data - baseline) > (noise), the baseline stop updating.
|
* If (raw data - baseline) > (noise), the baseline stop updating.
|
||||||
* If (raw data - baseline) < (noise), the baseline start updating.
|
* If (raw data - baseline) < (noise), the baseline start updating.
|
||||||
* Range: 0 ~ 3. The coefficient is 0: 1/2; 1: 3/8; 2: 1/4; 3: 1/8;
|
* Range: 0 ~ 3. The coefficient is 0: 4/8; 1: 3/8; 2: 2/8; 3: 1;
|
||||||
*
|
*
|
||||||
* @param noise_thr Noise threshold coefficient.
|
* @param noise_thr Noise threshold coefficient.
|
||||||
*/
|
*/
|
||||||
|
@ -674,7 +808,7 @@ static inline void touch_ll_filter_get_neg_noise_thres(uint32_t *noise_thr)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the cumulative number of baseline reset processes. such as `n`. If the measured values continue to exceed
|
* Set the cumulative number of baseline reset processes. such as `n`. If the measured values continue to exceed
|
||||||
* the negative noise threshold for `n` times, the baseline reset to raw data.
|
* the negative noise threshold for `n+1` times, the baseline reset to raw data.
|
||||||
* Range: 0 ~ 15
|
* Range: 0 ~ 15
|
||||||
*
|
*
|
||||||
* @param reset_cnt The cumulative number of baseline reset processes.
|
* @param reset_cnt The cumulative number of baseline reset processes.
|
||||||
|
@ -686,7 +820,7 @@ static inline void touch_ll_filter_set_baseline_reset(uint32_t reset_cnt)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the cumulative number of baseline reset processes. such as `n`. If the measured values continue to exceed
|
* Get the cumulative number of baseline reset processes. such as `n`. If the measured values continue to exceed
|
||||||
* the negative noise threshold for `n` times, the baseline reset to raw data.
|
* the negative noise threshold for `n+1` times, the baseline reset to raw data.
|
||||||
* Range: 0 ~ 15
|
* Range: 0 ~ 15
|
||||||
*
|
*
|
||||||
* @param reset_cnt The cumulative number of baseline reset processes.
|
* @param reset_cnt The cumulative number of baseline reset processes.
|
||||||
|
@ -817,9 +951,9 @@ static inline void touch_ll_denoise_get_grade(touch_pad_denoise_grade_t *grade)
|
||||||
*
|
*
|
||||||
* @param denoise value of denoise.
|
* @param denoise value of denoise.
|
||||||
*/
|
*/
|
||||||
static inline uint32_t touch_ll_denoise_read_data(uint32_t *data)
|
static inline void touch_ll_denoise_read_data(uint32_t *data)
|
||||||
{
|
{
|
||||||
return (uint32_t)SENS.sar_touch_status0.touch_denoise_data;
|
*data = SENS.sar_touch_status0.touch_denoise_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************ Waterproof register setting ************************/
|
/************************ Waterproof register setting ************************/
|
||||||
|
@ -950,11 +1084,11 @@ static inline void touch_ll_proximity_get_meas_times(uint32_t *times)
|
||||||
static inline void touch_ll_proximity_read_meas_cnt(touch_pad_t touch_num, uint32_t *cnt)
|
static inline void touch_ll_proximity_read_meas_cnt(touch_pad_t touch_num, uint32_t *cnt)
|
||||||
{
|
{
|
||||||
if (SENS.sar_touch_conf.touch_approach_pad0 == touch_num) {
|
if (SENS.sar_touch_conf.touch_approach_pad0 == touch_num) {
|
||||||
*cnt = SENS.sar_touch_status16.touch_approach_pad0_cnt;
|
*cnt = SENS.sar_touch_appr_status.touch_approach_pad0_cnt;
|
||||||
} else if (SENS.sar_touch_conf.touch_approach_pad1 == touch_num) {
|
} else if (SENS.sar_touch_conf.touch_approach_pad1 == touch_num) {
|
||||||
*cnt = SENS.sar_touch_status16.touch_approach_pad1_cnt;
|
*cnt = SENS.sar_touch_appr_status.touch_approach_pad1_cnt;
|
||||||
} else if (SENS.sar_touch_conf.touch_approach_pad2 == touch_num) {
|
} else if (SENS.sar_touch_conf.touch_approach_pad2 == touch_num) {
|
||||||
*cnt = SENS.sar_touch_status16.touch_approach_pad2_cnt;
|
*cnt = SENS.sar_touch_appr_status.touch_approach_pad2_cnt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1003,7 +1137,7 @@ static inline void touch_ll_sleep_get_channel_num(touch_pad_t *touch_num)
|
||||||
* The threshold determines the sensitivity of the touch sensor.
|
* The threshold determines the sensitivity of the touch sensor.
|
||||||
* The threshold is the original value of the trigger state minus the baseline value.
|
* The threshold is the original value of the trigger state minus the baseline value.
|
||||||
*
|
*
|
||||||
* @note The threshold at sleep is the same as the threshold before sleep.
|
* @note In general, the touch threshold during sleep can use the threshold parameter parameters before sleep.
|
||||||
*/
|
*/
|
||||||
static inline void touch_ll_sleep_set_threshold(uint32_t touch_thres)
|
static inline void touch_ll_sleep_set_threshold(uint32_t touch_thres)
|
||||||
{
|
{
|
||||||
|
@ -1015,7 +1149,7 @@ static inline void touch_ll_sleep_set_threshold(uint32_t touch_thres)
|
||||||
* The threshold determines the sensitivity of the touch sensor.
|
* The threshold determines the sensitivity of the touch sensor.
|
||||||
* The threshold is the original value of the trigger state minus the baseline value.
|
* The threshold is the original value of the trigger state minus the baseline value.
|
||||||
*
|
*
|
||||||
* @note The threshold at sleep is the same as the threshold before sleep.
|
* @note In general, the touch threshold during sleep can use the threshold parameter parameters before sleep.
|
||||||
*/
|
*/
|
||||||
static inline void touch_ll_sleep_get_threshold(uint32_t *touch_thres)
|
static inline void touch_ll_sleep_get_threshold(uint32_t *touch_thres)
|
||||||
{
|
{
|
||||||
|
@ -1038,6 +1172,14 @@ static inline void touch_ll_sleep_disable_approach(void)
|
||||||
RTCCNTL.touch_slp_thres.touch_slp_approach_en = 0;
|
RTCCNTL.touch_slp_thres.touch_slp_approach_en = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get proximity function status for sleep pad.
|
||||||
|
*/
|
||||||
|
static inline bool touch_ll_sleep_get_approach_status(void)
|
||||||
|
{
|
||||||
|
return (bool)RTCCNTL.touch_slp_thres.touch_slp_approach_en;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read baseline of touch sensor for sleep pad.
|
* Read baseline of touch sensor for sleep pad.
|
||||||
*
|
*
|
||||||
|
@ -1045,7 +1187,37 @@ static inline void touch_ll_sleep_disable_approach(void)
|
||||||
*/
|
*/
|
||||||
static inline void touch_ll_sleep_read_baseline(uint32_t *baseline)
|
static inline void touch_ll_sleep_read_baseline(uint32_t *baseline)
|
||||||
{
|
{
|
||||||
*baseline = REG_GET_FIELD(SENS_SAR_TOUCH_STATUS15_REG, SENS_TOUCH_SLP_BASELINE);
|
SENS.sar_touch_conf.touch_data_sel = TOUCH_LL_READ_BASELINE;
|
||||||
|
*baseline = SENS.sar_touch_slp_status.touch_slp_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void touch_ll_sleep_read_smooth(uint32_t *smooth_data)
|
||||||
|
{
|
||||||
|
SENS.sar_touch_conf.touch_data_sel = TOUCH_LL_READ_SMOOTH;
|
||||||
|
*smooth_data = SENS.sar_touch_slp_status.touch_slp_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Workaround: Note: sleep pad raw data is not in `sar_touch_slp_status` */
|
||||||
|
static inline void touch_ll_sleep_read_data(uint32_t *raw_data)
|
||||||
|
{
|
||||||
|
uint32_t touch_num = RTCCNTL.touch_slp_thres.touch_slp_pad;
|
||||||
|
SENS.sar_touch_conf.touch_data_sel = TOUCH_LL_READ_RAW;
|
||||||
|
*raw_data = SENS.sar_touch_status[touch_num - 1].touch_pad_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void touch_ll_sleep_reset_baseline(void)
|
||||||
|
{
|
||||||
|
RTCCNTL.touch_approach.touch_slp_channel_clr = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select touch sensor dbias to save power in sleep mode.
|
||||||
|
*
|
||||||
|
* @note If change the dbias, the reading of touch sensor will changed. Users should make sure the threshold.
|
||||||
|
*/
|
||||||
|
static inline void touch_ll_sleep_low_power(bool is_low_power)
|
||||||
|
{
|
||||||
|
RTCCNTL.touch_ctrl2.touch_dbias = is_low_power;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1055,7 +1227,7 @@ static inline void touch_ll_sleep_read_baseline(uint32_t *baseline)
|
||||||
*/
|
*/
|
||||||
static inline void touch_ll_sleep_read_debounce(uint32_t *debounce)
|
static inline void touch_ll_sleep_read_debounce(uint32_t *debounce)
|
||||||
{
|
{
|
||||||
*debounce = REG_GET_FIELD(SENS_SAR_TOUCH_STATUS15_REG, SENS_TOUCH_SLP_DEBOUNCE);
|
*debounce = SENS.sar_touch_slp_status.touch_slp_debounce;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1064,7 +1236,7 @@ static inline void touch_ll_sleep_read_debounce(uint32_t *debounce)
|
||||||
*/
|
*/
|
||||||
static inline void touch_ll_sleep_read_proximity_cnt(uint32_t *approach_cnt)
|
static inline void touch_ll_sleep_read_proximity_cnt(uint32_t *approach_cnt)
|
||||||
{
|
{
|
||||||
*approach_cnt = REG_GET_FIELD(SENS_SAR_TOUCH_STATUS16_REG, SENS_TOUCH_SLP_APPROACH_CNT);
|
*approach_cnt = SENS.sar_touch_appr_status.touch_slp_approach_cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
void touch_hal_init(void)
|
void touch_hal_init(void)
|
||||||
{
|
{
|
||||||
touch_ll_intr_disable(TOUCH_PAD_INTR_ALL);
|
touch_ll_intr_disable(TOUCH_PAD_INTR_MASK_ALL);
|
||||||
touch_ll_clear_channel_mask(SOC_TOUCH_SENSOR_BIT_MASK_MAX);
|
touch_ll_clear_channel_mask(SOC_TOUCH_SENSOR_BIT_MASK_MAX);
|
||||||
touch_ll_clear_trigger_status_mask();
|
touch_ll_clear_trigger_status_mask();
|
||||||
touch_ll_set_meas_times(TOUCH_PAD_MEASURE_CYCLE_DEFAULT);
|
touch_ll_set_meas_times(TOUCH_PAD_MEASURE_CYCLE_DEFAULT);
|
||||||
|
@ -27,14 +27,31 @@ void touch_hal_init(void)
|
||||||
touch_ll_set_voltage_high(TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD);
|
touch_ll_set_voltage_high(TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD);
|
||||||
touch_ll_set_voltage_low(TOUCH_PAD_LOW_VOLTAGE_THRESHOLD);
|
touch_ll_set_voltage_low(TOUCH_PAD_LOW_VOLTAGE_THRESHOLD);
|
||||||
touch_ll_set_voltage_attenuation(TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD);
|
touch_ll_set_voltage_attenuation(TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD);
|
||||||
touch_ll_set_inactive_connect(TOUCH_PAD_INACTIVE_CONNECT_DEFAULT);
|
touch_ll_set_idle_channel_connect(TOUCH_PAD_IDLE_CH_CONNECT_DEFAULT);
|
||||||
|
/* Clear touch channels to initialize the channel value (baseline, raw_data).
|
||||||
|
* Note: Should call it after enable clock gate. */
|
||||||
|
touch_ll_clkgate(true); // Enable clock gate for touch sensor.
|
||||||
|
touch_ll_filter_reset_baseline(TOUCH_PAD_MAX);
|
||||||
|
touch_ll_sleep_reset_baseline();
|
||||||
}
|
}
|
||||||
|
|
||||||
void touch_hal_deinit(void)
|
void touch_hal_deinit(void)
|
||||||
{
|
{
|
||||||
touch_hal_stop_fsm();
|
touch_ll_filter_reset_baseline(TOUCH_PAD_MAX);
|
||||||
touch_hal_clear_trigger_status_mask();
|
touch_ll_sleep_reset_baseline();
|
||||||
touch_ll_intr_disable(TOUCH_PAD_INTR_ALL);
|
touch_ll_stop_fsm();
|
||||||
|
touch_ll_clkgate(false);
|
||||||
|
touch_ll_clear_channel_mask(SOC_TOUCH_SENSOR_BIT_MASK_MAX);
|
||||||
|
touch_ll_clear_trigger_status_mask();
|
||||||
|
touch_ll_intr_disable(TOUCH_PAD_INTR_MASK_ALL);
|
||||||
|
touch_ll_timeout_disable();
|
||||||
|
touch_ll_waterproof_disable();
|
||||||
|
touch_ll_denoise_disable();
|
||||||
|
touch_pad_t prox_pad[SOC_TOUCH_PROXIMITY_CHANNEL_NUM] = {[0 ... (SOC_TOUCH_PROXIMITY_CHANNEL_NUM - 1)] = 0};
|
||||||
|
touch_ll_proximity_set_channel_num((const touch_pad_t *)prox_pad);
|
||||||
|
touch_ll_sleep_set_channel_num(0);
|
||||||
|
touch_ll_sleep_disable_approach();
|
||||||
|
touch_ll_reset(); // Reset the touch sensor FSM.
|
||||||
}
|
}
|
||||||
|
|
||||||
void touch_hal_filter_set_config(const touch_filter_config_t *filter_info)
|
void touch_hal_filter_set_config(const touch_filter_config_t *filter_info)
|
||||||
|
@ -46,6 +63,7 @@ void touch_hal_filter_set_config(const touch_filter_config_t *filter_info)
|
||||||
touch_ll_filter_set_neg_noise_thres(filter_info->noise_neg_thr);
|
touch_ll_filter_set_neg_noise_thres(filter_info->noise_neg_thr);
|
||||||
touch_ll_filter_set_baseline_reset(filter_info->neg_noise_limit);
|
touch_ll_filter_set_baseline_reset(filter_info->neg_noise_limit);
|
||||||
touch_ll_filter_set_jitter_step(filter_info->jitter_step);
|
touch_ll_filter_set_jitter_step(filter_info->jitter_step);
|
||||||
|
touch_ll_filter_set_smooth_mode(filter_info->smh_lvl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void touch_hal_filter_get_config(touch_filter_config_t *filter_info)
|
void touch_hal_filter_get_config(touch_filter_config_t *filter_info)
|
||||||
|
@ -57,6 +75,7 @@ void touch_hal_filter_get_config(touch_filter_config_t *filter_info)
|
||||||
touch_ll_filter_get_neg_noise_thres(&filter_info->noise_neg_thr);
|
touch_ll_filter_get_neg_noise_thres(&filter_info->noise_neg_thr);
|
||||||
touch_ll_filter_get_baseline_reset(&filter_info->neg_noise_limit);
|
touch_ll_filter_get_baseline_reset(&filter_info->neg_noise_limit);
|
||||||
touch_ll_filter_get_jitter_step(&filter_info->jitter_step);
|
touch_ll_filter_get_jitter_step(&filter_info->jitter_step);
|
||||||
|
touch_ll_filter_get_smooth_mode(&filter_info->smh_lvl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void touch_hal_denoise_set_config(const touch_pad_denoise_t *denoise)
|
void touch_hal_denoise_set_config(const touch_pad_denoise_t *denoise)
|
||||||
|
@ -95,25 +114,51 @@ void touch_hal_waterproof_enable(void)
|
||||||
touch_ll_waterproof_enable();
|
touch_ll_waterproof_enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void touch_hal_proximity_set_config(const touch_pad_proximity_t *proximity)
|
bool touch_hal_enable_proximity(touch_pad_t touch_num, bool enabled)
|
||||||
{
|
{
|
||||||
touch_ll_proximity_set_channel_num(proximity->select_pad);
|
int i = 0;
|
||||||
touch_ll_proximity_set_meas_times(proximity->meas_num);
|
touch_pad_t ch_num[SOC_TOUCH_PROXIMITY_CHANNEL_NUM] = {0};
|
||||||
}
|
touch_ll_proximity_get_channel_num(ch_num);
|
||||||
|
if (enabled) {
|
||||||
void touch_hal_proximity_get_config(touch_pad_proximity_t *proximity)
|
for (i = 0; i < SOC_TOUCH_PROXIMITY_CHANNEL_NUM; i++) {
|
||||||
{
|
if (ch_num[i] == TOUCH_PAD_NUM0 || ch_num[i] >= TOUCH_PAD_MAX || ch_num[i] == touch_num) {
|
||||||
touch_ll_proximity_get_channel_num(proximity->select_pad);
|
ch_num[i] = touch_num;
|
||||||
touch_ll_proximity_get_meas_times(&proximity->meas_num);
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void touch_hal_sleep_channel_config(const touch_pad_sleep_channel_t *slp_config)
|
if (i == SOC_TOUCH_PROXIMITY_CHANNEL_NUM) {
|
||||||
{
|
return false;
|
||||||
touch_ll_sleep_set_channel_num(slp_config->touch_num);
|
}
|
||||||
touch_ll_sleep_set_threshold(slp_config->sleep_pad_threshold);
|
|
||||||
if (slp_config->en_proximity) {
|
|
||||||
touch_ll_sleep_enable_approach();
|
|
||||||
} else {
|
} else {
|
||||||
touch_ll_sleep_disable_approach();
|
for (i = 0; i < SOC_TOUCH_PROXIMITY_CHANNEL_NUM; i++) {
|
||||||
|
if (ch_num[i] == touch_num) {
|
||||||
|
ch_num[i] = TOUCH_PAD_NUM0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
touch_ll_proximity_set_channel_num(ch_num);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void touch_hal_sleep_channel_enable(touch_pad_t pad_num, bool enable)
|
||||||
|
{
|
||||||
|
if (enable) {
|
||||||
|
touch_ll_sleep_set_channel_num(pad_num);
|
||||||
|
touch_ll_sleep_set_threshold(SOC_TOUCH_PAD_THRESHOLD_MAX);
|
||||||
|
/* Default change touch dbias to self-dbias to save power.
|
||||||
|
Measuring the sleep pad threshold after `sleep_channel_set_config`. */
|
||||||
|
touch_ll_sleep_low_power(true);
|
||||||
|
touch_ll_sleep_reset_baseline();
|
||||||
|
} else {
|
||||||
|
touch_ll_sleep_set_channel_num(TOUCH_PAD_NUM0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void touch_hal_sleep_channel_get_config(touch_pad_sleep_channel_t *slp_config)
|
||||||
|
{
|
||||||
|
touch_ll_sleep_get_channel_num(&slp_config->touch_num);
|
||||||
|
slp_config->en_proximity = touch_ll_sleep_get_approach_status();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "freertos/queue.h"
|
#include "freertos/queue.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
|
||||||
#include "driver/touch_pad.h"
|
#include "driver/touch_pad.h"
|
||||||
#include "soc/rtc_periph.h"
|
#include "soc/rtc_periph.h"
|
||||||
#include "soc/sens_periph.h"
|
#include "soc/sens_periph.h"
|
||||||
|
@ -29,20 +28,21 @@ typedef struct touch_msg {
|
||||||
#define TOUCH_BUTTON_NUM 4
|
#define TOUCH_BUTTON_NUM 4
|
||||||
#define TOUCH_BUTTON_WATERPROOF_ENABLE 1
|
#define TOUCH_BUTTON_WATERPROOF_ENABLE 1
|
||||||
#define TOUCH_BUTTON_DENOISE_ENABLE 1
|
#define TOUCH_BUTTON_DENOISE_ENABLE 1
|
||||||
|
#define TOUCH_CHANGE_CONFIG 0
|
||||||
|
|
||||||
static const touch_pad_t button[TOUCH_BUTTON_NUM] = {
|
static const touch_pad_t button[TOUCH_BUTTON_NUM] = {
|
||||||
TOUCH_PAD_NUM7, // 'SELECT' button.
|
TOUCH_PAD_NUM7, // 'SELECT' button.
|
||||||
TOUCH_PAD_NUM9, // 'MENU' button.
|
TOUCH_PAD_NUM9, // 'MENU' button.
|
||||||
TOUCH_PAD_NUM11, // 'BACK' button.
|
TOUCH_PAD_NUM11, // 'BACK' button.
|
||||||
TOUCH_PAD_NUM13, // Guard ring for waterproof design.
|
TOUCH_PAD_NUM13, // Guard ring for waterproof design.
|
||||||
// if this pad be touched, other pads no response.
|
// If this pad be touched, other pads no response.
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Touch threshold. The threshold determines the sensitivity of the touch.
|
* Touch threshold. The threshold determines the sensitivity of the touch.
|
||||||
* This threshold is derived by testing changes in readings from different touch channels.
|
* This threshold is derived by testing changes in readings from different touch channels.
|
||||||
* If (raw_data - baseline) > baseline * threshold, the pad be actived.
|
* If (raw_data - baseline) > baseline * threshold, the pad be activated.
|
||||||
* If (raw_data - baseline) < baseline * threshold, the pad be inactived.
|
* If (raw_data - baseline) < baseline * threshold, the pad be inactivated.
|
||||||
*/
|
*/
|
||||||
static const float button_threshold[TOUCH_BUTTON_NUM] = {
|
static const float button_threshold[TOUCH_BUTTON_NUM] = {
|
||||||
0.2, // 20%.
|
0.2, // 20%.
|
||||||
|
@ -64,9 +64,6 @@ static void touchsensor_interrupt_cb(void *arg)
|
||||||
evt.pad_status = touch_pad_get_status();
|
evt.pad_status = touch_pad_get_status();
|
||||||
evt.pad_num = touch_pad_get_current_meas_channel();
|
evt.pad_num = touch_pad_get_current_meas_channel();
|
||||||
|
|
||||||
if (evt.intr_mask & TOUCH_PAD_INTR_MASK_DONE) {
|
|
||||||
touch_pad_filter_read_baseline(evt.pad_num, &evt.pad_val);
|
|
||||||
}
|
|
||||||
xQueueSendFromISR(que_touch, &evt, &task_awoken);
|
xQueueSendFromISR(que_touch, &evt, &task_awoken);
|
||||||
if (task_awoken == pdTRUE) {
|
if (task_awoken == pdTRUE) {
|
||||||
portYIELD_FROM_ISR();
|
portYIELD_FROM_ISR();
|
||||||
|
@ -81,7 +78,7 @@ static void tp_example_set_thresholds(void)
|
||||||
touch_pad_filter_read_baseline(button[i], &touch_value);
|
touch_pad_filter_read_baseline(button[i], &touch_value);
|
||||||
//set interrupt threshold.
|
//set interrupt threshold.
|
||||||
touch_pad_set_thresh(button[i], touch_value * button_threshold[i]);
|
touch_pad_set_thresh(button[i], touch_value * button_threshold[i]);
|
||||||
ESP_LOGI(TAG, "test init: touch pad [%d] base %d, thresh %d", \
|
ESP_LOGI(TAG, "touch pad [%d] base %d, thresh %d", \
|
||||||
button[i], touch_value, (uint32_t)(touch_value * button_threshold[i]));
|
button[i], touch_value, (uint32_t)(touch_value * button_threshold[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,10 +94,10 @@ static void touchsensor_filter_set(touch_filter_mode_t mode)
|
||||||
.noise_neg_thr = 0, // 50%
|
.noise_neg_thr = 0, // 50%
|
||||||
.neg_noise_limit = 10, // 10 time count.
|
.neg_noise_limit = 10, // 10 time count.
|
||||||
.jitter_step = 4, // use for jitter mode.
|
.jitter_step = 4, // use for jitter mode.
|
||||||
|
.smh_lvl = TOUCH_PAD_SMOOTH_IIR_2,
|
||||||
};
|
};
|
||||||
touch_pad_filter_set_config(&filter_info);
|
touch_pad_filter_set_config(&filter_info);
|
||||||
touch_pad_filter_enable();
|
touch_pad_filter_enable();
|
||||||
touch_pad_filter_reset_baseline(TOUCH_PAD_MAX);
|
|
||||||
ESP_LOGI(TAG, "touch pad filter init");
|
ESP_LOGI(TAG, "touch pad filter init");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +106,7 @@ static void tp_example_read_task(void *pvParameter)
|
||||||
touch_event_t evt = {0};
|
touch_event_t evt = {0};
|
||||||
static uint8_t guard_mode_flag = 0;
|
static uint8_t guard_mode_flag = 0;
|
||||||
/* Wait touch sensor init done */
|
/* Wait touch sensor init done */
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(50 / portTICK_RATE_MS);
|
||||||
tp_example_set_thresholds();
|
tp_example_set_thresholds();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -121,10 +118,10 @@ static void tp_example_read_task(void *pvParameter)
|
||||||
/* if guard pad be touched, other pads no response. */
|
/* if guard pad be touched, other pads no response. */
|
||||||
if (evt.pad_num == button[3]) {
|
if (evt.pad_num == button[3]) {
|
||||||
guard_mode_flag = 1;
|
guard_mode_flag = 1;
|
||||||
ESP_LOGW(TAG, "TouchSensor [%d] be actived, enter guard mode", evt.pad_num);
|
ESP_LOGW(TAG, "TouchSensor [%d] be activated, enter guard mode", evt.pad_num);
|
||||||
} else {
|
} else {
|
||||||
if (guard_mode_flag == 0) {
|
if (guard_mode_flag == 0) {
|
||||||
ESP_LOGI(TAG, "TouchSensor [%d] be actived, status mask 0x%x", evt.pad_num, evt.pad_status);
|
ESP_LOGI(TAG, "TouchSensor [%d] be inactivated, status mask 0x%x", evt.pad_num, evt.pad_status);
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGW(TAG, "In guard mode. No response");
|
ESP_LOGW(TAG, "In guard mode. No response");
|
||||||
}
|
}
|
||||||
|
@ -134,15 +131,20 @@ static void tp_example_read_task(void *pvParameter)
|
||||||
/* if guard pad be touched, other pads no response. */
|
/* if guard pad be touched, other pads no response. */
|
||||||
if (evt.pad_num == button[3]) {
|
if (evt.pad_num == button[3]) {
|
||||||
guard_mode_flag = 0;
|
guard_mode_flag = 0;
|
||||||
ESP_LOGW(TAG, "TouchSensor [%d] be actived, exit guard mode", evt.pad_num);
|
ESP_LOGW(TAG, "TouchSensor [%d] be activated, exit guard mode", evt.pad_num);
|
||||||
} else {
|
} else {
|
||||||
if (guard_mode_flag == 0) {
|
if (guard_mode_flag == 0) {
|
||||||
ESP_LOGI(TAG, "TouchSensor [%d] be inactived, status mask 0x%x", evt.pad_num, evt.pad_status);
|
ESP_LOGI(TAG, "TouchSensor [%d] be inactivated, status mask 0x%x", evt.pad_num, evt.pad_status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (evt.intr_mask & TOUCH_PAD_INTR_MASK_DONE) {
|
if (evt.intr_mask & TOUCH_PAD_INTR_MASK_SCAN_DONE) {
|
||||||
ESP_LOGI(TAG, "TouchSensor [%d] measure done, raw data %d", evt.pad_num, evt.pad_val);
|
ESP_LOGI(TAG, "The touch sensor group measurement is done [%d].", evt.pad_num);
|
||||||
|
}
|
||||||
|
if (evt.intr_mask & TOUCH_PAD_INTR_MASK_TIMEOUT) {
|
||||||
|
/* Add your exception handling in here. */
|
||||||
|
ESP_LOGI(TAG, "Touch sensor channel %d measure timeout. Skip this exception channel!!", evt.pad_num);
|
||||||
|
touch_pad_timeout_resume(); // Point on the next channel to measure.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,21 +161,24 @@ void app_main(void)
|
||||||
for (int i = 0; i < TOUCH_BUTTON_NUM; i++) {
|
for (int i = 0; i < TOUCH_BUTTON_NUM; i++) {
|
||||||
touch_pad_config(button[i]);
|
touch_pad_config(button[i]);
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
|
#if TOUCH_CHANGE_CONFIG
|
||||||
/* If you want change the touch sensor default setting, please write here(after initialize). There are examples: */
|
/* If you want change the touch sensor default setting, please write here(after initialize). There are examples: */
|
||||||
touch_pad_set_meas_time(TOUCH_PAD_SLEEP_CYCLE_DEFAULT, TOUCH_PAD_SLEEP_CYCLE_DEFAULT);
|
touch_pad_set_meas_time(TOUCH_PAD_SLEEP_CYCLE_DEFAULT, TOUCH_PAD_SLEEP_CYCLE_DEFAULT);
|
||||||
touch_pad_set_voltage(TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD, TOUCH_PAD_LOW_VOLTAGE_THRESHOLD, TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD);
|
touch_pad_set_voltage(TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD, TOUCH_PAD_LOW_VOLTAGE_THRESHOLD, TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD);
|
||||||
touch_pad_set_inactive_connect(TOUCH_PAD_INACTIVE_CONNECT_DEFAULT);
|
touch_pad_set_idle_channel_connect(TOUCH_PAD_IDLE_CH_CONNECT_DEFAULT);
|
||||||
for (int i = 0; i < TOUCH_BUTTON_NUM; i++) {
|
for (int i = 0; i < TOUCH_BUTTON_NUM; i++) {
|
||||||
touch_pad_set_cnt_mode(i, TOUCH_PAD_SLOPE_DEFAULT, TOUCH_PAD_TIE_OPT_DEFAULT);
|
touch_pad_set_cnt_mode(i, TOUCH_PAD_SLOPE_DEFAULT, TOUCH_PAD_TIE_OPT_DEFAULT);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TOUCH_BUTTON_DENOISE_ENABLE
|
#if TOUCH_BUTTON_DENOISE_ENABLE
|
||||||
/* Denoise setting at TouchSensor 0. */
|
/* Denoise setting at TouchSensor 0. */
|
||||||
touch_pad_denoise_t denoise = {
|
touch_pad_denoise_t denoise = {
|
||||||
/* The bits to be cancelled are determined according to the noise level. */
|
/* The bits to be cancelled are determined according to the noise level. */
|
||||||
.grade = TOUCH_PAD_DENOISE_BIT4,
|
.grade = TOUCH_PAD_DENOISE_BIT4,
|
||||||
.cap_level = TOUCH_PAD_DENOISE_CAP_L7,
|
/* By adjusting the parameters, the reading of T0 should be approximated to the reading of the measured channel. */
|
||||||
|
.cap_level = TOUCH_PAD_DENOISE_CAP_L4,
|
||||||
};
|
};
|
||||||
touch_pad_denoise_set_config(&denoise);
|
touch_pad_denoise_set_config(&denoise);
|
||||||
touch_pad_denoise_enable();
|
touch_pad_denoise_enable();
|
||||||
|
@ -184,8 +189,10 @@ void app_main(void)
|
||||||
/* Waterproof function */
|
/* Waterproof function */
|
||||||
touch_pad_waterproof_t waterproof = {
|
touch_pad_waterproof_t waterproof = {
|
||||||
.guard_ring_pad = button[3], // If no ring pad, set 0;
|
.guard_ring_pad = button[3], // If no ring pad, set 0;
|
||||||
/* It depends on the number of the parasitic capacitance of the shield pad. */
|
/* It depends on the number of the parasitic capacitance of the shield pad.
|
||||||
.shield_driver = TOUCH_PAD_SHIELD_DRV_L0, //40pf
|
Based on the touch readings of T14 and T0, estimate the size of the parasitic capacitance on T14
|
||||||
|
and set the parameters of the appropriate hardware. */
|
||||||
|
.shield_driver = TOUCH_PAD_SHIELD_DRV_L2,
|
||||||
};
|
};
|
||||||
touch_pad_waterproof_set_config(&waterproof);
|
touch_pad_waterproof_set_config(&waterproof);
|
||||||
touch_pad_waterproof_enable();
|
touch_pad_waterproof_enable();
|
||||||
|
@ -193,11 +200,12 @@ void app_main(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Filter setting */
|
/* Filter setting */
|
||||||
touchsensor_filter_set(TOUCH_PAD_FILTER_IIR_8);
|
touchsensor_filter_set(TOUCH_PAD_FILTER_IIR_16);
|
||||||
|
touch_pad_timeout_set(true, SOC_TOUCH_PAD_THRESHOLD_MAX);
|
||||||
/* Register touch interrupt ISR, enable intr type. */
|
/* Register touch interrupt ISR, enable intr type. */
|
||||||
touch_pad_isr_register(touchsensor_interrupt_cb, NULL, TOUCH_PAD_INTR_MASK_ALL);
|
touch_pad_isr_register(touchsensor_interrupt_cb, NULL, TOUCH_PAD_INTR_MASK_ALL);
|
||||||
touch_pad_intr_enable(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE);
|
/* If you have other touch algorithm, you can get the measured value after the `TOUCH_PAD_INTR_MASK_SCAN_DONE` interrupt is generated. */
|
||||||
// touch_pad_intr_enable(TOUCH_PAD_INTR_MASK_DONE); // Use for debug
|
touch_pad_intr_enable(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE | TOUCH_PAD_INTR_MASK_TIMEOUT);
|
||||||
|
|
||||||
/* Enable touch sensor clock. Work mode is "timer trigger". */
|
/* Enable touch sensor clock. Work mode is "timer trigger". */
|
||||||
touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER);
|
touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER);
|
||||||
|
|
|
@ -13,8 +13,9 @@
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
|
||||||
#define TOUCH_BUTTON_NUM 14
|
#define TOUCH_BUTTON_NUM 14
|
||||||
|
#define TOUCH_CHANGE_CONFIG 0
|
||||||
|
|
||||||
static const char * TAG = "touch read";
|
static const char *TAG = "touch read";
|
||||||
static const touch_pad_t button[TOUCH_BUTTON_NUM] = {
|
static const touch_pad_t button[TOUCH_BUTTON_NUM] = {
|
||||||
TOUCH_PAD_NUM1,
|
TOUCH_PAD_NUM1,
|
||||||
TOUCH_PAD_NUM2,
|
TOUCH_PAD_NUM2,
|
||||||
|
@ -61,11 +62,11 @@ void app_main(void)
|
||||||
for (int i = 0; i < TOUCH_BUTTON_NUM; i++) {
|
for (int i = 0; i < TOUCH_BUTTON_NUM; i++) {
|
||||||
touch_pad_config(button[i]);
|
touch_pad_config(button[i]);
|
||||||
}
|
}
|
||||||
#if 0
|
#if TOUCH_CHANGE_CONFIG
|
||||||
/* If you want change the touch sensor default setting, please write here(after initialize). There are examples: */
|
/* If you want change the touch sensor default setting, please write here(after initialize). There are examples: */
|
||||||
touch_pad_set_meas_time(TOUCH_PAD_SLEEP_CYCLE_DEFAULT, TOUCH_PAD_SLEEP_CYCLE_DEFAULT);
|
touch_pad_set_meas_time(TOUCH_PAD_SLEEP_CYCLE_DEFAULT, TOUCH_PAD_SLEEP_CYCLE_DEFAULT);
|
||||||
touch_pad_set_voltage(TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD, TOUCH_PAD_LOW_VOLTAGE_THRESHOLD, TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD);
|
touch_pad_set_voltage(TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD, TOUCH_PAD_LOW_VOLTAGE_THRESHOLD, TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD);
|
||||||
touch_pad_set_inactive_connect(TOUCH_PAD_INACTIVE_CONNECT_DEFAULT);
|
touch_pad_set_idle_channel_connect(TOUCH_PAD_IDLE_CH_CONNECT_DEFAULT);
|
||||||
for (int i = 0; i < TOUCH_BUTTON_NUM; i++) {
|
for (int i = 0; i < TOUCH_BUTTON_NUM; i++) {
|
||||||
touch_pad_set_cnt_mode(i, TOUCH_PAD_SLOPE_DEFAULT, TOUCH_PAD_TIE_OPT_DEFAULT);
|
touch_pad_set_cnt_mode(i, TOUCH_PAD_SLOPE_DEFAULT, TOUCH_PAD_TIE_OPT_DEFAULT);
|
||||||
}
|
}
|
||||||
|
@ -74,7 +75,7 @@ void app_main(void)
|
||||||
touch_pad_denoise_t denoise = {
|
touch_pad_denoise_t denoise = {
|
||||||
/* The bits to be cancelled are determined according to the noise level. */
|
/* The bits to be cancelled are determined according to the noise level. */
|
||||||
.grade = TOUCH_PAD_DENOISE_BIT4,
|
.grade = TOUCH_PAD_DENOISE_BIT4,
|
||||||
.cap_level = TOUCH_PAD_DENOISE_CAP_L7,
|
.cap_level = TOUCH_PAD_DENOISE_CAP_L4,
|
||||||
};
|
};
|
||||||
touch_pad_denoise_set_config(&denoise);
|
touch_pad_denoise_set_config(&denoise);
|
||||||
touch_pad_denoise_enable();
|
touch_pad_denoise_enable();
|
||||||
|
|
|
@ -177,41 +177,36 @@ void app_main(void)
|
||||||
touch_pad_denoise_t denoise = {
|
touch_pad_denoise_t denoise = {
|
||||||
/* The bits to be cancelled are determined according to the noise level. */
|
/* The bits to be cancelled are determined according to the noise level. */
|
||||||
.grade = TOUCH_PAD_DENOISE_BIT4,
|
.grade = TOUCH_PAD_DENOISE_BIT4,
|
||||||
.cap_level = TOUCH_PAD_DENOISE_CAP_L7,
|
.cap_level = TOUCH_PAD_DENOISE_CAP_L4,
|
||||||
};
|
};
|
||||||
touch_pad_denoise_set_config(&denoise);
|
touch_pad_denoise_set_config(&denoise);
|
||||||
touch_pad_denoise_enable();
|
touch_pad_denoise_enable();
|
||||||
printf("Denoise function init\n");
|
printf("Denoise function init\n");
|
||||||
/* Filter setting */
|
/* Filter setting */
|
||||||
touch_filter_config_t filter_info = {
|
touch_filter_config_t filter_info = {
|
||||||
.mode = TOUCH_PAD_FILTER_IIR_8,
|
.mode = TOUCH_PAD_FILTER_IIR_16,
|
||||||
.debounce_cnt = 1, // 1 time count.
|
.debounce_cnt = 1, // 1 time count.
|
||||||
.hysteresis_thr = 3, // 3%
|
.hysteresis_thr = 3, // 3%
|
||||||
.noise_thr = 0, // 50%
|
.noise_thr = 0, // 50%
|
||||||
.noise_neg_thr = 0, // 50%
|
.noise_neg_thr = 0, // 50%
|
||||||
.neg_noise_limit = 10, // 10 time count.
|
.neg_noise_limit = 10, // 10 time count.
|
||||||
.jitter_step = 4, // use for jitter mode.
|
.jitter_step = 4, // use for jitter mode.
|
||||||
|
.smh_lvl = TOUCH_PAD_SMOOTH_IIR_2,
|
||||||
};
|
};
|
||||||
touch_pad_filter_set_config(&filter_info);
|
touch_pad_filter_set_config(&filter_info);
|
||||||
touch_pad_filter_enable();
|
touch_pad_filter_enable();
|
||||||
touch_pad_filter_reset_baseline(TOUCH_PAD_NUM9);
|
|
||||||
printf("touch pad filter init %d\n", TOUCH_PAD_FILTER_IIR_8);
|
printf("touch pad filter init %d\n", TOUCH_PAD_FILTER_IIR_8);
|
||||||
/* Set sleep touch pad. */
|
/* Set sleep touch pad. */
|
||||||
touch_pad_sleep_channel_t slp_config = {
|
touch_pad_sleep_channel_enable(TOUCH_PAD_NUM9, true);
|
||||||
.touch_num = TOUCH_PAD_NUM9,
|
touch_pad_sleep_channel_enable_proximity(TOUCH_PAD_NUM9, false);
|
||||||
.sleep_pad_threshold = TOUCH_PAD_THRESHOLD_MAX,
|
|
||||||
.en_proximity = false,
|
|
||||||
};
|
|
||||||
touch_pad_sleep_channel_config(&slp_config);
|
|
||||||
/* Enable touch sensor clock. Work mode is "timer trigger". */
|
/* Enable touch sensor clock. Work mode is "timer trigger". */
|
||||||
touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER);
|
touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER);
|
||||||
touch_pad_fsm_start();
|
touch_pad_fsm_start();
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_RATE_MS);
|
||||||
/* read sleep touch pad value */
|
/* read sleep touch pad value */
|
||||||
uint32_t touch_value;
|
uint32_t touch_value;
|
||||||
touch_pad_sleep_channel_read_baseline(&touch_value);
|
touch_pad_sleep_channel_read_smooth(TOUCH_PAD_NUM9, &touch_value);
|
||||||
slp_config.sleep_pad_threshold = touch_value * 0.1;
|
touch_pad_sleep_set_threshold(TOUCH_PAD_NUM9, touch_value * 0.1); //10%
|
||||||
touch_pad_sleep_channel_config(&slp_config); //10%
|
|
||||||
printf("test init: touch pad [%d] slp %d, thresh %d\n",
|
printf("test init: touch pad [%d] slp %d, thresh %d\n",
|
||||||
TOUCH_PAD_NUM9, touch_value, (uint32_t)(touch_value * 0.1));
|
TOUCH_PAD_NUM9, touch_value, (uint32_t)(touch_value * 0.1));
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue