1 /* 2 * Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved. 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 #ifndef __TOUCH_H__ 16 #define __TOUCH_H__ 17 18 #include <stdint.h> 19 #include <stdbool.h> 20 #include <stdlib.h> 21 #include <string.h> 22 #include <errno.h> 23 #include "cmsis_os2.h" 24 #include "touch_if.h" 25 26 struct touch_device { 27 const char *name; 28 osThreadId_t tid; 29 osSemaphoreId_t sem; 30 osMessageQueueId_t mq; 31 int (*init)(struct touch_device *); 32 void (*deinit)(void); 33 void (*irq_enable)(bool); 34 int (*read)(struct touch_device *, struct touch_msg *); 35 }; 36 37 int32_t RegisterTouchDevice(struct touch_device *device); 38 39 #endif 40