mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-27 02:13:10 +00:00

1. add sens_struct.h 2. add definition of RTCCNTL and RTCIO 3. modify touch pad examples 4. update example code. 5. add comments add option in menuconfig 6. fix issue that pad index 8 and 9 are mismatched 7. add touch_pad_read_filtered() api to get value filtered by iir filter 8. modify touch pad isr func 9. Make the items in perihperal.ld in the sequence of address 10. delete Kconfig for touch pad 11. add touchpad filter APIs to adjust the filter 12. add touch_pad into index.rst 13. add touch_pad in Doxyfile 14. add touch_pad.rst
282 lines
16 KiB
C
282 lines
16 KiB
C
// Copyright 2015-2016 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_RTC_IO_STRUCT_H_
|
||
#define _SOC_RTC_IO_STRUCT_H_
|
||
typedef volatile struct {
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 14;
|
||
uint32_t data:18; /*GPIO0~17 output value*/
|
||
};
|
||
uint32_t val;
|
||
} out;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 14;
|
||
uint32_t w1ts:18; /*GPIO0~17 output value write 1 to set*/
|
||
};
|
||
uint32_t val;
|
||
} out_w1ts;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 14;
|
||
uint32_t w1tc:18; /*GPIO0~17 output value write 1 to clear*/
|
||
};
|
||
uint32_t val;
|
||
} out_w1tc;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 14;
|
||
uint32_t enable:18; /*GPIO0~17 output enable*/
|
||
};
|
||
uint32_t val;
|
||
} enable;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 14;
|
||
uint32_t w1ts:18; /*GPIO0~17 output enable write 1 to set*/
|
||
};
|
||
uint32_t val;
|
||
} enable_w1ts;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 14;
|
||
uint32_t w1tc:18; /*GPIO0~17 output enable write 1 to clear*/
|
||
};
|
||
uint32_t val;
|
||
} enable_w1tc;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 14;
|
||
uint32_t status:18; /*GPIO0~17 interrupt status*/
|
||
};
|
||
uint32_t val;
|
||
} status;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 14;
|
||
uint32_t w1ts:18; /*GPIO0~17 interrupt status write 1 to set*/
|
||
};
|
||
uint32_t val;
|
||
} status_w1ts;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 14;
|
||
uint32_t w1tc:18; /*GPIO0~17 interrupt status write 1 to clear*/
|
||
};
|
||
uint32_t val;
|
||
} status_w1tc;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 14;
|
||
uint32_t in:18; /*GPIO0~17 input value*/
|
||
};
|
||
uint32_t val;
|
||
} in_val;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 2;
|
||
uint32_t pad_driver: 1; /*if set to 0: normal output if set to 1: open drain*/
|
||
uint32_t reserved3: 4;
|
||
uint32_t int_type: 3; /*if set to 0: GPIO interrupt disable if set to 1: rising edge trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/
|
||
uint32_t wakeup_enable: 1; /*GPIO wake up enable only available in light sleep*/
|
||
uint32_t reserved11: 21;
|
||
};
|
||
uint32_t val;
|
||
} pin[18];
|
||
union {
|
||
struct {
|
||
uint32_t sel0: 5;
|
||
uint32_t sel1: 5;
|
||
uint32_t sel2: 5;
|
||
uint32_t sel3: 5;
|
||
uint32_t sel4: 5;
|
||
uint32_t no_gating_12m: 1;
|
||
uint32_t reserved26: 6;
|
||
};
|
||
uint32_t val;
|
||
} debug_sel;
|
||
uint32_t dig_pad_hold; /*select the digital pad hold value.*/
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 30;
|
||
uint32_t hall_phase: 1; /*Reverse phase of hall sensor*/
|
||
uint32_t xpd_hall: 1; /*Power on hall sensor and connect to VP and VN*/
|
||
};
|
||
uint32_t val;
|
||
} hall_sens;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 4;
|
||
uint32_t sense4_fun_ie: 1; /*the input enable of the pad*/
|
||
uint32_t sense4_slp_ie: 1; /*the input enable of the pad in sleep status*/
|
||
uint32_t sense4_slp_sel: 1; /*the sleep status selection signal of the pad*/
|
||
uint32_t sense4_fun_sel: 2; /*the functional selection signal of the pad*/
|
||
uint32_t sense3_fun_ie: 1; /*the input enable of the pad*/
|
||
uint32_t sense3_slp_ie: 1; /*the input enable of the pad in sleep status*/
|
||
uint32_t sense3_slp_sel: 1; /*the sleep status selection signal of the pad*/
|
||
uint32_t sense3_fun_sel: 2; /*the functional selection signal of the pad*/
|
||
uint32_t sense2_fun_ie: 1; /*the input enable of the pad*/
|
||
uint32_t sense2_slp_ie: 1; /*the input enable of the pad in sleep status*/
|
||
uint32_t sense2_slp_sel: 1; /*the sleep status selection signal of the pad*/
|
||
uint32_t sense2_fun_sel: 2; /*the functional selection signal of the pad*/
|
||
uint32_t sense1_fun_ie: 1; /*the input enable of the pad*/
|
||
uint32_t sense1_slp_ie: 1; /*the input enable of the pad in sleep status*/
|
||
uint32_t sense1_slp_sel: 1; /*the sleep status selection signal of the pad*/
|
||
uint32_t sense1_fun_sel: 2; /*the functional selection signal of the pad*/
|
||
uint32_t sense4_mux_sel: 1; /*<2A>1<EFBFBD> select the digital function <20>0<EFBFBD>slection the rtc function*/
|
||
uint32_t sense3_mux_sel: 1; /*<2A>1<EFBFBD> select the digital function <20>0<EFBFBD>slection the rtc function*/
|
||
uint32_t sense2_mux_sel: 1; /*<2A>1<EFBFBD> select the digital function <20>0<EFBFBD>slection the rtc function*/
|
||
uint32_t sense1_mux_sel: 1; /*<2A>1<EFBFBD> select the digital function <20>0<EFBFBD>slection the rtc function*/
|
||
uint32_t sense4_hold: 1; /*hold the current value of the output when setting the hold to <20>1<EFBFBD>*/
|
||
uint32_t sense3_hold: 1; /*hold the current value of the output when setting the hold to <20>1<EFBFBD>*/
|
||
uint32_t sense2_hold: 1; /*hold the current value of the output when setting the hold to <20>1<EFBFBD>*/
|
||
uint32_t sense1_hold: 1; /*hold the current value of the output when setting the hold to <20>1<EFBFBD>*/
|
||
};
|
||
uint32_t val;
|
||
} sensor_pads;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 18;
|
||
uint32_t adc2_fun_ie: 1; /*the input enable of the pad*/
|
||
uint32_t adc2_slp_ie: 1; /*the input enable of the pad in sleep status*/
|
||
uint32_t adc2_slp_sel: 1; /*the sleep status selection signal of the pad*/
|
||
uint32_t adc2_fun_sel: 2; /*the functional selection signal of the pad*/
|
||
uint32_t adc1_fun_ie: 1; /*the input enable of the pad*/
|
||
uint32_t adc1_slp_ie: 1; /*the input enable of the pad in sleep status*/
|
||
uint32_t adc1_slp_sel: 1; /*the sleep status selection signal of the pad*/
|
||
uint32_t adc1_fun_sel: 2; /*the functional selection signal of the pad*/
|
||
uint32_t adc2_mux_sel: 1; /*<2A>1<EFBFBD> select the digital function <20>0<EFBFBD>slection the rtc function*/
|
||
uint32_t adc1_mux_sel: 1; /*<2A>1<EFBFBD> select the digital function <20>0<EFBFBD>slection the rtc function*/
|
||
uint32_t adc2_hold: 1; /*hold the current value of the output when setting the hold to <20>1<EFBFBD>*/
|
||
uint32_t adc1_hold: 1; /*hold the current value of the output when setting the hold to <20>1<EFBFBD>*/
|
||
};
|
||
uint32_t val;
|
||
} adc_pad;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 10;
|
||
uint32_t dac_xpd_force: 1; /*Power on DAC1. Usually we need to tristate PDAC1 if we power on the DAC i.e. IE=0 OE=0 RDE=0 RUE=0*/
|
||
uint32_t fun_ie: 1; /*the input enable of the pad*/
|
||
uint32_t slp_oe: 1; /*the output enable of the pad in sleep status*/
|
||
uint32_t slp_ie: 1; /*the input enable of the pad in sleep status*/
|
||
uint32_t slp_sel: 1; /*the sleep status selection signal of the pad*/
|
||
uint32_t fun_sel: 2; /*the functional selection signal of the pad*/
|
||
uint32_t mux_sel: 1; /*<2A>1<EFBFBD> select the digital function <20>0<EFBFBD>slection the rtc function*/
|
||
uint32_t xpd_dac: 1; /*Power on DAC1. Usually we need to tristate PDAC1 if we power on the DAC i.e. IE=0 OE=0 RDE=0 RUE=0*/
|
||
uint32_t dac: 8; /*PAD DAC1 control code.*/
|
||
uint32_t rue: 1; /*the pull up enable of the pad*/
|
||
uint32_t rde: 1; /*the pull down enable of the pad*/
|
||
uint32_t hold: 1; /*hold the current value of the output when setting the hold to <20>1<EFBFBD>*/
|
||
uint32_t drv: 2; /*the driver strength of the pad*/
|
||
};
|
||
uint32_t val;
|
||
} pad_dac[2];
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 1;
|
||
uint32_t dbias_xtal_32k: 2; /*32K XTAL self-bias reference control.*/
|
||
uint32_t dres_xtal_32k: 2; /*32K XTAL resistor bias control.*/
|
||
uint32_t x32p_fun_ie: 1; /*the input enable of the pad*/
|
||
uint32_t x32p_slp_oe: 1; /*the output enable of the pad in sleep status*/
|
||
uint32_t x32p_slp_ie: 1; /*the input enable of the pad in sleep status*/
|
||
uint32_t x32p_slp_sel: 1; /*the sleep status selection signal of the pad*/
|
||
uint32_t x32p_fun_sel: 2; /*the functional selection signal of the pad*/
|
||
uint32_t x32n_fun_ie: 1; /*the input enable of the pad*/
|
||
uint32_t x32n_slp_oe: 1; /*the output enable of the pad in sleep status*/
|
||
uint32_t x32n_slp_ie: 1; /*the input enable of the pad in sleep status*/
|
||
uint32_t x32n_slp_sel: 1; /*the sleep status selection signal of the pad*/
|
||
uint32_t x32n_fun_sel: 2; /*the functional selection signal of the pad*/
|
||
uint32_t x32p_mux_sel: 1; /*<2A>1<EFBFBD> select the digital function <20>0<EFBFBD>slection the rtc function*/
|
||
uint32_t x32n_mux_sel: 1; /*<2A>1<EFBFBD> select the digital function <20>0<EFBFBD>slection the rtc function*/
|
||
uint32_t xpd_xtal_32k: 1; /*Power up 32kHz crystal oscillator*/
|
||
uint32_t dac_xtal_32k: 2; /*32K XTAL bias current DAC.*/
|
||
uint32_t x32p_rue: 1; /*the pull up enable of the pad*/
|
||
uint32_t x32p_rde: 1; /*the pull down enable of the pad*/
|
||
uint32_t x32p_hold: 1; /*hold the current value of the output when setting the hold to <20>1<EFBFBD>*/
|
||
uint32_t x32p_drv: 2; /*the driver strength of the pad*/
|
||
uint32_t x32n_rue: 1; /*the pull up enable of the pad*/
|
||
uint32_t x32n_rde: 1; /*the pull down enable of the pad*/
|
||
uint32_t x32n_hold: 1; /*hold the current value of the output when setting the hold to <20>1<EFBFBD>*/
|
||
uint32_t x32n_drv: 2; /*the driver strength of the pad*/
|
||
};
|
||
uint32_t val;
|
||
} xtal_32k_pad;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 23;
|
||
uint32_t dcur: 2; /*touch sensor bias current. Should have option to tie with BIAS_SLEEP(When BIAS_SLEEP this setting is available*/
|
||
uint32_t drange: 2; /*touch sensor saw wave voltage range.*/
|
||
uint32_t drefl: 2; /*touch sensor saw wave bottom voltage.*/
|
||
uint32_t drefh: 2; /*touch sensor saw wave top voltage.*/
|
||
uint32_t xpd_bias: 1; /*touch sensor bias power on.*/
|
||
};
|
||
uint32_t val;
|
||
} touch_cfg;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 12;
|
||
uint32_t to_gpio: 1; /*connect the rtc pad input to digital pad input <20>0<EFBFBD> is availbale GPIO4*/
|
||
uint32_t fun_ie: 1; /*the input enable of the pad*/
|
||
uint32_t slp_oe: 1; /*the output enable of the pad in sleep status*/
|
||
uint32_t slp_ie: 1; /*the input enable of the pad in sleep status*/
|
||
uint32_t slp_sel: 1; /*the sleep status selection signal of the pad*/
|
||
uint32_t fun_sel: 2; /*the functional selection signal of the pad*/
|
||
uint32_t mux_sel: 1; /*<2A>1<EFBFBD> select the digital function <20>0<EFBFBD>slection the rtc function*/
|
||
uint32_t xpd: 1; /*touch sensor power on.*/
|
||
uint32_t tie_opt: 1; /*default touch sensor tie option. 0: tie low 1: tie high.*/
|
||
uint32_t start: 1; /*start touch sensor.*/
|
||
uint32_t dac: 3; /*touch sensor slope control. 3-bit for each touch panel default 100.*/
|
||
uint32_t reserved26: 1;
|
||
uint32_t rue: 1; /*the pull up enable of the pad*/
|
||
uint32_t rde: 1; /*the pull down enable of the pad*/
|
||
uint32_t drv: 2; /*the driver strength of the pad*/
|
||
uint32_t hold: 1; /*hold the current value of the output when setting the hold to <20>1<EFBFBD>*/
|
||
};
|
||
uint32_t val;
|
||
} touch_pad[10];
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 27;
|
||
uint32_t sel: 5; /*select the wakeup source <20>0<EFBFBD> select GPIO0 <20>1<EFBFBD> select GPIO2 ...<2E>17<31> select GPIO17*/
|
||
};
|
||
uint32_t val;
|
||
} ext_wakeup0;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 27;
|
||
uint32_t sel: 5; /*select the external xtl power source <20>0<EFBFBD> select GPIO0 <20>1<EFBFBD> select GPIO2 ...<2E>17<31> select GPIO17*/
|
||
};
|
||
uint32_t val;
|
||
} xtl_ext_ctr;
|
||
union {
|
||
struct {
|
||
uint32_t reserved0: 23;
|
||
uint32_t debug_bit_sel: 5;
|
||
uint32_t scl_sel: 2; /*<2A>0<EFBFBD> using TOUCH_PAD[0] as i2c clk <20>1<EFBFBD> using TOUCH_PAD[2] as i2c clk*/
|
||
uint32_t sda_sel: 2; /*<2A>0<EFBFBD> using TOUCH_PAD[1] as i2c sda <20>1<EFBFBD> using TOUCH_PAD[3] as i2c sda*/
|
||
};
|
||
uint32_t val;
|
||
} sar_i2c_io;
|
||
union {
|
||
struct {
|
||
uint32_t date: 28; /*date*/
|
||
uint32_t reserved28: 4;
|
||
};
|
||
uint32_t val;
|
||
} date;
|
||
} rtc_io_dev_t;
|
||
extern rtc_io_dev_t RTCIO;
|
||
#endif /* _SOC_RTC_IO_STRUCT_H_ */
|