summaryrefslogtreecommitdiff
path: root/third_party/TouchSense/STMTouch_Driver/inc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/TouchSense/STMTouch_Driver/inc')
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl.h52
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_acq.h118
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32f0xx.h199
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32f3xx.h210
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32l1xx_hw.h287
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32l1xx_sw.h293
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm8l_hw.h234
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm8l_sw.h275
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm8tl5x.h270
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config.h451
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm32f0xx.h245
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm32f3xx.h227
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm32l1xx.h401
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm8l.h211
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm8tl5x.h270
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm32f0xx.h_TOADAPT629
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm32f3xx.h_TOADAPT628
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm32l1xx.h_TOADAPT527
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm8l.h_TOADAPT533
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm8tl5x.h_TOADAPT598
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_dxs.h43
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_ecs.h45
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_filter.h41
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_globals.h87
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_linrot.h226
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_object.h89
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_time.h88
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm32f0xx.h51
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm32f3xx.h51
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm32l1xx.h43
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm8l.h51
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm8tl5x.h43
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_touchkey.h139
-rw-r--r--third_party/TouchSense/STMTouch_Driver/inc/tsl_types.h217
34 files changed, 7872 insertions, 0 deletions
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl.h
new file mode 100644
index 0000000..6141ae1
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl.h
@@ -0,0 +1,52 @@
+/**
+ ******************************************************************************
+ * @file tsl.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_H
+#define __TSL_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "tsl_acq.h"
+#include "tsl_time.h"
+#include "tsl_touchkey.h"
+#include "tsl_linrot.h"
+#include "tsl_object.h"
+#include "tsl_dxs.h"
+#include "tsl_ecs.h"
+#include "tsl_filter.h"
+#include "tsl_globals.h"
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+
+/* Exported functions ------------------------------------------------------- */
+TSL_Status_enum_T TSL_Init(CONST TSL_Bank_T *bank);
+
+#endif /* __TSL_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq.h
new file mode 100644
index 0000000..eec8d83
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq.h
@@ -0,0 +1,118 @@
+/**
+ ******************************************************************************
+ * @file tsl_acq.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_acq.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_ACQ_H
+#define __TSL_ACQ_H
+
+/* Includes ------------------------------------------------------------------*/
+
+// Check the device selection.
+// It must be defined in the toolchain compiler preprocessor.
+// The same name as in the Standard Peripheral Library is used.
+#if !defined(STM8L10X) &&\
+ !defined(STM8L15X_LD) && !defined(STM8L15X_MD) && !defined(STM8L15X_MDP) && !defined(STM8L15X_HD) &&\
+ !defined(STM8TL5X) &&\
+ !defined(STM32L1XX_MD) && !defined(STM32L1XX_MDP) && !defined(STM32L1XX_HD) && !defined(STM32L1XX_XL) &&\
+ !defined(STM32F0XX) && !defined(STM32F0XX_MD) && !defined(STM32F0XX_HD) &&\
+ !defined(STM32F051) && !defined(STM32F072) && !defined(STM32F042) &&\
+ !defined(STM32F303xC) && !defined(STM32F334x8) && !defined(STM32F303x8) && !defined(STM32F301x8) && !defined(STM32F302x8) &&\
+ !defined(STM32F37X)
+#error "Device family not declared in the toolchain compiler preprocessor."
+#endif
+
+#if defined(STM8L10X) || defined(STM8L15X_MD) || defined(STM8L15X_MDP) || defined(STM8L15X_HD)
+#include "tsl_acq_stm8l_sw.h" // Software acquisition only
+#endif
+
+#if defined(STM8L15X_LD)
+#if defined(TSLPRM_STM8L1XX_SW_ACQ)
+#include "tsl_acq_stm8l_sw.h" // Software acquisition
+#else
+#include "tsl_acq_stm8l_hw.h" // Hardware acquisition with Timers (default)
+#endif
+#endif
+
+#if defined(STM8TL5X)
+#include "tsl_acq_stm8tl5x.h"
+#endif
+
+#if defined(STM32L1XX_MD)
+#include "tsl_acq_stm32l1xx_sw.h" // Software acquisition only
+#endif
+
+#if defined(STM32L1XX_MDP) || defined(STM32L1XX_HD) || defined(STM32L1XX_XL)
+#if defined(TSLPRM_STM32L1XX_SW_ACQ)
+#include "tsl_acq_stm32l1xx_sw.h" // Software acquisition
+#else
+#include "tsl_acq_stm32l1xx_hw.h" // Hardware acquisition with Timers (default)
+#endif
+#endif
+
+#if defined(STM32F0XX) || defined(STM32F0XX_MD) || defined(STM32F0XX_HD) ||\
+ defined(STM32F051) || defined(STM32F072) || defined(STM32F042)
+#include "tsl_acq_stm32f0xx.h"
+#endif
+
+#if defined(STM32F303xC) || defined(STM32F334x8) || defined(STM32F303x8) || defined(STM32F301x8) || defined(STM32F302x8) ||\
+ defined(STM32F37X)
+#include "tsl_acq_stm32f3xx.h"
+#endif
+
+/* Defines -------------------------------------------------------------------*/
+
+/* Exported types ------------------------------------------------------------*/
+
+// Filter functions
+typedef TSL_tMeas_T(* TSL_pFuncMeasFilter_T)(TSL_tMeas_T, TSL_tMeas_T); /**< Pointer to the Measure filter function */
+typedef TSL_tDelta_T(* TSL_pFuncDeltaFilter_T)(TSL_tDelta_T); /**< Pointer to the Delta filter function */
+
+/** Structure containing all data of a Zone.
+ * A Zone is a set of Banks.
+ * Variables of this structure type can be placed in RAM or ROM.
+ */
+typedef struct
+{
+ // Common to all acquisitions
+ TSL_tIndex_T *BankIndex; /**< Pointer to an array of bank indexes */
+ TSL_pFuncDeltaFilter_T *dFilter; /**< Pointer to a Delta filter function */
+ TSL_tNb_T NbBanks; /**< Number of banks in the zone */
+} TSL_Zone_T;
+
+/* Exported variables --------------------------------------------------------*/
+
+/* Exported macros -----------------------------------------------------------*/
+
+/* Exported functions ------------------------------------------------------- */
+TSL_Status_enum_T TSL_acq_ZoneConfig(CONST TSL_Zone_T *zone, TSL_tIndex_T idx_bk);
+TSL_Status_enum_T TSL_acq_BankGetResult(TSL_tIndex_T idx_bk, TSL_pFuncMeasFilter_T mfilter, TSL_pFuncDeltaFilter_T dfilter);
+TSL_Status_enum_T TSL_acq_BankCalibrate(TSL_tIndex_T bank);
+void TSL_acq_BankClearData(TSL_tIndex_T bank);
+
+#endif /* __TSL_ACQ_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32f0xx.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32f0xx.h
new file mode 100644
index 0000000..80fc192
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32f0xx.h
@@ -0,0 +1,199 @@
+/**
+ ******************************************************************************
+ * @file tsl_acq_stm32f0xx.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains all functions prototypes that manage the TSC
+ * acquisition on STM32F0x products.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_ACQ_STM32F0XX_H
+#define __TSL_ACQ_STM32F0XX_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32f0xx.h"
+#include "tsl_conf_stm32f0xx.h"
+#include "tsl_types.h"
+
+/* Defines -------------------------------------------------------------------*/
+
+#ifndef CONST
+#define CONST const
+#endif
+
+// SysTick enable/disable interrupt macros
+#define enableInterrupts() {SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;}
+#define disableInterrupts() {SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;}
+
+#define TSL_NB_GROUPS (8)
+
+#define TSL_GROUP1 (0x01)
+#define TSL_GROUP2 (0x02)
+#define TSL_GROUP3 (0x04)
+#define TSL_GROUP4 (0x08)
+#define TSL_GROUP5 (0x10)
+#define TSL_GROUP6 (0x20)
+#define TSL_GROUP7 (0x40)
+#define TSL_GROUP8 (0x80)
+
+// GxIOy masks
+#define TSL_GROUP1_IO1 (0x00000001)
+#define TSL_GROUP1_IO2 (0x00000002)
+#define TSL_GROUP1_IO3 (0x00000004)
+#define TSL_GROUP1_IO4 (0x00000008)
+#define TSL_GROUP2_IO1 (0x00000010)
+#define TSL_GROUP2_IO2 (0x00000020)
+#define TSL_GROUP2_IO3 (0x00000040)
+#define TSL_GROUP2_IO4 (0x00000080)
+#define TSL_GROUP3_IO1 (0x00000100)
+#define TSL_GROUP3_IO2 (0x00000200)
+#define TSL_GROUP3_IO3 (0x00000400)
+#define TSL_GROUP3_IO4 (0x00000800)
+#define TSL_GROUP4_IO1 (0x00001000)
+#define TSL_GROUP4_IO2 (0x00002000)
+#define TSL_GROUP4_IO3 (0x00004000)
+#define TSL_GROUP4_IO4 (0x00008000)
+#define TSL_GROUP5_IO1 (0x00010000)
+#define TSL_GROUP5_IO2 (0x00020000)
+#define TSL_GROUP5_IO3 (0x00040000)
+#define TSL_GROUP5_IO4 (0x00080000)
+#define TSL_GROUP6_IO1 (0x00100000)
+#define TSL_GROUP6_IO2 (0x00200000)
+#define TSL_GROUP6_IO3 (0x00400000)
+#define TSL_GROUP6_IO4 (0x00800000)
+#define TSL_GROUP7_IO1 (0x01000000)
+#define TSL_GROUP7_IO2 (0x02000000)
+#define TSL_GROUP7_IO3 (0x04000000)
+#define TSL_GROUP7_IO4 (0x08000000)
+#define TSL_GROUP8_IO1 (0x10000000)
+#define TSL_GROUP8_IO2 (0x20000000)
+#define TSL_GROUP8_IO3 (0x40000000)
+#define TSL_GROUP8_IO4 (0x80000000)
+
+/* Exported types ------------------------------------------------------------*/
+
+// For all devices/acquisitions
+
+typedef uint16_t TSL_tMeas_T; /**< Measurement */
+typedef uint16_t TSL_tRef_T; /**< Reference */
+typedef int16_t TSL_tDelta_T; /**< Delta */
+
+typedef uint8_t TSL_tIndexSrc_T; /**< Channel source index */
+typedef uint16_t TSL_tIndexDest_T; /**< Channel destination index */
+
+typedef uint8_t TSL_tRefRest_T; /**< Reference Rest (ECS) */
+typedef uint16_t TSL_tKCoeff_T; /**< K coefficient (ECS) */
+
+typedef uint8_t TSL_tIndex_T; /**< Generic index */
+typedef uint16_t TSL_tNb_T; /**< Generic number */
+typedef uint8_t TSL_tCounter_T; /**< Generic counter used for debounce */
+
+typedef uint8_t TSL_tThreshold_T; /**< Delta threshold */
+
+typedef int16_t TSL_tsignPosition_T; /**< Linear and Rotary sensors position */
+typedef uint8_t TSL_tPosition_T; /**< Linear and Rotary sensors position */
+
+typedef uint16_t TSL_tTick_ms_T; /**< Time in ms */
+typedef uint8_t TSL_tTick_sec_T; /**< Time in sec */
+
+//------------------------------------------------------------------------------
+// Channel
+//------------------------------------------------------------------------------
+
+/** Channel destination index
+ */
+typedef struct
+{
+ TSL_tIndexDest_T IdxDest; /**< Index in the Channel data array */
+} TSL_ChannelDest_T;
+
+/** Channel Source and Configuration
+ */
+typedef struct
+{
+ TSL_tIndexSrc_T IdxSrc; /**< Index of TSC->IOGXCR[] registers */
+ // For stm32f0x TSC acquisition only
+ uint32_t msk_IOCCR_channel; /**< Mask of the Channel IO (electrodes ONLY) */
+ uint32_t msk_IOGCSR_group; /**< Mask of the Group used (electrodes ONLY) */
+} TSL_ChannelSrc_T;
+
+/** Channel flags
+ */
+typedef struct
+{
+ unsigned int DataReady : 1; /**< To identify a new measurement (TSL_DataReady_enum_T) */
+ unsigned int AcqStatus : 2; /**< Acquisition status (TSL_AcqStatus_enum_T) */
+ unsigned int ObjStatus : 2; /**< Object status (TSL_ObjStatus_enum_T) */
+} TSL_ChannelFlags_T;
+
+/** Channel Data
+ */
+typedef struct
+{
+ TSL_ChannelFlags_T Flags; /**< Flags */
+ TSL_tRef_T Ref; /**< Reference */
+ TSL_tRefRest_T RefRest; /**< Reference rest for ECS */
+ TSL_tDelta_T Delta; /**< Delta */
+#if TSLPRM_USE_MEAS > 0
+ TSL_tMeas_T Meas; /**< Hold the last acquisition measure */
+#endif
+} TSL_ChannelData_T;
+
+//------------------------------------------------------------------------------
+// Bank
+//------------------------------------------------------------------------------
+
+/** Bank
+ */
+typedef struct
+{
+ // Common to all acquisitions
+ CONST TSL_ChannelSrc_T *p_chSrc; /**< Pointer to the Channel Source and Configuration */
+ CONST TSL_ChannelDest_T *p_chDest; /**< Pointer to the Channel Destination */
+ TSL_ChannelData_T *p_chData; /**< Pointer to the Channel Data */
+ TSL_tNb_T NbChannels; /**< Number of channels in the bank */
+ // For STM32F0x TSC acquisition only
+ uint32_t msk_IOCCR_channels; /**< Mask of all channel IOs (electrodes AND shields) */
+ uint32_t msk_IOGCSR_groups; /**< Mask of all groups used (electrodes ONLY) */
+} TSL_Bank_T;
+
+/* Exported variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+
+TSL_Status_enum_T TSL_acq_Init(void);
+void TSL_acq_InitGPIOs(void);
+TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk);
+TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh);
+TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh);
+TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas);
+void TSL_acq_BankStartAcq(void);
+TSL_Status_enum_T TSL_acq_BankWaitEOC(void);
+TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void);
+TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndexSrc_T index);
+TSL_tDelta_T TSL_acq_ComputeDelta(TSL_tRef_T ref, TSL_tMeas_T meas);
+TSL_tMeas_T TSL_acq_ComputeMeas(TSL_tRef_T ref, TSL_tDelta_T delta);
+
+#endif /* __TSL_ACQ_STM32F0XX_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32f3xx.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32f3xx.h
new file mode 100644
index 0000000..945ec4e
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32f3xx.h
@@ -0,0 +1,210 @@
+/**
+ ******************************************************************************
+ * @file tsl_acq_stm32f3xx.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains all functions prototypes that manage the TSC
+ * acquisition on STM32F3xx products.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_ACQ_STM32F3XX_H
+#define __TSL_ACQ_STM32F3XX_H
+
+/* Includes ------------------------------------------------------------------*/
+
+#if defined(STM32F303xC) || defined(STM32F334x8) || defined(STM32F303x8) || defined(STM32F301x8) || defined(STM32F302x8)
+#include "stm32f30x.h"
+#ifndef STM32F30X
+#define STM32F30X (1)
+#endif
+#endif
+
+#if defined(STM32F37X)
+#include "stm32f37x.h"
+#endif
+
+#include "tsl_conf_stm32f3xx.h"
+#include "tsl_types.h"
+
+/* Defines -------------------------------------------------------------------*/
+
+#ifndef CONST
+#define CONST const
+#endif
+
+// SysTick enable/disable interrupt macros
+#define enableInterrupts() {SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;}
+#define disableInterrupts() {SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;}
+
+#define TSL_NB_GROUPS (8) // Number of groups available on STM32F3xx devices
+
+#define TSL_GROUP1 (0x01)
+#define TSL_GROUP2 (0x02)
+#define TSL_GROUP3 (0x04)
+#define TSL_GROUP4 (0x08)
+#define TSL_GROUP5 (0x10)
+#define TSL_GROUP6 (0x20)
+#define TSL_GROUP7 (0x40)
+#define TSL_GROUP8 (0x80)
+
+// GxIOy masks
+#define TSL_GROUP1_IO1 (0x00000001)
+#define TSL_GROUP1_IO2 (0x00000002)
+#define TSL_GROUP1_IO3 (0x00000004)
+#define TSL_GROUP1_IO4 (0x00000008)
+#define TSL_GROUP2_IO1 (0x00000010)
+#define TSL_GROUP2_IO2 (0x00000020)
+#define TSL_GROUP2_IO3 (0x00000040)
+#define TSL_GROUP2_IO4 (0x00000080)
+#define TSL_GROUP3_IO1 (0x00000100)
+#define TSL_GROUP3_IO2 (0x00000200)
+#define TSL_GROUP3_IO3 (0x00000400)
+#define TSL_GROUP3_IO4 (0x00000800)
+#define TSL_GROUP4_IO1 (0x00001000)
+#define TSL_GROUP4_IO2 (0x00002000)
+#define TSL_GROUP4_IO3 (0x00004000)
+#define TSL_GROUP4_IO4 (0x00008000)
+#define TSL_GROUP5_IO1 (0x00010000)
+#define TSL_GROUP5_IO2 (0x00020000)
+#define TSL_GROUP5_IO3 (0x00040000)
+#define TSL_GROUP5_IO4 (0x00080000)
+#define TSL_GROUP6_IO1 (0x00100000)
+#define TSL_GROUP6_IO2 (0x00200000)
+#define TSL_GROUP6_IO3 (0x00400000)
+#define TSL_GROUP6_IO4 (0x00800000)
+#define TSL_GROUP7_IO1 (0x01000000)
+#define TSL_GROUP7_IO2 (0x02000000)
+#define TSL_GROUP7_IO3 (0x04000000)
+#define TSL_GROUP7_IO4 (0x08000000)
+#define TSL_GROUP8_IO1 (0x10000000)
+#define TSL_GROUP8_IO2 (0x20000000)
+#define TSL_GROUP8_IO3 (0x40000000)
+#define TSL_GROUP8_IO4 (0x80000000)
+
+/* Exported types ------------------------------------------------------------*/
+
+// For all devices/acquisitions
+
+typedef uint16_t TSL_tMeas_T; /**< Measurement */
+typedef uint16_t TSL_tRef_T; /**< Reference */
+typedef int16_t TSL_tDelta_T; /**< Delta */
+
+typedef uint8_t TSL_tIndexSrc_T; /**< Channel source index */
+typedef uint16_t TSL_tIndexDest_T; /**< Channel destination index */
+
+typedef uint8_t TSL_tRefRest_T; /**< Reference Rest (ECS) */
+typedef uint16_t TSL_tKCoeff_T; /**< K coefficient (ECS) */
+
+typedef uint8_t TSL_tIndex_T; /**< Generic index */
+typedef uint16_t TSL_tNb_T; /**< Generic number */
+typedef uint8_t TSL_tCounter_T; /**< Generic counter used for debounce */
+
+typedef uint8_t TSL_tThreshold_T; /**< Delta threshold */
+
+typedef int16_t TSL_tsignPosition_T; /**< Linear and Rotary sensors position */
+typedef uint8_t TSL_tPosition_T; /**< Linear and Rotary sensors position */
+
+typedef uint16_t TSL_tTick_ms_T; /**< Time in ms */
+typedef uint8_t TSL_tTick_sec_T; /**< Time in sec */
+
+//------------------------------------------------------------------------------
+// Channel
+//------------------------------------------------------------------------------
+
+/** Channel destination index
+ */
+typedef struct
+{
+ TSL_tIndexDest_T IdxDest; /**< Index in the Channel data array */
+} TSL_ChannelDest_T;
+
+/** Channel Source and Configuration
+ */
+typedef struct
+{
+ TSL_tIndexSrc_T IdxSrc; /**< Index of TSC->IOGXCR[] registers */
+ // For STM32F3xx TSC acquisition only
+ uint32_t msk_IOCCR_channel; /**< Mask of the Channel IO (electrodes ONLY) */
+ uint32_t msk_IOGCSR_group; /**< Mask of the Group used (electrodes ONLY) */
+} TSL_ChannelSrc_T;
+
+/** Channel flags
+ */
+typedef struct
+{
+ unsigned int DataReady : 1; /**< To identify a new measurement (TSL_DataReady_enum_T) */
+ unsigned int AcqStatus : 2; /**< Acquisition status (TSL_AcqStatus_enum_T) */
+ unsigned int ObjStatus : 2; /**< Object status (TSL_ObjStatus_enum_T) */
+} TSL_ChannelFlags_T;
+
+/** Channel Data
+ */
+typedef struct
+{
+ TSL_ChannelFlags_T Flags; /**< Flags */
+ TSL_tRef_T Ref; /**< Reference */
+ TSL_tRefRest_T RefRest; /**< Reference rest for ECS */
+ TSL_tDelta_T Delta; /**< Delta */
+#if TSLPRM_USE_MEAS > 0
+ TSL_tMeas_T Meas; /**< Hold the last acquisition measure */
+#endif
+} TSL_ChannelData_T;
+
+//------------------------------------------------------------------------------
+// Bank
+//------------------------------------------------------------------------------
+
+/** Bank
+ */
+typedef struct
+{
+ // Common to all acquisitions
+ CONST TSL_ChannelSrc_T *p_chSrc; /**< Pointer to the Channel Source and Configuration */
+ CONST TSL_ChannelDest_T *p_chDest; /**< Pointer to the Channel Destination */
+ TSL_ChannelData_T *p_chData; /**< Pointer to the Channel Data */
+ TSL_tNb_T NbChannels; /**< Number of channels in the bank */
+ // For STM32F3xx TSC acquisition only
+ uint32_t msk_IOCCR_channels; /**< Mask of all channel IOs (electrodes AND shields) */
+ uint32_t msk_IOGCSR_groups; /**< Mask of all groups used (electrodes ONLY) */
+} TSL_Bank_T;
+
+/* Exported variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+
+TSL_Status_enum_T TSL_acq_Init(void);
+void TSL_acq_InitGPIOs(void);
+TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk);
+TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh);
+TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh);
+TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas);
+void TSL_acq_BankStartAcq(void);
+TSL_Status_enum_T TSL_acq_BankWaitEOC(void);
+TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void);
+TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndexSrc_T index);
+TSL_tDelta_T TSL_acq_ComputeDelta(TSL_tRef_T ref, TSL_tMeas_T meas);
+TSL_tMeas_T TSL_acq_ComputeMeas(TSL_tRef_T ref, TSL_tDelta_T delta);
+
+#endif /* __TSL_ACQ_STM32F3XX_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32l1xx_hw.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32l1xx_hw.h
new file mode 100644
index 0000000..f13a943
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32l1xx_hw.h
@@ -0,0 +1,287 @@
+/**
+ ******************************************************************************
+ * @file tsl_acq_stm32l1xx_hw.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_acq_stm32l1xx_hw.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_ACQ_STM32L1XX_HW_H
+#define __TSL_ACQ_STM32L1XX_HW_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32l1xx.h"
+#include "tsl_conf_stm32l1xx.h"
+#include "tsl_types.h"
+
+/* Defines -------------------------------------------------------------------*/
+
+#ifndef CONST
+#define CONST const
+#endif
+
+// SysTick enable/disable interrupt macros
+#define enableInterrupts() {SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;}
+#define disableInterrupts() {SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;}
+
+/** Groups list
+ */
+enum
+{
+ GR1,
+ GR2,
+ GR3,
+ GR4,
+ GR5,
+ GR6,
+ GR7,
+ GR8,
+ GR9,
+ GR10,
+ GR11
+};
+
+/** GPIOs list
+ High significant nibble for the IO port (GPIOA:0,...,GPIOG:6)
+ Low significant nibble for the IO number (pin0:0,...,pin15:F)
+ */
+enum
+{
+ PA0 = 0x00, /**< TSL_GROUP1_IO1 */
+ PA1 = 0x01,
+ PA2 = 0x02,
+ PA3 = 0x03,
+ PA6 = 0x06, /**< TSL_GROUP2_IO1 */
+ PA7 = 0x07,
+ PA8 = 0x08,
+ PA9 = 0x09,
+ PA10 = 0x0A,
+ PA13 = 0x0D, /**< TSL_GROUP5_IO1 */
+ PA14 = 0x0E,
+ PA15 = 0x0F,
+ PB0 = 0x10, /**< TSL_GROUP3_IO1 */
+ PB1 = 0x11,
+ PB2 = 0x12,
+ PB4 = 0x14, /**< TSL_GROUP6_IO1 */
+ PB5 = 0x15,
+ PB6 = 0x16,
+ PB7 = 0x17,
+ PB12 = 0x1C, /**< TSL_GROUP7_IO1 */
+ PB13 = 0x1D,
+ PB14 = 0x1E,
+ PB15 = 0x1F,
+ PC0 = 0x20, /**< TSL_GROUP8_IO1 */
+ PC1 = 0x21,
+ PC2 = 0x22,
+ PC3 = 0x23,
+ PC4 = 0x24,
+ PC5 = 0x25,
+ PC6 = 0x26,
+ PC7 = 0x27,
+ PC8 = 0x28,
+ PC9 = 0x29,
+ PF6 = 0x56, /**< TSL_GROUP11_IO1 */
+ PF7 = 0x57,
+ PF8 = 0x58,
+ PF9 = 0x59,
+ PF10 = 0x5A,
+ PF11 = 0x5B,
+ PF12 = 0x5C,
+ PF13 = 0x5D,
+ PF14 = 0x5E,
+ PF15 = 0x5F,
+ PG0 = 0x60, /**< TSL_GROUP2_IO4 */
+ PG1 = 0x61,
+ PG2 = 0x62,
+ PG3 = 0x63,
+ PG4 = 0x64
+};
+
+/** GPIOs list:
+ High significant nibble for the IO port (GPIOA:0,...,GPIOG:6)
+ Low significant nibble for the IO number (pin0:0,...,pin15:F)
+ */
+enum
+{
+ TSL_GROUP1_IO1 = 0x00, /**< PA0 */
+ TSL_GROUP1_IO2 = 0x01,
+ TSL_GROUP1_IO3 = 0x02,
+ TSL_GROUP1_IO4 = 0x03,
+ TSL_GROUP2_IO1 = 0x06, /**< PA6 */
+ TSL_GROUP2_IO2 = 0x07,
+ TSL_GROUP4_IO1 = 0x08,
+ TSL_GROUP4_IO2 = 0x09,
+ TSL_GROUP4_IO3 = 0x0A,
+ TSL_GROUP5_IO1 = 0x0D, /**< PA13 */
+ TSL_GROUP5_IO2 = 0x0E,
+ TSL_GROUP5_IO3 = 0x0F,
+ TSL_GROUP3_IO1 = 0x10, /**< PB0 */
+ TSL_GROUP3_IO2 = 0x11,
+ TSL_GROUP3_IO3 = 0x12,
+ TSL_GROUP6_IO1 = 0x14, /**< PB4 */
+ TSL_GROUP6_IO2 = 0x15,
+ TSL_GROUP6_IO3 = 0x16,
+ TSL_GROUP6_IO4 = 0x17,
+ TSL_GROUP7_IO1 = 0x1C, /**< PB12 */
+ TSL_GROUP7_IO2 = 0x1D,
+ TSL_GROUP7_IO3 = 0x1E,
+ TSL_GROUP7_IO4 = 0x1F,
+ TSL_GROUP8_IO1 = 0x20, /**< PC0 */
+ TSL_GROUP8_IO2 = 0x21,
+ TSL_GROUP8_IO3 = 0x22,
+ TSL_GROUP8_IO4 = 0x23,
+ TSL_GROUP9_IO1 = 0x24,
+ TSL_GROUP9_IO2 = 0x25,
+ TSL_GROUP10_IO1 = 0x26,
+ TSL_GROUP10_IO2 = 0x27,
+ TSL_GROUP10_IO3 = 0x28,
+ TSL_GROUP10_IO4 = 0x29,
+ TSL_GROUP11_IO1 = 0x56, /**< PF6 */
+ TSL_GROUP11_IO2 = 0x57,
+ TSL_GROUP11_IO3 = 0x58,
+ TSL_GROUP11_IO4 = 0x59,
+ TSL_GROUP11_IO5 = 0x5A,
+ TSL_GROUP3_IO4 = 0x5B,
+ TSL_GROUP3_IO5 = 0x5C,
+ TSL_GROUP9_IO3 = 0x5D,
+ TSL_GROUP9_IO4 = 0x5E,
+ TSL_GROUP2_IO3 = 0x5F,
+ TSL_GROUP2_IO4 = 0x60, /**< PG0 */
+ TSL_GROUP2_IO5 = 0x61,
+ TSL_GROUP7_IO5 = 0x62,
+ TSL_GROUP7_IO6 = 0x63,
+ TSL_GROUP7_IO7 = 0x64
+};
+
+/* Exported types ------------------------------------------------------------*/
+
+// For all devices/acquisitions
+
+typedef uint16_t TSL_tMeas_T; /**< Measurement */
+typedef uint16_t TSL_tRef_T; /**< Reference */
+typedef int16_t TSL_tDelta_T; /**< Delta */
+
+typedef uint8_t TSL_tIndexSrc_T; /**< Channel source index */
+typedef uint16_t TSL_tIndexDest_T; /**< Channel destination index */
+
+typedef uint8_t TSL_tRefRest_T; /**< Reference Rest (ECS) */
+typedef uint16_t TSL_tKCoeff_T; /**< K coefficient (ECS) */
+
+typedef uint8_t TSL_tIndex_T; /**< Generic index */
+typedef uint16_t TSL_tNb_T; /**< Generic number */
+typedef uint8_t TSL_tCounter_T; /**< Generic counter used for debounce */
+
+typedef uint8_t TSL_tThreshold_T; /**< Delta threshold */
+
+typedef int16_t TSL_tsignPosition_T; /**< Linear and Rotary sensors position */
+typedef uint8_t TSL_tPosition_T; /**< Linear and Rotary sensors position */
+
+typedef uint16_t TSL_tTick_ms_T; /**< Time in ms */
+typedef uint8_t TSL_tTick_sec_T; /**< Time in sec */
+
+//------------------------------------------------------------------------------
+// Channel
+//------------------------------------------------------------------------------
+
+typedef uint8_t TSL_Conf_t;
+
+/** Channel destination index
+ */
+typedef struct
+{
+ TSL_tIndex_T IdxDest; /**< Index in the Channel data array */
+} TSL_ChannelDest_T;
+
+/** Channel Source and Configuration
+ */
+typedef struct
+{
+ TSL_tIndex_T IdxSrc; /**< Index of source value */
+ // For stm32l1x acquisition only
+ TSL_Conf_t t_sample; /**< Indicates which GPIO.n is used for the sample */
+ TSL_Conf_t t_channel; /**< Indicates which GPIO.n is used for the channel */
+} TSL_ChannelSrc_T;
+
+/** Channel flags
+ */
+typedef struct
+{
+ unsigned int DataReady : 1; /**< To identify a new measurement (TSL_DataReady_enum_T) */
+ unsigned int AcqStatus : 2; /**< Acquisition status (TSL_AcqStatus_enum_T) */
+ unsigned int ObjStatus : 2; /**< Object status (TSL_ObjStatus_enum_T) */
+} TSL_ChannelFlags_T;
+
+/** Channel Data
+ */
+typedef struct
+{
+ TSL_ChannelFlags_T Flags; /**< Flags */
+ TSL_tRef_T Ref; /**< Reference */
+ TSL_tRefRest_T RefRest; /**< Reference rest for ECS */
+ TSL_tDelta_T Delta; /**< Delta */
+#if TSLPRM_USE_MEAS > 0
+ TSL_tMeas_T Meas; /**< Hold the last acquisition measure */
+#endif
+} TSL_ChannelData_T;
+
+//------------------------------------------------------------------------------
+// Bank
+//------------------------------------------------------------------------------
+
+/** Bank
+ */
+typedef struct
+{
+ // Common to all acquisitions
+ CONST TSL_ChannelSrc_T *p_chSrc; /**< Pointer to the Channel Source and Configuration */
+ CONST TSL_ChannelDest_T *p_chDest; /**< Pointer to the Channel Destination */
+ TSL_ChannelData_T *p_chData; /**< Pointer to the Channel Data */
+ TSL_tNb_T NbChannels; /**< Number of channels in the bank */
+ // For stm32l1x acquisition only
+ TSL_Conf_t shield_sample; /**< Indicates which GPIO.n is used for the shield sample */
+ TSL_Conf_t shield_channel; /**< Indicates which GPIO.n is used for the shield channel */
+} TSL_Bank_T;
+
+/* Exported variables --------------------------------------------------------*/
+
+/* Exported macros -----------------------------------------------------------*/
+
+
+/* Exported functions ------------------------------------------------------- */
+
+TSL_Status_enum_T TSL_acq_Init(void);
+TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk);
+void TSL_acq_BankStartAcq(void);
+TSL_Status_enum_T TSL_acq_BankWaitEOC(void);
+void TSL_acq_ProcessIT(void);
+TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndex_T index);
+TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void);
+TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh);
+TSL_tDelta_T TSL_acq_ComputeDelta(TSL_tRef_T ref, TSL_tMeas_T meas);
+TSL_tMeas_T TSL_acq_ComputeMeas(TSL_tRef_T ref, TSL_tDelta_T delta);
+TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh);
+TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas);
+
+#endif // __TSL_ACQ_STM32L1XX_HW_H
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32l1xx_sw.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32l1xx_sw.h
new file mode 100644
index 0000000..a410aca
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm32l1xx_sw.h
@@ -0,0 +1,293 @@
+/**
+ ******************************************************************************
+ * @file tsl_acq_stm32l1xx_sw.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_acq_stm32l1xx_sw.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_ACQ_STM32L1XX_SW_H
+#define __TSL_ACQ_STM32L1XX_SW_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32l1xx.h"
+#include "tsl_conf_stm32l1xx.h"
+#include "tsl_types.h"
+
+/* Defines -------------------------------------------------------------------*/
+
+#ifndef CONST
+#define CONST const
+#endif
+
+// SysTick enable/disable interrupt macros
+#define enableInterrupts() {SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;}
+#define disableInterrupts() {SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;}
+
+enum
+{
+ GR1,
+ GR2,
+ GR3,
+ GR4,
+ GR5,
+ GR6,
+ GR7,
+ GR8,
+ GR9,
+ GR10,
+ GR11
+};
+
+enum
+{
+ TSL_BANK_GPIOA = 0,
+ TSL_BANK_GPIOB = 1,
+ TSL_BANK_GPIOC = 2,
+ TSL_BANK_GPIOE = 4,
+ TSL_BANK_GPIOF = 5,
+ TSL_BANK_GPIOG = 6
+};
+
+/** GPIOs list
+ High significant nibble for the IO port (GPIOA:0,...,GPIOG:6)
+ Low significant nibble for the IO number (pin0:0,...,pin15:F)
+ */
+enum
+{
+ PA0 = 0x00, /**< TSL_GROUP1_IO1 */
+ PA1 = 0x01,
+ PA2 = 0x02,
+ PA3 = 0x03,
+ PA6 = 0x06, /**< TSL_GROUP2_IO1 */
+ PA7 = 0x07,
+ PA8 = 0x08,
+ PA9 = 0x09,
+ PA10 = 0x0A,
+ PA13 = 0x0D, /**< TSL_GROUP5_IO1 */
+ PA14 = 0x0E,
+ PA15 = 0x0F,
+ PB0 = 0x10, /**< TSL_GROUP3_IO1 */
+ PB1 = 0x11,
+ PB2 = 0x12,
+ PB4 = 0x14, /**< TSL_GROUP6_IO1 */
+ PB5 = 0x15,
+ PB6 = 0x16,
+ PB7 = 0x17,
+ PB12 = 0x1C, /**< TSL_GROUP7_IO1 */
+ PB13 = 0x1D,
+ PB14 = 0x1E,
+ PB15 = 0x1F,
+ PC0 = 0x20, /**< TSL_GROUP8_IO1 */
+ PC1 = 0x21,
+ PC2 = 0x22,
+ PC3 = 0x23,
+ PC4 = 0x24,
+ PC5 = 0x25,
+ PC6 = 0x26,
+ PC7 = 0x27,
+ PC8 = 0x28,
+ PC9 = 0x29,
+ PF6 = 0x56, /**< TSL_GROUP11_IO1 */
+ PF7 = 0x57,
+ PF8 = 0x58,
+ PF9 = 0x59,
+ PF10 = 0x5A,
+ PF11 = 0x5B,
+ PF12 = 0x5C,
+ PF13 = 0x5D,
+ PF14 = 0x5E,
+ PF15 = 0x5F,
+ PG0 = 0x60, /**< TSL_GROUP2_IO4 */
+ PG1 = 0x61,
+ PG2 = 0x62,
+ PG3 = 0x63,
+ PG4 = 0x64
+};
+
+/** GPIOs list:
+ - High significant nibble for the IO port (GPIOA:0,...,GPIOG:6)
+ - Low significant nibble for the IO number (pin0:0,...,pin15:F)
+ */
+enum
+{
+ TSL_GROUP1_IO1 = 0x00, /**< PA0 */
+ TSL_GROUP1_IO2 = 0x01,
+ TSL_GROUP1_IO3 = 0x02,
+ TSL_GROUP1_IO4 = 0x03,
+ TSL_GROUP2_IO1 = 0x06, /**< PA6 */
+ TSL_GROUP2_IO2 = 0x07,
+ TSL_GROUP4_IO1 = 0x08,
+ TSL_GROUP4_IO2 = 0x09,
+ TSL_GROUP4_IO3 = 0x0A,
+ TSL_GROUP5_IO1 = 0x0D, /**< PA13 */
+ TSL_GROUP5_IO2 = 0x0E,
+ TSL_GROUP5_IO3 = 0x0F,
+ TSL_GROUP3_IO1 = 0x10, /**< PB0 */
+ TSL_GROUP3_IO2 = 0x11,
+ TSL_GROUP3_IO3 = 0x12,
+ TSL_GROUP6_IO1 = 0x14, /**< PB4 */
+ TSL_GROUP6_IO2 = 0x15,
+ TSL_GROUP6_IO3 = 0x16,
+ TSL_GROUP6_IO4 = 0x17,
+ TSL_GROUP7_IO1 = 0x1C, /**< PB12 */
+ TSL_GROUP7_IO2 = 0x1D,
+ TSL_GROUP7_IO3 = 0x1E,
+ TSL_GROUP7_IO4 = 0x1F,
+ TSL_GROUP8_IO1 = 0x20, /**< PC0 */
+ TSL_GROUP8_IO2 = 0x21,
+ TSL_GROUP8_IO3 = 0x22,
+ TSL_GROUP8_IO4 = 0x23,
+ TSL_GROUP9_IO1 = 0x24,
+ TSL_GROUP9_IO2 = 0x25,
+ TSL_GROUP10_IO1 = 0x26,
+ TSL_GROUP10_IO2 = 0x27,
+ TSL_GROUP10_IO3 = 0x28,
+ TSL_GROUP10_IO4 = 0x29,
+ TSL_GROUP11_IO1 = 0x56, /**< PF6 */
+ TSL_GROUP11_IO2 = 0x57,
+ TSL_GROUP11_IO3 = 0x58,
+ TSL_GROUP11_IO4 = 0x59,
+ TSL_GROUP11_IO5 = 0x5A,
+ TSL_GROUP3_IO4 = 0x5B,
+ TSL_GROUP3_IO5 = 0x5C,
+ TSL_GROUP9_IO3 = 0x5D,
+ TSL_GROUP9_IO4 = 0x5E,
+ TSL_GROUP2_IO3 = 0x5F,
+ TSL_GROUP2_IO4 = 0x60, /**< PG0 */
+ TSL_GROUP2_IO5 = 0x61,
+ TSL_GROUP7_IO5 = 0x62,
+ TSL_GROUP7_IO6 = 0x63,
+ TSL_GROUP7_IO7 = 0x64
+};
+
+/* Exported types ------------------------------------------------------------*/
+
+// For all devices/acquisitions
+
+typedef uint16_t TSL_tMeas_T; /**< Measurement */
+typedef uint16_t TSL_tRef_T; /**< Reference */
+typedef int16_t TSL_tDelta_T; /**< Delta */
+
+typedef uint8_t TSL_tIndexSrc_T; /**< Channel source index */
+typedef uint16_t TSL_tIndexDest_T; /**< Channel destination index */
+
+typedef uint8_t TSL_tRefRest_T; /**< Reference Rest (ECS) */
+typedef uint16_t TSL_tKCoeff_T; /**< K coefficient (ECS) */
+
+typedef uint8_t TSL_tIndex_T; /**< Generic index */
+typedef uint16_t TSL_tNb_T; /**< Generic number */
+typedef uint8_t TSL_tCounter_T; /**< Generic counter used for debounce */
+
+typedef uint8_t TSL_tThreshold_T; /**< Delta threshold */
+
+typedef int16_t TSL_tsignPosition_T; /**< Linear and Rotary sensors position */
+typedef uint8_t TSL_tPosition_T; /**< Linear and Rotary sensors position */
+
+typedef uint16_t TSL_tTick_ms_T; /**< Time in ms */
+typedef uint8_t TSL_tTick_sec_T; /**< Time in sec */
+
+//------------------------------------------------------------------------------
+// Channel
+//------------------------------------------------------------------------------
+
+typedef uint8_t TSL_Conf_t;
+
+/** Channel destination index
+ */
+typedef struct
+{
+ TSL_tIndex_T IdxDest; /**< Index in the Channel data array */
+} TSL_ChannelDest_T;
+
+/** Channel Source and Configuration
+ */
+typedef struct
+{
+ TSL_tIndex_T IdxSrc; /**< Index of source value */
+ // For stm32l1x acquisition only
+ TSL_Conf_t t_sample; /**< Indicates which GPIO.n is used for the sample */
+ TSL_Conf_t t_channel; /**< Indicates which GPIO.n is used for the channel */
+} TSL_ChannelSrc_T;
+
+/** Channel flags
+ */
+typedef struct
+{
+ unsigned int DataReady : 1; /**< To identify a new measurement (TSL_DataReady_enum_T) */
+ unsigned int AcqStatus : 2; /**< Acquisition status (TSL_AcqStatus_enum_T) */
+ unsigned int ObjStatus : 2; /**< Object status (TSL_ObjStatus_enum_T) */
+} TSL_ChannelFlags_T;
+
+/** Channel Data
+ */
+typedef struct
+{
+ TSL_ChannelFlags_T Flags; /**< Flags */
+ TSL_tRef_T Ref; /**< Reference */
+ TSL_tRefRest_T RefRest; /**< Reference rest for ECS */
+ TSL_tDelta_T Delta; /**< Delta */
+#if TSLPRM_USE_MEAS > 0
+ TSL_tMeas_T Meas; /**< Hold the last acquisition measure */
+#endif
+} TSL_ChannelData_T;
+
+//------------------------------------------------------------------------------
+// Bank
+//------------------------------------------------------------------------------
+
+/** Bank
+ */
+typedef struct
+{
+ // Common to all acquisitions
+ CONST TSL_ChannelSrc_T *p_chSrc; /**< Pointer to the Channel Source and Configuration */
+ CONST TSL_ChannelDest_T *p_chDest; /**< Pointer to the Channel Destination */
+ TSL_ChannelData_T *p_chData; /**< Pointer to the Channel Data */
+ TSL_tNb_T NbChannels; /**< Number of channels in the bank */
+ // For stm32l1x acquisition only
+ TSL_Conf_t shield_sample; /**< Indicates which GPIO.n is used for the shield sample */
+ TSL_Conf_t shield_channel; /**< Indicates which GPIO.n is used for the shield channel */
+} TSL_Bank_T;
+
+/* Exported variables --------------------------------------------------------*/
+
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+TSL_Status_enum_T TSL_acq_Init(void);
+TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk);
+void TSL_acq_BankStartAcq(void);
+TSL_Status_enum_T TSL_acq_BankWaitEOC(void);
+void TSL_acq_ProcessIT(void);
+TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndex_T index);
+TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void);
+
+TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh);
+TSL_tDelta_T TSL_acq_ComputeDelta(TSL_tRef_T ref, TSL_tMeas_T meas);
+TSL_tMeas_T TSL_acq_ComputeMeas(TSL_tRef_T ref, TSL_tDelta_T delta);
+TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh);
+TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas);
+
+#endif /* __TSL_ACQ_STM32L1XX_SW_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm8l_hw.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm8l_hw.h
new file mode 100644
index 0000000..b77d867
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm8l_hw.h
@@ -0,0 +1,234 @@
+/**
+ ******************************************************************************
+ * @file tsl_acq_stm8l_hw.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_acq_stm8l_hw.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_ACQ_STM8L_HW_H
+#define __TSL_ACQ_STM8L_HW_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm8l15x.h"
+#include "tsl_conf_stm8l.h"
+#include "tsl_types.h"
+
+/* Defines -------------------------------------------------------------------*/
+
+#ifndef CONST
+#define CONST const
+#endif
+
+enum
+{
+ GR1 = 0,
+ GR2,
+ GR3,
+ GR4,
+ GR5,
+ GR6,
+ GR7,
+ GR8
+};
+
+enum
+{
+ TSL_BANK_GPIOA = 0,
+ TSL_BANK_GPIOB,
+ TSL_BANK_GPIOC,
+ TSL_BANK_GPIOD,
+ TSL_BANK_GPIOE
+};
+
+/** GPIOs list:
+ - bits 7:3 GPIO number (0=GPIOA, 1=GPIOB, 2=GPIOC, 3=GPIOD, 4=GPIOE)
+ - bits 2:0 IO number (0=pin0, ..., 7=pin7)
+ */
+
+// GROUP1
+#define PA4 (0x00|0x04) // CH1
+#define PA5 (0x00|0x05) // CH2
+#define PA6 (0x00|0x06) // CH3
+#define PA7 (0x00|0x07) // CH4
+// GROUP2
+#define PC7 (0x10|0x07) // CH1
+#define PC4 (0x10|0x04) // CH2
+#define PC3 (0x10|0x03) // CH3
+#define PE7 (0x20|0x07) // CH4
+// GROUP3
+#define PC2 (0x10|0x02) // CH1
+#define PD7 (0x18|0x07) // CH2
+#define PD6 (0x18|0x06) // CH3
+// GROUP4
+#define PD5 (0x18|0x05) // CH1
+#define PD4 (0x18|0x04) // CH2
+#define PB7 (0x08|0x07) // CH3
+// GROUP5
+#define PB6 (0x08|0x06) // CH1
+#define PB5 (0x08|0x05) // CH2
+#define PB4 (0x08|0x04) // CH3
+// GROUP6
+#define PB3 (0x08|0x03) // CH1
+#define PB2 (0x08|0x02) // CH2
+#define PB1 (0x08|0x01) // CH3
+// GROUP7
+#define PB0 (0x08|0x00) // CH1
+#define PD3 (0x18|0x03) // CH2
+#define PD2 (0x18|0x02) // CH3
+#define PE3 (0x20|0x03) // CH4
+// GROUP8
+#define PD1 (0x18|0x01) // CH1
+#define PD0 (0x18|0x00) // CH2
+#define PE5 (0x20|0x05) // CH3
+#define PE4 (0x20|0x04) // CH4
+
+// Acquisition pulses period
+/** Master timer reload value for HW acquisition only (range=4..65534, even number)
+ --> Period for Charge/Transfer cycle = ((TSLPRM_TIM_RELOAD*2)/FTimer)
+*/
+#define TIM_RELOAD ((TSLPRM_CT_PERIOD * TSLPRM_TIMER_FREQ) / 2)
+#define TIM2_PWM_CH1_WIDTH ((TIM_RELOAD / 2) - 1) // Configure channel 1 Pulse Width
+#define TIM2_PWM_CH2_WIDTH ((TIM_RELOAD / 2) + 1) // Configure channel 2 Pulse Width
+
+/* Exported types ------------------------------------------------------------*/
+
+// For all devices/acquisitions
+
+typedef uint16_t TSL_tMeas_T; /**< Measurement */
+typedef uint16_t TSL_tRef_T; /**< Reference */
+typedef int16_t TSL_tDelta_T; /**< Delta */
+
+typedef uint8_t TSL_tIndexSrc_T; /**< Channel source index */
+typedef uint8_t TSL_tIndexDest_T; /**< Channel destination index */
+
+typedef uint8_t TSL_tRefRest_T; /**< Reference Rest (ECS) */
+typedef uint16_t TSL_tKCoeff_T; /**< K coefficient (ECS) */
+
+typedef uint16_t TSL_tIndex_T; /**< Generic index */
+typedef uint16_t TSL_tNb_T; /**< Generic number */
+typedef uint8_t TSL_tCounter_T; /**< Generic counter used for debounce */
+
+typedef uint8_t TSL_tThreshold_T; /**< Delta threshold */
+
+typedef int16_t TSL_tsignPosition_T; /**< Linear and Rotary sensors position */
+typedef uint8_t TSL_tPosition_T; /**< Linear and Rotary sensors position */
+
+typedef uint16_t TSL_tTick_ms_T; /**< Time in ms */
+typedef uint8_t TSL_tTick_sec_T; /**< Time in sec */
+
+//------------------------------------------------------------------------------
+// Channel
+//------------------------------------------------------------------------------
+
+typedef uint8_t TSL_Conf_T;
+
+/** Channel destination index
+ */
+typedef struct
+{
+ TSL_tIndexDest_T IdxDest; /**< Index in the Channel data array */
+} TSL_ChannelDest_T;
+
+/** Channel Source and Configuration
+ */
+typedef struct
+{
+ TSL_tIndex_T IdxSrc; /**< Index of source value */
+ // For stm8l acquisition only
+ TSL_Conf_T sampling; /**< Indicates which GPIO.n is used for the sample */
+ TSL_Conf_T channel; /**< Indicates which GPIO.n is used for the channel */
+} TSL_ChannelSrc_T;
+
+/** Channel flags
+ */
+typedef struct
+{
+unsigned int DataReady : 1; /**< To identify a new measurement (TSL_DataReady_enum_T) */
+unsigned int AcqStatus : 2; /**< Acquisition status (TSL_AcqStatus_enum_T) */
+unsigned int ObjStatus : 2; /**< Object status (TSL_ObjStatus_enum_T) */
+} TSL_ChannelFlags_T;
+
+/** Channel Data
+ */
+typedef struct
+{
+ TSL_ChannelFlags_T Flags; /**< Flags */
+ TSL_tRef_T Ref; /**< Reference */
+ TSL_tRefRest_T RefRest; /**< Reference rest for ECS */
+ TSL_tDelta_T Delta; /**< Delta */
+#if TSLPRM_USE_MEAS > 0
+ TSL_tMeas_T Meas; /**< Hold the last acquisition measure */
+#endif
+} TSL_ChannelData_T;
+
+//------------------------------------------------------------------------------
+// Bank
+//------------------------------------------------------------------------------
+
+/** Bank
+ */
+typedef struct
+{
+ // Common to all acquisitions
+ CONST TSL_ChannelSrc_T *p_chSrc; /**< Pointer to the Channel Source and Configuration */
+ CONST TSL_ChannelDest_T *p_chDest; /**< Pointer to the Channel Destination */
+ TSL_ChannelData_T *p_chData; /**< Pointer to the Channel Data */
+ TSL_tNb_T NbChannels; /**< Number of channels in the bank */
+ // For stm8l acquisition only
+ TSL_Conf_T shield_sampling; /**< Indicates which GPIO.n is used for the shield sample */
+ TSL_Conf_T shield_channel; /**< Indicates which GPIO.n is used for the shield channel */
+} TSL_Bank_T;
+
+/** Bank Config Mask
+ */
+typedef struct
+{
+ uint8_t ch1; /**< Contains the mask for all first channel of group */
+ uint8_t ch2; /**< Contains the mask for all second channel of group */
+ uint8_t ch3; /**< Contains the mask for all third channel of group */
+ uint8_t ch4; /**< Contains the mask for all fourth channel of group (if LD device)*/
+} TSL_Bank_Config_Mask_T;
+
+/* Exported variables --------------------------------------------------------*/
+
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+TSL_Status_enum_T TSL_acq_Init(void);
+TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk);
+void TSL_acq_BankStartAcq(void);
+TSL_Status_enum_T TSL_acq_BankWaitEOC(void);
+void TSL_CT_HWacq_TIM3(void);
+void TSL_CT_HWacq_RI(void);
+TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndex_T index);
+TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void);
+
+TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh);
+TSL_tDelta_T TSL_acq_ComputeDelta(TSL_tRef_T ref, TSL_tMeas_T meas);
+TSL_tMeas_T TSL_acq_ComputeMeas(TSL_tRef_T ref, TSL_tDelta_T delta);
+TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh);
+TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas);
+
+#endif /* __TSL_ACQ_STM8L_HW_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm8l_sw.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm8l_sw.h
new file mode 100644
index 0000000..7ac57de
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm8l_sw.h
@@ -0,0 +1,275 @@
+/**
+ ******************************************************************************
+ * @file tsl_acq_stm8l_sw.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_acq_stm8l_sw.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_ACQ_STM8L_SW_H
+#define __TSL_ACQ_STM8L_SW_H
+
+/* Includes ------------------------------------------------------------------*/
+
+#if defined(STM8L15X_LD) || defined(STM8L15X_MD) || defined(STM8L15X_MDP) || defined(STM8L15X_HD)
+#include "stm8l15x.h"
+#endif
+
+#if defined(STM8L10X)
+#include "stm8l10x.h"
+#endif
+
+#include "tsl_conf_stm8l.h"
+#include "tsl_types.h"
+
+/* Defines -------------------------------------------------------------------*/
+
+#ifndef CONST
+#define CONST const
+#endif
+
+#if !defined(STM8L10X)
+
+enum
+{
+ GR1 = 0,
+ GR2,
+ GR3,
+ GR4,
+ GR5,
+ GR6,
+ GR7,
+ GR8
+};
+
+/** GPIOs list:
+ - bits 7:3 GPIO number (0=GPIOA, 1=GPIOB, 2=GPIOC, 3=GPIOD, 4=GPIOE)
+ - bits 2:0 IO number (0=pin0, ..., 7=pin7)
+ */
+
+// GROUP1
+#define PA4 (0x00|0x04) // CH1
+#define PA5 (0x00|0x05) // CH2
+#define PA6 (0x00|0x06) // CH3
+#ifdef STM8L15X_LD
+#define PA7 (0x00|0x07) // CH4
+#endif
+// GROUP2
+#define PC7 (0x10|0x07) // CH1
+#define PC4 (0x10|0x04) // CH2
+#define PC3 (0x10|0x03) // CH3
+#ifdef STM8L15X_LD
+#define PE7 (0x20|0x07) // CH4
+#endif
+// GROUP3
+#define PC2 (0x10|0x02) // CH1
+#define PD7 (0x18|0x07) // CH2
+#define PD6 (0x18|0x06) // CH3
+// GROUP4
+#define PD5 (0x18|0x05) // CH1
+#define PD4 (0x18|0x04) // CH2
+#define PB7 (0x08|0x07) // CH3
+// GROUP5
+#define PB6 (0x08|0x06) // CH1
+#define PB5 (0x08|0x05) // CH2
+#define PB4 (0x08|0x04) // CH3
+// GROUP6
+#define PB3 (0x08|0x03) // CH1
+#define PB2 (0x08|0x02) // CH2
+#define PB1 (0x08|0x01) // CH3
+// GROUP7
+#define PB0 (0x08|0x00) // CH1
+#define PD3 (0x18|0x03) // CH2
+#define PD2 (0x18|0x02) // CH3
+#ifdef STM8L15X_LD
+#define PE3 (0x20|0x03) // CH4
+#endif
+// GROUP8
+#define PD1 (0x18|0x01) // CH1
+#define PD0 (0x18|0x00) // CH2
+#define PE5 (0x20|0x05) // CH3
+#ifdef STM8L15X_LD
+#define PE4 (0x20|0x04) // CH4
+#endif
+
+#else // STM8L10X
+
+enum
+{
+ GR1 = 0,
+ GR2
+};
+
+/** GPIOs list:
+ - bits 7:2 GPIO number (0=GPIOB, 1=GPIOD)
+ - bits 1:0 IO number (0=pin0, ..., 3=pin3)
+ */
+// GROUP1
+#define PB0 (0x00|0x00) // CH1
+#define PB1 (0x00|0x01) // CH2
+#define PD0 (0x04|0x00) // CH3
+#define PD1 (0x04|0x01) // CH4
+// GROUP2
+#define PB2 (0x00|0x02) // CH1
+#define PB3 (0x00|0x03) // CH2
+#define PD2 (0x04|0x02) // CH3
+#define PD3 (0x04|0x03) // CH4
+
+#endif // !defined(STM8L10X)
+
+/* Exported types ------------------------------------------------------------*/
+
+// For all devices/acquisitions
+
+typedef uint16_t TSL_tMeas_T; /**< Measurement */
+typedef uint16_t TSL_tRef_T; /**< Reference */
+typedef int16_t TSL_tDelta_T; /**< Delta */
+
+typedef uint8_t TSL_tIndexSrc_T; /**< Channel source index */
+typedef uint8_t TSL_tIndexDest_T; /**< Channel destination index */
+
+typedef uint8_t TSL_tRefRest_T; /**< Reference Rest (ECS) */
+typedef uint16_t TSL_tKCoeff_T; /**< K coefficient (ECS) */
+
+typedef uint16_t TSL_tIndex_T; /**< Generic index */
+typedef uint16_t TSL_tNb_T; /**< Generic number */
+typedef uint8_t TSL_tCounter_T; /**< Generic counter used for debounce */
+
+typedef uint8_t TSL_tThreshold_T; /**< Delta threshold */
+
+typedef int16_t TSL_tsignPosition_T; /**< Linear and Rotary sensors position */
+typedef uint8_t TSL_tPosition_T; /**< Linear and Rotary sensors position */
+
+typedef uint16_t TSL_tTick_ms_T; /**< Time in ms */
+typedef uint8_t TSL_tTick_sec_T; /**< Time in sec */
+
+//------------------------------------------------------------------------------
+// Channel
+//------------------------------------------------------------------------------
+
+typedef uint8_t TSL_Conf_T;
+
+/** Channel destination index
+ */
+typedef struct
+{
+ TSL_tIndexDest_T IdxDest; /**< Index in the Channel data array */
+} TSL_ChannelDest_T;
+
+/** Channel Source and Configuration
+ */
+typedef struct
+{
+ TSL_tIndex_T IdxSrc; /**< Index of source value */
+ // For stm8l acquisition only
+ TSL_Conf_T sampling; /**< Indicates which GPIO.n is used for the sample */
+ TSL_Conf_T channel; /**< Indicates which GPIO.n is used for the channel */
+} TSL_ChannelSrc_T;
+
+/** Channel flags
+ */
+typedef struct
+{
+unsigned int DataReady : 1; /**< To identify a new measurement (TSL_DataReady_enum_T) */
+unsigned int AcqStatus : 2; /**< Acquisition status (TSL_AcqStatus_enum_T) */
+unsigned int ObjStatus : 2; /**< Object status (TSL_ObjStatus_enum_T) */
+} TSL_ChannelFlags_T;
+
+/** Channel Data
+ */
+typedef struct
+{
+ TSL_ChannelFlags_T Flags; /**< Flags */
+ TSL_tRef_T Ref; /**< Reference */
+ TSL_tRefRest_T RefRest; /**< Reference rest for ECS */
+ TSL_tDelta_T Delta; /**< Delta */
+#if TSLPRM_USE_MEAS > 0
+ TSL_tMeas_T Meas; /**< Hold the last acquisition measure */
+#endif
+} TSL_ChannelData_T;
+
+//------------------------------------------------------------------------------
+// Bank
+//------------------------------------------------------------------------------
+
+/** Bank
+ */
+typedef struct
+{
+ // Common to all acquisitions
+ CONST TSL_ChannelSrc_T *p_chSrc; /**< Pointer to the Channel Source and Configuration */
+ CONST TSL_ChannelDest_T *p_chDest; /**< Pointer to the Channel Destination */
+ TSL_ChannelData_T *p_chData; /**< Pointer to the Channel Data */
+ TSL_tNb_T NbChannels; /**< Number of channels in the bank */
+ // For stm8l acquisition only
+ TSL_Conf_T shield_sampling; /**< Indicates which GPIO.n is used for the shield sample */
+ TSL_Conf_T shield_channel; /**< Indicates which GPIO.n is used for the shield channel */
+} TSL_Bank_T;
+
+#if !defined(STM8L10X)
+
+/** Bank Config Mask
+ */
+typedef struct
+{
+ uint8_t ch1; /**< Contains the mask for all first channel of group */
+ uint8_t ch2; /**< Contains the mask for all second channel of group */
+ uint8_t ch3; /**< Contains the mask for all third channel of group */
+ uint8_t ch4; /**< Contains the mask for all fourth channel of group (if LD device)*/
+} TSL_Bank_Config_Mask_T;
+
+#else // STM8L10X
+
+/** Bank Config Mask
+ */
+typedef struct
+{
+ uint8_t GPIOB_IO; /**< Contains the mask for all first channel of group */
+ uint8_t GPIOB_Samp; /**< Contains the mask for all second channel of group */
+ uint8_t GPIOD_IO; /**< Contains the mask for all third channel of group */
+ uint8_t GPIOD_Samp; /**< Contains the mask for all fourth channel of group (if LD device)*/
+} TSL_Bank_Config_Mask_T;
+
+#endif // !defined(STM8L10X)
+
+/* Exported variables --------------------------------------------------------*/
+
+/* Exported macros -----------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+TSL_Status_enum_T TSL_acq_Init(void);
+TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk);
+void TSL_acq_BankStartAcq(void);
+TSL_Status_enum_T TSL_acq_BankWaitEOC(void);
+void TSL_acq_ProcessIT(void);
+TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndex_T index);
+TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void);
+
+TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh);
+TSL_tDelta_T TSL_acq_ComputeDelta(TSL_tRef_T ref, TSL_tMeas_T meas);
+TSL_tMeas_T TSL_acq_ComputeMeas(TSL_tRef_T ref, TSL_tDelta_T delta);
+TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh);
+TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas);
+
+#endif /* __TSL_ACQ_STM8L_SW_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm8tl5x.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm8tl5x.h
new file mode 100644
index 0000000..31318b3
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_acq_stm8tl5x.h
@@ -0,0 +1,270 @@
+/**
+ ******************************************************************************
+ * @file tsl_acq_stm8tl5x.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains all functions prototypes that manage the TSC
+ * acquisition on STM8TL5x products.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_ACQ_STM8TL5X_H
+#define __TSL_ACQ_STM8TL5X_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm8tl5x.h"
+#include "tsl_conf_stm8tl5x.h"
+#include "tsl_types.h"
+
+/*==============================================================================
+
+ *** RECEIVERS AND TRANSMITTERS DESCRIPTION ***
+
+ ProxSense receiver and transmitter description for STM8TL5x
+ For more details please refer to the Proxsense
+ section in the reference manual
+
+
+ Txi
+ Group Ai Rx0a __/____ |
+ Rx1a __/____ |
+ Rx2a __/____ |
+ Rx3a __/____ |
+ Rx4a __/____ |
+ Rx5a __/____ |
+ Rx6a __/____ |
+ Rx7a __/____ |
+ Rx8a __/____ |
+ Rx9a __/____ |
+
+ Group Bi Rx0b __/____ |
+ Rx1b __/____ |
+ Rx2b __/____ |
+ Rx3b __/____ |
+ Rx4b __/____ |
+ Rx5b __/____ |
+ Rx6b __/____ |
+ Rx7b __/____ |
+ Rx8b __/____ |
+ Rx9b __/____ |
+
+==============================================================================*/
+
+/* Defines -------------------------------------------------------------------*/
+
+// Receivers
+#define RX0 (0+0x8000)
+#define RX1 (1+0x8000)
+#define RX2 (2+0x8000)
+#define RX3 (3+0x8000)
+#define RX4 (4+0x8000)
+#define RX5 (5+0x8000)
+#define RX6 (6+0x8000)
+#define RX7 (7+0x8000)
+#define RX8 (8+0x8000)
+#define RX9 (9+0x8000)
+
+// Transmitters
+#define TX0 (0)
+#define TX1 (1)
+#define TX2 (2)
+#define TX3 (3)
+#define TX4 (4)
+#define TX5 (5)
+#define TX6 (6)
+#define TX7 (7)
+#define TX8 (8)
+#define TX9 (9)
+#define TX10 (10)
+#define TX11 (11)
+#define TX12 (12)
+#define TX13 (13)
+#define TX14 (14)
+
+#define BIT_MASK_RX(N) ((uint16_t)1<<(uint8_t)(N & 0xFF))
+#define BIT_MASK_TX(N) ((uint16_t)1<< N)
+
+// Acquisition Bank
+#define BANK01 1
+#define BANK02 2
+#define BANK03 3
+#define BANK04 4
+#define BANK05 5
+#define BANK06 6
+#define BANK07 7
+#define BANK08 8
+#define BANK09 9
+#define BANK10 10
+#define BANK11 11
+#define BANK12 12
+#define BANK13 13
+#define BANK14 14
+#define BANK15 15
+#define BANK16 16
+#define BANK17 17
+#define BANK18 18
+#define BANK19 19
+#define BANK20 20
+#define BANK21 21
+#define BANK22 22
+#define BANK23 23
+#define BANK24 24
+#define BANK25 25
+#define BANK26 26
+#define BANK27 27
+#define BANK28 28
+#define BANK29 29
+#define BANK30 30
+
+/* Exported types ------------------------------------------------------------*/
+
+// For all devices/acquisitions
+
+typedef uint16_t TSL_tMeas_T; /**< Measurement */
+typedef uint16_t TSL_tRef_T; /**< Reference */
+typedef int16_t TSL_tDelta_T; /**< Delta */
+
+typedef uint8_t TSL_tIndexSrc_T; /**< Channel source index */
+typedef uint16_t TSL_tIndexDest_T; /**< Channel destination index */
+
+typedef uint8_t TSL_tRefRest_T; /**< Reference Rest (ECS) */
+typedef uint16_t TSL_tKCoeff_T; /**< K coefficient (ECS) */
+
+typedef uint8_t TSL_tIndex_T; /**< Generic index */
+typedef uint16_t TSL_tNb_T; /**< Generic number */
+typedef uint8_t TSL_tCounter_T; /**< Generic counter used for debounce */
+
+typedef uint8_t TSL_tThreshold_T; /**< Delta threshold */
+
+typedef int16_t TSL_tsignPosition_T; /**< Linear and Rotary sensors position */
+typedef uint8_t TSL_tPosition_T; /**< Linear and Rotary sensors position */
+
+typedef uint16_t TSL_tTick_ms_T; /**< Time in ms */
+typedef uint8_t TSL_tTick_sec_T; /**< Time in sec */
+
+// For STM8TL5X only
+
+typedef uint16_t TSL_tMaskRX; /**< Receiver mask */
+typedef uint16_t TSL_tMaskTX; /**< Transmitter mask */
+
+//------------------------------------------------------------------------------
+// Channel
+//------------------------------------------------------------------------------
+
+/** Channel destination index
+ */
+typedef struct
+{
+ TSL_tIndexDest_T IdxDest; /**< Index in the Channel data array */
+} TSL_ChannelDest_T;
+
+/** Channel Source and Configuration
+ */
+typedef struct
+{
+ TSL_tIndexSrc_T IdxSrc; /**< Index of the receivers (between 0 and 9) */
+} TSL_ChannelSrc_T;
+
+#define TSL_EPCC_CHANGE_MASK (0x04) /**< EPCC change mask */
+
+/** EPCC status
+ */
+typedef enum
+{
+ TSL_EPCC_STATUS_UNLOCKED = 0, /**< EPCC is unlocked */
+ TSL_EPCC_STATUS_LOCKED = 1, /**< EPCC is locked */
+ TSL_EPCC_STATUS_DECREASE = 4, /**< EPCC must decreased */
+ TSL_EPCC_STATUS_INCREASE = 6 /**< EPCC must be increased */
+} TSL_EPCCStatus_enum_T;
+
+/** Channel flags
+ */
+typedef struct
+{
+ unsigned int DataReady : 1; /**< To identify a new measurement (TSL_DataReady_enum_T) */
+ unsigned int AcqStatus : 2; /**< Acquisition status (TSL_AcqStatus_enum_T) */
+ unsigned int EPCCStatus : 3; /**< Acquisition status (TSL_EPCCStatus_enum_T) */
+ unsigned int ObjStatus : 2; /**< Object status (TSL_ObjStatus_enum_T) */
+} TSL_ChannelFlags_T;
+
+/** Channel Data
+ */
+typedef struct
+{
+ TSL_ChannelFlags_T Flags; /**< Flags */
+ TSL_tRef_T Ref; /**< Reference */
+ TSL_tRefRest_T RefRest; /**< Reference rest for ECS */
+ TSL_tDelta_T Delta; /**< Delta */
+#if TSLPRM_USE_MEAS > 0
+ TSL_tMeas_T Meas; /**< Hold the last acquisition measure */
+#endif
+} TSL_ChannelData_T;
+
+//------------------------------------------------------------------------------
+// Bank
+//------------------------------------------------------------------------------
+
+/** Bank
+ */
+typedef struct
+{
+ // Common to all acquisitions
+ CONST TSL_ChannelSrc_T *p_chSrc; /**< Pointer to the Channel Source and Configuration */
+ CONST TSL_ChannelDest_T *p_chDest; /**< Pointer to the Channel Destination */
+ TSL_ChannelData_T *p_chData; /**< Pointer to the Channel Data */
+ TSL_tNb_T NbChannels; /**< Number of channels in the bank */
+ // For stm8tl5x PXS acquisition only
+ TSL_tMaskRX msk_channels; /**< Mask of all receivers */
+ TSL_tMaskTX msk_TX; /**< Mask of Tx */
+ uint8_t msk_group; /**< Mask of group used (RX_GROUPA or RX_GROUPB) */
+ TSL_tMaskRX msk_RXEN; /**< Mask of all RX (receivers and transmitters) */
+} TSL_Bank_T;
+
+/** Bank Configuration
+ */
+typedef struct
+{
+ uint8_t CSSEL[TSLPRM_HIGH_CHANNEL_NB+1]; /**< Array of CS values */
+ uint8_t EPCCSEL[TSLPRM_HIGH_CHANNEL_NB+1]; /**< Array of EPCC values */
+} TSL_BankConfig_T;
+
+/* Exported variables --------------------------------------------------------*/
+
+/* Exported macros -----------------------------------------------------------*/
+#define TSL_acq_ComputeDelta(Reference,Measure) (TSL_tDelta_T)(Measure - Reference) /**< Calculate the Delta */
+#define TSL_acq_ComputeMeas(Reference,Delta) (TSL_tMeas_T)(Delta + Reference) /**< Calculate the Measure */
+
+/* Exported functions ------------------------------------------------------- */
+TSL_Status_enum_T TSL_acq_Init(void);
+TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk);
+TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh);
+TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas);
+TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh);
+void TSL_acq_BankStartAcq(void);
+TSL_Status_enum_T TSL_acq_BankWaitEOC(void);
+TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void);
+TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndexSrc_T index);
+void TSL_acq_UpdateCS(uint8_t *pCSSEL, TSL_EPCCStatus_enum_T change);
+
+#endif /* __TSL_ACQ_STM8TL5X_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config.h
new file mode 100644
index 0000000..836c3e6
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config.h
@@ -0,0 +1,451 @@
+/**
+ ******************************************************************************
+ * @file tsl_check_config.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains the check of all parameters defined in the
+ * common configuration file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_CHECK_CONFIG_H
+#define __TSL_CHECK_CONFIG_H
+
+//==============================================================================
+// Common parameters check
+//==============================================================================
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TOTAL_CHANNELS
+#error "TSLPRM_TOTAL_CHANNELS is not defined."
+#endif
+
+#ifndef TSLPRM_TOTAL_BANKS
+#error "TSLPRM_TOTAL_BANKS is not defined."
+#endif
+
+#ifndef TSLPRM_TOTAL_TOUCHKEYS
+#error "TSLPRM_TOTAL_TOUCHKEYS is not defined."
+#endif
+
+#ifndef TSLPRM_TOTAL_TOUCHKEYS_B
+#error "TSLPRM_TOTAL_TOUCHKEYS_B is not defined."
+#endif
+
+#ifndef TSLPRM_TOTAL_LINROTS
+#error "TSLPRM_TOTAL_LINROTS is not defined."
+#endif
+
+#ifndef TSLPRM_TOTAL_LINROTS_B
+#error "TSLPRM_TOTAL_LINROTS_B is not defined."
+#endif
+
+#ifndef TSLPRM_TOTAL_OBJECTS
+#error "TSLPRM_TOTAL_OBJECTS is not defined."
+#endif
+
+#define TSLPRM_TOTAL_TKEYS (TSLPRM_TOTAL_TOUCHKEYS + TSLPRM_TOTAL_TOUCHKEYS_B)
+#define TSLPRM_TOTAL_LNRTS (TSLPRM_TOTAL_LINROTS + TSLPRM_TOTAL_LINROTS_B)
+
+#if ((TSLPRM_TOTAL_TKEYS == 0) && (TSLPRM_TOTAL_LNRTS == 0))
+#error "No TouchKey and No Linear/Rotary sensors are defined."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_CALIB_SAMPLES
+#error "TSLPRM_CALIB_SAMPLES is not defined."
+#endif
+
+#if ((TSLPRM_CALIB_SAMPLES != 4) && (TSLPRM_CALIB_SAMPLES != 8) && (TSLPRM_CALIB_SAMPLES != 16))
+#error "TSLPRM_CALIB_SAMPLES is out of range (4, 8, 16)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_CALIB_DELAY
+#error "TSLPRM_CALIB_DELAY is not defined."
+#endif
+
+#if ((TSLPRM_CALIB_DELAY < 0) || (TSLPRM_CALIB_DELAY > 40))
+#error "TSLPRM_CALIB_DELAY is out of range (0..40)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_ACQ_MIN
+#error "TSLPRM_ACQ_MIN is not defined."
+#endif
+
+#ifndef TSLPRM_ACQ_MAX
+#error "TSLPRM_ACQ_MAX is not defined."
+#endif
+
+#if ((TSLPRM_ACQ_MIN < 1) || (TSLPRM_ACQ_MIN > (TSLPRM_ACQ_MAX-1)))
+#error "TSLPRM_ACQ_MIN is out of range (1 .. ACQ_MAX-1)."
+#endif
+
+#if ((TSLPRM_ACQ_MAX < (TSLPRM_ACQ_MIN+1)) || (TSLPRM_ACQ_MAX > 50000))
+#error "TSLPRM_ACQ_MAX is out of range (ACQ_MIN+1 .. 50000)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TKEY_PROX_IN_TH
+#error "TSLPRM_TKEY_PROX_IN_TH is not defined."
+#endif
+
+#ifndef TSLPRM_TKEY_PROX_OUT_TH
+#error "TSLPRM_TKEY_PROX_OUT_TH is not defined."
+#endif
+
+#if ((TSLPRM_TKEY_PROX_OUT_TH < 0) || (TSLPRM_TKEY_PROX_OUT_TH > (TSLPRM_TKEY_PROX_IN_TH-1)))
+#error "TSLPRM_TKEY_PROX_OUT_TH is out of range (0 .. TSLPRM_TKEY_PROX_IN_TH-1)."
+#endif
+
+#if TSLPRM_COEFF_TH == 0
+#if ((TSLPRM_TKEY_PROX_IN_TH < (TSLPRM_TKEY_PROX_OUT_TH+1)) || (TSLPRM_TKEY_PROX_IN_TH > (TSLPRM_TKEY_DETECT_OUT_TH-1)))
+#error "TSLPRM_TKEY_PROX_IN_TH is out of range (TSLPRM_TKEY_PROX_OUT_TH+1 .. TSLPRM_TKEY_DETECT_OUT_TH-1)."
+#endif
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_LINROT_PROX_IN_TH
+#error "TSLPRM_LINROT_PROX_IN_TH is not defined."
+#endif
+
+#ifndef TSLPRM_LINROT_PROX_OUT_TH
+#error "TSLPRM_LINROT_PROX_OUT_TH is not defined."
+#endif
+
+#if ((TSLPRM_LINROT_PROX_OUT_TH < 0) || (TSLPRM_LINROT_PROX_OUT_TH > (TSLPRM_LINROT_PROX_IN_TH-1)))
+#error "TSLPRM_LINROT_PROX_OUT_TH is out of range (0 .. TSLPRM_LINROT_PROX_IN_TH-1)."
+#endif
+
+#if TSLPRM_COEFF_TH == 0
+#if ((TSLPRM_LINROT_PROX_IN_TH < (TSLPRM_LINROT_PROX_OUT_TH+1)) || (TSLPRM_LINROT_PROX_IN_TH > (TSLPRM_LINROT_DETECT_OUT_TH-1)))
+#error "TSLPRM_LINROT_PROX_IN_TH is out of range (TSLPRM_LINROT_PROX_OUT_TH+1 .. TSLPRM_LINROT_DETECT_OUT_TH-1)."
+#endif
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TKEY_DETECT_IN_TH
+#error "TSLPRM_TKEY_DETECT_IN_TH is not defined."
+#endif
+
+#ifndef TSLPRM_TKEY_DETECT_OUT_TH
+#error "TSLPRM_TKEY_DETECT_OUT_TH is not defined."
+#endif
+
+#if TSLPRM_COEFF_TH == 0
+#if ((TSLPRM_TKEY_DETECT_OUT_TH < (TSLPRM_TKEY_PROX_IN_TH+1)) || (TSLPRM_TKEY_DETECT_OUT_TH > (TSLPRM_TKEY_DETECT_IN_TH-1)))
+#error "TSLPRM_TKEY_DETECT_OUT_TH is out of range (TSLPRM_TKEY_PROX_IN_TH+1 .. TSLPRM_TKEY_DETECT_IN_TH-1)."
+#endif
+#endif
+
+#if ((TSLPRM_TKEY_DETECT_IN_TH < (TSLPRM_TKEY_DETECT_OUT_TH+1)) || (TSLPRM_TKEY_DETECT_IN_TH > 255))
+#error "TSLPRM_TKEY_DETECT_IN_TH is out of range (TSLPRM_TKEY_DETECT_OUT_TH+1 .. 255)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_LINROT_DETECT_IN_TH
+#error "TSLPRM_LINROT_DETECT_IN_TH is not defined."
+#endif
+
+#ifndef TSLPRM_LINROT_DETECT_OUT_TH
+#error "TSLPRM_LINROT_DETECT_OUT_TH is not defined."
+#endif
+
+#if TSLPRM_COEFF_TH == 0
+#if ((TSLPRM_LINROT_DETECT_OUT_TH < (TSLPRM_LINROT_PROX_IN_TH+1)) || (TSLPRM_LINROT_DETECT_OUT_TH > (TSLPRM_LINROT_DETECT_IN_TH-1)))
+#error "TSLPRM_LINROT_DETECT_OUT_TH is out of range (TSLPRM_LINROT_PROX_IN_TH+1 .. TSLPRM_LINROT_DETECT_IN_TH-1)."
+#endif
+#endif
+
+#if ((TSLPRM_LINROT_DETECT_IN_TH < (TSLPRM_LINROT_DETECT_OUT_TH+1)) || (TSLPRM_LINROT_DETECT_IN_TH > 255))
+#error "TSLPRM_LINROT_DETECT_IN_TH is out of range (TSLPRM_LINROT_DETECT_OUT_TH+1 .. 255)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TKEY_CALIB_TH
+#error "TSLPRM_TKEY_CALIB_TH is not defined."
+#endif
+
+#if ((TSLPRM_TKEY_CALIB_TH < 0) || (TSLPRM_TKEY_CALIB_TH > 255))
+#error "TSLPRM_TKEY_CALIB_TH is out of range (0 .. 255)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_LINROT_CALIB_TH
+#error "TSLPRM_LINROT_CALIB_TH is not defined."
+#endif
+
+#if ((TSLPRM_LINROT_CALIB_TH < 0) || (TSLPRM_LINROT_CALIB_TH > 255))
+#error "TSLPRM_LINROT_CALIB_TH is out of range (0 .. 255)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_LINROT_USE_NORMDELTA
+#error "TSLPRM_LINROT_USE_NORMDELTA is not defined."
+#endif
+
+#if ((TSLPRM_LINROT_USE_NORMDELTA < 0) || (TSLPRM_LINROT_USE_NORMDELTA > 1))
+#error "TSLPRM_LINROT_USE_NORMDELTA is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_COEFF_TH
+#error "TSLPRM_COEFF_TH is not defined."
+#endif
+
+#if ((TSLPRM_COEFF_TH < 0) || (TSLPRM_COEFF_TH > 4))
+#error "TSLPRM_COEFF_TH is out of range (0 .. 4)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_LINROT_DIR_CHG_POS
+#error "TSLPRM_LINROT_DIR_CHG_POS is not defined."
+#endif
+
+#if ((TSLPRM_LINROT_DIR_CHG_POS < 0) || (TSLPRM_LINROT_DIR_CHG_POS > 255))
+#error "TSLPRM_LINROT_DIR_CHG_POS is out of range (0 .. 255)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_LINROT_RESOLUTION
+#error "TSLPRM_LINROT_RESOLUTION is not defined."
+#endif
+
+#if ((TSLPRM_LINROT_RESOLUTION < 1) || (TSLPRM_LINROT_RESOLUTION > 8))
+#error "TSLPRM_LINROT_RESOLUTION is out of range (1 .. 8)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_DEBOUNCE_PROX
+#error "TSLPRM_DEBOUNCE_PROX is not defined."
+#endif
+
+#if ((TSLPRM_DEBOUNCE_PROX < 0) || (TSLPRM_DEBOUNCE_PROX > 63))
+#error "TSLPRM_DEBOUNCE_PROX is out of range (0 .. 63)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_DEBOUNCE_DETECT
+#error "TSLPRM_DEBOUNCE_DETECT is not defined."
+#endif
+
+#if ((TSLPRM_DEBOUNCE_DETECT < 0) || (TSLPRM_DEBOUNCE_DETECT > 63))
+#error "TSLPRM_DEBOUNCE_DETECT is out of range (0 .. 63)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_DEBOUNCE_RELEASE
+#error "TSLPRM_DEBOUNCE_RELEASE is not defined."
+#endif
+
+#if ((TSLPRM_DEBOUNCE_RELEASE < 0) || (TSLPRM_DEBOUNCE_RELEASE > 63))
+#error "TSLPRM_DEBOUNCE_RELEASE is out of range (0 .. 63)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_DEBOUNCE_CALIB
+#error "TSLPRM_DEBOUNCE_CALIB is not defined."
+#endif
+
+#if ((TSLPRM_DEBOUNCE_CALIB < 0) || (TSLPRM_DEBOUNCE_CALIB > 63))
+#error "TSLPRM_DEBOUNCE_CALIB is out of range (0 .. 63)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_DEBOUNCE_ERROR
+#error "TSLPRM_DEBOUNCE_ERROR is not defined."
+#endif
+
+#if ((TSLPRM_DEBOUNCE_ERROR < 0) || (TSLPRM_DEBOUNCE_ERROR > 63))
+#error "TSLPRM_DEBOUNCE_ERROR is out of range (0 .. 63)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_LINROT_DIR_CHG_DEB
+#error "TSLPRM_LINROT_DIR_CHG_DEB is not defined."
+#endif
+
+#if ((TSLPRM_LINROT_DIR_CHG_DEB < 0) || (TSLPRM_LINROT_DIR_CHG_DEB > 63))
+#error "TSLPRM_LINROT_DIR_CHG_DEB is out of range (0 .. 63)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_ECS_K_SLOW
+#error "TSLPRM_ECS_K_SLOW is not defined."
+#endif
+
+#if ((TSLPRM_ECS_K_SLOW < 0) || (TSLPRM_ECS_K_SLOW > 255))
+#error "TSLPRM_ECS_K_SLOW is out of range (0 .. 255)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_ECS_K_FAST
+#error "TSLPRM_ECS_K_FAST is not defined."
+#endif
+
+#if ((TSLPRM_ECS_K_FAST < 0) || (TSLPRM_ECS_K_FAST > 255))
+#error "TSLPRM_ECS_K_FAST is out of range (0 .. 255)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_ECS_DELAY
+#error "TSLPRM_ECS_DELAY is not defined."
+#endif
+
+#if ((TSLPRM_ECS_DELAY < 0) || (TSLPRM_ECS_DELAY > 5000))
+#error "TSLPRM_ECS_DELAY is out of range (0 .. 5000)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_USE_MEAS
+#error "TSLPRM_USE_MEAS is not defined."
+#endif
+
+#if ((TSLPRM_USE_MEAS != 0) && (TSLPRM_USE_MEAS != 1))
+#error "TSLPRM_USE_MEAS is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_USE_PROX
+#error "TSLPRM_USE_PROX is not defined."
+#endif
+
+#if ((TSLPRM_USE_PROX != 0) && (TSLPRM_USE_PROX != 1))
+#error "TSLPRM_USE_PROX is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_USE_ZONE
+#error "TSLPRM_USE_ZONE is not defined."
+#endif
+
+#if ((TSLPRM_USE_ZONE != 0) && (TSLPRM_USE_ZONE != 1))
+#error "TSLPRM_USE_ZONE is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_USE_ACQ_INTERRUPT
+#error "TSLPRM_USE_ACQ_INTERRUPT is not defined."
+#endif
+
+#if ((TSLPRM_USE_ACQ_INTERRUPT != 0) && (TSLPRM_USE_ACQ_INTERRUPT != 1))
+#error "TSLPRM_USE_ACQ_INTERRUPT is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_DTO
+#error "TSLPRM_DTO is not defined."
+#endif
+
+#if ((TSLPRM_DTO < 0) || (TSLPRM_DTO > 63))
+#error "TSLPRM_DTO is out of range (0 .. 63)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TICK_FREQ
+#error "TSLPRM_TICK_FREQ is not defined."
+#endif
+
+#if ((TSLPRM_TICK_FREQ != 125) && (TSLPRM_TICK_FREQ != 250) && (TSLPRM_TICK_FREQ != 500) &&\
+ (TSLPRM_TICK_FREQ != 1000) && (TSLPRM_TICK_FREQ != 2000))
+#error "TSLPRM_TICK_FREQ is out of range (125, 250, 500, 1000, 2000)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_USE_DXS
+#error "TSLPRM_USE_DXS is not defined."
+#endif
+
+#if ((TSLPRM_USE_DXS < 0) || (TSLPRM_USE_DXS > 1))
+#error "TSLPRM_USE_DXS is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_USE_TIMER_CALLBACK
+#error "TSLPRM_USE_TIMER_CALLBACK is not defined."
+#endif
+
+#if ((TSLPRM_USE_TIMER_CALLBACK != 0) && (TSLPRM_USE_TIMER_CALLBACK != 1))
+#error "TSLPRM_USE_TIMER_CALLBACK is out of range (0 .. 1)."
+#endif
+
+//==============================================================================
+// Specific parameters check
+//==============================================================================
+
+#if defined(STM8L10X) || defined(STM8L15X_LD) || defined(STM8L15X_MD) || defined(STM8L15X_MDP) || defined(STM8L15X_HD)
+#include "tsl_check_config_stm8l.h"
+#endif
+
+#if defined(STM8TL5X)
+#include "tsl_check_config_stm8tl5x.h"
+#endif
+
+#if defined(STM32L1XX_MD) || defined(STM32L1XX_MDP) || defined(STM32L1XX_HD) || defined(STM32L1XX_XL)
+#include "tsl_check_config_stm32l1xx.h"
+#endif
+
+#if defined(STM32F0XX) || defined(STM32F0XX_MD) || defined(STM32F0XX_HD) ||\
+ defined(STM32F051) || defined(STM32F072) || defined(STM32F042)
+#include "tsl_check_config_stm32f0xx.h"
+#endif
+
+#if defined(STM32F303xC) || defined(STM32F334x8) || defined(STM32F303x8) || defined(STM32F301x8) || defined(STM32F302x8) ||\
+ defined(STM32F37X)
+#include "tsl_check_config_stm32f3xx.h"
+#endif
+
+#endif /* __TSL_CHECK_CONFIG_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm32f0xx.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm32f0xx.h
new file mode 100644
index 0000000..661f41f
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm32f0xx.h
@@ -0,0 +1,245 @@
+/**
+ ******************************************************************************
+ * @file tsl_check_config_stm32f0xx.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains the check of all parameters defined in the
+ * STM32F0XX configuration file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_CHECK_CONFIG_STM32F0XX_H
+#define __TSL_CHECK_CONFIG_STM32F0XX_H
+
+//------------------------------------------------------------------------------
+
+#if ((TSLPRM_TOTAL_CHANNELS < 1) || (TSLPRM_TOTAL_CHANNELS > 24))
+#error "TSLPRM_TOTAL_CHANNELS is out of range (1 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_BANKS < 1) || (TSLPRM_TOTAL_BANKS > 8))
+#error "TSLPRM_TOTAL_BANKS is out of range (1 .. 8)."
+#endif
+
+#if ((TSLPRM_TOTAL_TOUCHKEYS < 0) || (TSLPRM_TOTAL_TOUCHKEYS > 24))
+#error "TSLPRM_TOTAL_TOUCHKEYS is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_TOUCHKEYS_B < 0) || (TSLPRM_TOTAL_TOUCHKEYS_B > 24))
+#error "TSLPRM_TOTAL_TOUCHKEYS_B is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_LINROTS < 0) || (TSLPRM_TOTAL_LINROTS > 24))
+#error "TSLPRM_TOTAL_LINROTS is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_LINROTS_B < 0) || (TSLPRM_TOTAL_LINROTS_B > 24))
+#error "TSLPRM_TOTAL_LINROTS_B is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_OBJECTS < 1) || (TSLPRM_TOTAL_OBJECTS > 24))
+#error "TSLPRM_TOTAL_OBJECTS is out of range (1 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_TKEYS + TSLPRM_TOTAL_LNRTS) > 24)
+#error "The Sum of TouchKeys and Linear/Rotary sensors exceeds 24."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_GPIO_CONFIG
+#error "TSLPRM_TSC_GPIO_CONFIG is not defined."
+#endif
+
+#if ((TSLPRM_TSC_GPIO_CONFIG < 0) || (TSLPRM_TSC_GPIO_CONFIG > 1))
+#error "TSLPRM_TSC_GPIO_CONFIG is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_CTPH
+#error "TSLPRM_TSC_CTPH is not defined."
+#endif
+
+#if ((TSLPRM_TSC_CTPH < 0) || (TSLPRM_TSC_CTPH > 15))
+#error "TSLPRM_TSC_CTPH is out of range (0 .. 15)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_CTPL
+#error "TSLPRM_TSC_CTPL is not defined."
+#endif
+
+#if ((TSLPRM_TSC_CTPL < 0) || (TSLPRM_TSC_CTPL > 15))
+#error "TSLPRM_TSC_CTPL is out of range (0 .. 15)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_PGPSC
+#error "TSLPRM_TSC_PGPSC is not defined."
+#endif
+
+#if ((TSLPRM_TSC_PGPSC < 0) || (TSLPRM_TSC_PGPSC > 7))
+#error "TSLPRM_TSC_PGPSC is out of range (0 .. 7)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#if (TSLPRM_ACQ_MAX > 0) && (TSLPRM_ACQ_MAX < 256)
+#define TSLPRM_TSC_MCV 0 // 255
+#endif
+
+#if (TSLPRM_ACQ_MAX > 255) && (TSLPRM_ACQ_MAX < 512)
+#define TSLPRM_TSC_MCV 1 // 511
+#endif
+
+#if (TSLPRM_ACQ_MAX > 511) && (TSLPRM_ACQ_MAX < 1024)
+#define TSLPRM_TSC_MCV 2 // 1023
+#endif
+
+#if (TSLPRM_ACQ_MAX > 1023) && (TSLPRM_ACQ_MAX < 2048)
+#define TSLPRM_TSC_MCV 3 // 2047
+#endif
+
+#if (TSLPRM_ACQ_MAX > 2047) && (TSLPRM_ACQ_MAX < 4096)
+#define TSLPRM_TSC_MCV 4 // 4095
+#endif
+
+#if (TSLPRM_ACQ_MAX > 4095) && (TSLPRM_ACQ_MAX < 8192)
+#define TSLPRM_TSC_MCV 5 // 8191
+#endif
+
+#if (TSLPRM_ACQ_MAX > 8191)
+#define TSLPRM_TSC_MCV 6 // 16383
+#endif
+
+#ifndef TSLPRM_TSC_MCV
+#error "TSLPRM_TSC_MCV is not defined."
+#endif
+
+#if ((TSLPRM_TSC_MCV < 0) || (TSLPRM_TSC_MCV > 6))
+#error "TSLPRM_TSC_MCV is out of range (0 .. 6)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_IODEF
+#error "TSLPRM_TSC_IODEF is not defined."
+#endif
+
+#if ((TSLPRM_TSC_IODEF < 0) || (TSLPRM_TSC_IODEF > 1))
+#error "TSLPRM_TSC_IODEF is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_AM
+#error "TSLPRM_TSC_AM is not defined."
+#endif
+
+#if ((TSLPRM_TSC_AM < 0) || (TSLPRM_TSC_AM > 1))
+#error "TSLPRM_TSC_AM is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_SYNC_PIN
+#error "TSLPRM_TSC_SYNC_PIN is not defined."
+#endif
+
+#if ((TSLPRM_TSC_SYNC_PIN < 0) || (TSLPRM_TSC_SYNC_PIN > 1))
+#error "TSLPRM_TSC_SYNC_PIN is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_SYNC_POL
+#error "TSLPRM_TSC_SYNC_POL is not defined."
+#endif
+
+#if ((TSLPRM_TSC_SYNC_POL < 0) || (TSLPRM_TSC_SYNC_POL > 1))
+#error "TSLPRM_TSC_SYNC_POL is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_USE_SS
+#error "TSLPRM_TSC_USE_SS is not defined."
+#endif
+
+#if ((TSLPRM_TSC_USE_SS < 0) || (TSLPRM_TSC_USE_SS > 1))
+#error "TSLPRM_TSC_USE_SS is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_SSD
+#error "TSLPRM_TSC_SSD is not defined."
+#endif
+
+#if ((TSLPRM_TSC_SSD < 0) || (TSLPRM_TSC_SSD > 127))
+#error "TSLPRM_TSC_SSD is out of range (0 .. 127)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_SSPSC
+#error "TSLPRM_TSC_SSPSC is not defined."
+#endif
+
+#if ((TSLPRM_TSC_SSPSC < 0) || (TSLPRM_TSC_SSPSC > 1))
+#error "TSLPRM_TSC_SSPSC is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifdef TSC_GROUP7_ENABLED
+#undef TSC_GROUP7_ENABLED
+#endif
+
+#if (TSLPRM_TSC_GROUP7_IO1 != NU) || (TSLPRM_TSC_GROUP7_IO2 != NU) || (TSLPRM_TSC_GROUP7_IO3 != NU) || (TSLPRM_TSC_GROUP7_IO4 != NU)
+#define TSC_GROUP7_ENABLED (1)
+#endif
+
+#ifdef TSC_GROUP8_ENABLED
+#undef TSC_GROUP8_ENABLED
+#endif
+
+#if (TSLPRM_TSC_GROUP8_IO1 != NU) || (TSLPRM_TSC_GROUP8_IO2 != NU) || (TSLPRM_TSC_GROUP8_IO3 != NU) || (TSLPRM_TSC_GROUP8_IO4 != NU)
+#define TSC_GROUP8_ENABLED (1)
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_DELAY_DISCHARGE_ALL
+#error "TSLPRM_DELAY_DISCHARGE_ALL is not defined."
+#endif
+
+#if ((TSLPRM_DELAY_DISCHARGE_ALL < 0) || (TSLPRM_DELAY_DISCHARGE_ALL > 65535))
+#error "TSLPRM_DELAY_DISCHARGE_ALL is out of range (0 .. 65535)."
+#endif
+
+#endif /* __TSL_CHECK_CONFIG_STM32F0XX_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm32f3xx.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm32f3xx.h
new file mode 100644
index 0000000..d0e5813
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm32f3xx.h
@@ -0,0 +1,227 @@
+/**
+ ******************************************************************************
+ * @file tsl_check_config_stm32f3xx.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains the check of all parameters defined in the
+ * STM32F3XX configuration file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_CHECK_CONFIG_STM32F3XX_H
+#define __TSL_CHECK_CONFIG_STM32F3XX_H
+
+//------------------------------------------------------------------------------
+
+#if ((TSLPRM_TOTAL_CHANNELS < 1) || (TSLPRM_TOTAL_CHANNELS > 24))
+#error "TSLPRM_TOTAL_CHANNELS is out of range (1 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_BANKS < 1) || (TSLPRM_TOTAL_BANKS > 8))
+#error "TSLPRM_TOTAL_BANKS is out of range (1 .. 8)."
+#endif
+
+#if ((TSLPRM_TOTAL_TOUCHKEYS < 0) || (TSLPRM_TOTAL_TOUCHKEYS > 24))
+#error "TSLPRM_TOTAL_TOUCHKEYS is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_TOUCHKEYS_B < 0) || (TSLPRM_TOTAL_TOUCHKEYS_B > 24))
+#error "TSLPRM_TOTAL_TOUCHKEYS_B is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_LINROTS < 0) || (TSLPRM_TOTAL_LINROTS > 24))
+#error "TSLPRM_TOTAL_LINROTS is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_LINROTS_B < 0) || (TSLPRM_TOTAL_LINROTS_B > 24))
+#error "TSLPRM_TOTAL_LINROTS_B is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_OBJECTS < 1) || (TSLPRM_TOTAL_OBJECTS > 24))
+#error "TSLPRM_TOTAL_OBJECTS is out of range (1 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_TKEYS + TSLPRM_TOTAL_LNRTS) > 24)
+#error "The Sum of TouchKeys and Linear/Rotary sensors exceeds 24."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_GPIO_CONFIG
+#error "TSLPRM_TSC_GPIO_CONFIG is not defined."
+#endif
+
+#if ((TSLPRM_TSC_GPIO_CONFIG < 0) || (TSLPRM_TSC_GPIO_CONFIG > 1))
+#error "TSLPRM_TSC_GPIO_CONFIG is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_CTPH
+#error "TSLPRM_TSC_CTPH is not defined."
+#endif
+
+#if ((TSLPRM_TSC_CTPH < 0) || (TSLPRM_TSC_CTPH > 15))
+#error "TSLPRM_TSC_CTPH is out of range (0 .. 15)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_CTPL
+#error "TSLPRM_TSC_CTPL is not defined."
+#endif
+
+#if ((TSLPRM_TSC_CTPL < 0) || (TSLPRM_TSC_CTPL > 15))
+#error "TSLPRM_TSC_CTPL is out of range (0 .. 15)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_PGPSC
+#error "TSLPRM_TSC_PGPSC is not defined."
+#endif
+
+#if ((TSLPRM_TSC_PGPSC < 0) || (TSLPRM_TSC_PGPSC > 7))
+#error "TSLPRM_TSC_PGPSC is out of range (0 .. 7)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#if (TSLPRM_ACQ_MAX > 0) && (TSLPRM_ACQ_MAX < 256)
+#define TSLPRM_TSC_MCV 0 // 255
+#endif
+
+#if (TSLPRM_ACQ_MAX > 255) && (TSLPRM_ACQ_MAX < 512)
+#define TSLPRM_TSC_MCV 1 // 511
+#endif
+
+#if (TSLPRM_ACQ_MAX > 511) && (TSLPRM_ACQ_MAX < 1024)
+#define TSLPRM_TSC_MCV 2 // 1023
+#endif
+
+#if (TSLPRM_ACQ_MAX > 1023) && (TSLPRM_ACQ_MAX < 2048)
+#define TSLPRM_TSC_MCV 3 // 2047
+#endif
+
+#if (TSLPRM_ACQ_MAX > 2047) && (TSLPRM_ACQ_MAX < 4096)
+#define TSLPRM_TSC_MCV 4 // 4095
+#endif
+
+#if (TSLPRM_ACQ_MAX > 4095) && (TSLPRM_ACQ_MAX < 8192)
+#define TSLPRM_TSC_MCV 5 // 8191
+#endif
+
+#if (TSLPRM_ACQ_MAX > 8191)
+#define TSLPRM_TSC_MCV 6 // 16383
+#endif
+
+#ifndef TSLPRM_TSC_MCV
+#error "TSLPRM_TSC_MCV is not defined."
+#endif
+
+#if ((TSLPRM_TSC_MCV < 0) || (TSLPRM_TSC_MCV > 6))
+#error "TSLPRM_TSC_MCV is out of range (0 .. 6)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_IODEF
+#error "TSLPRM_TSC_IODEF is not defined."
+#endif
+
+#if ((TSLPRM_TSC_IODEF < 0) || (TSLPRM_TSC_IODEF > 1))
+#error "TSLPRM_TSC_IODEF is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_AM
+#error "TSLPRM_TSC_AM is not defined."
+#endif
+
+#if ((TSLPRM_TSC_AM < 0) || (TSLPRM_TSC_AM > 1))
+#error "TSLPRM_TSC_AM is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_SYNC_PIN
+#error "TSLPRM_TSC_SYNC_PIN is not defined."
+#endif
+
+#if ((TSLPRM_TSC_SYNC_PIN < 0) || (TSLPRM_TSC_SYNC_PIN > 2))
+#error "TSLPRM_TSC_SYNC_PIN is out of range (0 .. 2)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_SYNC_POL
+#error "TSLPRM_TSC_SYNC_POL is not defined."
+#endif
+
+#if ((TSLPRM_TSC_SYNC_POL < 0) || (TSLPRM_TSC_SYNC_POL > 1))
+#error "TSLPRM_TSC_SYNC_POL is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_USE_SS
+#error "TSLPRM_TSC_USE_SS is not defined."
+#endif
+
+#if ((TSLPRM_TSC_USE_SS < 0) || (TSLPRM_TSC_USE_SS > 1))
+#error "TSLPRM_TSC_USE_SS is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_SSD
+#error "TSLPRM_TSC_SSD is not defined."
+#endif
+
+#if ((TSLPRM_TSC_SSD < 0) || (TSLPRM_TSC_SSD > 127))
+#error "TSLPRM_TSC_SSD is out of range (0 .. 127)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TSC_SSPSC
+#error "TSLPRM_TSC_SSPSC is not defined."
+#endif
+
+#if ((TSLPRM_TSC_SSPSC < 0) || (TSLPRM_TSC_SSPSC > 1))
+#error "TSLPRM_TSC_SSPSC is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_DELAY_DISCHARGE_ALL
+#error "TSLPRM_DELAY_DISCHARGE_ALL is not defined."
+#endif
+
+#if ((TSLPRM_DELAY_DISCHARGE_ALL < 0) || (TSLPRM_DELAY_DISCHARGE_ALL > 65535))
+#error "TSLPRM_DELAY_DISCHARGE_ALL is out of range (0 .. 65535)."
+#endif
+
+#endif /* __TSL_CHECK_CONFIG_STM32F3XX_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm32l1xx.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm32l1xx.h
new file mode 100644
index 0000000..e948768
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm32l1xx.h
@@ -0,0 +1,401 @@
+/**
+ ******************************************************************************
+ * @file tsl_check_config_stm32l1xx.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains the check of all parameters defined in the
+ * STM32L1XX configuration file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_CHECK_CONFIG_STM32L1XX_H
+#define __TSL_CHECK_CONFIG_STM32L1XX_H
+
+//------------------------------------------------------------------------------
+
+#if ((TSLPRM_TOTAL_CHANNELS < 1) || (TSLPRM_TOTAL_CHANNELS > 24))
+#error "TSLPRM_TOTAL_CHANNELS is out of range (1 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_BANKS < 1) || (TSLPRM_TOTAL_BANKS > 8))
+#error "TSLPRM_TOTAL_BANKS is out of range (1 .. 8)."
+#endif
+
+#if ((TSLPRM_TOTAL_TOUCHKEYS < 0) || (TSLPRM_TOTAL_TOUCHKEYS > 24))
+#error "TSLPRM_TOTAL_TOUCHKEYS is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_TOUCHKEYS_B < 0) || (TSLPRM_TOTAL_TOUCHKEYS_B > 24))
+#error "TSLPRM_TOTAL_TOUCHKEYS_B is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_LINROTS < 0) || (TSLPRM_TOTAL_LINROTS > 24))
+#error "TSLPRM_TOTAL_LINROTS is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_LINROTS_B < 0) || (TSLPRM_TOTAL_LINROTS_B > 24))
+#error "TSLPRM_TOTAL_LINROTS_B is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_OBJECTS < 1) || (TSLPRM_TOTAL_OBJECTS > 24))
+#error "TSLPRM_TOTAL_OBJECTS is out of range (1 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_TKEYS + TSLPRM_TOTAL_LNRTS) > 24)
+#error "The Sum of TouchKeys and Linear/Rotary sensors exceeds 24."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_USE_SHIELD
+#error "TSLPRM_USE_SHIELD is not defined."
+#endif
+
+#if ((TSLPRM_USE_SHIELD < 0) || (TSLPRM_USE_SHIELD > 1))
+#error "TSLPRM_USE_SHIELD is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_IODEF
+#error "TSLPRM_IODEF is not defined."
+#endif
+
+#if ((TSLPRM_IODEF < 0) || (TSLPRM_IODEF > 1))
+#error "TSLPRM_IODEF is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#if defined(STM32L1XX_MD) || defined(TSLPRM_STM32L1XX_SW_ACQ)
+
+#ifndef TSLPRM_DELAY_TRANSFER
+#error "TSLPRM_DELAY_TRANSFER is not defined."
+#endif
+
+#if ((TSLPRM_DELAY_TRANSFER < 0) || (TSLPRM_DELAY_TRANSFER > 65535))
+#error "TSLPRM_DELAY_TRANSFER is out of range (0 .. 65535)."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if defined(STM32L1XX_MD) || defined(TSLPRM_STM32L1XX_SW_ACQ)
+
+#ifndef TSLPRM_USE_SPREAD_SPECTRUM
+#error "TSLPRM_USE_SPREAD_SPECTRUM is not defined."
+#endif
+
+#if ((TSLPRM_USE_SPREAD_SPECTRUM < 0) || (TSLPRM_USE_SPREAD_SPECTRUM > 1))
+#error "TSLPRM_USE_SPREAD_SPECTRUM is out of range (0 .. 1)."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if defined(STM32L1XX_MD) || defined(TSLPRM_STM32L1XX_SW_ACQ)
+
+#ifndef TSLPRM_SPREAD_MIN
+#error "TSLPRM_SPREAD_MIN is not defined."
+#endif
+
+#if (TSLPRM_USE_SPREAD_SPECTRUM == 1)
+#if ((TSLPRM_SPREAD_MIN < 1) || (TSLPRM_SPREAD_MIN >= TSLPRM_SPREAD_MAX))
+#error "TSLPRM_SPREAD_MIN is out of range (1 .. TSLPRM_SPREAD_MAX-1)."
+#endif
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if defined(STM32L1XX_MD) || defined(TSLPRM_STM32L1XX_SW_ACQ)
+
+#ifndef TSLPRM_SPREAD_MAX
+#error "TSLPRM_SPREAD_MAX is not defined."
+#endif
+
+#if (TSLPRM_USE_SPREAD_SPECTRUM == 1)
+#if ((TSLPRM_SPREAD_MAX > 255) || (TSLPRM_SPREAD_MAX <= TSLPRM_SPREAD_MIN))
+#error "TSLPRM_SPREAD_MAX is out of range (TSLPRM_SPREAD_MIN+1 .. 255)."
+#endif
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && !defined(TSLPRM_STM32L1XX_SW_ACQ)
+
+#ifndef TSLPRM_CT_PERIOD
+#error "TSLPRM_CT_PERIOD is not defined."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && !defined(TSLPRM_STM32L1XX_SW_ACQ)
+
+#ifndef TSLPRM_TIMER_FREQ
+#error "TSLPRM_TIMER_FREQ is not defined."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && !defined(TSLPRM_STM32L1XX_SW_ACQ)
+
+#define TMP_RELOAD ((TSLPRM_CT_PERIOD * TSLPRM_TIMER_FREQ)/2)
+
+#if ((TMP_RELOAD < 4) || (TMP_RELOAD > 16534))
+#error "The calculated Timer RELOAD value is out of range (4 .. 65534)."
+#endif
+
+#if ((TMP_RELOAD % 2) != (0))
+#error "The calculated Timer RELOAD value is odd and must be even."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && defined(TSLPRM_STM32L1XX_SW_ACQ)
+
+#ifndef TSLPRM_PROTECT_IO_ACCESS
+#error "TSLPRM_PROTECT_IO_ACCESS is not defined."
+#endif
+
+#if ((TSLPRM_PROTECT_IO_ACCESS < 0) || (TSLPRM_PROTECT_IO_ACCESS > 1))
+#error "TSLPRM_PROTECT_IO_ACCESS is out of range (0 .. 1)."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && defined(TSLPRM_STM32L1XX_SW_ACQ)
+
+#ifndef TSLPRM_USE_GPIOA
+#error "TSLPRM_USE_GPIOA is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOA < 0) || (TSLPRM_USE_GPIOA > 1))
+#error "TSLPRM_USE_GPIOA is out of range (0 .. 1)."
+#endif
+
+#ifndef TSLPRM_USE_GPIOB
+#error "TSLPRM_USE_GPIOB is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOB < 0) || (TSLPRM_USE_GPIOB > 1))
+#error "TSLPRM_USE_GPIOB is out of range (0 .. 1)."
+#endif
+
+#ifndef TSLPRM_USE_GPIOC
+#error "TSLPRM_USE_GPIOC is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOC < 0) || (TSLPRM_USE_GPIOC > 1))
+#error "TSLPRM_USE_GPIOC is out of range (0 .. 1)."
+#endif
+
+#ifndef TSLPRM_USE_GPIOF
+#error "TSLPRM_USE_GPIOA is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOF < 0) || (TSLPRM_USE_GPIOF > 1))
+#error "TSLPRM_USE_GPIOF is out of range (0 .. 1)."
+#endif
+
+#ifndef TSLPRM_USE_GPIOG
+#error "TSLPRM_USE_GPIOG is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOG < 0) || (TSLPRM_USE_GPIOG > 1))
+#error "TSLPRM_USE_GPIOG is out of range (0 .. 1)."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if defined(STM32L1XX_MD)
+
+#ifndef TSLPRM_PROTECT_IO_ACCESS
+#error "TSLPRM_PROTECT_IO_ACCESS is not defined."
+#endif
+
+#if ((TSLPRM_PROTECT_IO_ACCESS < 0) || (TSLPRM_PROTECT_IO_ACCESS > 1))
+#error "TSLPRM_PROTECT_IO_ACCESS is out of range (0 .. 1)."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if defined(STM32L1XX_MD)
+
+#ifndef TSLPRM_USE_GPIOA
+#error "TSLPRM_USE_GPIOA is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOA < 0) || (TSLPRM_USE_GPIOA > 1))
+#error "TSLPRM_USE_GPIOA is out of range (0 .. 1)."
+#endif
+
+#ifndef TSLPRM_USE_GPIOB
+#error "TSLPRM_USE_GPIOB is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOB < 0) || (TSLPRM_USE_GPIOB > 1))
+#error "TSLPRM_USE_GPIOB is out of range (0 .. 1)."
+#endif
+
+#ifndef TSLPRM_USE_GPIOC
+#error "TSLPRM_USE_GPIOC is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOC < 0) || (TSLPRM_USE_GPIOC > 1))
+#error "TSLPRM_USE_GPIOC is out of range (0 .. 1)."
+#endif
+
+#ifndef TSLPRM_USE_GPIOF
+#error "TSLPRM_USE_GPIOA is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOF < 0) || (TSLPRM_USE_GPIOF > 1))
+#error "TSLPRM_USE_GPIOF is out of range (0 .. 1)."
+#endif
+
+#ifndef TSLPRM_USE_GPIOG
+#error "TSLPRM_USE_GPIOG is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOG < 0) || (TSLPRM_USE_GPIOG > 1))
+#error "TSLPRM_USE_GPIOG is out of range (0 .. 1)."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && !defined(TSLPRM_STM32L1XX_SW_ACQ)
+
+#ifndef TSLPRM_CT_PERIOD
+#error "TSLPRM_CT_PERIOD is not defined."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && !defined(TSLPRM_STM32L1XX_SW_ACQ)
+
+#ifndef TSLPRM_TIMER_FREQ
+#error "TSLPRM_TIMER_FREQ is not defined."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && !defined(TSLPRM_STM32L1XX_SW_ACQ)
+
+#define TMP_RELOAD ((TSLPRM_CT_PERIOD * TSLPRM_TIMER_FREQ)/2)
+
+#if ((TMP_RELOAD < 4) || (TMP_RELOAD > 16534))
+#error "The calculated Timer RELOAD value is out of range (4 .. 65534)."
+#endif
+
+#if ((TMP_RELOAD % 2) != (0))
+#error "The calculated Timer RELOAD value is odd and must be even."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if defined(STM32L1XX_MDP) && defined(TSLPRM_STM32L1XX_SW_ACQ)
+
+#ifndef TSLPRM_PROTECT_IO_ACCESS
+#error "TSLPRM_PROTECT_IO_ACCESS is not defined."
+#endif
+
+#if ((TSLPRM_PROTECT_IO_ACCESS < 0) || (TSLPRM_PROTECT_IO_ACCESS > 1))
+#error "TSLPRM_PROTECT_IO_ACCESS is out of range (0 .. 1)."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#if defined(STM32L1XX_MDP) && defined(TSLPRM_STM32L1XX_SW_ACQ)
+
+#ifndef TSLPRM_USE_GPIOA
+#error "TSLPRM_USE_GPIOA is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOA < 0) || (TSLPRM_USE_GPIOA > 1))
+#error "TSLPRM_USE_GPIOA is out of range (0 .. 1)."
+#endif
+
+#ifndef TSLPRM_USE_GPIOB
+#error "TSLPRM_USE_GPIOB is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOB < 0) || (TSLPRM_USE_GPIOB > 1))
+#error "TSLPRM_USE_GPIOB is out of range (0 .. 1)."
+#endif
+
+#ifndef TSLPRM_USE_GPIOC
+#error "TSLPRM_USE_GPIOC is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOC < 0) || (TSLPRM_USE_GPIOC > 1))
+#error "TSLPRM_USE_GPIOC is out of range (0 .. 1)."
+#endif
+
+#ifndef TSLPRM_USE_GPIOF
+#error "TSLPRM_USE_GPIOA is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOF < 0) || (TSLPRM_USE_GPIOF > 1))
+#error "TSLPRM_USE_GPIOF is out of range (0 .. 1)."
+#endif
+
+#ifndef TSLPRM_USE_GPIOG
+#error "TSLPRM_USE_GPIOG is not defined."
+#endif
+
+#if ((TSLPRM_USE_GPIOG < 0) || (TSLPRM_USE_GPIOG > 1))
+#error "TSLPRM_USE_GPIOG is out of range (0 .. 1)."
+#endif
+
+#endif
+
+#endif /* __TSL_CHECK_CONFIG_STM32L1XX_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm8l.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm8l.h
new file mode 100644
index 0000000..ecfb3a8
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm8l.h
@@ -0,0 +1,211 @@
+/**
+ ******************************************************************************
+ * @file tsl_check_config_stm8l.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains the check of all parameters defined in the
+ * STM8L configuration file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_CHECK_CONFIG_STM8L_H
+#define __TSL_CHECK_CONFIG_STM8L_H
+
+//------------------------------------------------------------------------------
+
+#if ((TSLPRM_TOTAL_CHANNELS < 1) || (TSLPRM_TOTAL_CHANNELS > 24))
+#error "TSLPRM_TOTAL_CHANNELS is out of range (1 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_BANKS < 1) || (TSLPRM_TOTAL_BANKS > 8))
+#error "TSLPRM_TOTAL_BANKS is out of range (1 .. 8)."
+#endif
+
+#if ((TSLPRM_TOTAL_TOUCHKEYS < 0) || (TSLPRM_TOTAL_TOUCHKEYS > 24))
+#error "TSLPRM_TOTAL_TOUCHKEYS is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_TOUCHKEYS_B < 0) || (TSLPRM_TOTAL_TOUCHKEYS_B > 24))
+#error "TSLPRM_TOTAL_TOUCHKEYS_B is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_LINROTS < 0) || (TSLPRM_TOTAL_LINROTS > 24))
+#error "TSLPRM_TOTAL_LINROTS is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_LINROTS_B < 0) || (TSLPRM_TOTAL_LINROTS_B > 24))
+#error "TSLPRM_TOTAL_LINROTS_B is out of range (0 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_OBJECTS < 1) || (TSLPRM_TOTAL_OBJECTS > 24))
+#error "TSLPRM_TOTAL_OBJECTS is out of range (1 .. 24)."
+#endif
+
+#if ((TSLPRM_TOTAL_TKEYS + TSLPRM_TOTAL_LNRTS) > 24)
+#error "The Sum of TouchKeys and Linear/Rotary sensors exceeds 24."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_USE_SHIELD
+#error "TSLPRM_USE_SHIELD is not defined."
+#endif
+
+#if ((TSLPRM_USE_SHIELD < 0) || (TSLPRM_USE_SHIELD > 1))
+#error "TSLPRM_USE_SHIELD is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_IODEF
+#error "TSLPRM_IODEF is not defined."
+#endif
+
+#if ((TSLPRM_IODEF < 0) || (TSLPRM_IODEF > 1))
+#error "TSLPRM_IODEF is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_DELAY_DISCHARGE_ALL
+#error "TSLPRM_DELAY_DISCHARGE_ALL is not defined."
+#endif
+
+#if ((TSLPRM_DELAY_DISCHARGE_ALL < 0) || (TSLPRM_DELAY_DISCHARGE_ALL > 65535))
+#error "TSLPRM_DELAY_DISCHARGE_ALL is out of range (0 .. 65535)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifdef TSLPRM_STM8L1XX_SW_ACQ // Software acquisition
+
+#ifndef TSLPRM_PROTECT_IO_ACCESS
+#error "TSLPRM_PROTECT_IO_ACCESS is not defined."
+#endif
+
+#if ((TSLPRM_PROTECT_IO_ACCESS < 0) || (TSLPRM_PROTECT_IO_ACCESS > 1))
+#error "TSLPRM_PROTECT_IO_ACCESS is out of range (0 .. 1)."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifdef TSLPRM_STM8L1XX_SW_ACQ // Software acquisition
+
+#ifndef TSLPRM_DELAY_CHARGE
+#error "TSLPRM_DELAY_CHARGE is not defined."
+#endif
+
+#if ((TSLPRM_DELAY_CHARGE < 0) || (TSLPRM_DELAY_CHARGE > 32))
+#error "TSLPRM_DELAY_CHARGE is out of range (0 .. 32)."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifdef TSLPRM_STM8L1XX_SW_ACQ // Software acquisition
+
+#ifndef TSLPRM_DELAY_TRANSFER
+#error "TSLPRM_DELAY_TRANSFER is not defined."
+#endif
+
+#if ((TSLPRM_DELAY_TRANSFER < 0) || (TSLPRM_DELAY_TRANSFER > 32))
+#error "TSLPRM_DELAY_TRANSFER is out of range (0 .. 32)."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_USE_SPREAD_SPECTRUM
+#error "TSLPRM_USE_SPREAD_SPECTRUM is not defined."
+#endif
+
+#if ((TSLPRM_USE_SPREAD_SPECTRUM < 0) || (TSLPRM_USE_SPREAD_SPECTRUM > 1))
+#error "TSLPRM_USE_SPREAD_SPECTRUM is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_SPREAD_MIN
+#error "TSLPRM_SPREAD_MIN is not defined."
+#endif
+
+#if (TSLPRM_USE_SPREAD_SPECTRUM == 1)
+#if ((TSLPRM_SPREAD_MIN < 1) || (TSLPRM_SPREAD_MIN >= TSLPRM_SPREAD_MAX))
+#error "TSLPRM_SPREAD_MIN is out of range (1 .. TSLPRM_SPREAD_MAX-1)."
+#endif
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_SPREAD_MAX
+#error "TSLPRM_SPREAD_MAX is not defined."
+#endif
+
+#if (TSLPRM_USE_SPREAD_SPECTRUM == 1)
+#if ((TSLPRM_SPREAD_MAX > 255) || (TSLPRM_SPREAD_MAX <= TSLPRM_SPREAD_MIN))
+#error "TSLPRM_SPREAD_MAX is out of range (TSLPRM_SPREAD_MIN+1 .. 255)."
+#endif
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_STM8L1XX_SW_ACQ // Hardware acquisition
+
+#ifndef TSLPRM_CT_PERIOD
+#error "TSLPRM_CT_PERIOD is not defined."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_STM8L1XX_SW_ACQ // Hardware acquisition
+
+#ifndef TSLPRM_TIMER_FREQ
+#error "TSLPRM_TIMER_FREQ is not defined."
+#endif
+
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_STM8L1XX_SW_ACQ // Hardware acquisition
+
+#define TMP_RELOAD ((TSLPRM_CT_PERIOD * TSLPRM_TIMER_FREQ) / 2)
+
+#if ((TMP_RELOAD < 4) || (TMP_RELOAD > 65534))
+#error "The calculated Timer RELOAD value is out of range (4 .. 65534)."
+#endif
+
+#if ((TMP_RELOAD % 2) != (0))
+#error "The calculated Timer RELOAD value is odd and must be even."
+#endif
+
+#endif
+
+#endif /* __TSL_CHECK_CONFIG_STM8L_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm8tl5x.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm8tl5x.h
new file mode 100644
index 0000000..cb9514f
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_check_config_stm8tl5x.h
@@ -0,0 +1,270 @@
+/**
+ ******************************************************************************
+ * @file tsl_check_config_stm8tl5x.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains the check of all parameters defined in the
+ * STM8TL5X configuration file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_CHECK_CONFIG_STM8TL5X_H
+#define __TSL_CHECK_CONFIG_STM8TL5X_H
+
+//------------------------------------------------------------------------------
+
+#if ((TSLPRM_MCU < 0) && (TSLPRM_MCU > 4))
+#error "The MCU selected is not in the STM8TL5x MCU list !"
+#endif
+
+#if (TSLPRM_MCU > 0)
+#define __MAX_RX 7
+#else
+#define __MAX_RX 9
+#endif
+
+//------------------------------------------------------------------------------
+
+#if ((TSLPRM_TOTAL_CHANNELS < 1) || (TSLPRM_TOTAL_CHANNELS > 300))
+#error "TSLPRM_TOTAL_CHANNELS is out of range (1 .. 300)."
+#endif
+
+#if ((TSLPRM_TOTAL_BANKS < 1) || (TSLPRM_TOTAL_BANKS > 15))
+#error "TSLPRM_TOTAL_BANKS is out of range (1 .. 15)."
+#endif
+
+#if ((TSLPRM_TOTAL_TOUCHKEYS < 0) || (TSLPRM_TOTAL_TOUCHKEYS > 256))
+#error "TSLPRM_TOTAL_TOUCHKEYS is out of range (0 .. 256)."
+#endif
+
+#if ((TSLPRM_TOTAL_TOUCHKEYS_B < 0) || (TSLPRM_TOTAL_TOUCHKEYS_B > 256))
+#error "TSLPRM_TOTAL_TOUCHKEYS_B is out of range (0 .. 256)."
+#endif
+
+#if ((TSLPRM_TOTAL_LINROTS < 0) || (TSLPRM_TOTAL_LINROTS > 256))
+#error "TSLPRM_TOTAL_LINROTS is out of range (0 .. 256)."
+#endif
+
+#if ((TSLPRM_TOTAL_LINROTS_B < 0) || (TSLPRM_TOTAL_LINROTS_B > 256))
+#error "TSLPRM_TOTAL_LINROTS_B is out of range (0 .. 256)."
+#endif
+
+#if ((TSLPRM_TOTAL_OBJECTS < 1) || (TSLPRM_TOTAL_OBJECTS > 256))
+#error "TSLPRM_TOTAL_OBJECTS is out of range (1 .. 256)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_KEY_TARGET_REFERENCE
+#error "TSLPRM_KEY_TARGET_REFERENCE is not defined."
+#endif
+
+#if ((TSLPRM_KEY_TARGET_REFERENCE < 100) || (TSLPRM_KEY_TARGET_REFERENCE > 2000))
+#error "TSLPRM_KEY_TARGET_REFERENCE is out of range (100 .. 2000)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_KEY_TARGET_REFERENCE_ERROR
+#error "TSLPRM_KEY_TARGET_REFERENCE_ERROR is not defined."
+#endif
+
+#if ((TSLPRM_KEY_TARGET_REFERENCE_ERROR < 1) || (TSLPRM_KEY_TARGET_REFERENCE_ERROR > TSLPRM_KEY_TARGET_REFERENCE))
+#error "TSLPRM_KEY_TARGET_REFERENCE_ERROR is out of range (1 .. TSLPRM_KEY_TARGET_REFERENCE)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_PXS_EPCC_FINE_TUNING_ITERATION
+#error "TSLPRM_PXS_EPCC_FINE_TUNING_ITERATION is not defined."
+#endif
+
+#if ((TSLPRM_PXS_EPCC_FINE_TUNING_ITERATION < 3) || (TSLPRM_PXS_EPCC_FINE_TUNING_ITERATION > 5))
+#error "TSLPRM_PXS_EPCC_FINE_TUNING_ITERATION is out of range (3 .. 5)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_KEY_TARGET_ATTENUATION
+#error "TSLPRM_KEY_TARGET_ATTENUATION is not defined."
+#endif
+
+#if ((TSLPRM_KEY_TARGET_ATTENUATION != 1) && (TSLPRM_KEY_TARGET_ATTENUATION != 2) &&\
+ (TSLPRM_KEY_TARGET_ATTENUATION != 4) && (TSLPRM_KEY_TARGET_ATTENUATION != 8))
+#error "TSLPRM_KEY_TARGET_ATTENUATION is out of range (1,2,4,8)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_TOUCHKEY_REFERENCE_RANGE
+#error "TSLPRM_TOUCHKEY_REFERENCE_RANGE is not defined."
+#endif
+
+#if ((TSLPRM_TOUCHKEY_REFERENCE_RANGE < 1) || (TSLPRM_TOUCHKEY_REFERENCE_RANGE > TSLPRM_KEY_TARGET_REFERENCE))
+#error "TSLPRM_TOUCHKEY_REFERENCE_RANGE is out of range (1 .. TSLPRM_KEY_TARGET_REFERENCE)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_LINROT_REFERENCE_RANGE
+#error "TSLPRM_LINROT_REFERENCE_RANGE is not defined."
+#endif
+
+#if ((TSLPRM_LINROT_REFERENCE_RANGE < 1) || (TSLPRM_LINROT_REFERENCE_RANGE > TSLPRM_KEY_TARGET_REFERENCE))
+#error "TSLPRM_LINROT_REFERENCE_RANGE is out of range (1 .. TSLPRM_KEY_TARGET_REFERENCE)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_PXS_HSI
+#error "TSLPRM_PXS_HSI is not defined."
+#endif
+
+#if ((TSLPRM_PXS_HSI != 16000) && (TSLPRM_PXS_HSI != 8000) && (TSLPRM_PXS_HSI != 4000) && \
+ (TSLPRM_PXS_HSI != 2000) && (TSLPRM_PXS_HSI != 1000) && (TSLPRM_PXS_HSI != 500) && \
+ (TSLPRM_PXS_HSI != 250) && (TSLPRM_PXS_HSI != 125))
+#error "TSLPRM_PXS_HSI is out of range (16000, 8000, 4000, 2000, 1000, 500, 250, 125)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_PXS_UP_LENGTH
+#error "TSLPRM_PXS_UP_LENGTH is not defined."
+#endif
+
+#if ((TSLPRM_PXS_UP_LENGTH < 1) || (TSLPRM_PXS_UP_LENGTH > 7))
+#error "TSLPRM_PXS_UP_LENGTH is out of range (1 .. 7)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_PXS_PASS_LENGTH
+#error "TSLPRM_PXS_PASS_LENGTH is not defined."
+#endif
+
+#if ((TSLPRM_PXS_PASS_LENGTH < 1) || (TSLPRM_PXS_PASS_LENGTH > 7))
+#error "TSLPRM_PXS_PASS_LENGTH is out of range (1 .. 7)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_PXS_LOW_POWER_MODE
+#error "TSLPRM_PXS_LOW_POWER_MODE is not defined."
+#endif
+
+#if ((TSLPRM_PXS_LOW_POWER_MODE != 0) && (TSLPRM_PXS_LOW_POWER_MODE != 1))
+#error "TSLPRM_PXS_LOW_POWER_MODE is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_PXS_RF_DETECTION
+#error "TSLPRM_PXS_RF_DETECTION is not defined."
+#endif
+
+#if ((TSLPRM_PXS_RF_DETECTION != 0) && (TSLPRM_PXS_RF_DETECTION != 1))
+#error "TSLPRM_PXS_RF_DETECTION is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_PXS_SYNCHRONIZE
+#error "TSLPRM_PXS_SYNCHRONIZE is not defined."
+#endif
+
+#if ((TSLPRM_PXS_SYNCHRONIZE != 0) && (TSLPRM_PXS_SYNCHRONIZE != 1))
+#error "TSLPRM_PXS_SYNCHRONIZE is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_PXS_SYNCHRO_EDGE
+#error "TSLPRM_PXS_SYNCHRO_EDGE is not defined."
+#endif
+
+#if ((TSLPRM_PXS_SYNCHRO_EDGE != 0) && (TSLPRM_PXS_SYNCHRO_EDGE != 1))
+#error "TSLPRM_PXS_SYNCHRO_EDGE is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_PXS_INACTIVE_TX
+#error "TSLPRM_PXS_INACTIVE_TX is not defined."
+#endif
+
+#if ((TSLPRM_PXS_INACTIVE_TX != 0) && (TSLPRM_PXS_INACTIVE_TX != 1))
+#error "TSLPRM_PXS_INACTIVE_TX is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_PXS_INACTIVE_RX
+#error "TSLPRM_PXS_INACTIVE_RX is not defined."
+#endif
+
+#if ((TSLPRM_PXS_INACTIVE_RX != 0) && (TSLPRM_PXS_INACTIVE_RX != 1))
+#error "TSLPRM_PXS_INACTIVE_RX is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_PXS_RX_COUPLING
+#error "TSLPRM_PXS_RX_COUPLING is not defined."
+#endif
+
+#if ((TSLPRM_PXS_RX_COUPLING != 0) && (TSLPRM_PXS_RX_COUPLING != 1))
+#error "TSLPRM_PXS_RX_COUPLING is out of range (0 .. 1)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_PXS_STAB
+#error "TSLPRM_PXS_STAB is not defined."
+#endif
+
+#if ((TSLPRM_PXS_STAB != LONG_STAB) && (TSLPRM_PXS_STAB != MEDIUM_STAB) && (TSLPRM_PXS_STAB != SHORT_STAB))
+#error "TSLPRM_PXS_STAB is out of range (LONG_STAB, MEDIUM_STAB, SHORT_STAB)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_PXS_BIAS
+#error "TSLPRM_PXS_BIAS is not defined."
+#endif
+
+#if ((TSLPRM_PXS_BIAS != HIGH_BIAS) && (TSLPRM_PXS_BIAS != MEDIUM_BIAS) && (TSLPRM_PXS_BIAS != LOW_BIAS) && (TSLPRM_PXS_BIAS != VERY_LOW_BIAS))
+#error "TSLPRM_PXS_BIAS is out of range (HIGH_BIAS, MEDIUM_BIAS, LOW_BIAS, VERY_LOW_BIAS)."
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifndef TSLPRM_HIGH_CHANNEL_NB
+#error "TSLPRM_HIGH_CHANNEL_NB is not defined."
+#endif
+
+#if ((TSLPRM_HIGH_CHANNEL_NB < 0) || (TSLPRM_HIGH_CHANNEL_NB > __MAX_RX))
+#error "TSLPRM_HIGH_CHANNEL_NB is out of range (0..9 for STM8TL53C4, 0..7 for STM8TL53G4)."
+#endif
+
+#endif /* __TSL_CHECK_CONFIG_STM8TL5X_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm32f0xx.h_TOADAPT b/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm32f0xx.h_TOADAPT
new file mode 100644
index 0000000..2dc3877
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm32f0xx.h_TOADAPT
@@ -0,0 +1,629 @@
+/**
+ ******************************************************************************
+ * @file tsl_conf_stm32f0xx.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief Acquisition parameters for STM32F0xx products.
+ * @note This file must be copied in the application project and values
+ * changed for the application.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_CONF_STM32F0XX_H
+#define __TSL_CONF_STM32F0XX_H
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++ COMMON PARAMETERS ++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+/** @defgroup Common_Parameters Common Parameters
+ * @{ */
+
+//==============================================================================
+// Number of elements
+//==============================================================================
+
+/** @defgroup Common_Parameters_Number_Of_Elements 01 - Number of elements
+ * @{ */
+
+/** Total number of channels in application (range=1..255)
+*/
+#define TSLPRM_TOTAL_CHANNELS (1)
+
+/** Total number of banks in application (range=1..255)
+*/
+#define TSLPRM_TOTAL_BANKS (1)
+
+/** Total number of "Extended" TouchKeys in application (range=0..255)
+*/
+#define TSLPRM_TOTAL_TOUCHKEYS (1)
+
+/** Total number of "Basic" TouchKeys in application (range=0..255)
+*/
+#define TSLPRM_TOTAL_TOUCHKEYS_B (1)
+
+/** Total number of "Extended" Linear and Rotary sensors in application (range=0..255)
+ - Count also the 1-channel linear sensor used as TouchKey
+*/
+#define TSLPRM_TOTAL_LINROTS (1)
+
+/** Total number of "Basic" Linear and Rotary sensors in application (range=0..255)
+ - Count also the 1-channel linear sensor used as TouchKey
+*/
+#define TSLPRM_TOTAL_LINROTS_B (1)
+
+/** Total number of sensors/objects in application (range=1..255)
+ - Count all TouchKeys, Linear and Rotary sensors
+*/
+#define TSLPRM_TOTAL_OBJECTS (1)
+
+/** @} Common_Parameters_Number_Of_Elements */
+
+//==============================================================================
+// Optional features
+//==============================================================================
+
+/** @defgroup Common_Parameters_Options 02 - Optional features
+ * @{ */
+
+/** Record the last measure (0=No, 1=Yes)
+ - If No the measure is recalculated using the Reference and Delta
+*/
+#define TSLPRM_USE_MEAS (1)
+
+/** Zone management usage (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_ZONE (1)
+
+/** Proximity detection usage (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_PROX (1)
+
+/** Use the Timer tick callback (0=No, 1=Yes)
+ - When equal to 1, the function TSL_CallBack_TimerTick must be defined in
+ the application code. It is called for each timer interruption.
+*/
+#define TSLPRM_USE_TIMER_CALLBACK (1)
+
+/** Acquisition interrupt mode (0=No, 1=Yes)
+ - If No the TS interrupt is not used.
+ - If Yes the TS interrupt is used.
+*/
+#define TSLPRM_USE_ACQ_INTERRUPT (1)
+
+/** @} Common_Parameters_Options */
+
+//==============================================================================
+// Acquisition limits
+//==============================================================================
+
+/** @defgroup Common_Parameters_Acquisition_Limits 03 - Acquisition limits
+ * @{ */
+
+/** Minimum acquisition measurement (range=0..65535)
+ - This is the minimum acceptable value for the acquisition measure.
+ - The acquisition will be in error if the measure is below this value.
+*/
+#define TSLPRM_ACQ_MIN (10)
+
+/** Maximum acquisition measurement (range=255, 511, 1023, 2047, 8191, 16383)
+ - This is the maximum acceptable value for the acquisition measure.
+ - The acquisition will be in error if the measure is above this value.
+*/
+#define TSLPRM_ACQ_MAX (8191)
+
+/** @} Common_Parameters_Acquisition_Limits */
+
+//==============================================================================
+// Calibration
+//==============================================================================
+
+/** @defgroup Common_Parameters_Calibration 04 - Calibration
+ * @{ */
+
+/** Number of calibration samples (range=4, 8, 16)
+ - Low value = faster calibration but less precision.
+ - High value = slower calibration but more precision.
+*/
+#define TSLPRM_CALIB_SAMPLES (8)
+
+/** Delay in measurement samples before starting the calibration (range=0..40)
+ - This is useful if a noise filter is used.
+ - Write 0 to disable the delay.
+*/
+#define TSLPRM_CALIB_DELAY (10)
+
+/** @} Common_Parameters_Calibration */
+
+//==============================================================================
+// Thresholds for TouchKey sensors
+//==============================================================================
+
+/** @defgroup Common_Parameters_TouchKey_Thresholds 05 - Thresholds for TouchKey sensors
+ * @{ */
+
+/** TouchKeys Proximity state input threshold (range=0..255)
+ - Enter Proximity state if delta is above
+*/
+#define TSLPRM_TKEY_PROX_IN_TH (10)
+
+/** TouchKeys Proximity state output threshold (range=0..255)
+ - Exit Proximity state if delta is below
+*/
+#define TSLPRM_TKEY_PROX_OUT_TH (5)
+
+/** TouchKeys Detect state input threshold (range=0..255)
+ - Enter Detect state if delta is above
+*/
+#define TSLPRM_TKEY_DETECT_IN_TH (20)
+
+/** TouchKeys Detect state output threshold (range=0..255)
+ - Exit Detect state if delta is below
+*/
+#define TSLPRM_TKEY_DETECT_OUT_TH (15)
+
+/** TouchKeys re-Calibration threshold (range=0..255)
+ - @warning The value is inverted in the sensor state machine
+ - Enter Calibration state if delta is below
+*/
+#define TSLPRM_TKEY_CALIB_TH (20)
+
+/** TouchKey, Linear and Rotary sensors thresholds coefficient (range=0..4)
+ This multiplier coefficient is applied on Detect and Re-Calibration thresholds only.
+ - 0: feature disabled
+ - 1: thresholds x 2
+ - 2: thresholds x 4
+ - 3: thresholds x 8
+ - 4: thresholds x 16
+*/
+#define TSLPRM_COEFF_TH (1)
+
+/** @} Common_Parameters_TouchKey_Thresholds */
+
+//==============================================================================
+// Thresholds for Linear and Rotary sensors
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Thresholds 06 - Thresholds for Linear and Rotary sensors
+ * @{ */
+
+/** Linear/Rotary Proximity state input threshold (range=0..255)
+ - Enter Proximity state if delta is above
+*/
+#define TSLPRM_LINROT_PROX_IN_TH (10)
+
+/** Linear/Rotary Proximity state output threshold (range=0..255)
+ - Exit Proximity state if delta is below
+*/
+#define TSLPRM_LINROT_PROX_OUT_TH (5)
+
+/** Linear/Rotary Detect state input threshold (range=0..255)
+ - Enter Detect state if delta is above
+*/
+#define TSLPRM_LINROT_DETECT_IN_TH (20)
+
+/** Linear/Rotary Detect state output threshold (range=0..255)
+ - Exit Detect state if delta is below
+*/
+#define TSLPRM_LINROT_DETECT_OUT_TH (15)
+
+/** Linear/Rotary re-Calibration threshold (range=0..255)
+ - @warning The value is inverted in the sensor state machine
+ - Enter Calibration state if delta is below
+ - A low absolute value will result in a higher sensitivity and thus some spurious
+ recalibration may be issued.
+*/
+#define TSLPRM_LINROT_CALIB_TH (20)
+
+/** Linear/Rotary Delta normalization (0=No, 1=Yes)
+ - When this parameter is set, a coefficient is applied on all Delta of all sensors
+ in order to normalize them and to improve the position calculation.
+ - These coefficients must be defined in a constant table in the application (see Library examples).
+ - The MSB is the coefficient integer part, the LSB is the coefficient real part.
+ - Examples:
+ - To apply a factor 1.10:
+ 0x01 to the MSB
+ 0x1A to the LSB (0.10 x 256 = 25.6 -> rounded to 26 = 0x1A)
+ - To apply a factor 0.90:
+ 0x00 to the MSB
+ 0xE6 to the LSB (0.90 x 256 = 230.4 -> rounded to 230 = 0xE6)
+ - To apply no factor:
+ 0x01 to the MSB
+ 0x00 to the LSB
+*/
+#define TSLPRM_LINROT_USE_NORMDELTA (1)
+
+/** @} Common_Parameters_LinRot_Thresholds */
+
+//==============================================================================
+// Linear/Rotary sensors used
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Used 07 - Linear/Rotary sensors used
+ * @{ */
+
+/** Select which Linear and Rotary sensors you use in your application.
+ - 0 = Not Used
+ - 1 = Used
+
+ LIN = Linear sensor
+ ROT = Rotary sensor
+ M1 = Mono electrodes design with 0/255 position at extremities of the sensor
+ M2 = Mono electrodes design
+ H = Half-ended electrodes design
+ D = Dual electrodes design
+*/
+#define TSLPRM_USE_3CH_LIN_M1 (1)
+#define TSLPRM_USE_3CH_LIN_M2 (1)
+#define TSLPRM_USE_3CH_LIN_H (1)
+#define TSLPRM_USE_3CH_ROT_M (1)
+
+#define TSLPRM_USE_4CH_LIN_M1 (1)
+#define TSLPRM_USE_4CH_LIN_M2 (1)
+#define TSLPRM_USE_4CH_LIN_H (1)
+#define TSLPRM_USE_4CH_ROT_M (1)
+
+#define TSLPRM_USE_5CH_LIN_M1 (1)
+#define TSLPRM_USE_5CH_LIN_M2 (1)
+#define TSLPRM_USE_5CH_LIN_H (1)
+#define TSLPRM_USE_5CH_ROT_M (1)
+#define TSLPRM_USE_5CH_ROT_D (1)
+
+#define TSLPRM_USE_6CH_LIN_M1 (1)
+#define TSLPRM_USE_6CH_LIN_M2 (1)
+#define TSLPRM_USE_6CH_LIN_H (1)
+#define TSLPRM_USE_6CH_ROT_M (1)
+
+/** @} Common_Parameters_LinRot_used */
+
+//==============================================================================
+// Linear/Rotary sensors position
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Position 08 - Linear/Rotary sensors position
+ * @{ */
+
+/** Position resolution in number of bits (range=1..8)
+ - A Low value will result in a low resolution and will be less subject to noise.
+ - A High value will result in a high resolution and will be more subject to noise.
+*/
+#define TSLPRM_LINROT_RESOLUTION (7)
+
+/** Direction change threshold in position unit (range=0..255)
+ - Defines the default threshold used during the change direction process.
+ - A Low value will result in a faster direction change.
+ - A High value will result in a slower direction change.
+*/
+#define TSLPRM_LINROT_DIR_CHG_POS (10)
+
+/** Direction change debounce (range=0..63)
+ - Defines the default integrator counter used during the change direction process.
+ - This counter is decremented when the same change in the position is detected and the direction will
+ change after this counter reaches zero.
+ - A Low value will result in a faster direction change.
+ - A High value will result in a slower direction change.
+*/
+#define TSLPRM_LINROT_DIR_CHG_DEB (1)
+
+/** @} Common_Parameters_LinRot_Position */
+
+//==============================================================================
+// Debounce counters
+//==============================================================================
+
+/** @defgroup Common_Parameters_Debounce 09 - Debounce counters
+ * @{ */
+
+/** Proximity state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the Proximity detection but with less noise filtering.
+ - A High value will result in improving the system noise immunity but will increase the system response time.
+*/
+#define TSLPRM_DEBOUNCE_PROX (3)
+
+/** Detect state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the detection but with less noise filtering.
+ - A High value will result in improving the system noise immunity but will increase the system response time.
+*/
+#define TSLPRM_DEBOUNCE_DETECT (3)
+
+/** Release state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the end-detection but with less noise filtering.
+ - A High value will result in a lower sensitivity during the end-detection but with more noise filtering.
+*/
+#define TSLPRM_DEBOUNCE_RELEASE (3)
+
+/** Re-calibration state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the recalibration but with less noise filtering.
+ - A High value will result in a lower sensitivity during the recalibration but with more noise filtering.
+*/
+#define TSLPRM_DEBOUNCE_CALIB (3)
+
+/** Error state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity to enter in error state.
+ - A High value will result in a lower sensitivity to enter in error state.
+*/
+#define TSLPRM_DEBOUNCE_ERROR (3)
+
+/** @} Common_Parameters_Debounce */
+
+//==============================================================================
+// Environment Change System (ECS)
+//==============================================================================
+
+/** @defgroup Common_Parameters_ECS 10 - ECS
+ * @{ */
+
+/** Environment Change System Slow K factor (range=0..255)
+ - The higher value is K, the faster is the response time.
+*/
+#define TSLPRM_ECS_K_SLOW (10)
+
+/** Environment Change System Fast K factor (range=0..255)
+ - The higher value is K, the faster is the response time.
+*/
+#define TSLPRM_ECS_K_FAST (20)
+
+/** Environment Change System delay in msec (range=0..5000)
+ - The ECS will be started after this delay and when all sensors are in Release state.
+*/
+#define TSLPRM_ECS_DELAY (500)
+
+/** @} Common_Parameters_ECS */
+
+//==============================================================================
+// Detection Time Out (DTO)
+//==============================================================================
+
+/** @defgroup Common_Parameters_DTO 11 - DTO
+ * @{ */
+
+/** Detection Time Out delay in seconds (range=0..63)
+ - Value 0: DTO processing not compiled in the code (to gain size if not used).
+ - Value 1: Default time out infinite.
+ - Value between 2 and 63: Default time out between value n-1 and n.
+ - Examples:
+ - With a DTO equal to 2, the time out is between 1s and 2s.
+ - With a DTO equal to 63, the time out is between 62s and 63s.
+
+@note The DTO can be changed in run-time by the application only if the
+ default value is between 1 and 63.
+*/
+#define TSLPRM_DTO (5)
+
+/** @} Common_Parameters_DTO */
+
+//==============================================================================
+// Detection Exclusion System (DXS)
+//==============================================================================
+
+/** @defgroup Common_Parameters_DXS 12 - DXS
+ * @{ */
+
+/** Detection Exclusion System (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_DXS (1)
+
+/** @} Common_Parameters_DXS */
+
+//==============================================================================
+// Miscellaneous parameters
+//==============================================================================
+
+/** @defgroup Common_Parameters_Misc 13 - Miscellaneous
+ * @{ */
+
+/** Timing tick frequency in Hz (range=125, 250, 500, 1000, 2000)
+ - Result to a timing interrupt respectively every 8ms, 4ms, 2ms, 1ms, 0.5ms
+*/
+#define TSLPRM_TICK_FREQ (1000)
+
+/** Delay for discharging Cx and Cs capacitors (range=0..65535)
+ - The value corresponds to the Softdelay function parameter.
+ - 500 gives around 53 µs delay whatever HCLK
+ - 1000 gives around 106 µs delay whatever HCLK
+ - 2000 gives around 210 µs delay whatever HCLK
+*/
+#define TSLPRM_DELAY_DISCHARGE_ALL (1000)
+
+/** @} Common_Parameters_Misc */
+
+/** @} Common_Parameters */
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++ MCU PARAMETERS ++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+/** @defgroup STM32F0xx_Parameters STM32F0xx Parameters
+ * @{ */
+
+//==============================================================================
+// GPIO configuration
+//==============================================================================
+
+/** @defgroup STM32F0xx_Parameters_GPIO_Config 01 - TSC GPIOs Configuration
+ * @{ */
+
+/** TSC GPIOs Configuration selection (range=0..1)
+ - 0: Manual. The TSC GPIOs configuration must be done by the application code.
+ - 1: Automatic. The TSLPRM_TSC_GROUPx_IOy parameters below must be filled up.
+ The TSC GPIOs configuration is automatically done by the STMTouch driver.
+*/
+#define TSLPRM_TSC_GPIO_CONFIG (1)
+
+//+++ DO NOT CHANGE THESE VALUES +++++++++++++++++++++++++++++++++
+// These defines must be applied to the TSLPRM_TSC_GROUPx_IOy parameters below.
+#define NU (0) // Not Used IO
+#define CHANNEL (1) // Channel IO
+#define SHIELD (2) // Shield IO (= Channel IO but not acquired)
+#define SAMPCAP (3) // Sampling Capacitor IO
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+// If TSLPRM_TSC_GPIO_CONFIG=1 assign each TSLPRM_TSC_GROUPx_IOy parameters below.
+// If TSLPRM_TSC_GPIO_CONFIG=0 these parameters are ignored.
+
+#define TSLPRM_TSC_GROUP1_IO1 NU // PA0
+#define TSLPRM_TSC_GROUP1_IO2 NU // PA1
+#define TSLPRM_TSC_GROUP1_IO3 NU // PA2
+#define TSLPRM_TSC_GROUP1_IO4 NU // PA3
+
+#define TSLPRM_TSC_GROUP2_IO1 NU // PA4
+#define TSLPRM_TSC_GROUP2_IO2 NU // PA5
+#define TSLPRM_TSC_GROUP2_IO3 NU // PA6
+#define TSLPRM_TSC_GROUP2_IO4 NU // PA7
+
+#define TSLPRM_TSC_GROUP3_IO1 NU // PC5
+#define TSLPRM_TSC_GROUP3_IO2 NU // PB0
+#define TSLPRM_TSC_GROUP3_IO3 NU // PB1
+#define TSLPRM_TSC_GROUP3_IO4 NU // PB2
+
+#define TSLPRM_TSC_GROUP4_IO1 NU // PA9
+#define TSLPRM_TSC_GROUP4_IO2 NU // PA10
+#define TSLPRM_TSC_GROUP4_IO3 NU // PA11
+#define TSLPRM_TSC_GROUP4_IO4 NU // PA12
+
+#define TSLPRM_TSC_GROUP5_IO1 NU // PB3
+#define TSLPRM_TSC_GROUP5_IO2 NU // PB4
+#define TSLPRM_TSC_GROUP5_IO3 NU // PB6
+#define TSLPRM_TSC_GROUP5_IO4 NU // PB7
+
+#define TSLPRM_TSC_GROUP6_IO1 NU // PB11
+#define TSLPRM_TSC_GROUP6_IO2 NU // PB12
+#define TSLPRM_TSC_GROUP6_IO3 NU // PB13
+#define TSLPRM_TSC_GROUP6_IO4 NU // PB14
+
+// Warning: this group is available on some devices only.
+#define TSLPRM_TSC_GROUP7_IO1 NU // PE2
+#define TSLPRM_TSC_GROUP7_IO2 NU // PE3
+#define TSLPRM_TSC_GROUP7_IO3 NU // PE4
+#define TSLPRM_TSC_GROUP7_IO4 NU // PE5
+
+// Warning: this group is available on some devices only.
+#define TSLPRM_TSC_GROUP8_IO1 NU // PD12
+#define TSLPRM_TSC_GROUP8_IO2 NU // PD13
+#define TSLPRM_TSC_GROUP8_IO3 NU // PD14
+#define TSLPRM_TSC_GROUP8_IO4 NU // PD15
+
+/** @} STM32F0xx_Parameters_GPIO_Config */
+
+//==============================================================================
+// Charge Transfer Pulses
+//==============================================================================
+
+/** @defgroup STM32F0xx_Parameters_CT_Pulses 02 - Charge Transfer Pulses
+ * @{ */
+
+/** Charge Transfer Pulse High (range=0..15)
+ - 0: 1 x tPGCLK
+ - 1: 2 x tPGCLK
+ - ...
+ - 15: 16 x tPGCLK
+*/
+#define TSLPRM_TSC_CTPH (1)
+
+/** Charge Transfer Pulse Low (range=0..15)
+ - 0: 1 x tPGCLK
+ - 1: 2 x tPGCLK
+ - ...
+ - 15: 16 x tPGCLK
+*/
+#define TSLPRM_TSC_CTPL (1)
+
+/** Pulse Generator Prescaler (range=0..7)
+ - 0: fPGCLK = fHCLK
+ - 1: fPGCLK = fHCLK/2
+ - ...
+ - 7: fPGCLK = fHCLK/128
+*/
+#define TSLPRM_TSC_PGPSC (5)
+
+/** @} STM32F0xx_Parameters_CT_Pulses */
+
+//==============================================================================
+// IOs
+//==============================================================================
+
+/** @defgroup STM32F0xx_Parameters_IOs 03 - I/Os
+ * @{ */
+
+/** TSC IOs default mode when no on-going acquisition (range=0..1)
+ - 0: Output push-pull low
+ - 1: Input floating
+@note To ensure a correct operation in noisy environment, this parameter should
+be configured to output push-pull low.
+*/
+#define TSLPRM_TSC_IODEF (0)
+
+/** Acquisition Mode (range=0..1)
+ - 0: Normal acquisition mode
+ - 1: Synchronized acquisition mode
+*/
+#define TSLPRM_TSC_AM (0)
+
+/** Synchronization Pin (range=0..1)
+ - 0: PB08
+ - 1: PB10
+*/
+#define TSLPRM_TSC_SYNC_PIN (0)
+
+/** Synchronization Polarity (range=0..1)
+ - 0: Falling edge only
+ - 1: Rising edge and high level
+*/
+#define TSLPRM_TSC_SYNC_POL (0)
+
+/** @} STM32F0xx_Parameters_Misc */
+
+//==============================================================================
+// Spread Spectrum
+//==============================================================================
+
+/** @defgroup STM32F0xx_Parameters_SpreadSpectrum 04 - Spread Spectrum
+ * @{ */
+
+/** Use Spread Spectrum (0=No, 1=Yes)
+*/
+#define TSLPRM_TSC_USE_SS (0)
+
+/** Spread Spectrum Deviation (range=0..127)
+ - 0: 1 x tSSCLK
+ - 1: 2 x tSSCLK
+ - ...
+ - 127: 128 x tSSCLK
+*/
+#define TSLPRM_TSC_SSD (0)
+
+/** Spread Spectrum Prescaler (range=0..1)
+ - 0: fSSCLK = fHCLK
+ - 1: fSSCLK = fHCLK/2
+*/
+#define TSLPRM_TSC_SSPSC (0)
+
+/** @} STM32F0xx_Parameters_SpreadSpectrum */
+
+/** @} STM32F0xx_Parameters */
+
+// DO NOT REMOVE !!!
+#include "tsl_check_config.h"
+
+#endif /* __TSL_CONF_STM32F0XX_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm32f3xx.h_TOADAPT b/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm32f3xx.h_TOADAPT
new file mode 100644
index 0000000..547555e
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm32f3xx.h_TOADAPT
@@ -0,0 +1,628 @@
+/**
+ ******************************************************************************
+ * @file tsl_conf_stm32f3xx.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief Acquisition parameters for STM32F3xx products.
+ * @note This file must be copied in the application project and values
+ * changed for the application.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_CONF_STM32F3XX_H
+#define __TSL_CONF_STM32F3XX_H
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++ COMMON PARAMETERS ++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+/** @defgroup Common_Parameters Common Parameters
+ * @{ */
+
+//==============================================================================
+// Number of elements
+//==============================================================================
+
+/** @defgroup Common_Parameters_Number_Of_Elements 01 - Number of elements
+ * @{ */
+
+/** Total number of channels in application (range=1..255)
+*/
+#define TSLPRM_TOTAL_CHANNELS (1)
+
+/** Total number of banks in application (range=1..255)
+*/
+#define TSLPRM_TOTAL_BANKS (1)
+
+/** Total number of "Extended" TouchKeys in application (range=0..255)
+*/
+#define TSLPRM_TOTAL_TOUCHKEYS (1)
+
+/** Total number of "Basic" TouchKeys in application (range=0..255)
+*/
+#define TSLPRM_TOTAL_TOUCHKEYS_B (1)
+
+/** Total number of "Extended" Linear and Rotary sensors in application (range=0..255)
+ - Count also the 1-channel linear sensor used as TouchKey
+*/
+#define TSLPRM_TOTAL_LINROTS (1)
+
+/** Total number of "Basic" Linear and Rotary sensors in application (range=0..255)
+ - Count also the 1-channel linear sensor used as TouchKey
+*/
+#define TSLPRM_TOTAL_LINROTS_B (1)
+
+/** Total number of sensors/objects in application (range=1..255)
+ - Count all TouchKeys, Linear and Rotary sensors
+*/
+#define TSLPRM_TOTAL_OBJECTS (1)
+
+/** @} Common_Parameters_Number_Of_Elements */
+
+//==============================================================================
+// Optional features
+//==============================================================================
+
+/** @defgroup Common_Parameters_Options 02 - Optional features
+ * @{ */
+
+/** Record the last measure (0=No, 1=Yes)
+ - If No the measure is recalculated using the Reference and Delta
+*/
+#define TSLPRM_USE_MEAS (1)
+
+/** Zone management usage (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_ZONE (1)
+
+/** Proximity detection usage (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_PROX (1)
+
+/** Use the Timer tick callback (0=No, 1=Yes)
+ - When equal to 1, the function TSL_CallBack_TimerTick must be defined in
+ the application code. It is called for each timer interruption.
+*/
+#define TSLPRM_USE_TIMER_CALLBACK (1)
+
+/** Acquisition interrupt mode (0=No, 1=Yes)
+ - If No the TS interrupt is not used.
+ - If Yes the TS interrupt is used.
+*/
+#define TSLPRM_USE_ACQ_INTERRUPT (1)
+
+/** @} Common_Parameters_Options */
+
+//==============================================================================
+// Acquisition limits
+//==============================================================================
+
+/** @defgroup Common_Parameters_Acquisition_Limits 03 - Acquisition limits
+ * @{ */
+
+/** Minimum acquisition measurement (range=0..65535)
+ - This is the minimum acceptable value for the acquisition measure.
+ - The acquisition will be in error if the measure is below this value.
+*/
+#define TSLPRM_ACQ_MIN (10)
+
+/** Maximum acquisition measurement (range=255, 511, 1023, 2047, 8191, 16383)
+ - This is the maximum acceptable value for the acquisition measure.
+ - The acquisition will be in error if the measure is above this value.
+*/
+#define TSLPRM_ACQ_MAX (8191)
+
+/** @} Common_Parameters_Acquisition_Limits */
+
+//==============================================================================
+// Calibration
+//==============================================================================
+
+/** @defgroup Common_Parameters_Calibration 04 - Calibration
+ * @{ */
+
+/** Number of calibration samples (range=4, 8, 16)
+ - Low value = faster calibration but less precision.
+ - High value = slower calibration but more precision.
+*/
+#define TSLPRM_CALIB_SAMPLES (8)
+
+/** Delay in measurement samples before starting the calibration (range=0..40)
+ - This is useful if a noise filter is used.
+ - Write 0 to disable the delay.
+*/
+#define TSLPRM_CALIB_DELAY (10)
+
+/** @} Common_Parameters_Calibration */
+
+//==============================================================================
+// Thresholds for TouchKey sensors
+//==============================================================================
+
+/** @defgroup Common_Parameters_TouchKey_Thresholds 05 - Thresholds for TouchKey sensors
+ * @{ */
+
+/** TouchKeys Proximity state input threshold (range=0..255)
+ - Enter Proximity state if delta is above
+*/
+#define TSLPRM_TKEY_PROX_IN_TH (10)
+
+/** TouchKeys Proximity state output threshold (range=0..255)
+ - Exit Proximity state if delta is below
+*/
+#define TSLPRM_TKEY_PROX_OUT_TH (5)
+
+/** TouchKeys Detect state input threshold (range=0..255)
+ - Enter Detect state if delta is above
+*/
+#define TSLPRM_TKEY_DETECT_IN_TH (20)
+
+/** TouchKeys Detect state output threshold (range=0..255)
+ - Exit Detect state if delta is below
+*/
+#define TSLPRM_TKEY_DETECT_OUT_TH (15)
+
+/** TouchKeys re-Calibration threshold (range=0..255)
+ - @warning The value is inverted in the sensor state machine
+ - Enter Calibration state if delta is below
+*/
+#define TSLPRM_TKEY_CALIB_TH (20)
+
+/** TouchKey, Linear and Rotary sensors thresholds coefficient (range=0..4)
+ This multiplier coefficient is applied on Detect and Re-Calibration thresholds only.
+ - 0: feature disabled
+ - 1: thresholds x 2
+ - 2: thresholds x 4
+ - 3: thresholds x 8
+ - 4: thresholds x 16
+*/
+#define TSLPRM_COEFF_TH (1)
+
+/** @} Common_Parameters_TouchKey_Thresholds */
+
+//==============================================================================
+// Thresholds for Linear and Rotary sensors
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Thresholds 06 - Thresholds for Linear and Rotary sensors
+ * @{ */
+
+/** Linear/Rotary Proximity state input threshold (range=0..255)
+ - Enter Proximity state if delta is above
+*/
+#define TSLPRM_LINROT_PROX_IN_TH (10)
+
+/** Linear/Rotary Proximity state output threshold (range=0..255)
+ - Exit Proximity state if delta is below
+*/
+#define TSLPRM_LINROT_PROX_OUT_TH (5)
+
+/** Linear/Rotary Detect state input threshold (range=0..255)
+ - Enter Detect state if delta is above
+*/
+#define TSLPRM_LINROT_DETECT_IN_TH (20)
+
+/** Linear/Rotary Detect state output threshold (range=0..255)
+ - Exit Detect state if delta is below
+*/
+#define TSLPRM_LINROT_DETECT_OUT_TH (15)
+
+/** Linear/Rotary re-Calibration threshold (range=0..255)
+ - @warning The value is inverted in the sensor state machine
+ - Enter Calibration state if delta is below
+ - A low absolute value will result in a higher sensitivity and thus some spurious
+ recalibration may be issued.
+*/
+#define TSLPRM_LINROT_CALIB_TH (20)
+
+/** Linear/Rotary Delta normalization (0=No, 1=Yes)
+ - When this parameter is set, a coefficient is applied on all Delta of all sensors
+ in order to normalize them and to improve the position calculation.
+ - These coefficients must be defined in a constant table in the application (see Library examples).
+ - The MSB is the coefficient integer part, the LSB is the coefficient real part.
+ - Examples:
+ - To apply a factor 1.10:
+ 0x01 to the MSB
+ 0x1A to the LSB (0.10 x 256 = 25.6 -> rounded to 26 = 0x1A)
+ - To apply a factor 0.90:
+ 0x00 to the MSB
+ 0xE6 to the LSB (0.90 x 256 = 230.4 -> rounded to 230 = 0xE6)
+ - To apply no factor:
+ 0x01 to the MSB
+ 0x00 to the LSB
+*/
+#define TSLPRM_LINROT_USE_NORMDELTA (1)
+
+/** @} Common_Parameters_LinRot_Thresholds */
+
+//==============================================================================
+// Linear/Rotary sensors used
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Used 07 - Linear/Rotary sensors used
+ * @{ */
+
+/** Select which Linear and Rotary sensors you use in your application.
+ - 0 = Not Used
+ - 1 = Used
+
+ LIN = Linear sensor
+ ROT = Rotary sensor
+ M1 = Mono electrodes design with 0/255 position at extremities of the sensor
+ M2 = Mono electrodes design
+ H = Half-ended electrodes design
+ D = Dual electrodes design
+*/
+#define TSLPRM_USE_3CH_LIN_M1 (1)
+#define TSLPRM_USE_3CH_LIN_M2 (1)
+#define TSLPRM_USE_3CH_LIN_H (1)
+#define TSLPRM_USE_3CH_ROT_M (1)
+
+#define TSLPRM_USE_4CH_LIN_M1 (1)
+#define TSLPRM_USE_4CH_LIN_M2 (1)
+#define TSLPRM_USE_4CH_LIN_H (1)
+#define TSLPRM_USE_4CH_ROT_M (1)
+
+#define TSLPRM_USE_5CH_LIN_M1 (1)
+#define TSLPRM_USE_5CH_LIN_M2 (1)
+#define TSLPRM_USE_5CH_LIN_H (1)
+#define TSLPRM_USE_5CH_ROT_M (1)
+#define TSLPRM_USE_5CH_ROT_D (1)
+
+#define TSLPRM_USE_6CH_LIN_M1 (1)
+#define TSLPRM_USE_6CH_LIN_M2 (1)
+#define TSLPRM_USE_6CH_LIN_H (1)
+#define TSLPRM_USE_6CH_ROT_M (1)
+
+/** @} Common_Parameters_LinRot_used */
+
+//==============================================================================
+// Linear/Rotary sensors position
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Position 08 - Linear/Rotary sensors position
+ * @{ */
+
+/** Position resolution in number of bits (range=1..8)
+ - A Low value will result in a low resolution and will be less subject to noise.
+ - A High value will result in a high resolution and will be more subject to noise.
+*/
+#define TSLPRM_LINROT_RESOLUTION (7)
+
+/** Direction change threshold in position unit (range=0..255)
+ - Defines the default threshold used during the change direction process.
+ - A Low value will result in a faster direction change.
+ - A High value will result in a slower direction change.
+*/
+#define TSLPRM_LINROT_DIR_CHG_POS (10)
+
+/** Direction change debounce (range=0..63)
+ - Defines the default integrator counter used during the change direction process.
+ - This counter is decremented when the same change in the position is detected and the direction will
+ change after this counter reaches zero.
+ - A Low value will result in a faster direction change.
+ - A High value will result in a slower direction change.
+*/
+#define TSLPRM_LINROT_DIR_CHG_DEB (1)
+
+/** @} Common_Parameters_LinRot_Position */
+
+//==============================================================================
+// Debounce counters
+//==============================================================================
+
+/** @defgroup Common_Parameters_Debounce 09 - Debounce counters
+ * @{ */
+
+/** Proximity state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the Proximity detection but with less noise filtering.
+ - A High value will result in improving the system noise immunity but will increase the system response time.
+*/
+#define TSLPRM_DEBOUNCE_PROX (3)
+
+/** Detect state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the detection but with less noise filtering.
+ - A High value will result in improving the system noise immunity but will increase the system response time.
+*/
+#define TSLPRM_DEBOUNCE_DETECT (3)
+
+/** Release state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the end-detection but with less noise filtering.
+ - A High value will result in a lower sensitivity during the end-detection but with more noise filtering.
+*/
+#define TSLPRM_DEBOUNCE_RELEASE (3)
+
+/** Re-calibration state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the recalibration but with less noise filtering.
+ - A High value will result in a lower sensitivity during the recalibration but with more noise filtering.
+*/
+#define TSLPRM_DEBOUNCE_CALIB (3)
+
+/** Error state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity to enter in error state.
+ - A High value will result in a lower sensitivity to enter in error state.
+*/
+#define TSLPRM_DEBOUNCE_ERROR (3)
+
+/** @} Common_Parameters_Debounce */
+
+//==============================================================================
+// Environment Change System (ECS)
+//==============================================================================
+
+/** @defgroup Common_Parameters_ECS 10 - ECS
+ * @{ */
+
+/** Environment Change System Slow K factor (range=0..255)
+ - The higher value is K, the faster is the response time.
+*/
+#define TSLPRM_ECS_K_SLOW (10)
+
+/** Environment Change System Fast K factor (range=0..255)
+ - The higher value is K, the faster is the response time.
+*/
+#define TSLPRM_ECS_K_FAST (20)
+
+/** Environment Change System delay in msec (range=0..5000)
+ - The ECS will be started after this delay and when all sensors are in Release state.
+*/
+#define TSLPRM_ECS_DELAY (500)
+
+/** @} Common_Parameters_ECS */
+
+//==============================================================================
+// Detection Time Out (DTO)
+//==============================================================================
+
+/** @defgroup Common_Parameters_DTO 11 - DTO
+ * @{ */
+
+/** Detection Time Out delay in seconds (range=0..63)
+ - Value 0: DTO processing not compiled in the code (to gain size if not used).
+ - Value 1: Default time out infinite.
+ - Value between 2 and 63: Default time out between value n-1 and n.
+ - Examples:
+ - With a DTO equal to 2, the time out is between 1s and 2s.
+ - With a DTO equal to 63, the time out is between 62s and 63s.
+
+@note The DTO can be changed in run-time by the application only if the
+ default value is between 1 and 63.
+*/
+#define TSLPRM_DTO (5)
+
+/** @} Common_Parameters_DTO */
+
+//==============================================================================
+// Detection Exclusion System (DXS)
+//==============================================================================
+
+/** @defgroup Common_Parameters_DXS 12 - DXS
+ * @{ */
+
+/** Detection Exclusion System (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_DXS (1)
+
+/** @} Common_Parameters_DXS */
+
+//==============================================================================
+// Miscellaneous parameters
+//==============================================================================
+
+/** @defgroup Common_Parameters_Misc 13 - Miscellaneous
+ * @{ */
+
+/** Timing tick frequency in Hz (range=125, 250, 500, 1000, 2000)
+ - Result to a timing interrupt respectively every 8ms, 4ms, 2ms, 1ms, 0.5ms
+*/
+#define TSLPRM_TICK_FREQ (1000)
+
+/** Delay for discharging Cx and Cs capacitors (range=0..65535)
+ - The value corresponds to the Softdelay function parameter.
+ - 500 gives around 63 µs delay whatever HCLK
+ - 1000 gives around 126 µs delay whatever HCLK
+ - 2000 gives around 251 µs delay whatever HCLK
+*/
+#define TSLPRM_DELAY_DISCHARGE_ALL (1000)
+
+/** @} Common_Parameters_Misc */
+
+/** @} Common_Parameters */
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++ MCU PARAMETERS ++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+/** @defgroup STM32F3xx_Parameters STM32F3xx Parameters
+ * @{ */
+
+//==============================================================================
+// GPIO configuration
+//==============================================================================
+
+/** @defgroup STM32F3xx_Parameters_GPIO_Config 01 - TSC GPIOs Configuration
+ * @{ */
+
+/** TSC GPIOs Configuration selection (range=0..1)
+ - 0: Manual. The TSC GPIOs configuration must be done by the application code.
+ - 1: Automatic. The TSLPRM_TSC_GROUPx_IOy parameters below must be filled up.
+ The TSC GPIOs configuration is automatically done by the STMTouch driver.
+*/
+#define TSLPRM_TSC_GPIO_CONFIG (1)
+
+//+++ DO NOT CHANGE THESE VALUES +++++++++++++++++++++++++++++++++
+// These defines must be applied to the TSLPRM_TSC_GROUPx_IOy parameters below.
+#define NU (0) // Not Used IO
+#define CHANNEL (1) // Channel IO
+#define SHIELD (2) // Shield IO (= Channel IO but not acquired)
+#define SAMPCAP (3) // Sampling Capacitor IO
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+// If TSLPRM_TSC_GPIO_CONFIG=1 assign each TSLPRM_TSC_GROUPx_IOy parameters below.
+// If TSLPRM_TSC_GPIO_CONFIG=0 these parameters are ignored.
+// STM32F30X STM32F37X
+#define TSLPRM_TSC_GROUP1_IO1 NU // PA0 PA0
+#define TSLPRM_TSC_GROUP1_IO2 NU // PA1 PA1
+#define TSLPRM_TSC_GROUP1_IO3 NU // PA2 PA2
+#define TSLPRM_TSC_GROUP1_IO4 NU // PA3 PA3
+
+#define TSLPRM_TSC_GROUP2_IO1 NU // PA4 PA4
+#define TSLPRM_TSC_GROUP2_IO2 NU // PA5 PA5
+#define TSLPRM_TSC_GROUP2_IO3 NU // PA6 PA6
+#define TSLPRM_TSC_GROUP2_IO4 NU // PA7 PA7
+
+#define TSLPRM_TSC_GROUP3_IO1 NU // PC5 PC4 << diff
+#define TSLPRM_TSC_GROUP3_IO2 NU // PB0 PC5 << diff
+#define TSLPRM_TSC_GROUP3_IO3 NU // PB1 PB0 << diff
+#define TSLPRM_TSC_GROUP3_IO4 NU // PB2 PB1 << diff
+
+#define TSLPRM_TSC_GROUP4_IO1 NU // PA9 PA9
+#define TSLPRM_TSC_GROUP4_IO2 NU // PA10 PA10
+#define TSLPRM_TSC_GROUP4_IO3 NU // PA13 PA13
+#define TSLPRM_TSC_GROUP4_IO4 NU // PA14 PA14
+
+#define TSLPRM_TSC_GROUP5_IO1 NU // PB3 PB3
+#define TSLPRM_TSC_GROUP5_IO2 NU // PB4 PB4
+#define TSLPRM_TSC_GROUP5_IO3 NU // PB6 PB6
+#define TSLPRM_TSC_GROUP5_IO4 NU // PB7 PB7
+
+#define TSLPRM_TSC_GROUP6_IO1 NU // PB11 PB14 << diff
+#define TSLPRM_TSC_GROUP6_IO2 NU // PB12 PB15 << diff
+#define TSLPRM_TSC_GROUP6_IO3 NU // PB13 PD8 << diff
+#define TSLPRM_TSC_GROUP6_IO4 NU // PB14 PD9 << diff
+
+#define TSLPRM_TSC_GROUP7_IO1 NU // PE2 PE2
+#define TSLPRM_TSC_GROUP7_IO2 NU // PE3 PE3
+#define TSLPRM_TSC_GROUP7_IO3 NU // PE4 PE4
+#define TSLPRM_TSC_GROUP7_IO4 NU // PE5 PE5
+
+#define TSLPRM_TSC_GROUP8_IO1 NU // PD12 PD12
+#define TSLPRM_TSC_GROUP8_IO2 NU // PD13 PD13
+#define TSLPRM_TSC_GROUP8_IO3 NU // PD14 PD14
+#define TSLPRM_TSC_GROUP8_IO4 NU // PD15 PD15
+
+/** @} STM32F3xx_Parameters_GPIO_Config */
+
+//==============================================================================
+// Charge Transfer Pulses
+//==============================================================================
+
+/** @defgroup STM32F3xx_Parameters_CT_Pulses 02 - Charge Transfer Pulses
+ * @{ */
+
+/** Charge Transfer Pulse High (range=0..15)
+ - 0: 1 x tPGCLK
+ - 1: 2 x tPGCLK
+ - ...
+ - 15: 16 x tPGCLK
+*/
+#define TSLPRM_TSC_CTPH (1)
+
+/** Charge Transfer Pulse Low (range=0..15)
+ - 0: 1 x tPGCLK
+ - 1: 2 x tPGCLK
+ - ...
+ - 15: 16 x tPGCLK
+*/
+#define TSLPRM_TSC_CTPL (1)
+
+/** Pulse Generator Prescaler (range=0..7)
+ - 0: fPGCLK = fHCLK
+ - 1: fPGCLK = fHCLK/2
+ - ...
+ - 7: fPGCLK = fHCLK/128
+*/
+#define TSLPRM_TSC_PGPSC (5)
+
+/** @} STM32F3xx_Parameters_CT_Pulses */
+
+//==============================================================================
+// IOs
+//==============================================================================
+
+/** @defgroup STM32F3xx_Parameters_IOs 03 - I/Os
+ * @{ */
+
+/** TSC IOs default mode when no on-going acquisition (range=0..1)
+ - 0: Output push-pull low
+ - 1: Input floating
+@note To ensure a correct operation in noisy environment, this parameter should
+be configured to output push-pull low.
+*/
+#define TSLPRM_TSC_IODEF (0)
+
+/** Acquisition Mode (range=0..1)
+ - 0: Normal acquisition mode
+ - 1: Synchronized acquisition mode
+*/
+#define TSLPRM_TSC_AM (0)
+
+/** Synchronization Pin (range=0..2)
+ - 0: PB08
+ - 1: PB10
+ - 2: PA15 (on some devices only)
+*/
+#define TSLPRM_TSC_SYNC_PIN (0)
+
+/** Synchronization Polarity (range=0..1)
+ - 0: Falling edge only
+ - 1: Rising edge and high level
+*/
+#define TSLPRM_TSC_SYNC_POL (0)
+
+/** @} STM32F3xx_Parameters_Misc */
+
+//==============================================================================
+// Spread Spectrum
+//==============================================================================
+
+/** @defgroup STM32F3xx_Parameters_SpreadSpectrum 04 - Spread Spectrum
+ * @{ */
+
+/** Use Spread Spectrum (0=No, 1=Yes)
+*/
+#define TSLPRM_TSC_USE_SS (0)
+
+/** Spread Spectrum Deviation (range=0..127)
+ - 0: 1 x tSSCLK
+ - 1: 2 x tSSCLK
+ - ...
+ - 127: 128 x tSSCLK
+*/
+#define TSLPRM_TSC_SSD (0)
+
+/** Spread Spectrum Prescaler (range=0..1)
+ - 0: fSSCLK = fHCLK
+ - 1: fSSCLK = fHCLK/2
+*/
+#define TSLPRM_TSC_SSPSC (0)
+
+/** @} STM32F3xx_Parameters_SpreadSpectrum */
+
+/** @} STM32F3xx_Parameters */
+
+// DO NOT REMOVE !!!
+#include "tsl_check_config.h"
+
+#endif /* __TSL_CONF_STM32F3XX_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm32l1xx.h_TOADAPT b/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm32l1xx.h_TOADAPT
new file mode 100644
index 0000000..6dad088
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm32l1xx.h_TOADAPT
@@ -0,0 +1,527 @@
+/**
+ ******************************************************************************
+ * @file tsl_conf_stm32l1xx.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief Acquisition parameters for STM32L1xx products.
+ * @note This file must be copied in the application project and values
+ * changed for the application.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_CONF_STM32L1xx_H
+#define __TSL_CONF_STM32L1xx_H
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++ COMMON PARAMETERS ++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+/** @defgroup Common_Parameters Common Parameters
+ * @{ */
+
+//==============================================================================
+// Number of elements
+//==============================================================================
+
+/** @defgroup Common_Parameters_Number_Of_Elements 01 - Number of elements
+ * @{ */
+
+/** Total number of channels in application (range=1..255)
+*/
+#define TSLPRM_TOTAL_CHANNELS (1)
+
+/** Total number of banks in application (range=1..255)
+*/
+#define TSLPRM_TOTAL_BANKS (1)
+
+/** Total number of "Extended" TouchKeys in application (range=0..255)
+*/
+#define TSLPRM_TOTAL_TOUCHKEYS (1)
+
+/** Total number of "Basic" TouchKeys in application (range=0..255)
+*/
+#define TSLPRM_TOTAL_TOUCHKEYS_B (1)
+
+/** Total number of "Extended" Linear and Rotary sensors in application (range=0..255)
+ - Count also the 1-channel linear sensor used as TouchKey
+*/
+#define TSLPRM_TOTAL_LINROTS (1)
+
+/** Total number of "Basic" Linear and Rotary sensors in application (range=0..255)
+ - Count also the 1-channel linear sensor used as TouchKey
+*/
+#define TSLPRM_TOTAL_LINROTS_B (1)
+
+/** Total number of sensors/objects in application (range=1..255)
+ - Count all TouchKeys, Linear and Rotary sensors
+*/
+#define TSLPRM_TOTAL_OBJECTS (1)
+
+/** @} Common_Parameters_Number_Of_Elements */
+
+//==============================================================================
+// Optional features
+//==============================================================================
+
+/** @defgroup Common_Parameters_Options 02 - Optional features
+ * @{ */
+
+/** Record the last measure (0=No, 1=Yes)
+ - If No the measure is recalculated using the Reference and Delta
+*/
+#define TSLPRM_USE_MEAS (1)
+
+/** Zone management usage (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_ZONE (1)
+
+/** Proximity detection usage (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_PROX (1)
+
+/** Use the Timer tick callback (0=No, 1=Yes)
+ - When equal to 1, the function TSL_CallBack_TimerTick must be defined in
+ the application code. It is called for each timer interruption.
+*/
+#define TSLPRM_USE_TIMER_CALLBACK (1)
+
+/** Acquisition interrupt mode (0=No, 1=Yes)
+ - If No the TS interrupt is not used.
+ - If Yes the TS interrupt is used.
+*/
+#define TSLPRM_USE_ACQ_INTERRUPT (1)
+
+/** @} Common_Parameters_Options */
+
+//==============================================================================
+// Acquisition limits
+//==============================================================================
+
+/** @defgroup Common_Parameters_Acquisition_Limits 03 - Acquisition limits
+ * @{ */
+
+/** Minimum acquisition measurement (range=0..65535)
+ - This is the minimum acceptable value for the acquisition measure.
+ - The acquisition will be in error if the measure is below this value.
+*/
+#define TSLPRM_ACQ_MIN (10)
+
+/** Maximum acquisition measurement (range=0..65535)
+ - This is the maximum acceptable value for the acquisition measure.
+ - The acquisition will be in error if the measure is above this value.
+*/
+#define TSLPRM_ACQ_MAX (4000)
+
+/** @} Common_Parameters_Acquisition_Limits */
+
+//==============================================================================
+// Calibration
+//==============================================================================
+
+/** @defgroup Common_Parameters_Calibration 04 - Calibration
+ * @{ */
+
+/** Number of calibration samples (range=4, 8, 16)
+ - Low value = faster calibration but less precision.
+ - High value = slower calibration but more precision.
+*/
+#define TSLPRM_CALIB_SAMPLES (8)
+
+/** Delay in measurement samples before starting the calibration (range=0..40)
+ - This is useful if a noise filter is used.
+ - Write 0 to disable the delay.
+*/
+#define TSLPRM_CALIB_DELAY (10)
+
+/** @} Common_Parameters_Calibration */
+
+//==============================================================================
+// Thresholds for TouchKey sensors
+//==============================================================================
+
+/** @defgroup Common_Parameters_TouchKey_Thresholds 05 - Thresholds for TouchKey sensors
+ * @{ */
+
+/** TouchKeys Proximity state input threshold (range=0..255)
+ - Enter Proximity state if delta is above
+*/
+#define TSLPRM_TKEY_PROX_IN_TH (10)
+
+/** TouchKeys Proximity state output threshold (range=0..255)
+ - Exit Proximity state if delta is below
+*/
+#define TSLPRM_TKEY_PROX_OUT_TH (5)
+
+/** TouchKeys Detect state input threshold (range=0..255)
+ - Enter Detect state if delta is above
+*/
+#define TSLPRM_TKEY_DETECT_IN_TH (20)
+
+/** TouchKeys Detect state output threshold (range=0..255)
+ - Exit Detect state if delta is below
+*/
+#define TSLPRM_TKEY_DETECT_OUT_TH (15)
+
+/** TouchKeys re-Calibration threshold (range=0..255)
+ - @warning The value is inverted in the sensor state machine
+ - Enter Calibration state if delta is below
+*/
+#define TSLPRM_TKEY_CALIB_TH (20)
+
+/** TouchKey, Linear and Rotary sensors thresholds coefficient (range=0..4)
+ This multiplier coefficient is applied on Detect and Re-Calibration thresholds only.
+ - 0: feature disabled
+ - 1: thresholds x 2
+ - 2: thresholds x 4
+ - 3: thresholds x 8
+ - 4: thresholds x 16
+*/
+#define TSLPRM_COEFF_TH (1)
+
+/** @} Common_Parameters_TouchKey_Thresholds */
+
+//==============================================================================
+// Thresholds for Linear and Rotary sensors
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Thresholds 06 - Thresholds for Linear and Rotary sensors
+ * @{ */
+
+/** Linear/Rotary Proximity state input threshold (range=0..255)
+ - Enter Proximity state if delta is above
+*/
+#define TSLPRM_LINROT_PROX_IN_TH (10)
+
+/** Linear/Rotary Proximity state output threshold (range=0..255)
+ - Exit Proximity state if delta is below
+*/
+#define TSLPRM_LINROT_PROX_OUT_TH (5)
+
+/** Linear/Rotary Detect state input threshold (range=0..255)
+ - Enter Detect state if delta is above
+*/
+#define TSLPRM_LINROT_DETECT_IN_TH (20)
+
+/** Linear/Rotary Detect state output threshold (range=0..255)
+ - Exit Detect state if delta is below
+*/
+#define TSLPRM_LINROT_DETECT_OUT_TH (15)
+
+/** Linear/Rotary re-Calibration threshold (range=0..255)
+ - @warning The value is inverted in the sensor state machine
+ - Enter Calibration state if delta is below
+ - A low absolute value will result in a higher sensitivity and thus some spurious
+ recalibration may be issued.
+*/
+#define TSLPRM_LINROT_CALIB_TH (20)
+
+/** Linear/Rotary Delta normalization (0=No, 1=Yes)
+ - When this parameter is set, a coefficient is applied on all Delta of all sensors
+ in order to normalize them and to improve the position calculation.
+ - These coefficients must be defined in a constant table in the application (see Library examples).
+ - The MSB is the coefficient integer part, the LSB is the coefficient real part.
+ - Examples:
+ - To apply a factor 1.10:
+ 0x01 to the MSB
+ 0x1A to the LSB (0.10 x 256 = 25.6 -> rounded to 26 = 0x1A)
+ - To apply a factor 0.90:
+ 0x00 to the MSB
+ 0xE6 to the LSB (0.90 x 256 = 230.4 -> rounded to 230 = 0xE6)
+ - To apply no factor:
+ 0x01 to the MSB
+ 0x00 to the LSB
+*/
+#define TSLPRM_LINROT_USE_NORMDELTA (1)
+
+/** @} Common_Parameters_LinRot_Thresholds */
+
+//==============================================================================
+// Linear/Rotary sensors used
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Used 07 - Linear/Rotary sensors used
+ * @{ */
+
+/** Select which Linear and Rotary sensors you use in your application.
+ - 0 = Not Used
+ - 1 = Used
+
+ LIN = Linear sensor
+ ROT = Rotary sensor
+ M1 = Mono electrodes design with 0/255 position at extremities of the sensor
+ M2 = Mono electrodes design
+ H = Half-ended electrodes design
+ D = Dual electrodes design
+*/
+#define TSLPRM_USE_3CH_LIN_M1 (1)
+#define TSLPRM_USE_3CH_LIN_M2 (1)
+#define TSLPRM_USE_3CH_LIN_H (1)
+#define TSLPRM_USE_3CH_ROT_M (1)
+
+#define TSLPRM_USE_4CH_LIN_M1 (1)
+#define TSLPRM_USE_4CH_LIN_M2 (1)
+#define TSLPRM_USE_4CH_LIN_H (1)
+#define TSLPRM_USE_4CH_ROT_M (1)
+
+#define TSLPRM_USE_5CH_LIN_M1 (1)
+#define TSLPRM_USE_5CH_LIN_M2 (1)
+#define TSLPRM_USE_5CH_LIN_H (1)
+#define TSLPRM_USE_5CH_ROT_M (1)
+#define TSLPRM_USE_5CH_ROT_D (1)
+
+#define TSLPRM_USE_6CH_LIN_M1 (1)
+#define TSLPRM_USE_6CH_LIN_M2 (1)
+#define TSLPRM_USE_6CH_LIN_H (1)
+#define TSLPRM_USE_6CH_ROT_M (1)
+
+/** @} Common_Parameters_LinRot_used */
+
+//==============================================================================
+// Linear/Rotary sensors position
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Position 08 - Linear/Rotary sensors position
+ * @{ */
+
+/** Position resolution in number of bits (range=1..8)
+ - A Low value will result in a low resolution and will be less subject to noise.
+ - A High value will result in a high resolution and will be more subject to noise.
+*/
+#define TSLPRM_LINROT_RESOLUTION (7)
+
+/** Direction change threshold in position unit (range=0..255)
+ - Defines the default threshold used during the change direction process.
+ - A Low value will result in a faster direction change.
+ - A High value will result in a slower direction change.
+*/
+#define TSLPRM_LINROT_DIR_CHG_POS (10)
+
+/** Direction change debounce (range=0..63)
+ - Defines the default integrator counter used during the change direction process.
+ - This counter is decremented when the same change in the position is detected and the direction will
+ change after this counter reaches zero.
+ - A Low value will result in a faster direction change.
+ - A High value will result in a slower direction change.
+*/
+#define TSLPRM_LINROT_DIR_CHG_DEB (1)
+
+/** @} Common_Parameters_LinRot_Position */
+
+//==============================================================================
+// Debounce counters
+//==============================================================================
+
+/** @defgroup Common_Parameters_Debounce 09 - Debounce counters
+ * @{ */
+
+/** Proximity state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the Proximity detection but with less noise filtering.
+ - A High value will result in improving the system noise immunity but will increase the system response time.
+*/
+#define TSLPRM_DEBOUNCE_PROX (3)
+
+/** Detect state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the detection but with less noise filtering.
+ - A High value will result in improving the system noise immunity but will increase the system response time.
+*/
+#define TSLPRM_DEBOUNCE_DETECT (3)
+
+/** Release state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the end-detection but with less noise filtering.
+ - A High value will result in a lower sensitivity during the end-detection but with more noise filtering.
+*/
+#define TSLPRM_DEBOUNCE_RELEASE (3)
+
+/** Re-calibration state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the recalibration but with less noise filtering.
+ - A High value will result in a lower sensitivity during the recalibration but with more noise filtering.
+*/
+#define TSLPRM_DEBOUNCE_CALIB (3)
+
+/** Error state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity to enter in error state.
+ - A High value will result in a lower sensitivity to enter in error state.
+*/
+#define TSLPRM_DEBOUNCE_ERROR (3)
+
+/** @} Common_Parameters_Debounce */
+
+//==============================================================================
+// Environment Change System (ECS)
+//==============================================================================
+
+/** @defgroup Common_Parameters_ECS 10 - ECS
+ * @{ */
+
+/** Environment Change System Slow K factor (range=0..255)
+ - The higher value is K, the faster is the response time.
+*/
+#define TSLPRM_ECS_K_SLOW (10)
+
+/** Environment Change System Fast K factor (range=0..255)
+ - The higher value is K, the faster is the response time.
+*/
+#define TSLPRM_ECS_K_FAST (20)
+
+/** Environment Change System delay in msec (range=0..5000)
+ - The ECS will be started after this delay and when all sensors are in Release state.
+*/
+#define TSLPRM_ECS_DELAY (500)
+
+/** @} Common_Parameters_ECS */
+
+//==============================================================================
+// Detection Time Out (DTO)
+//==============================================================================
+
+/** @defgroup Common_Parameters_DTO 11 - DTO
+ * @{ */
+
+/** Detection Time Out delay in seconds (range=0..63)
+ - Value 0: DTO processing not compiled in the code (to gain size if not used).
+ - Value 1: Default time out infinite.
+ - Value between 2 and 63: Default time out between value n-1 and n.
+ - Examples:
+ - With a DTO equal to 2, the time out is between 1s and 2s.
+ - With a DTO equal to 63, the time out is between 62s and 63s.
+
+@note The DTO can be changed in run-time by the application only if the
+ default value is between 1 and 63.
+*/
+#define TSLPRM_DTO (5)
+
+/** @} Common_Parameters_DTO */
+
+//==============================================================================
+// Detection Exclusion System (DXS)
+//==============================================================================
+
+/** @defgroup Common_Parameters_DXS 12 - DXS
+ * @{ */
+
+/** Detection Exclusion System (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_DXS (1)
+
+/** @} Common_Parameters_DXS */
+
+//==============================================================================
+// Miscellaneous parameters
+//==============================================================================
+
+/** @defgroup Common_Parameters_Misc 13 - Miscellaneous
+ * @{ */
+
+/** Timing tick frequency in Hz (range=125, 250, 500, 1000, 2000)
+ - Result to a timing interrupt respectively every 8ms, 4ms, 2ms, 1ms, 0.5ms
+*/
+#define TSLPRM_TICK_FREQ (1000)
+
+/** @} Common_Parameters_Misc */
+
+/** @} Common_Parameters */
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++ MCU PARAMETERS ++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+/** @defgroup STM32L1xx_Parameters STM32L1xx Parameters
+ * @{ */
+
+/** @defgroup STM32L1xx_Parameters_Misc 01 - Miscellaneous
+ * @{ */
+
+/** Shield with a channel (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_SHIELD (1)
+
+/** IOs default mode when no on-going acquisition (range=0..1)
+ - 0: Output push-pull low
+ - 1: Input floating
+@note To ensure a correct operation in noisy environment, this parameter should
+be configured to output push-pull low.
+*/
+#define TSLPRM_IODEF (1)
+
+/** Charge/transfer Period (in µs) (= high pulse + low pulse)
+ - This is used to calculate the Timer reload value.
+@note For HW acquisition only
+ */
+#define TSLPRM_CT_PERIOD (2)
+
+/** Timer frequency (in MHz)
+ - This is used to calculate the Timer reload value.
+@note For HW acquisition only
+ */
+#define TSLPRM_TIMER_FREQ (32)
+
+/** Delay for transfering charges from Cx to Cs capacitor and then discharge Cx
+ (range=0..65535)
+ - 0: no delay (it takes about 2.8µs for a CT cycle)
+ - (1..65535): delay (in µs) = 0.75 * TSLPRM_DELAY_TRANSFER + 1
+@note for SW acquisition only
+*/
+#define TSLPRM_DELAY_TRANSFER (1)
+
+/**Use Spread Spectrum (0=No, 1=Yes)
+@note for SW acquisition only
+*/
+#define TSLPRM_USE_SPREAD_SPECTRUM (1)
+
+/** Spread min value (range=0..(TSLPRM_SPREAD_MAX-1))
+@note for SW acquisition only
+*/
+#define TSLPRM_SPREAD_MIN (1)
+
+/** Spread max value (range=2..255)
+@note for SW acquisition only
+*/
+#define TSLPRM_SPREAD_MAX (20)
+
+/** IT disabling for IO protection (range=0..1)
+ - 0: IO not protected
+ - 1: IO protected
+@note for SW acquisition only
+*/
+#define TSLPRM_PROTECT_IO_ACCESS (0)
+
+/** Which GPIO will be used (range=0..1)
+ - 0: Not used
+ - 1: Used
+@note for SW acquisition only
+*/
+#define TSLPRM_USE_GPIOA (1)
+#define TSLPRM_USE_GPIOB (1)
+#define TSLPRM_USE_GPIOC (1)
+#define TSLPRM_USE_GPIOF (0)
+#define TSLPRM_USE_GPIOG (0)
+
+/** @} STM32L1xx_Parameters_Misc */
+
+/** @} STM32L1xx_Parameters */
+
+// DO NOT REMOVE !!!
+#include "tsl_check_config.h"
+
+#endif /* __TSL_CONF_STM32L1xx_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm8l.h_TOADAPT b/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm8l.h_TOADAPT
new file mode 100644
index 0000000..511f0f6
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm8l.h_TOADAPT
@@ -0,0 +1,533 @@
+/**
+ ******************************************************************************
+ * @file tsl_conf_stm8l.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief Acquisition parameters for STM8L products.
+ * @note This file must be copied in the application project and values
+ * changed for the application.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_CONF_STM8L_H
+#define __TSL_CONF_STM8L_H
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++ COMMON PARAMETERS ++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+/** @defgroup Common_Parameters Common Parameters
+ * @{ */
+
+//==============================================================================
+// Number of elements
+//==============================================================================
+
+/** @defgroup Common_Parameters_Number_Of_Elements 01 - Number of elements
+ * @{ */
+
+/** Total number of channels in application (range=1..255)
+*/
+#define TSLPRM_TOTAL_CHANNELS (1)
+
+/** Total number of banks in application (range=1..255)
+*/
+#define TSLPRM_TOTAL_BANKS (1)
+
+/** Total number of "Extended" TouchKeys in application (range=0..255)
+*/
+#define TSLPRM_TOTAL_TOUCHKEYS (1)
+
+/** Total number of "Basic" TouchKeys in application (range=0..255)
+*/
+#define TSLPRM_TOTAL_TOUCHKEYS_B (1)
+
+/** Total number of "Extended" Linear and Rotary sensors in application (range=0..255)
+ - Count also the 1-channel linear sensor used as TouchKey
+*/
+#define TSLPRM_TOTAL_LINROTS (1)
+
+/** Total number of "Basic" Linear and Rotary sensors in application (range=0..255)
+ - Count also the 1-channel linear sensor used as TouchKey
+*/
+#define TSLPRM_TOTAL_LINROTS_B (1)
+
+/** Total number of sensors/objects in application (range=1..255)
+ - Count all TouchKeys, Linear and Rotary sensors
+*/
+#define TSLPRM_TOTAL_OBJECTS (1)
+
+/** @} Common_Parameters_Number_Of_Elements */
+
+//==============================================================================
+// Optional features
+//==============================================================================
+
+/** @defgroup Common_Parameters_Options 02 - Optional features
+ * @{ */
+
+/** Record the last measure (0=No, 1=Yes)
+ - If No the measure is recalculated using the Reference and Delta
+*/
+#define TSLPRM_USE_MEAS (1)
+
+/** Zone management usage (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_ZONE (1)
+
+/** Proximity detection usage (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_PROX (1)
+
+/** Use the Timer tick callback (0=No, 1=Yes)
+ - When equal to 1, the function TSL_CallBack_TimerTick must be defined in
+ the application code. It is called for each timer interruption.
+*/
+#define TSLPRM_USE_TIMER_CALLBACK (1)
+
+/** Acquisition interrupt mode (0=No, 1=Yes)
+ - If No the acquisition is managed in the main routine using polling mode.
+ - If Yes the acquisition is managed in the interrupt routines.
+*/
+#define TSLPRM_USE_ACQ_INTERRUPT (1)
+
+/** @} Common_Parameters_Options */
+
+//==============================================================================
+// Acquisition limits
+//==============================================================================
+
+/** @defgroup Common_Parameters_Acquisition_Limits 03 - Acquisition limits
+ * @{ */
+
+/** Minimum acquisition measurement (range=0..65535)
+ - This is the minimum acceptable value for the acquisition measure.
+ - The acquisition will be in error if the measure is below this value.
+*/
+#define TSLPRM_ACQ_MIN (50)
+
+/** Maximum acquisition measurement (range=0..65535)
+ - This is the maximum acceptable value for the acquisition measure.
+ - The acquisition will be in error if the measure is above this value.
+*/
+#define TSLPRM_ACQ_MAX (4000)
+
+/** @} Common_Parameters_Acquisition_Limits */
+
+//==============================================================================
+// Calibration
+//==============================================================================
+
+/** @defgroup Common_Parameters_Calibration 04 - Calibration
+ * @{ */
+
+/** Number of calibration samples (range=4, 8, 16)
+ - Low value = faster calibration but less precision.
+ - High value = slower calibration but more precision.
+*/
+#define TSLPRM_CALIB_SAMPLES (8)
+
+/** Delay in measurement samples before starting the calibration (range=0..40)
+ - This is useful if a noise filter is used.
+ - Write 0 to disable the delay.
+*/
+#define TSLPRM_CALIB_DELAY (10)
+
+/** @} Common_Parameters_Calibration */
+
+//==============================================================================
+// Thresholds for TouchKey sensors
+//==============================================================================
+
+/** @defgroup Common_Parameters_TouchKey_Thresholds 05 - Thresholds for TouchKey sensors
+ * @{ */
+
+/** TouchKeys Proximity state input threshold (range=0..255)
+ - Enter Proximity state if delta is above
+*/
+#define TSLPRM_TKEY_PROX_IN_TH (20)
+
+/** TouchKeys Proximity state output threshold (range=0..255)
+ - Exit Proximity state if delta is below
+*/
+#define TSLPRM_TKEY_PROX_OUT_TH (15)
+
+/** TouchKeys Detect state input threshold (range=0..255)
+ - Enter Detect state if delta is above
+*/
+#define TSLPRM_TKEY_DETECT_IN_TH (30)
+
+/** TouchKeys Detect state output threshold (range=0..255)
+ - Exit Detect state if delta is below
+*/
+#define TSLPRM_TKEY_DETECT_OUT_TH (25)
+
+/** TouchKeys re-Calibration threshold (range=0..255)
+ - @warning The value is inverted in the sensor state machine
+ - Enter Calibration state if delta is below
+*/
+#define TSLPRM_TKEY_CALIB_TH (30)
+
+/** TouchKey, Linear and Rotary sensors thresholds coefficient (range=0..4)
+ This multiplier coefficient is applied on Detect and Re-Calibration thresholds only.
+ - 0: feature disabled
+ - 1: thresholds x 2
+ - 2: thresholds x 4
+ - 3: thresholds x 8
+ - 4: thresholds x 16
+*/
+#define TSLPRM_COEFF_TH (1)
+
+/** @} Common_Parameters_TouchKey_Thresholds */
+
+//==============================================================================
+// Thresholds for Linear and Rotary sensors
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Thresholds 06 - Thresholds for Linear and Rotary sensors
+ * @{ */
+
+/** Linear/Rotary Proximity state input threshold (range=0..255)
+ - Enter Proximity state if delta is above
+*/
+#define TSLPRM_LINROT_PROX_IN_TH (10)
+
+/** Linear/Rotary Proximity state output threshold (range=0..255)
+ - Exit Proximity state if delta is below
+*/
+#define TSLPRM_LINROT_PROX_OUT_TH (5)
+
+/** Linear/Rotary Detect state input threshold (range=0..255)
+ - Enter Detect state if delta is above
+*/
+#define TSLPRM_LINROT_DETECT_IN_TH (20)
+
+/** Linear/Rotary Detect state output threshold (range=0..255)
+ - Exit Detect state if delta is below
+*/
+#define TSLPRM_LINROT_DETECT_OUT_TH (15)
+
+/** Linear/Rotary re-Calibration threshold (range=0..255)
+ - @warning The value is inverted in the sensor state machine
+ - Enter Calibration state if delta is below
+ - A low absolute value will result in a higher sensitivity and thus some spurious
+ recalibration may be issued.
+*/
+#define TSLPRM_LINROT_CALIB_TH (20)
+
+/** Linear/Rotary Delta normalization (0=No, 1=Yes)
+ - When this parameter is set, a coefficient is applied on all Delta of all sensors
+ in order to normalize them and to improve the position calculation.
+ - These coefficients must be defined in a constant table in the application (see Library examples).
+ - The MSB is the coefficient integer part, the LSB is the coefficient real part.
+ - Examples:
+ - To apply a factor 1.10:
+ 0x01 to the MSB
+ 0x1A to the LSB (0.10 x 256 = 25.6 -> rounded to 26 = 0x1A)
+ - To apply a factor 0.90:
+ 0x00 to the MSB
+ 0xE6 to the LSB (0.90 x 256 = 230.4 -> rounded to 230 = 0xE6)
+ - To apply no factor:
+ 0x01 to the MSB
+ 0x00 to the LSB
+*/
+#define TSLPRM_LINROT_USE_NORMDELTA (1)
+
+/** @} Common_Parameters_LinRot_Thresholds */
+
+//==============================================================================
+// Linear/Rotary sensors used
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Used 07 - Linear/Rotary sensors used
+ * @{ */
+
+/** Select which Linear and Rotary sensors you use in your application.
+ - 0 = Not Used
+ - 1 = Used
+
+ LIN = Linear sensor
+ ROT = Rotary sensor
+ M1 = Mono electrodes design with 0/255 position at extremities of the sensor
+ M2 = Mono electrodes design
+ H = Half-ended electrodes design
+ D = Dual electrodes design
+*/
+#define TSLPRM_USE_3CH_LIN_M1 (1)
+#define TSLPRM_USE_3CH_LIN_M2 (1)
+#define TSLPRM_USE_3CH_LIN_H (1)
+#define TSLPRM_USE_3CH_ROT_M (1)
+
+#define TSLPRM_USE_4CH_LIN_M1 (1)
+#define TSLPRM_USE_4CH_LIN_M2 (1)
+#define TSLPRM_USE_4CH_LIN_H (1)
+#define TSLPRM_USE_4CH_ROT_M (1)
+
+#define TSLPRM_USE_5CH_LIN_M1 (1)
+#define TSLPRM_USE_5CH_LIN_M2 (1)
+#define TSLPRM_USE_5CH_LIN_H (1)
+#define TSLPRM_USE_5CH_ROT_M (1)
+#define TSLPRM_USE_5CH_ROT_D (1)
+
+#define TSLPRM_USE_6CH_LIN_M1 (1)
+#define TSLPRM_USE_6CH_LIN_M2 (1)
+#define TSLPRM_USE_6CH_LIN_H (1)
+#define TSLPRM_USE_6CH_ROT_M (1)
+
+/** @} Common_Parameters_LinRot_used */
+
+//==============================================================================
+// Linear/Rotary sensors position
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Position 08 - Linear/Rotary sensors position
+ * @{ */
+
+/** Position resolution in number of bits (range=1..8)
+ - A Low value will result in a low resolution and will be less subject to noise.
+ - A High value will result in a high resolution and will be more subject to noise.
+*/
+#define TSLPRM_LINROT_RESOLUTION (7)
+
+/** Direction change threshold in position unit (range=0..255)
+ - Defines the default threshold used during the change direction process.
+ - A Low value will result in a faster direction change.
+ - A High value will result in a slower direction change.
+*/
+#define TSLPRM_LINROT_DIR_CHG_POS (10)
+
+/** Direction change debounce (range=0..63)
+ - Defines the default integrator counter used during the change direction process.
+ - This counter is decremented when the same change in the position is detected and the direction will
+ change after this counter reaches zero.
+ - A Low value will result in a faster direction change.
+ - A High value will result in a slower direction change.
+*/
+#define TSLPRM_LINROT_DIR_CHG_DEB (1)
+
+/** @} Common_Parameters_LinRot_Position */
+
+//==============================================================================
+// Debounce counters
+//==============================================================================
+
+/** @defgroup Common_Parameters_Debounce 09 - Debounce counters
+ * @{ */
+
+/** Proximity state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the Proximity detection but with less noise filtering.
+ - A High value will result in improving the system noise immunity but will increase the system response time.
+*/
+#define TSLPRM_DEBOUNCE_PROX (3)
+
+/** Detect state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the detection but with less noise filtering.
+ - A High value will result in improving the system noise immunity but will increase the system response time.
+*/
+#define TSLPRM_DEBOUNCE_DETECT (3)
+
+/** Release state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the end-detection but with less noise filtering.
+ - A High value will result in a lower sensitivity during the end-detection but with more noise filtering.
+*/
+#define TSLPRM_DEBOUNCE_RELEASE (3)
+
+/** Re-calibration state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the recalibration but with less noise filtering.
+ - A High value will result in a lower sensitivity during the recalibration but with more noise filtering.
+*/
+#define TSLPRM_DEBOUNCE_CALIB (3)
+
+/** Error state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity to enter in error state.
+ - A High value will result in a lower sensitivity to enter in error state.
+*/
+#define TSLPRM_DEBOUNCE_ERROR (3)
+
+/** @} Common_Parameters_Debounce */
+
+//==============================================================================
+// Environment Change System (ECS)
+//==============================================================================
+
+/** @defgroup Common_Parameters_ECS 10 - ECS
+ * @{ */
+
+/** Environment Change System Slow K factor (range=0..255)
+ - The higher value is K, the faster is the response time.
+*/
+#define TSLPRM_ECS_K_SLOW (10)
+
+/** Environment Change System Fast K factor (range=0..255)
+ - The higher value is K, the faster is the response time.
+*/
+#define TSLPRM_ECS_K_FAST (20)
+
+/** Environment Change System delay in msec (range=0..5000)
+ - The ECS will be started after this delay and when all sensors are in Release state.
+*/
+#define TSLPRM_ECS_DELAY (100)
+
+/** @} Common_Parameters_ECS */
+
+//==============================================================================
+// Detection Time Out (DTO)
+//==============================================================================
+
+/** @defgroup Common_Parameters_DTO 11 - DTO
+ * @{ */
+
+/** Detection Time Out delay in seconds (range=0..63)
+ - Value 0: DTO processing not compiled in the code (to gain size if not used).
+ - Value 1: Default time out infinite.
+ - Value between 2 and 63: Default time out between value n-1 and n.
+ - Examples:
+ - With a DTO equal to 2, the time out is between 1s and 2s.
+ - With a DTO equal to 63, the time out is between 62s and 63s.
+
+@note The DTO can be changed in run-time by the application only if the
+ default value is between 1 and 63.
+*/
+#define TSLPRM_DTO (5)
+
+/** @} Common_Parameters_DTO */
+
+//==============================================================================
+// Detection Exclusion System (DXS)
+//==============================================================================
+
+/** @defgroup Common_Parameters_DXS 12 - DXS
+ * @{ */
+
+/** Detection Exclusion System (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_DXS (1)
+
+/** @} Common_Parameters_DXS */
+
+//==============================================================================
+// Miscellaneous parameters
+//==============================================================================
+
+/** @defgroup Common_Parameters_Misc 13 - Miscellaneous
+ * @{ */
+
+/** Timing tick frequency in Hz (range=125, 250, 500, 1000, 2000)
+ - Result to a timing interrupt respectively every 8ms, 4ms, 2ms, 1ms, 0.5ms
+*/
+#define TSLPRM_TICK_FREQ (500)
+
+/** @} Common_Parameters_Misc */
+
+/** @} Common_Parameters */
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++ MCU PARAMETERS ++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+/** @defgroup STM8L_Parameters STM8L Parameters
+ * @{ */
+
+/** @defgroup STM8L_Parameters_Common 01 - Common
+ * @{ */
+
+/** Shield with a channel (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_SHIELD (1)
+
+/** IOs default mode when no on-going acquisition (range=0..1)
+ - 0: Output push-pull low
+ - 1: Input floating
+@note To ensure a correct operation in noisy environment, this parameter must
+be set to output push-pull low.
+*/
+#define TSLPRM_IODEF (1)
+
+/** Delay for discharging Cx and Cs capacitors (range=0..65535)
+ - The value corresponds to the Softdelay function parameter.
+*/
+#define TSLPRM_DELAY_DISCHARGE_ALL (3)
+
+/** @} STM8L_Parameters_Common */
+
+/** @defgroup STM8L_Parameters_Sw 02 - Software acquisition
+ * @{ */
+
+/** IT disabling for IO protection (range=0..1)
+ - 0: IO not protected
+ - 1: IO protected
+@note For software acquisition only
+*/
+#define TSLPRM_PROTECT_IO_ACCESS (1)
+
+/** Delay for charging Cx capacitor (range=0..32)
+ - The value corresponds to a number of NOPs.
+@note For software acquisition only
+*/
+#define TSLPRM_DELAY_CHARGE (3)
+
+/** Delay for transfering charges from Cx to Cs capacitor (range=0..32)
+ - The value corresponds to a number of NOPs.
+@note For software acquisition only
+*/
+#define TSLPRM_DELAY_TRANSFER (3)
+
+/** Use Spread Spectrum (0=No, 1=Yes)
+@note For software acquisition only
+*/
+#define TSLPRM_USE_SPREAD_SPECTRUM (1)
+
+/** Spread min value (range=1..TSLPRM_SPREAD_MAX-1)
+@note For software acquisition only
+*/
+#define TSLPRM_SPREAD_MIN (1)
+
+/** Spread max value (range=TSLPRM_SPREAD_MIN+1..255)
+@note For software acquisition only
+*/
+#define TSLPRM_SPREAD_MAX (20)
+
+/** @} STM8L_Parameters_Sw */
+
+/** @defgroup STM8L_Parameters_Hw 03 - Hardware acquisition
+ * @{ */
+
+/** Charge/transfer Period (in µs)
+ - This is used to calculate the Timer reload value.
+ */
+#define TSLPRM_CT_PERIOD (2)
+
+/** Timer frequency (in MHz)
+ - This is used to calculate the Timer reload value.
+ */
+#define TSLPRM_TIMER_FREQ (16)
+
+/** @} STM8L_Parameters_Hw */
+
+/** @} STM8L_Parameters */
+
+// DO NOT REMOVE !!!
+#include "tsl_check_config.h"
+
+#endif /* __TSL_CONF_STM8L_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm8tl5x.h_TOADAPT b/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm8tl5x.h_TOADAPT
new file mode 100644
index 0000000..adc7da4
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_conf_stm8tl5x.h_TOADAPT
@@ -0,0 +1,598 @@
+/**
+ ******************************************************************************
+ * @file tsl_conf_stm8tl5x.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief Acquisition parameters for STM8TL5x products.
+ * @note This file must be copied in the application project and values
+ * changed for the application.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_CONF_STM8TL5X_H
+#define __TSL_CONF_STM8TL5X_H
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++ COMMON PARAMETERS ++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+/** @defgroup Common_Parameters Common Parameters
+ * @{ */
+
+//==============================================================================
+// Number of elements
+//==============================================================================
+
+/** @defgroup Common_Parameters_Number_Of_Elements 01 - Number of elements
+ * @{ */
+
+/** Total number of channels in application (range=1..255)
+*/
+#define TSLPRM_TOTAL_CHANNELS (1)
+
+/** Total number of banks in application (range=1..255)
+*/
+#define TSLPRM_TOTAL_BANKS (1)
+
+/** Total number of "Extended" TouchKeys in application (range=0..255)
+*/
+#define TSLPRM_TOTAL_TOUCHKEYS (1)
+
+/** Total number of "Basic" TouchKeys in application (range=0..255)
+*/
+#define TSLPRM_TOTAL_TOUCHKEYS_B (1)
+
+/** Total number of "Extended" Linear and Rotary sensors in application (range=0..255)
+ - Count also the 1-channel linear sensor used as TouchKey
+*/
+#define TSLPRM_TOTAL_LINROTS (1)
+
+/** Total number of "Basic" Linear and Rotary sensors in application (range=0..255)
+ - Count also the 1-channel linear sensor used as TouchKey
+*/
+#define TSLPRM_TOTAL_LINROTS_B (1)
+
+/** Total number of sensors/objects in application (range=1..255)
+ - Count all TouchKeys, Linear and Rotary sensors
+*/
+#define TSLPRM_TOTAL_OBJECTS (1)
+
+/** @} Common_Parameters_Number_Of_Elements */
+
+//==============================================================================
+// Optional features
+//==============================================================================
+
+/** @defgroup Common_Parameters_Options 02 - Optional features
+ * @{ */
+
+/** Record the last measure (0=No, 1=Yes)
+ - If No the measure is recalculated using the Reference and Delta
+*/
+#define TSLPRM_USE_MEAS (1)
+
+/** Zone management usage (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_ZONE (1)
+
+/** Proximity detection usage (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_PROX (1)
+
+/** Use the Timer tick callback (0=No, 1=Yes)
+ - When equal to 1, the function TSL_CallBack_TimerTick must be defined in
+ the application code. It is called for each timer interruption.
+*/
+#define TSLPRM_USE_TIMER_CALLBACK (1)
+
+/** Acquisition interrupt mode (0=No, 1=Yes)
+ - If No the acquisition is managed in the main routine using polling mode.
+ - If Yes the acquisition is managed in the interrupt routines.
+*/
+#define TSLPRM_USE_ACQ_INTERRUPT (1)
+
+/** @} Common_Parameters_Options */
+
+//==============================================================================
+// Acquisition limits
+//==============================================================================
+
+/** @defgroup Common_Parameters_Acquisition_Limits 03 - Acquisition limits
+ * @{ */
+
+/** Minimum acquisition measurement (range=0..65535)
+ - This is the minimum acceptable value for the acquisition measure.
+ - The acquisition will be in error if the measure is below this value.
+*/
+#define TSLPRM_ACQ_MIN (50)
+
+/** Maximum acquisition measurement (range=0..65535)
+ - This is the maximum acceptable value for the acquisition measure.
+ - The acquisition will be in error if the measure is above this value.
+*/
+#define TSLPRM_ACQ_MAX (4000)
+
+/** @} Common_Parameters_Acquisition_Limits */
+
+//==============================================================================
+// Calibration
+//==============================================================================
+
+/** @defgroup Common_Parameters_Calibration 04 - Calibration
+ * @{ */
+
+/** Number of calibration samples (range=4, 8, 16)
+ - Low value = faster calibration but less precision.
+ - High value = slower calibration but more precision.
+*/
+#define TSLPRM_CALIB_SAMPLES (8)
+
+/** Delay in measurement samples before starting the calibration (range=0..40)
+ - This is useful if a noise filter is used.
+ - Write 0 to disable the delay.
+*/
+#define TSLPRM_CALIB_DELAY (10)
+
+/** @} Common_Parameters_Calibration */
+
+//==============================================================================
+// Thresholds for TouchKey sensors
+//==============================================================================
+
+/** @defgroup Common_Parameters_TouchKey_Thresholds 05 - Thresholds for TouchKey sensors
+ * @{ */
+
+/** TouchKeys Proximity state input threshold (range=0..255)
+ - Enter Proximity state if delta is above
+*/
+#define TSLPRM_TKEY_PROX_IN_TH (15)
+
+/** TouchKeys Proximity state output threshold (range=0..255)
+ - Exit Proximity state if delta is below
+*/
+#define TSLPRM_TKEY_PROX_OUT_TH (5)
+
+/** TouchKeys Detect state input threshold (range=0..255)
+ - Enter Detect state if delta is above
+*/
+#define TSLPRM_TKEY_DETECT_IN_TH (50)
+
+/** TouchKeys Detect state output threshold (range=0..255)
+ - Exit Detect state if delta is below
+*/
+#define TSLPRM_TKEY_DETECT_OUT_TH (40)
+
+/** TouchKeys re-Calibration threshold (range=0..255)
+ - @warning The value is inverted in the sensor state machine
+ - Enter Calibration state if delta is below
+*/
+#define TSLPRM_TKEY_CALIB_TH (20)
+
+/** TouchKey, Linear and Rotary sensors thresholds coefficient (range=0..4)
+ This multiplier coefficient is applied on Detect and Re-Calibration thresholds only.
+ - 0: feature disabled
+ - 1: thresholds x 2
+ - 2: thresholds x 4
+ - 3: thresholds x 8
+ - 4: thresholds x 16
+*/
+#define TSLPRM_COEFF_TH (1)
+
+/** @} Common_Parameters_TouchKey_Thresholds */
+
+//==============================================================================
+// Thresholds for Linear and Rotary sensors
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Thresholds 06 - Thresholds for Linear and Rotary sensors
+ * @{ */
+
+/** Linear/Rotary Proximity state input threshold (range=0..255)
+ - Enter Proximity state if delta is above
+*/
+#define TSLPRM_LINROT_PROX_IN_TH (15)
+
+/** Linear/Rotary Proximity state output threshold (range=0..255)
+ - Exit Proximity state if delta is below
+*/
+#define TSLPRM_LINROT_PROX_OUT_TH (5)
+
+/** Linear/Rotary Detect state input threshold (range=0..255)
+ - Enter Detect state if delta is above
+*/
+#define TSLPRM_LINROT_DETECT_IN_TH (50)
+
+/** Linear/Rotary Detect state output threshold (range=0..255)
+ - Exit Detect state if delta is below
+*/
+#define TSLPRM_LINROT_DETECT_OUT_TH (30)
+
+/** Linear/Rotary re-Calibration threshold (range=0..255)
+ - @warning The value is inverted in the sensor state machine
+ - Enter Calibration state if delta is below
+ - A low absolute value will result in a higher sensitivity and thus some spurious
+ recalibration may be issued.
+*/
+#define TSLPRM_LINROT_CALIB_TH (20)
+
+/** Linear/Rotary Delta normalization (0=No, 1=Yes)
+ - When this parameter is set, a coefficient is applied on all Delta of all sensors
+ in order to normalize them and to improve the position calculation.
+ - These coefficients must be defined in a constant table in the application (see Library examples).
+ - The MSB is the coefficient integer part, the LSB is the coefficient real part.
+ - Examples:
+ - To apply a factor 1.10:
+ 0x01 to the MSB
+ 0x1A to the LSB (0.10 x 256 = 25.6 -> rounded to 26 = 0x1A)
+ - To apply a factor 0.90:
+ 0x00 to the MSB
+ 0xE6 to the LSB (0.90 x 256 = 230.4 -> rounded to 230 = 0xE6)
+ - To apply no factor:
+ 0x01 to the MSB
+ 0x00 to the LSB
+*/
+#define TSLPRM_LINROT_USE_NORMDELTA (1)
+
+/** @} Common_Parameters_LinRot_Thresholds */
+
+//==============================================================================
+// Linear/Rotary sensors used
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Used 07 - Linear/Rotary sensors used
+ * @{ */
+
+/** Select which Linear and Rotary sensors you use in your application.
+ - 0 = Not Used
+ - 1 = Used
+
+ LIN = Linear sensor
+ ROT = Rotary sensor
+ M1 = Mono electrodes design with 0/255 position at extremities of the sensor
+ M2 = Mono electrodes design
+ H = Half-ended electrodes design
+ D = Dual electrodes design
+*/
+#define TSLPRM_USE_3CH_LIN_M1 (1)
+#define TSLPRM_USE_3CH_LIN_M2 (1)
+#define TSLPRM_USE_3CH_LIN_H (1)
+#define TSLPRM_USE_3CH_ROT_M (1)
+
+#define TSLPRM_USE_4CH_LIN_M1 (1)
+#define TSLPRM_USE_4CH_LIN_M2 (1)
+#define TSLPRM_USE_4CH_LIN_H (1)
+#define TSLPRM_USE_4CH_ROT_M (1)
+
+#define TSLPRM_USE_5CH_LIN_M1 (1)
+#define TSLPRM_USE_5CH_LIN_M2 (1)
+#define TSLPRM_USE_5CH_LIN_H (1)
+#define TSLPRM_USE_5CH_ROT_M (1)
+#define TSLPRM_USE_5CH_ROT_D (1)
+
+#define TSLPRM_USE_6CH_LIN_M1 (1)
+#define TSLPRM_USE_6CH_LIN_M2 (1)
+#define TSLPRM_USE_6CH_LIN_H (1)
+#define TSLPRM_USE_6CH_ROT_M (1)
+
+/** @} Common_Parameters_LinRot_used */
+
+//==============================================================================
+// Linear/Rotary sensors position
+//==============================================================================
+
+/** @defgroup Common_Parameters_LinRot_Position 08 - Linear/Rotary sensors position
+ * @{ */
+
+/** Position resolution in number of bits (range=1..8)
+ - A Low value will result in a low resolution and will be less subject to noise.
+ - A High value will result in a high resolution and will be more subject to noise.
+*/
+#define TSLPRM_LINROT_RESOLUTION (7)
+
+/** Direction change threshold in position unit (range=0..255)
+ - Defines the default threshold used during the change direction process.
+ - A Low value will result in a faster direction change.
+ - A High value will result in a slower direction change.
+*/
+#define TSLPRM_LINROT_DIR_CHG_POS (10)
+
+/** Direction change debounce (range=0..63)
+ - Defines the default integrator counter used during the change direction process.
+ - This counter is decremented when the same change in the position is detected and the direction will
+ change after this counter reaches zero.
+ - A Low value will result in a faster direction change.
+ - A High value will result in a slower direction change.
+*/
+#define TSLPRM_LINROT_DIR_CHG_DEB (1)
+
+/** @} Common_Parameters_LinRot_Position */
+
+//==============================================================================
+// Debounce counters
+//==============================================================================
+
+/** @defgroup Common_Parameters_Debounce 09 - Debounce counters
+ * @{ */
+
+/** Proximity state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the Proximity detection but with less noise filtering.
+ - A High value will result in improving the system noise immunity but will increase the system response time.
+*/
+#define TSLPRM_DEBOUNCE_PROX (3)
+
+/** Detect state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the detection but with less noise filtering.
+ - A High value will result in improving the system noise immunity but will increase the system response time.
+*/
+#define TSLPRM_DEBOUNCE_DETECT (3)
+
+/** Release state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the end-detection but with less noise filtering.
+ - A High value will result in a lower sensitivity during the end-detection but with more noise filtering.
+*/
+#define TSLPRM_DEBOUNCE_RELEASE (3)
+
+/** Re-calibration state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity during the recalibration but with less noise filtering.
+ - A High value will result in a lower sensitivity during the recalibration but with more noise filtering.
+*/
+#define TSLPRM_DEBOUNCE_CALIB (3)
+
+/** Error state debounce in samples unit (range=0..63)
+ - A Low value will result in a higher sensitivity to enter in error state.
+ - A High value will result in a lower sensitivity to enter in error state.
+*/
+#define TSLPRM_DEBOUNCE_ERROR (3)
+
+/** @} Common_Parameters_Debounce */
+
+//==============================================================================
+// Environment Change System (ECS)
+//==============================================================================
+
+/** @defgroup Common_Parameters_ECS 10 - ECS
+ * @{ */
+
+/** Environment Change System Slow K factor (range=0..255)
+ - The higher value is K, the faster is the response time.
+*/
+#define TSLPRM_ECS_K_SLOW (5)
+
+/** Environment Change System Fast K factor (range=0..255)
+ - The higher value is K, the faster is the response time.
+*/
+#define TSLPRM_ECS_K_FAST (40)
+
+/** Environment Change System delay in msec (range=0..5000)
+ - The ECS will be started after this delay and when all sensors are in Release state.
+*/
+#define TSLPRM_ECS_DELAY (500)
+
+/** @} Common_Parameters_ECS */
+
+//==============================================================================
+// Detection Time Out (DTO)
+//==============================================================================
+
+/** @defgroup Common_Parameters_DTO 11 - DTO
+ * @{ */
+
+/** Detection Time Out delay in seconds (range=0..63)
+ - Value 0: DTO processing not compiled in the code (to gain size if not used).
+ - Value 1: Default time out infinite.
+ - Value between 2 and 63: Default time out between value n-1 and n.
+ - Examples:
+ - With a DTO equal to 2, the time out is between 1s and 2s.
+ - With a DTO equal to 63, the time out is between 62s and 63s.
+
+@note The DTO can be changed in run-time by the application only if the
+ default value is between 1 and 63.
+*/
+#define TSLPRM_DTO (5)
+
+/** @} Common_Parameters_DTO */
+
+//==============================================================================
+// Detection Exclusion System (DXS)
+//==============================================================================
+
+/** @defgroup Common_Parameters_DXS 12 - DXS
+ * @{ */
+
+/** Detection Exclusion System (0=No, 1=Yes)
+*/
+#define TSLPRM_USE_DXS (1)
+
+/** @} Common_Parameters_DXS */
+
+//==============================================================================
+// Miscellaneous parameters
+//==============================================================================
+
+/** @defgroup Common_Parameters_Misc 13 - Miscellaneous
+ * @{ */
+
+/** Timing tick frequency in Hz (range=125, 250, 500, 1000, 2000)
+ - Result to a timing interrupt respectively every 8ms, 4ms, 2ms, 1ms, 0.5ms
+*/
+#define TSLPRM_TICK_FREQ (1000)
+
+/** @} Common_Parameters_Misc */
+
+/** @} Common_Parameters */
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++ MCU PARAMETERS ++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+// DO NOT MODIFY THE LINES BELOW!!!
+#define STM8TL53C4 (0)
+#define STM8TL53G4 (1)
+#define STM8TL53F4 (2)
+#define STM8TL52G4 (3)
+#define STM8TL52F4 (4)
+
+/** @defgroup STM8TL5x_Parameters STM8TL5x Parameters
+ * @{ */
+
+//==============================================================================
+// Device selection
+//==============================================================================
+
+/** @defgroup STM8TL5x_Parameters_Device_Selection 01 - Device Selection
+ * @{ */
+
+/** STM8TL5x device selection (range=0..4)
+ - Select a MCU in the above list
+*/
+#define TSLPRM_MCU STM8TL53C4
+
+/** @} STM8TL5x_Parameters_Device_Selection */
+
+//==============================================================================
+// Reference adjustment
+//==============================================================================
+
+/** @defgroup STM8TL5x_Parameters_Reference_Adjustment 02 - Reference adjustment
+ * @{ */
+
+/** Used to calibrate the EPCC to get the Reference closed to this value (range=100..2000)
+ - The range values are recommended values.
+ - The higher the Reference, the higher the sensitivity
+*/
+#define TSLPRM_KEY_TARGET_REFERENCE (500)
+
+/** Used to calibrate the EPCC (range=1..TSLPRM_KEY_TARGET_REFERENCE)
+*/
+#define TSLPRM_KEY_TARGET_REFERENCE_ERROR (25)
+
+/** Number of iteration after the dichotomy to fine tune the EPCC value (range=3..5)
+*/
+#define TSLPRM_PXS_EPCC_FINE_TUNING_ITERATION (3)
+
+/** Used to calibrate the CS (range=1,2,4,8)
+*/
+#define TSLPRM_KEY_TARGET_ATTENUATION (4)
+
+/** Below (TSLPRM_KEY_TARGET_REFERENCE - TSLPRM_TOUCHKEY_REFERENCE_RANGE) the EPCC is updated for the TKeys (range=1..TSLPRM_KEY_TARGET_REFERENCE)
+*/
+#define TSLPRM_TOUCHKEY_REFERENCE_RANGE (75)
+
+/** Below (TSLPRM_KEY_TARGET_REFERENCE - TSLPRM_LINROT_REFERENCE_RANGE) the EPCC is updated for the Linear/Rotary (range=1..TSLPRM_KEY_TARGET_REFERENCE)
+*/
+#define TSLPRM_LINROT_REFERENCE_RANGE (75)
+
+/** @} STM8TL5x_Parameters_Reference_Adjustment */
+
+//==============================================================================
+// PXS Clock
+//==============================================================================
+
+/** @defgroup STM8TL5x_Parameters_PXS_Clock 03 - PXS Clock
+ - These parameters define the acquisition clock settings.
+ * @{ */
+
+/** Acquisition frequency (values are 16000, 8000, 4000, 2000, 1000, 500, 250 or 125)
+*/
+#define TSLPRM_PXS_HSI (16000)
+
+/** Up phase length (range=1..7)
+*/
+#define TSLPRM_PXS_UP_LENGTH (1)
+
+/** Pass phase length (range=1..7)
+*/
+#define TSLPRM_PXS_PASS_LENGTH (1)
+
+/** @} STM8TL5x_Parameters_PXS_Clock */
+
+//==============================================================================
+// PXS Synchro
+//==============================================================================
+
+/** @defgroup STM8TL5x_Parameters_PXS_Synchro 04 - PXS Synchro
+ * @{ */
+
+/** Acquisition synchronized with SYNCHRO pin (0=No, 1=Yes)
+*/
+#define TSLPRM_PXS_SYNCHRONIZE (1)
+
+/** Synchronization edge (0=Fall, 1=Rise)
+*/
+#define TSLPRM_PXS_SYNCHRO_EDGE (1)
+
+/** @} STM8TL5x_Parameters_PXS_Synchro */
+
+//==============================================================================
+// PXS Miscellaneous
+//==============================================================================
+
+/** @defgroup STM8TL5x_Parameters_PXS_Miscellaneous 05 - PXS Miscellaneous
+ * @{ */
+
+/** Low power mode between acquisition (0=No, 1=Yes)
+*/
+#define TSLPRM_PXS_LOW_POWER_MODE (1)
+
+/** RF detection (0=No, 1=Yes)
+*/
+#define TSLPRM_PXS_RF_DETECTION (1)
+
+/** Transmitter inactive state (0=Grounded, 1=Floating)
+@note To ensure a correct operation in noisy environment, this parameter should
+be configured to Grounded state.
+*/
+#define TSLPRM_PXS_INACTIVE_TX (1)
+
+/** Receiver inactive state (0=Grounded, 1=Floating)
+@note To ensure a correct operation in noisy environment, this parameter should
+be configured to Grounded state.
+*/
+#define TSLPRM_PXS_INACTIVE_RX (1)
+
+/** Charge/Discharge cycle behaviour after VTHR is reached (0=stop, 1=continue)
+*/
+#define TSLPRM_PXS_RX_COUPLING (1)
+
+/** Stabilization time (values are LONG_STAB, MEDIUM_STAB, SHORT_STAB)
+*/
+#define TSLPRM_PXS_STAB LONG_STAB
+
+/** Bias (values are HIGH_BIAS, MEDIUM_BIAS, LOW_BIAS, VERY_LOW_BIAS)
+*/
+#define TSLPRM_PXS_BIAS HIGH_BIAS
+
+/** Index maximum of Rx channels ("N" of RxN)
+ - This value must not exceed 9 with STM8TL53C4 and 7 with STM8TL53G4
+*/
+#define TSLPRM_HIGH_CHANNEL_NB (9)
+
+/** @} STM8TL5x_Parameters_PXS_Miscellaneous */
+
+/** @} STM8TL5x_Parameters */
+
+// DO NOT REMOVE !!!
+#include "tsl_check_config.h"
+
+#endif /* __TSL_CONF_STM8TL5X_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_dxs.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_dxs.h
new file mode 100644
index 0000000..1d4f36b
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_dxs.h
@@ -0,0 +1,43 @@
+/**
+ ******************************************************************************
+ * @file tsl_dxs.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_dxs.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_DXS_H
+#define __TSL_DXS_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "tsl_object.h"
+
+/* Exported types ------------------------------------------------------------*/
+
+/* Exported functions --------------------------------------------------------*/
+
+void TSL_dxs_FirstObj(CONST TSL_ObjectGroup_T *objgrp);
+
+#endif /* __TSL_DXS_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_ecs.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_ecs.h
new file mode 100644
index 0000000..36482fa
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_ecs.h
@@ -0,0 +1,45 @@
+/**
+ ******************************************************************************
+ * @file tsl_ecs.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_ecs.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_ECS_H
+#define __TSL_ECS_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "tsl_object.h"
+
+/* Exported types ------------------------------------------------------------*/
+
+/* Exported functions --------------------------------------------------------*/
+
+TSL_tKCoeff_T TSL_ecs_CalcK(TSL_ObjectGroup_T *objgrp, TSL_tKCoeff_T k_slow, TSL_tKCoeff_T k_fast);
+void TSL_ecs_ProcessK(TSL_ObjectGroup_T *objgrp, TSL_tKCoeff_T Kcoeff);
+TSL_Status_enum_T TSL_ecs_Process(TSL_ObjectGroup_T *objgrp);
+
+#endif /* __TSL_ECS_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_filter.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_filter.h
new file mode 100644
index 0000000..ed3ce0a
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_filter.h
@@ -0,0 +1,41 @@
+/**
+ ******************************************************************************
+ * @file tsl_filter.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_filter.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_FILTER_H
+#define __TSL_FILTER_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "tsl_acq.h"
+
+/* Exported types ------------------------------------------------------------*/
+TSL_tMeas_T TSL_filt_MeasFilter(TSL_tMeas_T measn1, TSL_tMeas_T measn);
+TSL_tDelta_T TSL_filt_DeltaFilter(TSL_tDelta_T delta);
+
+#endif /* __TSL_FILTER_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_globals.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_globals.h
new file mode 100644
index 0000000..43e610f
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_globals.h
@@ -0,0 +1,87 @@
+/**
+ ******************************************************************************
+ * @file tsl_globals.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_globals.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_GLOBALS_H
+#define __TSL_GLOBALS_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "tsl_acq.h"
+#include "tsl_object.h"
+
+/* Exported types ------------------------------------------------------------*/
+
+/** Store all global variables shared between the STMTouch Driver and the Application.
+ */
+typedef struct
+{
+ TSL_tTick_ms_T Tick_ms; /**< Incremented each 0.5ms by timing interrupt routine */
+ TSL_tTick_sec_T Tick_sec; /**< Incremented each second by timing interrupt routine */
+ CONST TSL_Bank_T *Bank_Array; /**< Pointer to the array containing all Banks */
+ TSL_tIndex_T This_Bank; /**< Pointer to the current Bank */
+ CONST TSL_Object_T *This_Obj; /**< Pointer to the current Object */
+#if TSLPRM_USE_ZONE > 0
+ CONST TSL_Zone_T *This_Zone; /**< Pointer to the current Zone */
+ TSL_tIndex_T Index_In_This_Zone; /**< Index in the current Zone */
+#endif
+#if TSLPRM_TOTAL_TKEYS > 0
+ CONST TSL_TouchKey_T *This_TKey; /**< Pointer to the current TKey */
+#endif
+#if TSLPRM_TOTAL_LNRTS > 0
+ CONST TSL_LinRot_T *This_LinRot; /**< Pointer to the current Linear or Rotary sensor */
+#endif
+}
+TSL_Globals_T;
+
+/** Store all global parametersshared between the STMTouch Driver and the Application .
+ @warning Only one variable of this structure type must be created and be placed
+ in RAM only.
+ */
+typedef struct
+{
+ TSL_tMeas_T AcqMin; /**< Acquisition minimum limit */
+ TSL_tMeas_T AcqMax; /**< Acquisition maximum limit */
+ TSL_tNb_T NbCalibSamples; /**< Number of Calibration samples */
+ TSL_tTick_sec_T DTO; /**< Detection Time Out */
+#if TSLPRM_TOTAL_TKEYS > 0
+ CONST TSL_State_T *p_TKeySM; /**< Default state machine for TouchKey sensors */
+ CONST TSL_TouchKeyMethods_T *p_TKeyMT; /**< Default methods for TouchKey sensors */
+#endif
+#if TSLPRM_TOTAL_LNRTS > 0
+ CONST TSL_State_T *p_LinRotSM; /**< Default state machine for Linear/Rotary sensors */
+ CONST TSL_LinRotMethods_T *p_LinRotMT; /**< Default methods for Linear/Rotary sensors */
+#endif
+}
+TSL_Params_T;
+
+/* Exported variables --------------------------------------------------------*/
+extern TSL_Globals_T TSL_Globals;
+extern TSL_Params_T TSL_Params;
+
+#endif /* __TSL_GLOBALS_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_linrot.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_linrot.h
new file mode 100644
index 0000000..e0571b7
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_linrot.h
@@ -0,0 +1,226 @@
+/**
+ ******************************************************************************
+ * @file tsl_linrot.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_linrot.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_LINROT_H
+#define __TSL_LINROT_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "tsl_acq.h"
+#include "tsl_time.h"
+
+/* Exported types ------------------------------------------------------------*/
+
+/** Contains all data related to Linear and Rotary sensor.
+ * Variables of this structure type must be placed in RAM only.
+ */
+typedef struct
+{
+ TSL_StateId_enum_T StateId; /**< Current state identifier */
+ TSL_tPosition_T RawPosition; /**< Raw position */
+ TSL_tPosition_T Position; /**< Scaled position */
+ TSL_tCounter_T CounterDebounce; /**< Counter for debounce and calibration management */
+ unsigned int CounterDTO : 6; /**< Counter for DTO management (TSL_tCounter_T) */
+ unsigned int Change : 1; /**< The State is different from the previous one (TSL_StateChange_enum_T) */
+ unsigned int PosChange : 1; /**< The RawPosition/Position is different from the previous one (TSL_StateChange_enum_T) */
+ unsigned int CounterDirection : 6; /**< Counter for direction debounce management (TSL_tCounter_T) */
+ unsigned int DxSLock : 1; /**< The State is locked by the DxS (TSL_Bool_enum_T) */
+ unsigned int Direction : 1; /**< Movement direction (TSL_Bool_enum_T) */
+}
+TSL_LinRotData_T;
+
+/** Contains all parameters related to Linear and Rotary sensor.
+ * Variables of this structure type can be placed in RAM or ROM.
+ */
+typedef struct
+{
+ // Thresholds
+#if TSLPRM_USE_PROX > 0
+ TSL_tThreshold_T ProxInTh; /**< Proximity state in threshold */
+ TSL_tThreshold_T ProxOutTh; /**< Proximity state out threshold */
+#endif
+ TSL_tThreshold_T DetectInTh; /**< Detection state in threshold */
+ TSL_tThreshold_T DetectOutTh; /**< Detection state out threshold */
+ TSL_tThreshold_T CalibTh; /**< Calibration state threshold */
+ // Debounce counters
+ TSL_tCounter_T CounterDebCalib; /**< Debounce counter to enter in Calibration state */
+#if TSLPRM_USE_PROX > 0
+ TSL_tCounter_T CounterDebProx; /**< Debounce counter to enter in Proximity state */
+#endif
+ TSL_tCounter_T CounterDebDetect; /**< Debounce counter to enter in Detect state */
+ TSL_tCounter_T CounterDebRelease; /**< Debounce counter to enter in Release state */
+ TSL_tCounter_T CounterDebError; /**< Debounce counter to enter in Error state */
+ TSL_tCounter_T CounterDebDirection; /**< Debounce counter for the direction change */
+ // Other parameters
+ TSL_tCounter_T Resolution; /**< Position resolution */
+ TSL_tPosition_T DirChangePos; /**< Direction change position threshold */
+}
+TSL_LinRotParam_T;
+
+/** Contains definition of a Linear and Rotary sensor.
+ * Variables of this structure type can be placed in RAM or ROM.
+ */
+typedef struct
+{
+ TSL_LinRotData_T *p_Data; /**< Data (state id, counter, flags, ...) */
+ TSL_LinRotParam_T *p_Param; /**< Parameters (thresholds, debounce, ...) */
+ TSL_ChannelData_T *p_ChD; /**< First Channel Data (Meas, Ref, Delta, ...) */
+ TSL_tNb_T NbChannels; /**< Number of channels */
+ CONST uint16_t *p_DeltaCoeff; /**< Coefficient to apply on Delta */
+ CONST TSL_tsignPosition_T *p_PosOff; /**< Position offset table */
+ TSL_tNb_T SctComp; /**< Sector Computation */
+ TSL_tNb_T PosCorr; /**< Position Correction */
+ CONST TSL_State_T *p_SM; /**< State Machine */
+ CONST TSL_LinRotMethods_T *p_Methods; /**< Methods */
+}
+TSL_LinRot_T;
+
+/** Contains definition of a Basic Linear and Rotary sensor.
+ * Variables of this structure type can be placed in RAM or ROM.
+ * Basic sensor does not contain its own state machine and methods. It used
+ * default ones instead to gain memory space.
+ */
+typedef struct
+{
+ TSL_LinRotData_T *p_Data; /**< Data (state id, counter, flags, ...) */
+ TSL_LinRotParam_T *p_Param; /**< Parameters (thresholds, debounce, ...) */
+ TSL_ChannelData_T *p_ChD; /**< First Channel Data (Meas, Ref, Delta, ...) */
+ TSL_tNb_T NbChannels; /**< Number of channels */
+ CONST uint16_t *p_DeltaCoeff; /**< Coefficient to apply on Delta */
+ CONST TSL_tsignPosition_T *p_PosOff; /**< Position offset table */
+ TSL_tNb_T SctComp; /**< Sector Computation */
+ TSL_tNb_T PosCorr; /**< Position Correction */
+}
+TSL_LinRotB_T;
+
+/* Exported variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+
+/* Exported functions --------------------------------------------------------*/
+
+// "Object methods" functions
+void TSL_linrot_Init(void);
+void TSL_linrot_Process(void);
+TSL_Status_enum_T TSL_linrot_CalcPos(void);
+
+// Utility functions
+void TSL_linrot_SetStateCalibration(TSL_tCounter_T delay);
+void TSL_linrot_SetStateOff(void);
+#if !defined(TSLPRM_STM8TL5X) && !defined(STM8TL5X)
+void TSL_linrot_SetStateBurstOnly(void);
+#endif
+TSL_StateId_enum_T TSL_linrot_GetStateId(void);
+TSL_StateMask_enum_T TSL_linrot_GetStateMask(void);
+TSL_tNb_T TSL_linrot_IsChanged(void);
+
+// State machine functions
+void TSL_linrot_CalibrationStateProcess(void);
+void TSL_linrot_DebCalibrationStateProcess(void);
+void TSL_linrot_ReleaseStateProcess(void);
+void TSL_linrot_DebReleaseProxStateProcess(void);
+void TSL_linrot_DebReleaseDetectStateProcess(void);
+void TSL_linrot_DebReleaseTouchStateProcess(void);
+void TSL_linrot_ProxStateProcess(void);
+void TSL_linrot_DebProxStateProcess(void);
+void TSL_linrot_DebProxDetectStateProcess(void);
+void TSL_linrot_DebProxTouchStateProcess(void);
+void TSL_linrot_DetectStateProcess(void);
+void TSL_linrot_DebDetectStateProcess(void);
+void TSL_linrot_TouchStateProcess(void);
+void TSL_linrot_DebTouchStateProcess(void);
+void TSL_linrot_ErrorStateProcess(void);
+void TSL_linrot_DebErrorStateProcess(void);
+void TSL_linrot_OffStateProcess(void);
+
+// Position offset constant tables and corrections
+
+extern CONST TSL_tsignPosition_T TSL_POSOFF_3CH_LIN_M1[3][3];
+extern CONST TSL_tsignPosition_T TSL_POSOFF_3CH_LIN_M2[3][3];
+extern CONST TSL_tsignPosition_T TSL_POSOFF_3CH_LIN_H[3][3];
+extern CONST TSL_tsignPosition_T TSL_POSOFF_3CH_ROT_M[3][3];
+
+extern CONST TSL_tsignPosition_T TSL_POSOFF_4CH_LIN_M1[4][4];
+extern CONST TSL_tsignPosition_T TSL_POSOFF_4CH_LIN_M2[4][4];
+extern CONST TSL_tsignPosition_T TSL_POSOFF_4CH_LIN_H[4][4];
+extern CONST TSL_tsignPosition_T TSL_POSOFF_4CH_ROT_M[4][4];
+
+extern CONST TSL_tsignPosition_T TSL_POSOFF_5CH_LIN_M1[5][5];
+extern CONST TSL_tsignPosition_T TSL_POSOFF_5CH_LIN_M2[5][5];
+extern CONST TSL_tsignPosition_T TSL_POSOFF_5CH_LIN_H[5][5];
+extern CONST TSL_tsignPosition_T TSL_POSOFF_5CH_ROT_M[5][5];
+extern CONST TSL_tsignPosition_T TSL_POSOFF_5CH_ROT_D[5][5];
+
+extern CONST TSL_tsignPosition_T TSL_POSOFF_6CH_LIN_M1[6][6];
+extern CONST TSL_tsignPosition_T TSL_POSOFF_6CH_LIN_M2[6][6];
+extern CONST TSL_tsignPosition_T TSL_POSOFF_6CH_LIN_H[6][6];
+extern CONST TSL_tsignPosition_T TSL_POSOFF_6CH_ROT_M[6][6];
+
+#define TSL_SCTCOMP_3CH_LIN_M1 ((TSL_tNb_T)(128))
+#define TSL_POSCORR_3CH_LIN_M1 ((TSL_tNb_T)( 64))
+#define TSL_SCTCOMP_3CH_LIN_M2 ((TSL_tNb_T)(256))
+#define TSL_POSCORR_3CH_LIN_M2 ((TSL_tNb_T)(256))
+
+#define TSL_SCTCOMP_3CH_LIN_H ((TSL_tNb_T)(128))
+#define TSL_POSCORR_3CH_LIN_H ((TSL_tNb_T)(128))
+
+#define TSL_SCTCOMP_3CH_ROT_M ((TSL_tNb_T)( 85))
+
+#define TSL_SCTCOMP_4CH_LIN_M1 ((TSL_tNb_T)( 85))
+#define TSL_POSCORR_4CH_LIN_M1 ((TSL_tNb_T)( 43))
+#define TSL_SCTCOMP_4CH_LIN_M2 ((TSL_tNb_T)(128))
+#define TSL_POSCORR_4CH_LIN_M2 ((TSL_tNb_T)(128))
+
+#define TSL_SCTCOMP_4CH_LIN_H ((TSL_tNb_T)( 85))
+#define TSL_POSCORR_4CH_LIN_H ((TSL_tNb_T)( 85))
+
+#define TSL_SCTCOMP_4CH_ROT_M ((TSL_tNb_T)( 64))
+
+#define TSL_SCTCOMP_5CH_LIN_M1 ((TSL_tNb_T)( 64))
+#define TSL_POSCORR_5CH_LIN_M1 ((TSL_tNb_T)( 32))
+#define TSL_SCTCOMP_5CH_LIN_M2 ((TSL_tNb_T)( 85))
+#define TSL_POSCORR_5CH_LIN_M2 ((TSL_tNb_T)( 85))
+
+#define TSL_SCTCOMP_5CH_LIN_H ((TSL_tNb_T)( 64))
+#define TSL_POSCORR_5CH_LIN_H ((TSL_tNb_T)( 64))
+
+#define TSL_SCTCOMP_5CH_ROT_M ((TSL_tNb_T)( 51))
+
+#define TSL_SCTCOMP_5CH_ROT_D ((TSL_tNb_T)( 26))
+
+#define TSL_SCTCOMP_6CH_LIN_M1 ((TSL_tNb_T)( 51))
+#define TSL_POSCORR_6CH_LIN_M1 ((TSL_tNb_T)( 25))
+#define TSL_SCTCOMP_6CH_LIN_M2 ((TSL_tNb_T)( 64))
+#define TSL_POSCORR_6CH_LIN_M2 ((TSL_tNb_T)( 64))
+
+#define TSL_SCTCOMP_6CH_LIN_H ((TSL_tNb_T)( 51))
+#define TSL_POSCORR_6CH_LIN_H ((TSL_tNb_T)( 51))
+
+#define TSL_SCTCOMP_6CH_ROT_M ((TSL_tNb_T)( 43))
+
+#endif /* __TSL_LINROT_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_object.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_object.h
new file mode 100644
index 0000000..64b4d01
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_object.h
@@ -0,0 +1,89 @@
+/**
+ ******************************************************************************
+ * @file tsl_object.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_object.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_OBJECT_H
+#define __TSL_OBJECT_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "tsl_touchkey.h"
+#include "tsl_linrot.h"
+
+/* Exported types ------------------------------------------------------------*/
+
+#define TSL_OBJ_TYPE_TKEY_MASK (0x10) /**< TouchKey object mask */
+#define TSL_OBJ_TYPE_LINROT_MASK (0x20) /**< Linear and Rotary objects mask */
+#define TSL_OBJ_TYPE_TRACKNAV_MASK (0x40) /**< TrackPad and NaviPad objects mask */
+
+/** Contains all different kinds of sensors.
+ */
+typedef enum
+{
+ TSL_OBJ_TOUCHKEY = (TSL_OBJ_TYPE_TKEY_MASK + 0), /**< Normal TouchKey */
+ TSL_OBJ_TOUCHKEYB = (TSL_OBJ_TYPE_TKEY_MASK + 1), /**< Basic TouchKey */
+ TSL_OBJ_LINEAR = (TSL_OBJ_TYPE_LINROT_MASK + 0), /**< Normal Linear sensor */
+ TSL_OBJ_LINEARB = (TSL_OBJ_TYPE_LINROT_MASK + 1), /**< Basic Linear sensor */
+ TSL_OBJ_ROTARY = (TSL_OBJ_TYPE_LINROT_MASK + 2), /**< Normal Rotary sensor */
+ TSL_OBJ_ROTARYB = (TSL_OBJ_TYPE_LINROT_MASK + 3), /**< Basic Rotary sensor */
+ TSL_OBJ_TRACKPAD = (TSL_OBJ_TYPE_TRACKNAV_MASK + 0), /**< TrackPad sensor */
+ TSL_OBJ_NAVIPAD = (TSL_OBJ_TYPE_TRACKNAV_MASK + 1) /**< NaviPad sensor */
+} TSL_ObjectType_enum_T;
+
+/** Contains the definition of an Object.
+ * Variables of this structure type can be placed in RAM or ROM.
+ */
+typedef struct
+{
+ TSL_ObjectType_enum_T Type; /**< Object type */
+ void *Elmt; /**< Pointer to the object */
+} TSL_Object_T;
+
+/** Contains the definition of a Group of Objects.
+ * Variables of this structure type must be placed in RAM only.
+ */
+typedef struct
+{
+ CONST TSL_Object_T *p_Obj; /**< Pointer to the first object */
+ TSL_tNb_T NbObjects; /**< Number of objects in the group */
+ TSL_tNb_T StateMask; /**< "OR" of all objects state mask */
+ TSL_StateChange_enum_T Change; /**< The State is different from the previous one */
+ TSL_tIndex_T ECS_exec; /**< Flag for the ECS execution */
+#if TSLPRM_ECS_DELAY > 0
+ TSL_tIndex_T ECS_wait; /**< Flag for the ECS delay */
+ TSL_tTick_ms_T ECS_start_time; /**< Keep the time for the ECS delay */
+#endif
+} TSL_ObjectGroup_T;
+
+/* Exported functions --------------------------------------------------------*/
+
+void TSL_obj_GroupInit(TSL_ObjectGroup_T *objgrp);
+void TSL_obj_GroupProcess(TSL_ObjectGroup_T *objgrp);
+void TSL_obj_SetGlobalObj(CONST TSL_Object_T *pobj);
+
+#endif /* __TSL_OBJECT_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_time.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_time.h
new file mode 100644
index 0000000..00875e4
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_time.h
@@ -0,0 +1,88 @@
+/**
+ ******************************************************************************
+ * @file tsl_time.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_time.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_TIME_H
+#define __TSL_TIME_H
+
+/* Includes ------------------------------------------------------------------*/
+
+#if defined(STM8L10X) || defined(STM8L15X_MD) || defined(STM8L15X_MDP) || defined(STM8L15X_HD)
+#include "tsl_acq_stm8l_sw.h" // Software acquisition
+#include "tsl_time_stm8l.h"
+#endif
+
+#if defined(STM8L15X_LD)
+#if defined(TSLPRM_STM8L1XX_SW_ACQ)
+#include "tsl_acq_stm8l_sw.h" // Software acquisition
+#else
+#include "tsl_acq_stm8l_hw.h" // Hardware acquisition with Timers (default)
+#endif
+#include "tsl_time_stm8l.h"
+#endif
+
+#if defined(STM8TL5X)
+#include "tsl_acq_stm8tl5x.h"
+#include "tsl_time_stm8tl5x.h"
+#endif
+
+#if defined(STM32L1XX_MD)
+#include "tsl_acq_stm32l1xx_sw.h" // Software acquisition only
+#include "tsl_time_stm32l1xx.h"
+#endif
+
+#if defined(STM32L1XX_MDP) || defined(STM32L1XX_HD) || defined(STM32L1XX_XL)
+#if defined(TSLPRM_STM32L1XX_SW_ACQ)
+#include "tsl_acq_stm32l1xx_sw.h" // Software acquisition
+#else
+#include "tsl_acq_stm32l1xx_hw.h" // Hardware acquisition with Timers (default)
+#endif
+#include "tsl_time_stm32l1xx.h"
+#endif
+
+#if defined(STM32F0XX) || defined(STM32F0XX_MD) || defined(STM32F0XX_HD) ||\
+ defined(STM32F051) || defined(STM32F072) || defined(STM32F042)
+#include "tsl_acq_stm32f0xx.h"
+#include "tsl_time_stm32f0xx.h"
+#endif
+
+#if defined(STM32F303xC) || defined(STM32F334x8) || defined(STM32F303x8) || defined(STM32F301x8) || defined(STM32F302x8) ||\
+ defined(STM32F37X)
+#include "tsl_acq_stm32f3xx.h"
+#include "tsl_time_stm32f3xx.h"
+#endif
+
+/* Exported functions ------------------------------------------------------- */
+
+void TSL_tim_ProcessIT(void);
+TSL_Status_enum_T TSL_tim_CheckDelay_ms(TSL_tTick_ms_T delay_ms, __IO TSL_tTick_ms_T *last_tick);
+TSL_Status_enum_T TSL_tim_CheckDelay_sec(TSL_tTick_sec_T delay_sec, __IO TSL_tTick_sec_T *last_tick);
+void TSL_CallBack_TimerTick(void);
+
+#endif /* __TSL_TIME_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm32f0xx.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm32f0xx.h
new file mode 100644
index 0000000..6216974
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm32f0xx.h
@@ -0,0 +1,51 @@
+/**
+ ******************************************************************************
+ * @file tsl_time_stm32f0xx.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_time_stm32f0xx.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_TIME_STM32F0XX_H
+#define __TSL_TIME_STM32F0XX_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32f0xx.h"
+#include "stm32f0xx_rcc.h"
+#include "tsl_conf_stm32f0xx.h"
+#include "tsl_types.h"
+
+// Определения для таймера TouchSense --------------------------------------- //
+#define TS_TIM_IRQHandler TIM15_IRQHandler
+#define TS_TIMx TIM15
+#define TS_TIM_RCC RCC_APB2Periph_TIM15
+#define TS_TIM_IRQx TIM15_IRQn
+#define TS_RCC_APBxPeriphClockCmd RCC_APB2PeriphClockCmd
+
+/* Exported types ------------------------------------------------------------*/
+
+TSL_Status_enum_T TSL_tim_Init(void);
+
+#endif /* __TSL_TIME_STM32F0XX_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm32f3xx.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm32f3xx.h
new file mode 100644
index 0000000..c121e22
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm32f3xx.h
@@ -0,0 +1,51 @@
+/**
+ ******************************************************************************
+ * @file tsl_time_stm32f3xx.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_time_stm32f3xx.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_TIME_STM32F3XX_H
+#define __TSL_TIME_STM32F3XX_H
+
+/* Includes ------------------------------------------------------------------*/
+
+#if defined(STM32F303xC) || defined(STM32F334x8) || defined(STM32F303x8) || defined(STM32F301x8) || defined(STM32F302x8)
+#include "stm32f30x.h"
+#endif
+
+#if defined(STM32F37X)
+#include "stm32f37x.h"
+#endif
+
+#include "tsl_conf_stm32f3xx.h"
+#include "tsl_types.h"
+
+/* Exported types ------------------------------------------------------------*/
+
+TSL_Status_enum_T TSL_tim_Init(void);
+
+#endif /* __TSL_TIME_STM32F3XX_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm32l1xx.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm32l1xx.h
new file mode 100644
index 0000000..a693dc4
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm32l1xx.h
@@ -0,0 +1,43 @@
+/**
+ ******************************************************************************
+ * @file tsl_time_stm32l1xx.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_time_stm32l1xx.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_TIME_STM32L1XX_H
+#define __TSL_TIME_STM32L1XX_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32l1xx.h"
+#include "tsl_conf_stm32l1xx.h"
+#include "tsl_types.h"
+
+/* Exported types ------------------------------------------------------------*/
+
+TSL_Status_enum_T TSL_tim_Init(void);
+
+#endif /* __TSL_TIME_STM32L1XX_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm8l.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm8l.h
new file mode 100644
index 0000000..94d549f
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm8l.h
@@ -0,0 +1,51 @@
+/**
+ ******************************************************************************
+ * @file tsl_time_stm8l.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_time_stm8l.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_TIME_STM8L_H
+#define __TSL_TIME_STM8L_H
+
+/* Includes ------------------------------------------------------------------*/
+
+#if defined(STM8L15X_LD) || defined(STM8L15X_MD) || defined(STM8L15X_MDP) || defined(STM8L15X_HD)
+#include "stm8l15x.h"
+#endif
+
+#if defined(STM8L10X)
+#include "stm8l10x.h"
+#endif
+
+#include "tsl_conf_stm8l.h"
+#include "tsl_types.h"
+
+/* Exported types ------------------------------------------------------------*/
+
+TSL_Status_enum_T TSL_tim_Init(void);
+
+#endif /* __TSL_TIME_STM8L_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm8tl5x.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm8tl5x.h
new file mode 100644
index 0000000..70c0121
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_time_stm8tl5x.h
@@ -0,0 +1,43 @@
+/**
+ ******************************************************************************
+ * @file tsl_time_stm8tl5x.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_time_stm8tl5x.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_TIME_STM8TL5X_H
+#define __TSL_TIME_STM8TL5X_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm8tl5x.h"
+#include "tsl_conf_stm8tl5x.h"
+#include "tsl_types.h"
+
+/* Exported types ------------------------------------------------------------*/
+
+TSL_Status_enum_T TSL_tim_Init(void);
+
+#endif /* __TSL_TIME_STM8TL5X_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_touchkey.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_touchkey.h
new file mode 100644
index 0000000..04b4d73
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_touchkey.h
@@ -0,0 +1,139 @@
+/**
+ ******************************************************************************
+ * @file tsl_touchkey.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains external declarations of the tsl_touchkey.c file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_TOUCHKEY_H
+#define __TSL_TOUCHKEY_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "tsl_acq.h"
+#include "tsl_time.h"
+
+/* Exported types ------------------------------------------------------------*/
+
+/** Contains all data related to TouchKey sensor.
+ * Variables of this structure type must be placed in RAM only.
+ */
+typedef struct
+{
+ TSL_StateId_enum_T StateId; /**< Current state identifier */
+ TSL_tCounter_T CounterDebounce; /**< Counter for debounce and calibration management */
+ unsigned int CounterDTO : 6; /**< Counter for DTO management (TSL_tCounter_T) */
+ unsigned int Change : 1; /**< The State is different from the previous one (TSL_StateChange_enum_T) */
+ unsigned int DxSLock : 1; /**< The State is locked by the DxS (TSL_Bool_enum_T) */
+}
+TSL_TouchKeyData_T;
+
+/** Contains all parameters related to TouchKey sensor.
+ * Variables of this structure type can be placed in RAM or ROM.
+ */
+typedef struct
+{
+#if TSLPRM_USE_PROX > 0
+ TSL_tThreshold_T ProxInTh; /**< Proximity in threshold */
+ TSL_tThreshold_T ProxOutTh; /**< Proximity out threshold */
+#endif
+ TSL_tThreshold_T DetectInTh; /**< Detection in threshold */
+ TSL_tThreshold_T DetectOutTh; /**< Detection out threshold */
+ TSL_tThreshold_T CalibTh; /**< Calibration threshold */
+ TSL_tCounter_T CounterDebCalib; /**< Debounce counter to enter in Calibration state */
+#if TSLPRM_USE_PROX > 0
+ TSL_tCounter_T CounterDebProx; /**< Debounce counter to enter in Proximity state */
+#endif
+ TSL_tCounter_T CounterDebDetect; /**< Debounce counter to enter in Detect state */
+ TSL_tCounter_T CounterDebRelease; /**< Debounce counter to enter in Release state */
+ TSL_tCounter_T CounterDebError; /**< Debounce counter to enter in Error state */
+}
+TSL_TouchKeyParam_T;
+
+/** Contains definition of a TouchKey sensor.
+ * Variables of this structure type can be placed in RAM or ROM.
+ */
+typedef struct
+{
+ TSL_TouchKeyData_T *p_Data; /**< Data (state id, counter, flags, ...) */
+ TSL_TouchKeyParam_T *p_Param; /**< Parameters (thresholds, debounce, ...) */
+ TSL_ChannelData_T *p_ChD; /**< Channel Data (Meas, Ref, Delta, ...) */
+ CONST TSL_State_T *p_SM; /**< State Machine */
+ CONST TSL_TouchKeyMethods_T *p_Methods; /**< Methods */
+}
+TSL_TouchKey_T;
+
+/** Contains definition of a Basic TouchKey sensor.
+ * Variables of this structure type can be placed in RAM or ROM.
+ * Basic sensor does not contain its own state machine and methods. It used
+ * default ones instead to gain memory space.
+ */
+typedef struct
+{
+ TSL_TouchKeyData_T *p_Data; /**< Data (state id, counters, flags, ...) */
+ TSL_TouchKeyParam_T *p_Param; /**< Parameters (thresholds, debounce, ...) */
+ TSL_ChannelData_T *p_ChD; /**< Channel Data (Meas, Ref, Delta, ...) */
+}
+TSL_TouchKeyB_T;
+
+/* Exported variables --------------------------------------------------------*/
+/* Exported macros -----------------------------------------------------------*/
+
+/* Exported functions --------------------------------------------------------*/
+
+// "Object methods" functions
+void TSL_tkey_Init(void);
+void TSL_tkey_Process(void);
+
+// Utility functions
+void TSL_tkey_SetStateCalibration(TSL_tCounter_T delay);
+void TSL_tkey_SetStateOff(void);
+#if !defined(TSLPRM_STM8TL5X) && !defined(STM8TL5X)
+void TSL_tkey_SetStateBurstOnly(void);
+#endif
+TSL_StateId_enum_T TSL_tkey_GetStateId(void);
+TSL_StateMask_enum_T TSL_tkey_GetStateMask(void);
+TSL_tNb_T TSL_tkey_IsChanged(void);
+
+// State machine functions
+void TSL_tkey_CalibrationStateProcess(void);
+void TSL_tkey_DebCalibrationStateProcess(void);
+void TSL_tkey_ReleaseStateProcess(void);
+void TSL_tkey_DebReleaseProxStateProcess(void);
+void TSL_tkey_DebReleaseDetectStateProcess(void);
+void TSL_tkey_DebReleaseTouchStateProcess(void);
+void TSL_tkey_ProxStateProcess(void);
+void TSL_tkey_DebProxStateProcess(void);
+void TSL_tkey_DebProxDetectStateProcess(void);
+void TSL_tkey_DebProxTouchStateProcess(void);
+void TSL_tkey_DetectStateProcess(void);
+void TSL_tkey_DebDetectStateProcess(void);
+void TSL_tkey_TouchStateProcess(void);
+void TSL_tkey_DebTouchStateProcess(void);
+void TSL_tkey_ErrorStateProcess(void);
+void TSL_tkey_DebErrorStateProcess(void);
+void TSL_tkey_OffStateProcess(void);
+
+#endif /* __TSL_TOUCHKEY_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/third_party/TouchSense/STMTouch_Driver/inc/tsl_types.h b/third_party/TouchSense/STMTouch_Driver/inc/tsl_types.h
new file mode 100644
index 0000000..4284493
--- /dev/null
+++ b/third_party/TouchSense/STMTouch_Driver/inc/tsl_types.h
@@ -0,0 +1,217 @@
+/**
+ ******************************************************************************
+ * @file tsl_types.h
+ * @author MCD Application Team
+ * @version V1.4.4
+ * @date 31-March-2014
+ * @brief This file contains all general structures definition.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.st.com/software_license_agreement_liberty_v2
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __TSL_TYPES_H
+#define __TSL_TYPES_H
+
+/* Exported types ------------------------------------------------------------*/
+
+/** Generic Boolean status
+*/
+typedef enum
+{
+ TSL_FALSE = 0, /**< A False value */
+ TSL_TRUE = 1 /**< A True value */
+}
+TSL_Bool_enum_T;
+
+/** Generic status returned by functions
+*/
+typedef enum
+{
+ TSL_STATUS_OK = 0, /**< The function has been executed correctly */
+ TSL_STATUS_BUSY = 1, /**< The function is in a Busy state */
+ TSL_STATUS_ERROR = 2 /**< The function has been executed not correctly */
+} TSL_Status_enum_T;
+
+/** DataReady status : 1 bit
+ - Used by acquisition to indicate if a new measurement is ready or not.
+*/
+typedef enum
+{
+ TSL_DATA_NOT_READY = 0, /**< No new measurement or measurement treated */
+ TSL_DATA_READY = 1 /**< A new measurement is ready */
+} TSL_DataReady_enum_T;
+
+/** State change status
+*/
+typedef enum
+{
+ TSL_STATE_NOT_CHANGED = 0, /**< The object has the same state */
+ TSL_STATE_CHANGED = 1 /**< The object has changed of state */
+} TSL_StateChange_enum_T;
+
+#define TSL_ACQ_STATUS_ERROR_MASK (0x02) /**< Associated to TSL_AcqStatus_enum_T */
+
+/** Acquisition status
+*/
+typedef enum
+{
+ TSL_ACQ_STATUS_OK = 0, /**< The acquisition is correct */
+ TSL_ACQ_STATUS_NOISE = 1, /**< Noise detected during the acquisition */
+ TSL_ACQ_STATUS_ERROR_MIN = TSL_ACQ_STATUS_ERROR_MASK, /**< The measure is below the minimum threshold */
+ TSL_ACQ_STATUS_ERROR_MAX = (TSL_ACQ_STATUS_ERROR_MASK | 0x01) /**< The measure is above the maximum threshold */
+} TSL_AcqStatus_enum_T;
+
+/** Bank status
+*/
+typedef enum
+{
+ TSL_BANK_STATUS_DISABLED = 0, /**< The bank is disabled */
+ TSL_BANK_STATUS_ENABLED = 1 /**< The bank is enabled */
+} TSL_BankStatus_enum_T;
+
+/** Zone status
+*/
+typedef enum
+{
+ TSL_ZONE_STATUS_DISABLED = 0, /**< The zone is disabled */
+ TSL_ZONE_STATUS_ENABLED = 1 /**< The zone is enabled */
+}TSL_ZoneStatus_enum_T;
+
+#define TSL_OBJ_STATUS_ACQ_MASK (0x01) /**< Associated to TSL_ObjStatus_enum_T */
+#define TSL_OBJ_STATUS_BURST_MASK (0x02) /**< Associated to TSL_ObjStatus_enum_T */
+
+/** Object status
+*/
+typedef enum
+{
+ TSL_OBJ_STATUS_OFF = 0, /**< No burst and no acquisition */
+ TSL_OBJ_STATUS_BURST_ONLY = TSL_OBJ_STATUS_BURST_MASK, /**< Burst only */
+ TSL_OBJ_STATUS_ON = (TSL_OBJ_STATUS_BURST_MASK | TSL_OBJ_STATUS_ACQ_MASK) /**< Burst and acquisition */
+} TSL_ObjStatus_enum_T;
+
+#define TSL_STATE_ERROR_BIT_MASK (0x80) /**< Associated to TSL_StateMask_enum_T */
+#define TSL_STATE_OFF_BIT_MASK (0x40) /**< Associated to TSL_StateMask_enum_T */
+#define TSL_STATE_DEBOUNCE_BIT_MASK (0x20) /**< Associated to TSL_StateMask_enum_T */
+#define TSL_STATE_CALIB_BIT_MASK (0x10) /**< Associated to TSL_StateMask_enum_T */
+#define TSL_STATE_TOUCH_BIT_MASK (0x08) /**< Associated to TSL_StateMask_enum_T */
+#define TSL_STATE_DETECT_BIT_MASK (0x04) /**< Associated to TSL_StateMask_enum_T */
+#define TSL_STATE_PROX_BIT_MASK (0x02) /**< Associated to TSL_StateMask_enum_T */
+#define TSL_STATE_RELEASE_BIT_MASK (0x01) /**< Associated to TSL_StateMask_enum_T */
+
+/** Object state masks
+*/
+typedef enum
+{
+ // Calibration states
+ TSL_STATEMASK_CALIB = TSL_STATE_CALIB_BIT_MASK, /**< 0x10 */
+ TSL_STATEMASK_DEB_CALIB = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_CALIB_BIT_MASK), /**< 0x30 */
+ // Release states
+ TSL_STATEMASK_RELEASE = TSL_STATE_RELEASE_BIT_MASK, /**< 0x01 */
+ TSL_STATEMASK_DEB_RELEASE_PROX = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_RELEASE_BIT_MASK | TSL_STATE_PROX_BIT_MASK), /**< 0x23 */
+ TSL_STATEMASK_DEB_RELEASE_DETECT = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_RELEASE_BIT_MASK | TSL_STATE_DETECT_BIT_MASK), /**< 0x25 */
+ TSL_STATEMASK_DEB_RELEASE_TOUCH = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_RELEASE_BIT_MASK | TSL_STATE_TOUCH_BIT_MASK), /**< 0x29 */
+ // Proximity states
+ TSL_STATEMASK_PROX = TSL_STATE_PROX_BIT_MASK, /**< 0x02 */
+ TSL_STATEMASK_DEB_PROX = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_PROX_BIT_MASK), /**< 0x22 */
+ TSL_STATEMASK_DEB_PROX_DETECT = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_PROX_BIT_MASK | TSL_STATE_DETECT_BIT_MASK), /**< 0x26 */
+ TSL_STATEMASK_DEB_PROX_TOUCH = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_PROX_BIT_MASK | TSL_STATE_TOUCH_BIT_MASK), /**< 0x2A */
+ // Detect states
+ TSL_STATEMASK_DETECT = TSL_STATE_DETECT_BIT_MASK, /**< 0x04 */
+ TSL_STATEMASK_DEB_DETECT = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_DETECT_BIT_MASK), /**< 0x24 */
+ // Touch state
+ TSL_STATEMASK_TOUCH = TSL_STATE_TOUCH_BIT_MASK, /**< 0x08 */
+ // Error states
+ TSL_STATEMASK_ERROR = TSL_STATE_ERROR_BIT_MASK, /**< 0x80 */
+ TSL_STATEMASK_DEB_ERROR_CALIB = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_ERROR_BIT_MASK | TSL_STATE_CALIB_BIT_MASK), /**< 0xB0 */
+ TSL_STATEMASK_DEB_ERROR_RELEASE = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_ERROR_BIT_MASK | TSL_STATE_RELEASE_BIT_MASK), /**< 0xA1 */
+ TSL_STATEMASK_DEB_ERROR_PROX = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_ERROR_BIT_MASK | TSL_STATE_PROX_BIT_MASK), /**< 0xA2 */
+ TSL_STATEMASK_DEB_ERROR_DETECT = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_ERROR_BIT_MASK | TSL_STATE_DETECT_BIT_MASK), /**< 0xA4 */
+ TSL_STATEMASK_DEB_ERROR_TOUCH = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_ERROR_BIT_MASK | TSL_STATE_TOUCH_BIT_MASK), /**< 0xA8 */
+ // OFF state
+ TSL_STATEMASK_OFF = TSL_STATE_OFF_BIT_MASK, /**< 0x40 */
+ // Other states not associated to a state id
+ TSL_STATEMASK_ACTIVE = (TSL_STATE_PROX_BIT_MASK | TSL_STATE_DETECT_BIT_MASK | TSL_STATE_TOUCH_BIT_MASK | TSL_STATE_CALIB_BIT_MASK | TSL_STATE_DEBOUNCE_BIT_MASK), /**< 0x3E */
+ TSL_STATEMASK_UNKNOWN = 0 /**< 0x00 */
+} TSL_StateMask_enum_T;
+
+/** Object state identifiers
+*/
+typedef enum
+{
+ // Calibration states
+ TSL_STATEID_CALIB = 0, /**< 0 - Object is in Calibration */
+ TSL_STATEID_DEB_CALIB = 1, /**< 1 - Object is in Debounce Calibration */
+ // Release states
+ TSL_STATEID_RELEASE = 2, /**< 2 - Object is released */
+ TSL_STATEID_DEB_RELEASE_PROX = 3, /**< 3 - Object is in Debounce Release from Proximity state */
+ TSL_STATEID_DEB_RELEASE_DETECT = 4, /**< 4 - Object is in Debounce Release from Detect state */
+ TSL_STATEID_DEB_RELEASE_TOUCH = 5, /**< 5 - Object is in Debounce Release from Touch state */
+ // Proximity states
+ TSL_STATEID_PROX = 6, /**< 6 - Object is in Proximity */
+ TSL_STATEID_DEB_PROX = 7, /**< 7 - Object is in Debounce Proximity from Release state */
+ TSL_STATEID_DEB_PROX_DETECT = 8, /**< 8 - Object is in Debounce Proximity from Detect state */
+ TSL_STATEID_DEB_PROX_TOUCH = 9, /**< 9 - Object is in Debounce Proximity from Detect state */
+ // Detect states
+ TSL_STATEID_DETECT = 10, /**< 10 - Object is in Detect */
+ TSL_STATEID_DEB_DETECT = 11, /**< 11 - Object is in Debounce Detect */
+ // Touch state
+ TSL_STATEID_TOUCH = 12, /**< 12 - Object is in Touch */
+ // Error states
+ TSL_STATEID_ERROR = 13, /**< 13 - Object is in Error */
+ TSL_STATEID_DEB_ERROR_CALIB = 14, /**< 14 - Object is in Debounce Error from Calibration */
+ TSL_STATEID_DEB_ERROR_RELEASE = 15, /**< 15 - Object is in Debounce Error from Release */
+ TSL_STATEID_DEB_ERROR_PROX = 16, /**< 16 - Object is in Debounce Error from Proximity */
+ TSL_STATEID_DEB_ERROR_DETECT = 17, /**< 17 - Object is in Debounce Error from Detect */
+ TSL_STATEID_DEB_ERROR_TOUCH = 18, /**< 18 - Object is in Debounce Error from Touch */
+ // Other states
+ TSL_STATEID_OFF = 19 /**< 19 - Object is OFF (no burst, no acquisition) */
+} TSL_StateId_enum_T;
+
+/** Object state
+*/
+typedef struct
+{
+ TSL_StateMask_enum_T StateMask; /**< Current state mask */
+ void(* StateFunc)(void); /**< Function executed in the state */
+}
+TSL_State_T;
+
+/** Touchkey methods
+*/
+typedef struct
+{
+ void(* Init)(void); /**< Used to initialize the TouchKey sensor */
+ void(* Process)(void); /**< Used to execute the TouchKey sensor state machine */
+}
+TSL_TouchKeyMethods_T;
+
+/** Linear/Rotary methods
+*/
+typedef struct
+{
+ void(* Init)(void); /**< Used to initialize the Linear/Rotary sensor */
+ void(* Process)(void); /**< Used to execute the Linear/Rotary sensor state machine */
+ TSL_Status_enum_T(* CalcPosition)(void); /**< Used to calculate the Linear/Rotary sensor position */
+}
+TSL_LinRotMethods_T;
+
+#endif /* __TSL_TYPES_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/