2 ******************************************************************************
\r
3 * @file tsl_touchkey.h
\r
4 * @author MCD Application Team
\r
6 * @date 22-January-2013
\r
7 * @brief This file contains external declarations of the tsl_touchkey.c file.
\r
8 ******************************************************************************
\r
11 * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>
\r
13 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
\r
14 * You may not use this file except in compliance with the License.
\r
15 * You may obtain a copy of the License at:
\r
17 * http://www.st.com/software_license_agreement_liberty_v2
\r
19 * Unless required by applicable law or agreed to in writing, software
\r
20 * distributed under the License is distributed on an "AS IS" BASIS,
\r
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
22 * See the License for the specific language governing permissions and
\r
23 * limitations under the License.
\r
25 ******************************************************************************
\r
28 /* Define to prevent recursive inclusion -------------------------------------*/
\r
29 #ifndef __TSL_TOUCHKEY_H
\r
30 #define __TSL_TOUCHKEY_H
\r
32 /* Includes ------------------------------------------------------------------*/
\r
33 #include "tsl_acq.h"
\r
34 #include "tsl_time.h"
\r
36 /* Exported types ------------------------------------------------------------*/
\r
38 /** Contains all data related to TouchKey sensor.
\r
39 * Variables of this structure type must be placed in RAM only.
\r
43 TSL_StateId_enum_T StateId; /**< Current state identifier */
\r
44 unsigned int Counter : 6; /**< Generic counter for debounce, calibration & DTO */
\r
45 unsigned int Change : 1; /**< The State is different from the previous one (TSL_StateChange_enum_T) */
\r
46 unsigned int DxSLock : 1; /**< The State is locked by the DxS (TSL_Bool_enum_T) */
\r
50 /** Contains all parameters related to TouchKey sensor.
\r
51 * Variables of this structure type can be placed in RAM or ROM.
\r
55 #if TSLPRM_USE_PROX > 0
\r
56 TSL_tThreshold_T ProxInTh; /**< Proximity in threshold */
\r
57 TSL_tThreshold_T ProxOutTh; /**< Proximity out threshold */
\r
59 TSL_tThreshold_T DetectInTh; /**< Detection in threshold */
\r
60 TSL_tThreshold_T DetectOutTh; /**< Detection out threshold */
\r
61 TSL_tThreshold_T CalibTh; /**< Calibration threshold */
\r
62 TSL_tCounter_T CounterDebCalib; /**< Debounce counter to enter in Calibration state */
\r
63 #if TSLPRM_USE_PROX > 0
\r
64 TSL_tCounter_T CounterDebProx; /**< Debounce counter to enter in Proximity state */
\r
66 TSL_tCounter_T CounterDebDetect; /**< Debounce counter to enter in Detect state */
\r
67 TSL_tCounter_T CounterDebRelease; /**< Debounce counter to enter in Release state */
\r
68 TSL_tCounter_T CounterDebError; /**< Debounce counter to enter in Error state */
\r
70 TSL_TouchKeyParam_T;
\r
72 /** Contains definition of a TouchKey sensor.
\r
73 * Variables of this structure type can be placed in RAM or ROM.
\r
77 TSL_TouchKeyData_T *p_Data; /**< Data (state id, counter, flags, ...) */
\r
78 TSL_TouchKeyParam_T *p_Param; /**< Parameters (thresholds, debounce, ...) */
\r
79 TSL_ChannelData_T *p_ChD; /**< Channel Data (Meas, Ref, Delta, ...) */
\r
80 CONST TSL_State_T *p_SM; /**< State Machine */
\r
81 CONST TSL_TouchKeyMethods_T *p_Methods; /**< Methods */
\r
85 /** Contains definition of a Basic TouchKey sensor.
\r
86 * Variables of this structure type can be placed in RAM or ROM.
\r
87 * Basic sensor does not contain its own state machine and methods. It used
\r
88 * default ones instead to gain memory space.
\r
92 TSL_TouchKeyData_T *p_Data; /**< Data (state id, counter, flags, ...) */
\r
93 TSL_TouchKeyParam_T *p_Param; /**< Parameters (thresholds, debounce, ...) */
\r
94 TSL_ChannelData_T *p_ChD; /**< Channel Data (Meas, Ref, Delta, ...) */
\r
98 /* Exported variables --------------------------------------------------------*/
\r
99 /* Exported macros -----------------------------------------------------------*/
\r
101 /* Exported functions --------------------------------------------------------*/
\r
103 // "Object methods" functions
\r
104 void TSL_tkey_Init(void);
\r
105 void TSL_tkey_Process(void);
\r
107 // Utility functions
\r
108 void TSL_tkey_SetStateCalibration(TSL_tCounter_T delay);
\r
109 void TSL_tkey_SetStateOff(void);
\r
110 #if !defined(TSLPRM_STM8TL5X) && !defined(STM8TL5X)
\r
111 void TSL_tkey_SetStateBurstOnly(void);
\r
113 TSL_StateId_enum_T TSL_tkey_GetStateId(void);
\r
114 TSL_StateMask_enum_T TSL_tkey_GetStateMask(void);
\r
115 TSL_tNb_T TSL_tkey_IsChanged(void);
\r
117 // State machine functions
\r
118 void TSL_tkey_CalibrationStateProcess(void);
\r
119 void TSL_tkey_DebCalibrationStateProcess(void);
\r
120 void TSL_tkey_ReleaseStateProcess(void);
\r
121 void TSL_tkey_DebReleaseProxStateProcess(void);
\r
122 void TSL_tkey_DebReleaseDetectStateProcess(void);
\r
123 void TSL_tkey_DebReleaseTouchStateProcess(void);
\r
124 void TSL_tkey_ProxStateProcess(void);
\r
125 void TSL_tkey_DebProxStateProcess(void);
\r
126 void TSL_tkey_DebProxDetectStateProcess(void);
\r
127 void TSL_tkey_DebProxTouchStateProcess(void);
\r
128 void TSL_tkey_DetectStateProcess(void);
\r
129 void TSL_tkey_DebDetectStateProcess(void);
\r
130 void TSL_tkey_TouchStateProcess(void);
\r
131 void TSL_tkey_DebTouchStateProcess(void);
\r
132 void TSL_tkey_ErrorStateProcess(void);
\r
133 void TSL_tkey_DebErrorStateProcess(void);
\r
134 void TSL_tkey_OffStateProcess(void);
\r
136 #endif /* __TSL_TOUCHKEY_H */
\r
138 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r