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 #include <components/log.h> 18 #include <driver/touch_types.h> 19 20 21 #define TOUCH_TAG "touch" 22 #define TOUCH_LOGI(...) BK_LOGI(TOUCH_TAG, ##__VA_ARGS__) 23 #define TOUCH_LOGW(...) BK_LOGW(TOUCH_TAG, ##__VA_ARGS__) 24 #define TOUCH_LOGE(...) BK_LOGE(TOUCH_TAG, ##__VA_ARGS__) 25 #define TOUCH_LOGD(...) BK_LOGD(TOUCH_TAG, ##__VA_ARGS__) 26 27 #define SOC_TOUCH_ID_NUM 16 28 29 void touch_isr(void); 30 31 /** 32 * @brief enable/disable calibretion of touch channel 33 * 34 * This API enable or disable the touch channel calibretion. 35 * 36 * 37 * @param 38 * - enable: enable -- 1; disable -- 0; 39 * 40 * @return 41 * - BK_OK: succeed 42 * - others: other errors. 43 */ 44 bk_err_t bk_touch_calib_enable(uint32_t enable); 45 46 /** 47 * @brief get the status of touch channel interrupt 48 * 49 * This API get the status of touch channel interrupt. One bit corresponding to one channel. 50 * 51 * 52 * @param 53 * - None 54 * 55 * @return 56 * - BK_OK: succeed 57 * - others: other errors. 58 */ 59 bk_err_t bk_touch_get_int_status(void); 60 61 /** 62 * @brief clear the status of touch interrupt 63 * 64 * This API clear the status of touch interrupt. One bit corresponding to one channel. 65 * 66 * 67 * @param 68 * - touch_id: touch channel, channel 0 ~ channel 15; 69 * 70 * @return 71 * - BK_OK: succeed 72 * - others: other errors. 73 */ 74 bk_err_t bk_touch_clear_int(touch_channel_t touch_id); 75 76 77