1 /*! 2 * @file tsc_object.h 3 * 4 * @brief This file contains external declarations of the tsc_object.c file. 5 * 6 * @version V1.0.1 7 * 8 * @date 2022-09-20 9 * 10 * @attention 11 * 12 * Copyright (C) 2020-2022 Geehy Semiconductor 13 * 14 * You may not use this file except in compliance with the 15 * GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE). 16 * 17 * The program is only for reference, which is distributed in the hope 18 * that it will be useful and instructional for customers to develop 19 * their software. Unless required by applicable law or agreed to in 20 * writing, the program is distributed on an "AS IS" BASIS, WITHOUT 21 * ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied. 22 * See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions 23 * and limitations under the License. 24 */ 25 26 /* Define to prevent recursive inclusion */ 27 #ifndef __TOUCH_OBJECT_H 28 #define __TOUCH_OBJECT_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 /* Includes */ 35 #include "tsc_touchkey.h" 36 #include "tsc_linrot.h" 37 38 /** @addtogroup TSC_Driver_Library TSC Driver Library 39 @{ 40 */ 41 42 /** @addtogroup TSC_Object_Driver TSC Object Driver 43 @{ 44 */ 45 46 /** @defgroup TSC_Object_Macros Macros 47 @{ 48 */ 49 50 #define TSC_OBJ_TYPE_KEY_MASK (0x10) /*!< TouchKey object mask */ 51 #define TSC_OBJ_TYPE_LINROT_MASK (0x20) /*!< Linear and Rotary objects mask */ 52 #define TSC_OBJ_TYPE_TRACKNAV_MASK (0x40) /*!< TrackPad and NaviPad objects mask */ 53 54 /**@} end of group TSC_Object_Macros */ 55 56 /** @defgroup TSC_Object_Enumerations Enumerations 57 @{ 58 */ 59 60 /** 61 * @brief Contains all different kinds of sensors 62 */ 63 typedef enum 64 { 65 TSC_OBJ_TOUCHKEY = (TSC_OBJ_TYPE_KEY_MASK + 0), /*!< Normal TouchKey */ 66 TSC_OBJ_TOUCHKEYB = (TSC_OBJ_TYPE_KEY_MASK + 1), /*!< Basic TouchKey */ 67 TSC_OBJ_LINEAR = (TSC_OBJ_TYPE_LINROT_MASK + 0), /*!< Normal Linear sensor */ 68 TSC_OBJ_LINEARB = (TSC_OBJ_TYPE_LINROT_MASK + 1), /*!< Basic Linear sensor */ 69 TSC_OBJ_ROTARY = (TSC_OBJ_TYPE_LINROT_MASK + 2), /*!< Normal Rotary sensor */ 70 TSC_OBJ_ROTARYB = (TSC_OBJ_TYPE_LINROT_MASK + 3), /*!< Basic Rotary sensor */ 71 TSC_OBJ_TRACKPAD = (TSC_OBJ_TYPE_TRACKNAV_MASK + 0), /*!< TrackPad sensor */ 72 TSC_OBJ_NAVIPAD = (TSC_OBJ_TYPE_TRACKNAV_MASK + 1) /*!< NaviPad sensor */ 73 } TSC_OBJECT_T; 74 75 /**@} end of group TSC_Object_Enumerations */ 76 77 /** @defgroup TSC_Object_Structures Data Object Structures 78 @{ 79 */ 80 81 /** 82 * @brief Contains the definition of an Object. 83 * Variables of this structure type can be placed in RAM or ROM. 84 */ 85 typedef struct 86 { 87 TSC_OBJECT_T Type; /*!< Object type */ 88 void* MyObj; /*!< Pointer to the object */ 89 } TSC_Object_T; 90 91 /** 92 * @brief Contains the definition of a Group of Objects. 93 * Variables of this structure type can be placed in RAM or ROM. 94 */ 95 typedef struct 96 { 97 CONST TSC_Object_T* p_Obj; /*!< Pointer to the first object */ 98 TSC_tNum_T NbObjects; /*!< Number of objects in the group */ 99 TSC_tNum_T StateMask; /*!< "OR" of all objects state mask */ 100 TSC_STATE_T Change; /*!< The State is different from the previous one */ 101 TSC_tIndex_T execution; /*!< Flag for the ECS execution */ 102 #if TOUCH_ECS_DELAY > 0 103 TSC_tIndex_T wait; /*!< Flag for the ECS delay */ 104 TSC_tTick_ms_T time; /*!< Keep the time for the ECS delay */ 105 #endif 106 } TSC_ObjectGroup_T; 107 108 /**@} end of group TSC_Object_Structures */ 109 110 /** @defgroup TSC_Object_Functions Functions 111 @{ 112 */ 113 114 void TSC_Obj_ConfigGroup(TSC_ObjectGroup_T* objgrp); 115 void TSC_Obj_ProcessGroup(TSC_ObjectGroup_T* objgrp); 116 void TSC_Obj_ConfigGlobalObj(CONST TSC_Object_T* pObj); 117 118 #ifdef __cplusplus 119 } 120 #endif 121 122 #endif /* __TSC_OBJECT_H */ 123 124 /**@} end of group TSC_Object_Functions */ 125 /**@} end of group TSC_Object_Driver */ 126 /**@} end of group TSC_Driver_Library */ 127