1 // Copyright (C) 2022 Beken Corporation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 18 #include <common/bk_include.h> 19 #include <driver/int_types.h> 20 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 27 #define BK_ERR_TOUCH_ID (BK_ERR_TOUCH_BASE - 1) 28 29 30 typedef void (*touch_isr_t)(void *param); 31 32 33 typedef enum { 34 BK_TOUCH_0 = 1 << 0, /**< touch channel 0 */ 35 BK_TOUCH_1 = 1 << 1, /**< touch channel 1 */ 36 BK_TOUCH_2 = 1 << 2, /**< touch channel 2 */ 37 BK_TOUCH_3 = 1 << 3, /**< touch channel 3 */ 38 BK_TOUCH_4 = 1 << 4, /**< touch channel 4 */ 39 BK_TOUCH_5 = 1 << 5, /**< touch channel 5 */ 40 BK_TOUCH_6 = 1 << 6, /**< touch channel 6 */ 41 BK_TOUCH_7 = 1 << 7, /**< touch channel 7 */ 42 BK_TOUCH_8 = 1 << 8, /**< touch channel 8 */ 43 BK_TOUCH_9 = 1 << 9, /**< touch channel 9 */ 44 BK_TOUCH_10 = 1 << 10, /**< touch channel 10 */ 45 BK_TOUCH_11 = 1 << 11, /**< touch channel 11 */ 46 BK_TOUCH_12 = 1 << 12, /**< touch channel 12 */ 47 BK_TOUCH_13 = 1 << 13, /**< touch channel 13 */ 48 BK_TOUCH_14 = 1 << 14, /**< touch channel 14 */ 49 BK_TOUCH_15 = 1 << 15, /**< touch channel 15 */ 50 BK_TOUCH_MAX, 51 } touch_channel_t; 52 53 typedef enum { 54 TOUCH_SENSITIVITY_LEVLE_0 = 0, 55 TOUCH_SENSITIVITY_LEVLE_1, 56 TOUCH_SENSITIVITY_LEVLE_2, 57 TOUCH_SENSITIVITY_LEVLE_3, 58 } touch_sensitivity_level_t; 59 60 typedef enum { 61 TOUCH_DETECT_THRESHOLD_0 = 0, 62 TOUCH_DETECT_THRESHOLD_1, 63 TOUCH_DETECT_THRESHOLD_2, 64 TOUCH_DETECT_THRESHOLD_3, 65 TOUCH_DETECT_THRESHOLD_4, 66 TOUCH_DETECT_THRESHOLD_5, 67 TOUCH_DETECT_THRESHOLD_6, 68 TOUCH_DETECT_THRESHOLD_7, 69 } touch_detect_threshold_t; 70 71 typedef enum { 72 TOUCH_DETECT_RANGE_8PF = 0, /**< 8PF */ 73 TOUCH_DETECT_RANGE_12PF, /**< 12PF */ 74 TOUCH_DETECT_RANGE_19PF, /**< 19PF */ 75 TOUCH_DETECT_RANGE_27PF, /**< 27PF */ 76 } touch_detect_range_t; 77 78 79 typedef struct { 80 icu_int_src_t int_src; 81 int_group_isr_t isr; 82 } touch_int_config_t; 83 84 typedef struct { 85 touch_sensitivity_level_t sensitivity_level; /**< sensitivity_level */ 86 touch_detect_threshold_t detect_threshold; /**< detect_threshold */ 87 touch_detect_range_t detect_range; /**< detect_range */ 88 } touch_config_t; 89 90 91 #ifdef __cplusplus 92 } 93 #endif 94 95 96