1 /*!
2  * @file        tsc.h
3  *
4  * @brief       This file contains external declarations of the tsc.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 __TSC_H
28 #define __TSC_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /* Includes */
35 #include "tsc_acq.h"
36 #include "tsc_time.h"
37 #include "tsc_touchkey.h"
38 #include "tsc_linrot.h"
39 #include "tsc_object.h"
40 #include "tsc_dxs.h"
41 #include "tsc_ecs.h"
42 #include "tsc_filter.h"
43 
44 /** @addtogroup TSC_Driver_Library TSC Driver Library
45   @{
46 */
47 
48 /** @addtogroup TSC_Driver TSC Driver
49   @{
50 */
51 
52 /** @defgroup TSC_Macros Macros
53   @{
54 */
55 
56 /**@} end of group TSC_Macros */
57 
58 /** @defgroup TSC_Enumerations Enumerations
59   @{
60 */
61 
62 /**@} end of group TSC_Enumerations */
63 
64 /** @defgroup TSC_Structures Structures
65   @{
66 */
67 
68 /**
69  * @brief   Store all global variables shared between the Touch Driver and the Application.
70  */
71 typedef struct
72 {
73     TSC_tTick_ms_T       Tick_ms;        /*!< Incremented each 0.5ms by timing interrupt routine */
74     TSC_tTick_sec_T      Tick_sec;       /*!< Incremented each second by timing interrupt routine */
75     CONST TSC_Block_T*    Block_Array;   /*!< Pointer to the array containing all Blocks */
76     TSC_tIndex_T         For_Block;      /*!< Pointer to the current Block */
77     CONST TSC_Object_T*   For_Obj;       /*!< Pointer to the current Object */
78 #if TOUCH_USE_ZONE > 0
79     CONST TSC_Zone_T*     For_Zone;      /*!< Pointer to the current Zone */
80     TSC_tIndex_T         Index_For_Zone; /*!< Index in the current Zone */
81 #endif
82 #if TOUCH_TOTAL_KEYS > 0
83     CONST TSC_TouchKey_T* For_Key;    /*!< Pointer to the current Touch Key */
84 #endif
85 #if TOUCH_TOTAL_LNRTS > 0
86     CONST TSC_LinRot_T*   For_LinRot; /*!< Pointer to the current Linear or Rotary sensor */
87 #endif
88 } TSC_Globals_T;
89 
90 /**
91  * @brief   Store all global parametersshared between the Touch Driver and the Application.
92  * @warning Only one variable of this structure type must be created and be placed in RAM only.
93  */
94 typedef struct
95 {
96     TSC_tMeas_T       AcqMin;         /*!< Acquisition minimum limit */
97     TSC_tMeas_T       AcqMax;         /*!< Acquisition maximum limit */
98     TSC_tNum_T        NumCalibSample; /*!< Number of Calibration samples */
99     TSC_tTick_sec_T   DTO;            /*!< Detection Time Out */
100 #if TOUCH_TOTAL_KEYS > 0
101     CONST TSC_State_T*           p_KeySta; /*!< Default state machine for TouchKey sensors */
102     CONST TSC_TouchKeyMethods_T* p_KeyMet; /*!< Default methods for TouchKey sensors */
103 #endif
104 #if TOUCH_TOTAL_LNRTS > 0
105     CONST TSC_State_T*         p_LinRotSta; /*!< Default state machine for Linear/Rotary sensors */
106     CONST TSC_LinRotMethods_T* p_LinRotMet; /*!< Default methods for Linear/Rotary sensors */
107 #endif
108 } TSC_Params_T;
109 
110 /**@} end of group TSC_Structures */
111 
112 /** @defgroup TSC_Variables Variables
113   @{
114 */
115 
116 extern TSC_Globals_T  TSC_Globals;
117 extern TSC_Params_T   TSC_Params;
118 
119 /**@} end of group TSC_Variables */
120 
121 /** @defgroup TSC_Functions Functions
122   @{
123 */
124 
125 TSC_STATUS_T TSC_Config(CONST TSC_Block_T* block);
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif /* __TSC_H */
132 
133 /**@} end of group TSC_Functions */
134 /**@} end of group TSC_Driver */
135 /**@} end of group TSC_Driver_Library */
136