+++ /dev/null
-<html>\r
-<head>\r
-<style>\r
-<!--\r
-/* Style Definitions */\r
-p.MsoNormal, li.MsoNormal, div.MsoNormal\r
-{margin-top:0cm;margin-right:0cm;margin-bottom:8pt;margin-left:0cm;line-height:normal;font-size:10.0pt;font-family:Verdana,sans-serif;}\r
-p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph\r
-{margin-top:0cm;margin-right:0cm;margin-bottom:2pt;margin-left:0cm;line-height:normal;font-size:10.0pt;font-family:Verdana,sans-serif;}\r
--->\r
-</style>\r
-<title>\r
-STMTouch Driver Release Notes\r
-</title>\r
-</head>\r
-<body lang=EN-US>\r
-<p class=MsoNormal align=center style='text-align:center;line-height:normal'><b><span style='font-size:18.0pt;color: rgb(51, 102, 255)'>\r
-Release Notes for\r
-</span></b></p>\r
-<p class=MsoNormal align=center style='text-align:center;line-height:normal'><b><span style='font-size:18.0pt;color: rgb(51, 102, 255)'>\r
-STMTouch Driver\r
-</span></b></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal align=center style='line-height:center;line-height:normal'><span style='font-size:10.0pt'>\r
-Copyright © 2013 STMicroelectronics\r
-</span></p>\r
-<p class=MsoNormal align=center style='line-height:center;line-height:normal'><span style='font-size:10.0pt'>\r
-Microcontrollers Division - Application Team\r
-</span></p>\r
-<p class=MsoNormal align=center> <img id=_rnc_img0 src=../../_htmresc/st_logo.png border=0> </span></p>\r
-<p class=MsoNormal align=center> <img id=_rnc_img1 src=../../_htmresc/stmtouch.bmp border=0> </span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<table class=MsoNormal border=0 cellspacing=0 cellpadding=0 width=100%\r
-style='margin-left:4cm;margin-right:4cm;width:80%;background:rgb(51, 102, 255)'>\r
-<td style='padding:0cm 5.4pt 0cm 5.4pt'>\r
-<p class=MsoNormal style='margin-left:0cm;margin-bottom:0cm;line-height:normal'><b><span style='font-size:12.0pt;color:white'>\r
-Update History</span></b></p></td></tr></table>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<table class=MsoNormal border=0 cellspacing=0 cellpadding=0 width=100%\r
-style='margin-left:4cm;width:23%;background:rgb(51, 102, 255)'>\r
-<td align=left style='padding:0cm 5.4pt 0cm 5.4pt'>\r
-<p class=MsoNormal style='margin-bottom:0cm;line-height:normal'><b><span style='font-size:10.0pt;color:white'>\r
-V1.3.2 / 22-January-2013</span></b></p></td></tr></table>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Main Changes\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Change in STM32L1xx acquisition: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- GPIOs speed configured to "Very Low" (400 kHz). \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Content\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM8TL5xx devices (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32F0xx devices (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32F3xx devices (ALPHA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx High-density devices using hardware and software acquisition modes (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx Medium-density Plus devices using hardware and software acquisition modes (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx Medium-density devices using sofware acquisition mode (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of proximity, touchkey and linear/rotary touch sensors. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Debounce mechanism for all states. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Environment Change System (ECS). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Detection Exclusion System (DXS). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Detection Time Out (DTO). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Noise filtering capability on measurement and delta. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Development Toolchains and Compilers\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM8 devices: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- ST Visual Develop (STVD). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- IAR Embedded Workbench for STM8. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Cosmic STM8 C Compiler. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Raisonance Ride7/RKit-STM8. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM32 devices: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- IAR Embedded Workbench for ARM. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Keil MDK-ARM. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Altium Tasking. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Atollic TrueSTUDIO. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Raisonance Ride7/RKit-Arm. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Known Limitations\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-None. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<table class=MsoNormal border=0 cellspacing=0 cellpadding=0 width=100%\r
-style='margin-left:4cm;width:23%;background:rgb(51, 102, 255)'>\r
-<td align=left style='padding:0cm 5.4pt 0cm 5.4pt'>\r
-<p class=MsoNormal style='margin-bottom:0cm;line-height:normal'><b><span style='font-size:10.0pt;color:white'>\r
-V1.3.1 / 15-January-2013</span></b></p></td></tr></table>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Main Changes\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Improvement of STM32L1xx acquisition. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Typo corrections. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Content\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM8TL5xx devices (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32F0xx devices (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32F3xx devices (ALPHA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx High-density devices using hardware and software acquisition modes (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx Medium-density Plus devices using hardware and software acquisition modes (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx Medium-density devices using sofware acquisition mode (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of proximity, touchkey and linear/rotary touch sensors. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Debounce mechanism for all states. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Environment Change System (ECS). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Detection Exclusion System (DXS). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Detection Time Out (DTO). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Noise filtering capability on measurement and delta. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Development Toolchains and Compilers\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM8 devices: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- ST Visual Develop (STVD). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- IAR Embedded Workbench for STM8. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Cosmic STM8 C Compiler. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Raisonance Ride7/RKit-STM8. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM32 devices: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- IAR Embedded Workbench for ARM. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Keil MDK-ARM. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Altium Tasking. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Atollic TrueSTUDIO. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Raisonance Ride7/RKit-Arm. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Known Limitations\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-None. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<table class=MsoNormal border=0 cellspacing=0 cellpadding=0 width=100%\r
-style='margin-left:4cm;width:23%;background:rgb(51, 102, 255)'>\r
-<td align=left style='padding:0cm 5.4pt 0cm 5.4pt'>\r
-<p class=MsoNormal style='margin-bottom:0cm;line-height:normal'><b><span style='font-size:10.0pt;color:white'>\r
-V1.3.0 / 10-December-2012</span></b></p></td></tr></table>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Main Changes\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Add support of STM32F30x and STM32F37x devices. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Content\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM8TL5xx devices (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32F0xx devices (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32F3xx devices (ALPHA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx High-density devices using hardware and software acquisition modes (BETA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx Medium-density Plus devices using hardware and software acquisition modes (BETA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx Medium-density devices using sofware acquisition mode (BETA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of proximity, touchkey and linear/rotary touch sensors. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Debounce mechanism for all states. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Environment Change System (ECS). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Detection Exclusion System (DXS). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Detection Time Out (DTO). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Noise filtering capability on measurement and delta. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Development Toolchains and Compilers\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM8 devices: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- ST Visual Develop (STVD). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- IAR Embedded Workbench for STM8. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Cosmic STM8 C Compiler. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Raisonance Ride7/RKit-STM8. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM32 devices: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- IAR Embedded Workbench for ARM. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Keil MDK-ARM. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Altium Tasking. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Atollic TrueSTUDIO. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Raisonance Ride7/RKit-Arm. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Known Limitations\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-None. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<table class=MsoNormal border=0 cellspacing=0 cellpadding=0 width=100%\r
-style='margin-left:4cm;width:23%;background:rgb(51, 102, 255)'>\r
-<td align=left style='padding:0cm 5.4pt 0cm 5.4pt'>\r
-<p class=MsoNormal style='margin-bottom:0cm;line-height:normal'><b><span style='font-size:10.0pt;color:white'>\r
-V1.2.0 / 30-November-2012</span></b></p></td></tr></table>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Main Changes\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Common. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Change LinRot sensors position offset tables names (Mono, Half-ended, Dual). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Add more LinRot sensors position offset tables with conditional compilation. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM8TL5x acquisition. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Increase TSLPRM_KEY_TARGET_REFERENCE max value to 2000. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM32F0xx acquisition. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Improvement of capacitors discharge processing. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Add automatic GPIO configuration. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM32L1xx acquisition. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Add support of Medium-density Plus devices. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Rename files ("hw/sw" put after "stm32l1xx"). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Software acquisition is now done if TSLPRM_STM32L1XX_SW_ACQ is defined (was previously TSLPRM_STM32L1XX_HD_SW or TSLPRM_STM32L1XX_MDP_SW). \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Content\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM8TL5xx devices (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32F0xx devices (BETA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx High-density devices using hardware and software acquisition modes (BETA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx Medium-density Plus devices using hardware and software acquisition modes (BETA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx Medium-density devices using sofware acquisition mode (BETA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of proximity, touchkey and linear/rotary touch sensors (1, 3, 5 and 6 channels). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Debounce mechanism for all states. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Environment Change System (ECS). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Detection Exclusion System (DXS). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Detection Time Out (DTO). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Noise filtering capability on measurement and delta. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Development Toolchains and Compilers\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM8 devices: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- ST Visual Develop (STVD). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- IAR Embedded Workbench for STM8. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Cosmic STM8 C Compiler. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Raisonance Ride7/RKit-STM8. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM32 devices: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- IAR Embedded Workbench for ARM. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Keil MDK-ARM. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Altium Tasking. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Atollic TrueSTUDIO. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Raisonance Ride7/RKit-Arm. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Known Limitations\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-None. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<table class=MsoNormal border=0 cellspacing=0 cellpadding=0 width=100%\r
-style='margin-left:4cm;width:23%;background:rgb(51, 102, 255)'>\r
-<td align=left style='padding:0cm 5.4pt 0cm 5.4pt'>\r
-<p class=MsoNormal style='margin-bottom:0cm;line-height:normal'><b><span style='font-size:10.0pt;color:white'>\r
-V1.1.0 / 08-August-2012</span></b></p></td></tr></table>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Main Changes\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Improvement of hardware acquisition mode of STM32L1xx High-density devices: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Disable hysteresis on sampling capacitor IOs to reduce acquisition noise level. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Use of the timer TSUSP mode. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Add support of Medium-density devices. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Add sofware acquisition mode on STM32L1xx High and Medium density devices. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Add TSLPRM_LINROT_USE_NORMDELTA parameter. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Content\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM8TL5xx devices (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32F0xx devices (BETA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx High-density devices using hardware and software acquisition modes (BETA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx Medium-density devices using sofware acquisition mode (BETA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of proximity, touchkey and linear/rotary touch sensors (1, 3, 5 and 6 channels). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Debounce mechanism for all states. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Environment Change System (ECS). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Detection Exclusion System (DXS). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Detection Time Out (DTO). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Noise filtering capability on measurement and delta. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Development Toolchains and Compilers\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM8 devices: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- ST Visual Develop (STVD). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- IAR Embedded Workbench for STM8. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Cosmic STM8 C Compiler. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Raisonance Ride7/RKit-STM8. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM32 devices: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- IAR Embedded Workbench for ARM. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Keil MDK-ARM. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Known Limitations\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-None. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<table class=MsoNormal border=0 cellspacing=0 cellpadding=0 width=100%\r
-style='margin-left:4cm;width:23%;background:rgb(51, 102, 255)'>\r
-<td align=left style='padding:0cm 5.4pt 0cm 5.4pt'>\r
-<p class=MsoNormal style='margin-bottom:0cm;line-height:normal'><b><span style='font-size:10.0pt;color:white'>\r
-V1.0.0 / 25-June-2012</span></b></p></td></tr></table>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Main Changes\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-First official release. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Content\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM8TL5xx devices (OFFICIAL). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32F0xx devices (BETA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of STM32L1xx High-density devices using hardware acquisition mode (BETA). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Support of proximity, touchkey and linear/rotary touch sensors (1, 3, 5 and 6 channels). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Debounce mechanism for all states. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Environment Change System (ECS). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Detection Exclusion System (DXS). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Detection Time Out (DTO). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Noise filtering capability on measurement and delta. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Development Toolchains and Compilers\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM8 devices: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- ST Visual Develop (STVD). \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- IAR Embedded Workbench for STM8. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Cosmic STM8 C Compiler. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Raisonance Ride7/RKit-STM8. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-STM32 devices: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- IAR Embedded Workbench for ARM. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- Keil MDK-ARM. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;line-height:normal'><b><u><span style='font-size:10.0pt'>\r
-Known Limitations\r
-</span></u></b></p>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:10.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>•<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
-Use of Linear/Rotary sensors with STM32L1xx High-density devices: \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- The hardware acquisition is too noisy to properly support Linear/Rotary sensors. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- This noise induces an important jitter of the reported position. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- As a workaround, the position resolution must be configured to 4 bits maximum. \r
-</span>\r
-<p class=MsoListParagraph style='margin-left:4cm;margin-right:4cm;text-indent:30.0pt;line-height:normal'><spanstyle='font-size:10.0pt;font-family:Symbol'>–<span style='font:7.0pt'> </span><span style='font-size:10.0pt'>\r
- The Touchkey sensors are not impacted by this issue. \r
-</span></p>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<table class=MsoNormal border=0 cellspacing=0 cellpadding=0 width=100%\r
-style='margin-left:4cm;margin-right:4cm;width:80%;background:rgb(51, 102, 255)'>\r
-<td style='padding:0cm 5.4pt 0cm 5.4pt'>\r
-<p class=MsoNormal style='margin-left:0cm;margin-bottom:0cm;line-height:normal'><b><span style='font-size:12.0pt;color:white'>\r
-License</span></b></p></td></tr></table>\r
-<p class=MsoNormal style='line-height:normal'><span style='font-size:10.0pt'> </span></p>\r
-<p class=MsoNormal style='margin-left:4cm;margin-right:4cm;line-height:normal'><span style='font-size:10.0pt;color:black'>Licensed under MCD-ST Liberty SW License Agreement V2, (the "License").\r
-You may not use this file except in compliance with the License.\r
-You may obtain a copy of the License at:\r
-\r
-\r
-</span></p>\r
-<p class=MsoNormal style='text-align:center;line-height:normal'><span style='font-size:10.0pt'>\r
-<a href=http://www.st.com/software_license_agreement_liberty_v2> http://www.st.com/software_license_agreement_liberty_v2</a></span></p>\r
-<p class=MsoNormal style='margin-left:4cm;margin-right:4cm;line-height:normal'><span style='font-size:10.0pt;color:black'>Unless required by applicable law or agreed to in writing, software\r
-distributed under the License is distributed on an "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-See the License for the specific language governing permissions and\r
-limitations under the License.\r
-</a></span></p>\r
-<p class=MsoNormal style='line-height:normal'><b><span style='font-size:10.0pt'> </span></b></p>\r
-<table class=MsoNormal border=0 cellspacing=0 cellpadding=0 width=100%\r
-style='margin-left:4cm;margin-right:4cm;width:80%;background:rgb(51, 102, 255)'>\r
-<td style='padding:0cm 5.4pt 0cm 5.4pt'>\r
-<p class=MsoNormal style='margin-left:0cm;margin-bottom:0cm;line-height:4pt'><b><span style='font-size:10.0pt;color:rgb(51, 102, 255)'>\r
----</span></b></p></td></tr></table>\r
-<p class=MsoNormal style='line-height:normal'><b><span style='font-size:10.0pt'> </span></b></p>\r
-<p class=MsoNormal style='text-align:center;line-height:normal'><span style='font-size:10.0pt'>\r
-For complete documentation on <b>STMTouch</b> microcontrollers please visit <a href=http://www.st.com/stmtouch> http://www.st.com/stmtouch</a></span></p>\r
-<p class=MsoNormal style='line-height:normal'><b><span style='font-size:10.0pt'> </span></b></p>\r
-<p class=MsoNormal align=right style='margin-right:1cm;line-height:normal'><span style='font-size:8.0pt'>Generated by RNcreator v2.3\r
-</span></p>\r
-<!-- Generated by RNcreator v2.3 on 22-Jan-13 12:40:56 -->\r
-</div>\r
-</body>\r
-</html>\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_conf_stm32f0xx.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief Acquisition parameters for STM32F0xx products.\r
- * @note This file must be copied in the application project and values\r
- * changed for the application.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_CONF_STM32F0XX_H\r
-#define __TSL_CONF_STM32F0XX_H\r
-\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-//+++++++++++++++++++++++++++ COMMON PARAMETERS ++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
-/** @defgroup Common_Parameters Common Parameters\r
- * @{ */\r
-\r
-//==============================================================================\r
-// Number of elements\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Number_Of_Elements 01 - Number of elements\r
- * @{ */\r
-\r
-/** Total number of channels in application (range=1..255)\r
-*/\r
-#define TSLPRM_TOTAL_CHANNELS (1)\r
-\r
-/** Total number of banks in application (range=1..255)\r
-*/\r
-#define TSLPRM_TOTAL_BANKS (1)\r
-\r
-/** Total number of "Extended" TouchKeys in application (range=0..255)\r
-*/\r
-#define TSLPRM_TOTAL_TOUCHKEYS (1)\r
-\r
-/** Total number of "Basic" TouchKeys in application (range=0..255)\r
-*/\r
-#define TSLPRM_TOTAL_TOUCHKEYS_B (1)\r
-\r
-/** Total number of "Extended" Linear and Rotary sensors in application (range=0..255)\r
- - Count also the 1-channel linear sensor used as TouchKey\r
-*/\r
-#define TSLPRM_TOTAL_LINROTS (1)\r
-\r
-/** Total number of "Basic" Linear and Rotary sensors in application (range=0..255)\r
- - Count also the 1-channel linear sensor used as TouchKey\r
-*/\r
-#define TSLPRM_TOTAL_LINROTS_B (1)\r
-\r
-/** Total number of sensors/objects in application (range=1..255)\r
- - Count all TouchKeys, Linear and Rotary sensors\r
-*/\r
-#define TSLPRM_TOTAL_OBJECTS (1)\r
-\r
-/** @} Common_Parameters_Number_Of_Elements */\r
-\r
-//==============================================================================\r
-// Optional features\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Options 02 - Optional features\r
- * @{ */\r
-\r
-/** Record the last measure (0=No, 1=Yes)\r
- - If No the measure is recalculated using the Reference and Delta\r
-*/\r
-#define TSLPRM_USE_MEAS (1)\r
-\r
-/** Zone management usage (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_ZONE (1)\r
-\r
-/** Proximity detection usage (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_PROX (1)\r
-\r
-/** Use the Timer tick callback (0=No, 1=Yes)\r
- - When equal to 1, the function TSL_CallBack_TimerTick must be defined in\r
- the application code. It is called for each timer interruption.\r
-*/\r
-#define TSLPRM_USE_TIMER_CALLBACK (1)\r
-\r
-/** Acquisition interrupt mode (0=No, 1=Yes)\r
- - If No the TS interrupt is not used.\r
- - If Yes the TS interrupt is used.\r
-*/\r
-#define TSLPRM_USE_ACQ_INTERRUPT (1)\r
-\r
-/** @} Common_Parameters_Options */\r
-\r
-//==============================================================================\r
-// Acquisition limits\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Acquisition_Limits 03 - Acquisition limits\r
- * @{ */\r
-\r
-/** Minimum acquisition measurement (range=0..65535)\r
- - This is the minimum acceptable value for the acquisition measure.\r
- - The acquisition will be in error if the measure is below this value.\r
-*/\r
-#define TSLPRM_ACQ_MIN (10)\r
-\r
-/** Maximum acquisition measurement (range=255, 511, 1023, 2047, 8191, 16383)\r
- - This is the maximum acceptable value for the acquisition measure.\r
- - The acquisition will be in error if the measure is above this value.\r
-*/\r
-#define TSLPRM_ACQ_MAX (8191)\r
-\r
-/** @} Common_Parameters_Acquisition_Limits */\r
-\r
-//==============================================================================\r
-// Calibration\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Calibration 04 - Calibration\r
- * @{ */\r
-\r
-/** Number of calibration samples (range=4, 8, 16)\r
- - Low value = faster calibration but less precision.\r
- - High value = slower calibration but more precision.\r
-*/\r
-#define TSLPRM_CALIB_SAMPLES (8)\r
-\r
-/** Delay in measurement samples before starting the calibration (range=0..40)\r
- - This is usefull if a noise filter is used.\r
- - Write 0 to disable the delay.\r
-*/\r
-#define TSLPRM_CALIB_DELAY (10)\r
-\r
-/** @} Common_Parameters_Calibration */\r
-\r
-//==============================================================================\r
-// Thresholds for TouchKey sensors\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_TouchKey_Thresholds 05 - Thresholds for TouchKey sensors\r
- * @{ */\r
-\r
-/** TouchKeys Proximity state input threshold (range=0..255)\r
- - Enter Proximity state if delta is above\r
-*/\r
-#define TSLPRM_TKEY_PROX_IN_TH (10)\r
-\r
-/** TouchKeys Proximity state output threshold (range=0..255)\r
- - Exit Proximity state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_PROX_OUT_TH (5)\r
-\r
-/** TouchKeys Detect state input threshold (range=0..255)\r
- - Enter Detect state if delta is above\r
-*/\r
-#define TSLPRM_TKEY_DETECT_IN_TH (20)\r
-\r
-/** TouchKeys Detect state output threshold (range=0..255)\r
- - Exit Detect state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_DETECT_OUT_TH (15)\r
-\r
-/** TouchKeys re-Calibration threshold (range=0..255)\r
- - @warning The value is inverted in the sensor state machine\r
- - Enter Calibration state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_CALIB_TH (20)\r
-\r
-/** TouchKey, Linear and Rotary sensors thresholds coefficient (range=0..4)\r
- This multiplier coefficient is applied on Detect thresholds only.\r
- - 0: feature disabled\r
- - 1: thresholds x 2\r
- - 2: thresholds x 4\r
- - 3: thresholds x 8\r
- - 4: thresholds x 16\r
-*/\r
-#define TSLPRM_COEFF_TH (1)\r
-\r
-/** @} Common_Parameters_TouchKey_Thresholds */\r
-\r
-//==============================================================================\r
-// Thresholds for Linear and Rotary sensors\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Thresholds 06 - Thresholds for Linear and Rotary sensors\r
- * @{ */\r
-\r
-/** Linear/Rotary Proximity state input threshold (range=0..255)\r
- - Enter Proximity state if delta is above\r
-*/\r
-#define TSLPRM_LINROT_PROX_IN_TH (10)\r
-\r
-/** Linear/Rotary Proximity state output threshold (range=0..255)\r
- - Exit Proximity state if delta is below\r
-*/\r
-#define TSLPRM_LINROT_PROX_OUT_TH (5)\r
-\r
-/** Linear/Rotary Detect state input threshold (range=0..255)\r
- - Enter Detect state if delta is above\r
-*/\r
-#define TSLPRM_LINROT_DETECT_IN_TH (20)\r
-\r
-/** Linear/Rotary Detect state output threshold (range=0..255)\r
- - Exit Detect state if delta is below\r
-*/\r
-#define TSLPRM_LINROT_DETECT_OUT_TH (15)\r
-\r
-/** Linear/Rotary re-Calibration threshold (range=0..255)\r
- - @warning The value is inverted in the sensor state machine\r
- - Enter Calibration state if delta is below\r
- - A low absolute value will result in a higher sensitivity and thus some spurious\r
- recalibration may be issued.\r
-*/\r
-#define TSLPRM_LINROT_CALIB_TH (20)\r
-\r
-/** Linear/Rotary Delta normalization (0=No, 1=Yes)\r
- - When this parameter is set, a coefficient is applied on all Delta of all sensors\r
- in order to normalize them and to improve the position calculation.\r
- - These coefficients must be defined in a constant table in the application (see Library examples).\r
- - The MSB is the coefficient integer part, the LSB is the coefficient real part.\r
- - Examples:\r
- - To apply a factor 1.10:\r
- 0x01 to the MSB\r
- 0x1A to the LSB (0.10 x 256 = 25.6 -> rounded to 26 = 0x1A)\r
- - To apply a factor 0.90:\r
- 0x00 to the MSB\r
- 0xE6 to the LSB (0.90 x 256 = 230.4 -> rounded to 230 = 0xE6)\r
- - To apply no factor:\r
- 0x01 to the MSB\r
- 0x00 to the LSB\r
-*/\r
-#define TSLPRM_LINROT_USE_NORMDELTA (1)\r
-\r
-/** @} Common_Parameters_LinRot_Thresholds */\r
-\r
-//==============================================================================\r
-// Linear/Rotary sensors used\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Used 07 - Linear/Rotary sensors used\r
- * @{ */\r
-\r
-/** Select which Linear and Rotary sensors you use in your application.\r
- - 0 = Not Used\r
- - 1 = Used\r
-\r
- LIN = Linear sensor\r
- ROT = Rotary sensor\r
- M1 = Mono electrodes design with 0/255 position at extremities of the sensor\r
- M2 = Mono electrodes design\r
- H = Half-ended electrodes design\r
- D = Dual electrodes design\r
-*/\r
-#define TSLPRM_USE_3CH_LIN_M1 (1)\r
-#define TSLPRM_USE_3CH_LIN_M2 (1)\r
-#define TSLPRM_USE_3CH_LIN_H (1)\r
-#define TSLPRM_USE_3CH_ROT_M (1)\r
-\r
-#define TSLPRM_USE_4CH_LIN_M1 (1)\r
-#define TSLPRM_USE_4CH_LIN_M2 (1)\r
-#define TSLPRM_USE_4CH_LIN_H (1)\r
-#define TSLPRM_USE_4CH_ROT_M (1)\r
-\r
-#define TSLPRM_USE_5CH_LIN_M1 (1)\r
-#define TSLPRM_USE_5CH_LIN_M2 (1)\r
-#define TSLPRM_USE_5CH_LIN_H (1)\r
-#define TSLPRM_USE_5CH_ROT_M (1)\r
-#define TSLPRM_USE_5CH_ROT_D (1)\r
-\r
-#define TSLPRM_USE_6CH_LIN_M1 (1)\r
-#define TSLPRM_USE_6CH_LIN_M2 (1)\r
-#define TSLPRM_USE_6CH_LIN_H (1)\r
-#define TSLPRM_USE_6CH_ROT_M (1)\r
-\r
-/** @} Common_Parameters_LinRot_used */\r
-\r
-//==============================================================================\r
-// Linear/Rotary sensors position\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Position 08 - Linear/Rotary sensors position\r
- * @{ */\r
-\r
-/** Position resolution in number of bits (range=1..8)\r
- - A Low value will result in a low resolution and will be less subject to noise.\r
- - A High value will result in a high resolution and will be more subject to noise.\r
-*/\r
-#define TSLPRM_LINROT_RESOLUTION (7)\r
-\r
-/** Direction change threshold in position unit (range=0..255)\r
- - Defines the default threshold used during the change direction process.\r
- - A Low value will result in a faster direction change.\r
- - A High value will result in a slower direction change.\r
-*/\r
-#define TSLPRM_LINROT_DIR_CHG_POS (10)\r
-\r
-/** Direction change debounce (range=0..63)\r
- - Defines the default integrator counter used during the change direction process.\r
- - This counter is decremented when the same change in the position is detected and the direction will\r
- change after this counter reaches zero.\r
- - A Low value will result in a faster direction change.\r
- - A High value will result in a slower direction change.\r
-*/\r
-#define TSLPRM_LINROT_DIR_CHG_DEB (1)\r
-\r
-/** @} Common_Parameters_LinRot_Position */\r
-\r
-//==============================================================================\r
-// Debounce counters\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Debounce 09 - Debounce counters\r
- * @{ */\r
-\r
-/** Proximity state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the Proximity detection but with less noise filtering.\r
- - A High value will result in improving the system noise immunity but will increase the system response time.\r
-*/\r
-#define TSLPRM_DEBOUNCE_PROX (3)\r
-\r
-/** Detect state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the detection but with less noise filtering.\r
- - A High value will result in improving the system noise immunity but will increase the system response time.\r
-*/\r
-#define TSLPRM_DEBOUNCE_DETECT (3)\r
-\r
-/** Release state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the end-detection but with less noise filtering.\r
- - A High value will result in a lower sensitivity during the end-detection but with more noise filtering.\r
-*/\r
-#define TSLPRM_DEBOUNCE_RELEASE (3)\r
-\r
-/** Re-calibration state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the recalibration but with less noise filtering.\r
- - A High value will result in a lower sensitivity during the recalibration but with more noise filtering.\r
-*/\r
-#define TSLPRM_DEBOUNCE_CALIB (3)\r
-\r
-/** Error state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity to enter in error state.\r
- - A High value will result in a lower sensitivity to enter in error state.\r
-*/\r
-#define TSLPRM_DEBOUNCE_ERROR (3)\r
-\r
-/** @} Common_Parameters_Debounce */\r
-\r
-//==============================================================================\r
-// Environment Change System (ECS)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_ECS 10 - ECS\r
- * @{ */\r
-\r
-/** Environment Change System Slow K factor (range=0..255)\r
- - The higher value is K, the faster is the response time.\r
-*/\r
-#define TSLPRM_ECS_K_SLOW (10)\r
-\r
-/** Environment Change System Fast K factor (range=0..255)\r
- - The higher value is K, the faster is the response time.\r
-*/\r
-#define TSLPRM_ECS_K_FAST (20)\r
-\r
-/** Environment Change System delay in msec (range=0..5000)\r
- - The ECS will be started after this delay and when all sensors are in Release state.\r
-*/\r
-#define TSLPRM_ECS_DELAY (500)\r
-\r
-/** @} Common_Parameters_ECS */\r
-\r
-//==============================================================================\r
-// Detection Time Out (DTO)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_DTO 11 - DTO\r
- * @{ */\r
-\r
-/** Detection Time Out delay in seconds (range=0..63)\r
- - Value 0: DTO processing not compiled in the code (to gain size if not used).\r
- - Value 1: Default time out infinite.\r
- - Value between 2 and 63: Default time out between value n-1 and n.\r
- - Examples:\r
- - With a DTO equal to 2, the time out is between 1s and 2s.\r
- - With a DTO equal to 63, the time out is between 62s and 63s.\r
-\r
-@note The DTO can be changed in run-time by the application only if the\r
- default value is between 1 and 63.\r
-*/\r
-#define TSLPRM_DTO (5)\r
-\r
-/** @} Common_Parameters_DTO */\r
-\r
-//==============================================================================\r
-// Detection Exclusion System (DXS)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_DXS 12 - DXS\r
- * @{ */\r
-\r
-/** Detection Exclusion System (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_DXS (1)\r
-\r
-/** @} Common_Parameters_DXS */\r
-\r
-//==============================================================================\r
-// Miscellaneous parameters\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Misc 13 - Miscellaneous\r
- * @{ */\r
-\r
-/** Timing tick frequency in Hz (range=125, 250, 500, 1000, 2000)\r
- - Result to a timing interrupt respectively every 8ms, 4ms, 2ms, 1ms, 0.5ms\r
-*/\r
-#define TSLPRM_TICK_FREQ (1000)\r
-\r
-/** @} Common_Parameters_Misc */\r
-\r
-/** @} Common_Parameters */\r
-\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++ MCU PARAMETERS ++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
-/** @defgroup STM32F0xx_Parameters STM32F0xx Parameters\r
- * @{ */\r
-\r
-//==============================================================================\r
-// GPIO configuration\r
-//==============================================================================\r
-\r
-/** @defgroup STM32F0xx_Parameters_GPIO_Config 01 - TSC GPIOs Configuration\r
- * @{ */\r
-\r
-/** TSC GPIOs Configuration selection (range=0..1)\r
- - 0: Manual. The TSC GPIOs configuration must be done by the application code.\r
- - 1: Automatic. The TSLPRM_TSC_GROUPx_IOy parameters below must be filled up.\r
- The TSC GPIOs configuration is automatically done by the STMTouch driver.\r
-*/\r
-#define TSLPRM_TSC_GPIO_CONFIG (1)\r
-\r
-//+++ DO NOT CHANGE THESE VALUES +++++++++++++++++++++++++++++++++\r
-// These defines must be applied to the TSLPRM_TSC_GROUPx_IOy parameters below.\r
-#define NU (0) // Not Used IO\r
-#define CHANNEL (1) // Channel IO\r
-#define SHIELD (2) // Shield IO (= Channel IO but not acquired)\r
-#define SAMPCAP (3) // Sampling Capacitor IO\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
-// If TSLPRM_TSC_GPIO_CONFIG=1 assign each TSLPRM_TSC_GROUPx_IOy parameters below.\r
-// If TSLPRM_TSC_GPIO_CONFIG=0 these parameters are ignored.\r
-\r
-#define TSLPRM_TSC_GROUP1_IO1 NU // PA0\r
-#define TSLPRM_TSC_GROUP1_IO2 NU // PA1\r
-#define TSLPRM_TSC_GROUP1_IO3 NU // PA2\r
-#define TSLPRM_TSC_GROUP1_IO4 NU // PA3\r
-\r
-#define TSLPRM_TSC_GROUP2_IO1 NU // PA4\r
-#define TSLPRM_TSC_GROUP2_IO2 NU // PA5\r
-#define TSLPRM_TSC_GROUP2_IO3 NU // PA6\r
-#define TSLPRM_TSC_GROUP2_IO4 NU // PA7\r
-\r
-#define TSLPRM_TSC_GROUP3_IO1 NU // PC5\r
-#define TSLPRM_TSC_GROUP3_IO2 NU // PB0\r
-#define TSLPRM_TSC_GROUP3_IO3 NU // PB1\r
-#define TSLPRM_TSC_GROUP3_IO4 NU // PB2\r
-\r
-#define TSLPRM_TSC_GROUP4_IO1 NU // PA9\r
-#define TSLPRM_TSC_GROUP4_IO2 NU // PA10\r
-#define TSLPRM_TSC_GROUP4_IO3 NU // PA11\r
-#define TSLPRM_TSC_GROUP4_IO4 NU // PA12\r
-\r
-#define TSLPRM_TSC_GROUP5_IO1 NU // PB3\r
-#define TSLPRM_TSC_GROUP5_IO2 NU // PB4\r
-#define TSLPRM_TSC_GROUP5_IO3 NU // PB6\r
-#define TSLPRM_TSC_GROUP5_IO4 NU // PB7\r
-\r
-#define TSLPRM_TSC_GROUP6_IO1 NU // PB11\r
-#define TSLPRM_TSC_GROUP6_IO2 NU // PB12\r
-#define TSLPRM_TSC_GROUP6_IO3 NU // PB13\r
-#define TSLPRM_TSC_GROUP6_IO4 NU // PB14\r
-\r
-/** @} STM32F0xx_Parameters_GPIO_Config */\r
-\r
-//==============================================================================\r
-// Charge Transfer Pulses\r
-//==============================================================================\r
-\r
-/** @defgroup STM32F0xx_Parameters_CT_Pulses 02 - Charge Transfer Pulses\r
- * @{ */\r
-\r
-/** Charge Transfer Pulse High (range=0..15)\r
- - 0: 1 x tPGCLK\r
- - 1: 2 x tPGCLK\r
- - ...\r
- - 15: 16 x tPGCLK\r
-*/\r
-#define TSLPRM_TSC_CTPH (1)\r
-\r
-/** Charge Transfer Pulse Low (range=0..15)\r
- - 0: 1 x tPGCLK\r
- - 1: 2 x tPGCLK\r
- - ...\r
- - 15: 16 x tPGCLK\r
-*/\r
-#define TSLPRM_TSC_CTPL (1)\r
-\r
-/** Pulse Generator Prescaler (range=0..7)\r
- - 0: fPGCLK = fHCLK\r
- - 1: fPGCLK = fHCLK/2\r
- - ...\r
- - 7: fPGCLK = fHCLK/128\r
-*/\r
-#define TSLPRM_TSC_PGPSC (5)\r
-\r
-/** @} STM32F0xx_Parameters_CT_Pulses */\r
-\r
-//==============================================================================\r
-// IOs\r
-//==============================================================================\r
-\r
-/** @defgroup STM32F0xx_Parameters_IOs 03 - I/Os\r
- * @{ */\r
-\r
-/** TSC IOs default mode when no on-going acquisition (range=0..1)\r
- - 0: Output push-pull low\r
- - 1: Input floating\r
-*/\r
-#define TSLPRM_TSC_IODEF (0)\r
-\r
-/** Acquisition Mode (range=0..1)\r
- - 0: Normal acquisition mode\r
- - 1: Synchronized acquisition mode\r
-*/\r
-#define TSLPRM_TSC_AM (0)\r
-\r
-/** Synchronization Pin (range=0..1)\r
- - 0: PB08\r
- - 1: PB10\r
-*/\r
-#define TSLPRM_TSC_SYNC_PIN (0)\r
-\r
-/** Synchronization Polarity (range=0..1)\r
- - 0: Falling edge only\r
- - 1: Rising edge and high level\r
-*/\r
-#define TSLPRM_TSC_SYNC_POL (0)\r
-\r
-/** @} STM32F0xx_Parameters_Misc */\r
-\r
-//==============================================================================\r
-// Spread Spectrum\r
-//==============================================================================\r
-\r
-/** @defgroup STM32F0xx_Parameters_SpreadSpectrum 04 - Spread Spectrum\r
- * @{ */\r
-\r
-/** Use Spread Spectrum (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_TSC_USE_SS (0)\r
-\r
-/** Spread Spectrum Deviation (range=0..127)\r
- - 0: 1 x tSSCLK\r
- - 1: 2 x tSSCLK\r
- - ...\r
- - 127: 128 x tSSCLK\r
-*/\r
-#define TSLPRM_TSC_SSD (0)\r
-\r
-/** Spread Spectrum Prescaler (range=0..1)\r
- - 0: fSSCLK = fHCLK\r
- - 1: fSSCLK = fHCLK/2\r
-*/\r
-#define TSLPRM_TSC_SSPSC (0)\r
-\r
-/** @} STM32F0xx_Parameters_SpreadSpectrum */\r
-\r
-/** @} STM32F0xx_Parameters */\r
-\r
-// DO NOT REMOVE !!!\r
-#include "tsl_check_config.h"\r
-\r
-#endif /* __TSL_CONF_STM32F0XX_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_conf_stm32f3xx.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief Acquisition parameters for STM32F3xx products.\r
- * @note This file must be copied in the application project and values\r
- * changed for the application.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_CONF_STM32F3XX_H\r
-#define __TSL_CONF_STM32F3XX_H\r
-\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-//+++++++++++++++++++++++++++ COMMON PARAMETERS ++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
-/** @defgroup Common_Parameters Common Parameters\r
- * @{ */\r
-\r
-//==============================================================================\r
-// Number of elements\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Number_Of_Elements 01 - Number of elements\r
- * @{ */\r
-\r
-/** Total number of channels in application (range=1..255)\r
-*/\r
-#define TSLPRM_TOTAL_CHANNELS (1)\r
-\r
-/** Total number of banks in application (range=1..255)\r
-*/\r
-#define TSLPRM_TOTAL_BANKS (1)\r
-\r
-/** Total number of "Extended" TouchKeys in application (range=0..255)\r
-*/\r
-#define TSLPRM_TOTAL_TOUCHKEYS (1)\r
-\r
-/** Total number of "Basic" TouchKeys in application (range=0..255)\r
-*/\r
-#define TSLPRM_TOTAL_TOUCHKEYS_B (1)\r
-\r
-/** Total number of "Extended" Linear and Rotary sensors in application (range=0..255)\r
- - Count also the 1-channel linear sensor used as TouchKey\r
-*/\r
-#define TSLPRM_TOTAL_LINROTS (1)\r
-\r
-/** Total number of "Basic" Linear and Rotary sensors in application (range=0..255)\r
- - Count also the 1-channel linear sensor used as TouchKey\r
-*/\r
-#define TSLPRM_TOTAL_LINROTS_B (1)\r
-\r
-/** Total number of sensors/objects in application (range=1..255)\r
- - Count all TouchKeys, Linear and Rotary sensors\r
-*/\r
-#define TSLPRM_TOTAL_OBJECTS (1)\r
-\r
-/** @} Common_Parameters_Number_Of_Elements */\r
-\r
-//==============================================================================\r
-// Optional features\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Options 02 - Optional features\r
- * @{ */\r
-\r
-/** Record the last measure (0=No, 1=Yes)\r
- - If No the measure is recalculated using the Reference and Delta\r
-*/\r
-#define TSLPRM_USE_MEAS (1)\r
-\r
-/** Zone management usage (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_ZONE (1)\r
-\r
-/** Proximity detection usage (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_PROX (1)\r
-\r
-/** Use the Timer tick callback (0=No, 1=Yes)\r
- - When equal to 1, the function TSL_CallBack_TimerTick must be defined in\r
- the application code. It is called for each timer interruption.\r
-*/\r
-#define TSLPRM_USE_TIMER_CALLBACK (1)\r
-\r
-/** Acquisition interrupt mode (0=No, 1=Yes)\r
- - If No the TS interrupt is not used.\r
- - If Yes the TS interrupt is used.\r
-*/\r
-#define TSLPRM_USE_ACQ_INTERRUPT (1)\r
-\r
-/** @} Common_Parameters_Options */\r
-\r
-//==============================================================================\r
-// Acquisition limits\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Acquisition_Limits 03 - Acquisition limits\r
- * @{ */\r
-\r
-/** Minimum acquisition measurement (range=0..65535)\r
- - This is the minimum acceptable value for the acquisition measure.\r
- - The acquisition will be in error if the measure is below this value.\r
-*/\r
-#define TSLPRM_ACQ_MIN (10)\r
-\r
-/** Maximum acquisition measurement (range=255, 511, 1023, 2047, 8191, 16383)\r
- - This is the maximum acceptable value for the acquisition measure.\r
- - The acquisition will be in error if the measure is above this value.\r
-*/\r
-#define TSLPRM_ACQ_MAX (8191)\r
-\r
-/** @} Common_Parameters_Acquisition_Limits */\r
-\r
-//==============================================================================\r
-// Calibration\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Calibration 04 - Calibration\r
- * @{ */\r
-\r
-/** Number of calibration samples (range=4, 8, 16)\r
- - Low value = faster calibration but less precision.\r
- - High value = slower calibration but more precision.\r
-*/\r
-#define TSLPRM_CALIB_SAMPLES (8)\r
-\r
-/** Delay in measurement samples before starting the calibration (range=0..40)\r
- - This is usefull if a noise filter is used.\r
- - Write 0 to disable the delay.\r
-*/\r
-#define TSLPRM_CALIB_DELAY (10)\r
-\r
-/** @} Common_Parameters_Calibration */\r
-\r
-//==============================================================================\r
-// Thresholds for TouchKey sensors\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_TouchKey_Thresholds 05 - Thresholds for TouchKey sensors\r
- * @{ */\r
-\r
-/** TouchKeys Proximity state input threshold (range=0..255)\r
- - Enter Proximity state if delta is above\r
-*/\r
-#define TSLPRM_TKEY_PROX_IN_TH (10)\r
-\r
-/** TouchKeys Proximity state output threshold (range=0..255)\r
- - Exit Proximity state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_PROX_OUT_TH (5)\r
-\r
-/** TouchKeys Detect state input threshold (range=0..255)\r
- - Enter Detect state if delta is above\r
-*/\r
-#define TSLPRM_TKEY_DETECT_IN_TH (20)\r
-\r
-/** TouchKeys Detect state output threshold (range=0..255)\r
- - Exit Detect state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_DETECT_OUT_TH (15)\r
-\r
-/** TouchKeys re-Calibration threshold (range=0..255)\r
- - @warning The value is inverted in the sensor state machine\r
- - Enter Calibration state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_CALIB_TH (20)\r
-\r
-/** TouchKey, Linear and Rotary sensors thresholds coefficient (range=0..4)\r
- This multiplier coefficient is applied on Detect thresholds only.\r
- - 0: feature disabled\r
- - 1: thresholds x 2\r
- - 2: thresholds x 4\r
- - 3: thresholds x 8\r
- - 4: thresholds x 16\r
-*/\r
-#define TSLPRM_COEFF_TH (1)\r
-\r
-/** @} Common_Parameters_TouchKey_Thresholds */\r
-\r
-//==============================================================================\r
-// Thresholds for Linear and Rotary sensors\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Thresholds 06 - Thresholds for Linear and Rotary sensors\r
- * @{ */\r
-\r
-/** Linear/Rotary Proximity state input threshold (range=0..255)\r
- - Enter Proximity state if delta is above\r
-*/\r
-#define TSLPRM_LINROT_PROX_IN_TH (10)\r
-\r
-/** Linear/Rotary Proximity state output threshold (range=0..255)\r
- - Exit Proximity state if delta is below\r
-*/\r
-#define TSLPRM_LINROT_PROX_OUT_TH (5)\r
-\r
-/** Linear/Rotary Detect state input threshold (range=0..255)\r
- - Enter Detect state if delta is above\r
-*/\r
-#define TSLPRM_LINROT_DETECT_IN_TH (20)\r
-\r
-/** Linear/Rotary Detect state output threshold (range=0..255)\r
- - Exit Detect state if delta is below\r
-*/\r
-#define TSLPRM_LINROT_DETECT_OUT_TH (15)\r
-\r
-/** Linear/Rotary re-Calibration threshold (range=0..255)\r
- - @warning The value is inverted in the sensor state machine\r
- - Enter Calibration state if delta is below\r
- - A low absolute value will result in a higher sensitivity and thus some spurious\r
- recalibration may be issued.\r
-*/\r
-#define TSLPRM_LINROT_CALIB_TH (20)\r
-\r
-/** Linear/Rotary Delta normalization (0=No, 1=Yes)\r
- - When this parameter is set, a coefficient is applied on all Delta of all sensors\r
- in order to normalize them and to improve the position calculation.\r
- - These coefficients must be defined in a constant table in the application (see Library examples).\r
- - The MSB is the coefficient integer part, the LSB is the coefficient real part.\r
- - Examples:\r
- - To apply a factor 1.10:\r
- 0x01 to the MSB\r
- 0x1A to the LSB (0.10 x 256 = 25.6 -> rounded to 26 = 0x1A)\r
- - To apply a factor 0.90:\r
- 0x00 to the MSB\r
- 0xE6 to the LSB (0.90 x 256 = 230.4 -> rounded to 230 = 0xE6)\r
- - To apply no factor:\r
- 0x01 to the MSB\r
- 0x00 to the LSB\r
-*/\r
-#define TSLPRM_LINROT_USE_NORMDELTA (1)\r
-\r
-/** @} Common_Parameters_LinRot_Thresholds */\r
-\r
-//==============================================================================\r
-// Linear/Rotary sensors used\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Used 07 - Linear/Rotary sensors used\r
- * @{ */\r
-\r
-/** Select which Linear and Rotary sensors you use in your application.\r
- - 0 = Not Used\r
- - 1 = Used\r
-\r
- LIN = Linear sensor\r
- ROT = Rotary sensor\r
- M1 = Mono electrodes design with 0/255 position at extremities of the sensor\r
- M2 = Mono electrodes design\r
- H = Half-ended electrodes design\r
- D = Dual electrodes design\r
-*/\r
-#define TSLPRM_USE_3CH_LIN_M1 (1)\r
-#define TSLPRM_USE_3CH_LIN_M2 (1)\r
-#define TSLPRM_USE_3CH_LIN_H (1)\r
-#define TSLPRM_USE_3CH_ROT_M (1)\r
-\r
-#define TSLPRM_USE_4CH_LIN_M1 (1)\r
-#define TSLPRM_USE_4CH_LIN_M2 (1)\r
-#define TSLPRM_USE_4CH_LIN_H (1)\r
-#define TSLPRM_USE_4CH_ROT_M (1)\r
-\r
-#define TSLPRM_USE_5CH_LIN_M1 (1)\r
-#define TSLPRM_USE_5CH_LIN_M2 (1)\r
-#define TSLPRM_USE_5CH_LIN_H (1)\r
-#define TSLPRM_USE_5CH_ROT_M (1)\r
-#define TSLPRM_USE_5CH_ROT_D (1)\r
-\r
-#define TSLPRM_USE_6CH_LIN_M1 (1)\r
-#define TSLPRM_USE_6CH_LIN_M2 (1)\r
-#define TSLPRM_USE_6CH_LIN_H (1)\r
-#define TSLPRM_USE_6CH_ROT_M (1)\r
-\r
-/** @} Common_Parameters_LinRot_used */\r
-\r
-//==============================================================================\r
-// Linear/Rotary sensors position\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Position 08 - Linear/Rotary sensors position\r
- * @{ */\r
-\r
-/** Position resolution in number of bits (range=1..8)\r
- - A Low value will result in a low resolution and will be less subject to noise.\r
- - A High value will result in a high resolution and will be more subject to noise.\r
-*/\r
-#define TSLPRM_LINROT_RESOLUTION (7)\r
-\r
-/** Direction change threshold in position unit (range=0..255)\r
- - Defines the default threshold used during the change direction process.\r
- - A Low value will result in a faster direction change.\r
- - A High value will result in a slower direction change.\r
-*/\r
-#define TSLPRM_LINROT_DIR_CHG_POS (10)\r
-\r
-/** Direction change debounce (range=0..63)\r
- - Defines the default integrator counter used during the change direction process.\r
- - This counter is decremented when the same change in the position is detected and the direction will\r
- change after this counter reaches zero.\r
- - A Low value will result in a faster direction change.\r
- - A High value will result in a slower direction change.\r
-*/\r
-#define TSLPRM_LINROT_DIR_CHG_DEB (1)\r
-\r
-/** @} Common_Parameters_LinRot_Position */\r
-\r
-//==============================================================================\r
-// Debounce counters\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Debounce 09 - Debounce counters\r
- * @{ */\r
-\r
-/** Proximity state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the Proximity detection but with less noise filtering.\r
- - A High value will result in improving the system noise immunity but will increase the system response time.\r
-*/\r
-#define TSLPRM_DEBOUNCE_PROX (3)\r
-\r
-/** Detect state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the detection but with less noise filtering.\r
- - A High value will result in improving the system noise immunity but will increase the system response time.\r
-*/\r
-#define TSLPRM_DEBOUNCE_DETECT (3)\r
-\r
-/** Release state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the end-detection but with less noise filtering.\r
- - A High value will result in a lower sensitivity during the end-detection but with more noise filtering.\r
-*/\r
-#define TSLPRM_DEBOUNCE_RELEASE (3)\r
-\r
-/** Re-calibration state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the recalibration but with less noise filtering.\r
- - A High value will result in a lower sensitivity during the recalibration but with more noise filtering.\r
-*/\r
-#define TSLPRM_DEBOUNCE_CALIB (3)\r
-\r
-/** Error state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity to enter in error state.\r
- - A High value will result in a lower sensitivity to enter in error state.\r
-*/\r
-#define TSLPRM_DEBOUNCE_ERROR (3)\r
-\r
-/** @} Common_Parameters_Debounce */\r
-\r
-//==============================================================================\r
-// Environment Change System (ECS)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_ECS 10 - ECS\r
- * @{ */\r
-\r
-/** Environment Change System Slow K factor (range=0..255)\r
- - The higher value is K, the faster is the response time.\r
-*/\r
-#define TSLPRM_ECS_K_SLOW (10)\r
-\r
-/** Environment Change System Fast K factor (range=0..255)\r
- - The higher value is K, the faster is the response time.\r
-*/\r
-#define TSLPRM_ECS_K_FAST (20)\r
-\r
-/** Environment Change System delay in msec (range=0..5000)\r
- - The ECS will be started after this delay and when all sensors are in Release state.\r
-*/\r
-#define TSLPRM_ECS_DELAY (500)\r
-\r
-/** @} Common_Parameters_ECS */\r
-\r
-//==============================================================================\r
-// Detection Time Out (DTO)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_DTO 11 - DTO\r
- * @{ */\r
-\r
-/** Detection Time Out delay in seconds (range=0..63)\r
- - Value 0: DTO processing not compiled in the code (to gain size if not used).\r
- - Value 1: Default time out infinite.\r
- - Value between 2 and 63: Default time out between value n-1 and n.\r
- - Examples:\r
- - With a DTO equal to 2, the time out is between 1s and 2s.\r
- - With a DTO equal to 63, the time out is between 62s and 63s.\r
-\r
-@note The DTO can be changed in run-time by the application only if the\r
- default value is between 1 and 63.\r
-*/\r
-#define TSLPRM_DTO (5)\r
-\r
-/** @} Common_Parameters_DTO */\r
-\r
-//==============================================================================\r
-// Detection Exclusion System (DXS)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_DXS 12 - DXS\r
- * @{ */\r
-\r
-/** Detection Exclusion System (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_DXS (1)\r
-\r
-/** @} Common_Parameters_DXS */\r
-\r
-//==============================================================================\r
-// Miscellaneous parameters\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Misc 13 - Miscellaneous\r
- * @{ */\r
-\r
-/** Timing tick frequency in Hz (range=125, 250, 500, 1000, 2000)\r
- - Result to a timing interrupt respectively every 8ms, 4ms, 2ms, 1ms, 0.5ms\r
-*/\r
-#define TSLPRM_TICK_FREQ (1000)\r
-\r
-/** @} Common_Parameters_Misc */\r
-\r
-/** @} Common_Parameters */\r
-\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++ MCU PARAMETERS ++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
-/** @defgroup STM32F3xx_Parameters STM32F3xx Parameters\r
- * @{ */\r
-\r
-//==============================================================================\r
-// GPIO configuration\r
-//==============================================================================\r
-\r
-/** @defgroup STM32F3xx_Parameters_GPIO_Config 01 - TSC GPIOs Configuration\r
- * @{ */\r
-\r
-/** TSC GPIOs Configuration selection (range=0..1)\r
- - 0: Manual. The TSC GPIOs configuration must be done by the application code.\r
- - 1: Automatic. The TSLPRM_TSC_GROUPx_IOy parameters below must be filled up.\r
- The TSC GPIOs configuration is automatically done by the STMTouch driver.\r
-*/\r
-#define TSLPRM_TSC_GPIO_CONFIG (1)\r
-\r
-//+++ DO NOT CHANGE THESE VALUES +++++++++++++++++++++++++++++++++\r
-// These defines must be applied to the TSLPRM_TSC_GROUPx_IOy parameters below.\r
-#define NU (0) // Not Used IO\r
-#define CHANNEL (1) // Channel IO\r
-#define SHIELD (2) // Shield IO (= Channel IO but not acquired)\r
-#define SAMPCAP (3) // Sampling Capacitor IO\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
-// If TSLPRM_TSC_GPIO_CONFIG=1 assign each TSLPRM_TSC_GROUPx_IOy parameters below.\r
-// If TSLPRM_TSC_GPIO_CONFIG=0 these parameters are ignored.\r
-// STM32F30X STM32F37X\r
-#define TSLPRM_TSC_GROUP1_IO1 NU // PA0 PA0\r
-#define TSLPRM_TSC_GROUP1_IO2 NU // PA1 PA1\r
-#define TSLPRM_TSC_GROUP1_IO3 NU // PA2 PA2\r
-#define TSLPRM_TSC_GROUP1_IO4 NU // PA3 PA3\r
-\r
-#define TSLPRM_TSC_GROUP2_IO1 NU // PA4 PA4\r
-#define TSLPRM_TSC_GROUP2_IO2 NU // PA5 PA5\r
-#define TSLPRM_TSC_GROUP2_IO3 NU // PA6 PA6\r
-#define TSLPRM_TSC_GROUP2_IO4 NU // PA7 PA7\r
-\r
-#define TSLPRM_TSC_GROUP3_IO1 NU // PC5 PC4 << diff\r
-#define TSLPRM_TSC_GROUP3_IO2 NU // PB0 PC5 << diff\r
-#define TSLPRM_TSC_GROUP3_IO3 NU // PB1 PB0 << diff\r
-#define TSLPRM_TSC_GROUP3_IO4 NU // PB2 PB1 << diff\r
-\r
-#define TSLPRM_TSC_GROUP4_IO1 NU // PA9 PA9\r
-#define TSLPRM_TSC_GROUP4_IO2 NU // PA10 PA10\r
-#define TSLPRM_TSC_GROUP4_IO3 NU // PA13 PA13\r
-#define TSLPRM_TSC_GROUP4_IO4 NU // PA14 PA14\r
-\r
-#define TSLPRM_TSC_GROUP5_IO1 NU // PB3 PB3\r
-#define TSLPRM_TSC_GROUP5_IO2 NU // PB4 PB4\r
-#define TSLPRM_TSC_GROUP5_IO3 NU // PB6 PB6\r
-#define TSLPRM_TSC_GROUP5_IO4 NU // PB7 PB7\r
-\r
-#define TSLPRM_TSC_GROUP6_IO1 NU // PB11 PB14 << diff\r
-#define TSLPRM_TSC_GROUP6_IO2 NU // PB12 PB15 << diff\r
-#define TSLPRM_TSC_GROUP6_IO3 NU // PB13 PD8 << diff\r
-#define TSLPRM_TSC_GROUP6_IO4 NU // PB14 PD9 << diff\r
-\r
-#define TSLPRM_TSC_GROUP7_IO1 NU // PE2 PE2\r
-#define TSLPRM_TSC_GROUP7_IO2 NU // PE3 PE3\r
-#define TSLPRM_TSC_GROUP7_IO3 NU // PE4 PE4\r
-#define TSLPRM_TSC_GROUP7_IO4 NU // PE5 PE5\r
-\r
-#define TSLPRM_TSC_GROUP8_IO1 NU // PD12 PD12\r
-#define TSLPRM_TSC_GROUP8_IO2 NU // PD13 PD13\r
-#define TSLPRM_TSC_GROUP8_IO3 NU // PD14 PD14\r
-#define TSLPRM_TSC_GROUP8_IO4 NU // PD15 PD15\r
-\r
-/** @} STM32F3xx_Parameters_GPIO_Config */\r
-\r
-//==============================================================================\r
-// Charge Transfer Pulses\r
-//==============================================================================\r
-\r
-/** @defgroup STM32F3xx_Parameters_CT_Pulses 02 - Charge Transfer Pulses\r
- * @{ */\r
-\r
-/** Charge Transfer Pulse High (range=0..15)\r
- - 0: 1 x tPGCLK\r
- - 1: 2 x tPGCLK\r
- - ...\r
- - 15: 16 x tPGCLK\r
-*/\r
-#define TSLPRM_TSC_CTPH (1)\r
-\r
-/** Charge Transfer Pulse Low (range=0..15)\r
- - 0: 1 x tPGCLK\r
- - 1: 2 x tPGCLK\r
- - ...\r
- - 15: 16 x tPGCLK\r
-*/\r
-#define TSLPRM_TSC_CTPL (1)\r
-\r
-/** Pulse Generator Prescaler (range=0..7)\r
- - 0: fPGCLK = fHCLK\r
- - 1: fPGCLK = fHCLK/2\r
- - ...\r
- - 7: fPGCLK = fHCLK/128\r
-*/\r
-#define TSLPRM_TSC_PGPSC (5)\r
-\r
-/** @} STM32F3xx_Parameters_CT_Pulses */\r
-\r
-//==============================================================================\r
-// IOs\r
-//==============================================================================\r
-\r
-/** @defgroup STM32F3xx_Parameters_IOs 03 - I/Os\r
- * @{ */\r
-\r
-/** TSC IOs default mode when no on-going acquisition (range=0..1)\r
- - 0: Output push-pull low\r
- - 1: Input floating\r
-*/\r
-#define TSLPRM_TSC_IODEF (0)\r
-\r
-/** Acquisition Mode (range=0..1)\r
- - 0: Normal acquisition mode\r
- - 1: Synchronized acquisition mode\r
-*/\r
-#define TSLPRM_TSC_AM (0)\r
-\r
-/** Synchronization Pin (range=0..1)\r
- - 0: PB08\r
- - 1: PB10\r
-*/\r
-#define TSLPRM_TSC_SYNC_PIN (0)\r
-\r
-/** Synchronization Polarity (range=0..1)\r
- - 0: Falling edge only\r
- - 1: Rising edge and high level\r
-*/\r
-#define TSLPRM_TSC_SYNC_POL (0)\r
-\r
-/** @} STM32F3xx_Parameters_Misc */\r
-\r
-//==============================================================================\r
-// Spread Spectrum\r
-//==============================================================================\r
-\r
-/** @defgroup STM32F3xx_Parameters_SpreadSpectrum 04 - Spread Spectrum\r
- * @{ */\r
-\r
-/** Use Spread Spectrum (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_TSC_USE_SS (0)\r
-\r
-/** Spread Spectrum Deviation (range=0..127)\r
- - 0: 1 x tSSCLK\r
- - 1: 2 x tSSCLK\r
- - ...\r
- - 127: 128 x tSSCLK\r
-*/\r
-#define TSLPRM_TSC_SSD (0)\r
-\r
-/** Spread Spectrum Prescaler (range=0..1)\r
- - 0: fSSCLK = fHCLK\r
- - 1: fSSCLK = fHCLK/2\r
-*/\r
-#define TSLPRM_TSC_SSPSC (0)\r
-\r
-/** @} STM32F3xx_Parameters_SpreadSpectrum */\r
-\r
-/** @} STM32F3xx_Parameters */\r
-\r
-// DO NOT REMOVE !!!\r
-#include "tsl_check_config.h"\r
-\r
-#endif /* __TSL_CONF_STM32F3XX_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_conf_stm32l1xx.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief Acquisition parameters for STM32L1xx products.\r
- * @note This file must be copied in the application project and values\r
- * changed for the application.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_CONF_STM32L1xx_H\r
-#define __TSL_CONF_STM32L1xx_H\r
-\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-//+++++++++++++++++++++++++++ COMMON PARAMETERS ++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
-/** @defgroup Common_Parameters Common Parameters\r
- * @{ */\r
-\r
-//==============================================================================\r
-// Number of elements\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Number_Of_Elements 01 - Number of elements\r
- * @{ */\r
-\r
-/** Total number of channels in application (range=1..255)\r
-*/\r
-#define TSLPRM_TOTAL_CHANNELS (1)\r
-\r
-/** Total number of banks in application (range=1..255)\r
-*/\r
-#define TSLPRM_TOTAL_BANKS (1)\r
-\r
-/** Total number of "Extended" TouchKeys in application (range=0..255)\r
-*/\r
-#define TSLPRM_TOTAL_TOUCHKEYS (1)\r
-\r
-/** Total number of "Basic" TouchKeys in application (range=0..255)\r
-*/\r
-#define TSLPRM_TOTAL_TOUCHKEYS_B (1)\r
-\r
-/** Total number of "Extended" Linear and Rotary sensors in application (range=0..255)\r
- - Count also the 1-channel linear sensor used as TouchKey\r
-*/\r
-#define TSLPRM_TOTAL_LINROTS (1)\r
-\r
-/** Total number of "Basic" Linear and Rotary sensors in application (range=0..255)\r
- - Count also the 1-channel linear sensor used as TouchKey\r
-*/\r
-#define TSLPRM_TOTAL_LINROTS_B (1)\r
-\r
-/** Total number of sensors/objects in application (range=1..255)\r
- - Count all TouchKeys, Linear and Rotary sensors\r
-*/\r
-#define TSLPRM_TOTAL_OBJECTS (1)\r
-\r
-/** @} Common_Parameters_Number_Of_Elements */\r
-\r
-//==============================================================================\r
-// Optional features\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Options 02 - Optional features\r
- * @{ */\r
-\r
-/** Record the last measure (0=No, 1=Yes)\r
- - If No the measure is recalculated using the Reference and Delta\r
-*/\r
-#define TSLPRM_USE_MEAS (1)\r
-\r
-/** Zone management usage (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_ZONE (1)\r
-\r
-/** Proximity detection usage (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_PROX (1)\r
-\r
-/** Use the Timer tick callback (0=No, 1=Yes)\r
- - When equal to 1, the function TSL_CallBack_TimerTick must be defined in\r
- the application code. It is called for each timer interruption.\r
-*/\r
-#define TSLPRM_USE_TIMER_CALLBACK (1)\r
-\r
-/** Acquisition interrupt mode (0=No, 1=Yes)\r
- - If No the TS interrupt is not used.\r
- - If Yes the TS interrupt is used.\r
-*/\r
-#define TSLPRM_USE_ACQ_INTERRUPT (1)\r
-\r
-/** @} Common_Parameters_Options */\r
-\r
-//==============================================================================\r
-// Acquisition limits\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Acquisition_Limits 03 - Acquisition limits\r
- * @{ */\r
-\r
-/** Minimum acquisition measurement (range=0..65535)\r
- - This is the minimum acceptable value for the acquisition measure.\r
- - The acquisition will be in error if the measure is below this value.\r
-*/\r
-#define TSLPRM_ACQ_MIN (10)\r
-\r
-/** Maximum acquisition measurement (range=0..65535)\r
- - This is the maximum acceptable value for the acquisition measure.\r
- - The acquisition will be in error if the measure is above this value.\r
-*/\r
-#define TSLPRM_ACQ_MAX (4000)\r
-\r
-/** @} Common_Parameters_Acquisition_Limits */\r
-\r
-//==============================================================================\r
-// Calibration\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Calibration 04 - Calibration\r
- * @{ */\r
-\r
-/** Number of calibration samples (range=4, 8, 16)\r
- - Low value = faster calibration but less precision.\r
- - High value = slower calibration but more precision.\r
-*/\r
-#define TSLPRM_CALIB_SAMPLES (8)\r
-\r
-/** Delay in measurement samples before starting the calibration (range=0..40)\r
- - This is usefull if a noise filter is used.\r
- - Write 0 to disable the delay.\r
-*/\r
-#define TSLPRM_CALIB_DELAY (10)\r
-\r
-/** @} Common_Parameters_Calibration */\r
-\r
-//==============================================================================\r
-// Thresholds for TouchKey sensors\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_TouchKey_Thresholds 05 - Thresholds for TouchKey sensors\r
- * @{ */\r
-\r
-/** TouchKeys Proximity state input threshold (range=0..255)\r
- - Enter Proximity state if delta is above\r
-*/\r
-#define TSLPRM_TKEY_PROX_IN_TH (10)\r
-\r
-/** TouchKeys Proximity state output threshold (range=0..255)\r
- - Exit Proximity state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_PROX_OUT_TH (5)\r
-\r
-/** TouchKeys Detect state input threshold (range=0..255)\r
- - Enter Detect state if delta is above\r
-*/\r
-#define TSLPRM_TKEY_DETECT_IN_TH (20)\r
-\r
-/** TouchKeys Detect state output threshold (range=0..255)\r
- - Exit Detect state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_DETECT_OUT_TH (15)\r
-\r
-/** TouchKeys re-Calibration threshold (range=0..255)\r
- - @warning The value is inverted in the sensor state machine\r
- - Enter Calibration state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_CALIB_TH (20)\r
-\r
-/** TouchKey, Linear and Rotary sensors thresholds coefficient (range=0..4)\r
- This multiplier coefficient is applied on Detect thresholds only.\r
- - 0: feature disabled\r
- - 1: thresholds x 2\r
- - 2: thresholds x 4\r
- - 3: thresholds x 8\r
- - 4: thresholds x 16\r
-*/\r
-#define TSLPRM_COEFF_TH (1)\r
-\r
-/** @} Common_Parameters_TouchKey_Thresholds */\r
-\r
-//==============================================================================\r
-// Thresholds for Linear and Rotary sensors\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Thresholds 06 - Thresholds for Linear and Rotary sensors\r
- * @{ */\r
-\r
-/** Linear/Rotary Proximity state input threshold (range=0..255)\r
- - Enter Proximity state if delta is above\r
-*/\r
-#define TSLPRM_LINROT_PROX_IN_TH (10)\r
-\r
-/** Linear/Rotary Proximity state output threshold (range=0..255)\r
- - Exit Proximity state if delta is below\r
-*/\r
-#define TSLPRM_LINROT_PROX_OUT_TH (5)\r
-\r
-/** Linear/Rotary Detect state input threshold (range=0..255)\r
- - Enter Detect state if delta is above\r
-*/\r
-#define TSLPRM_LINROT_DETECT_IN_TH (20)\r
-\r
-/** Linear/Rotary Detect state output threshold (range=0..255)\r
- - Exit Detect state if delta is below\r
-*/\r
-#define TSLPRM_LINROT_DETECT_OUT_TH (15)\r
-\r
-/** Linear/Rotary re-Calibration threshold (range=0..255)\r
- - @warning The value is inverted in the sensor state machine\r
- - Enter Calibration state if delta is below\r
- - A low absolute value will result in a higher sensitivity and thus some spurious\r
- recalibration may be issued.\r
-*/\r
-#define TSLPRM_LINROT_CALIB_TH (20)\r
-\r
-/** Linear/Rotary Delta normalization (0=No, 1=Yes)\r
- - When this parameter is set, a coefficient is applied on all Delta of all sensors\r
- in order to normalize them and to improve the position calculation.\r
- - These coefficients must be defined in a constant table in the application (see Library examples).\r
- - The MSB is the coefficient integer part, the LSB is the coefficient real part.\r
- - Examples:\r
- - To apply a factor 1.10:\r
- 0x01 to the MSB\r
- 0x1A to the LSB (0.10 x 256 = 25.6 -> rounded to 26 = 0x1A)\r
- - To apply a factor 0.90:\r
- 0x00 to the MSB\r
- 0xE6 to the LSB (0.90 x 256 = 230.4 -> rounded to 230 = 0xE6)\r
- - To apply no factor:\r
- 0x01 to the MSB\r
- 0x00 to the LSB\r
-*/\r
-#define TSLPRM_LINROT_USE_NORMDELTA (1)\r
-\r
-/** @} Common_Parameters_LinRot_Thresholds */\r
-\r
-//==============================================================================\r
-// Linear/Rotary sensors used\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Used 07 - Linear/Rotary sensors used\r
- * @{ */\r
-\r
-/** Select which Linear and Rotary sensors you use in your application.\r
- - 0 = Not Used\r
- - 1 = Used\r
-\r
- LIN = Linear sensor\r
- ROT = Rotary sensor\r
- M1 = Mono electrodes design with 0/255 position at extremities of the sensor\r
- M2 = Mono electrodes design\r
- H = Half-ended electrodes design\r
- D = Dual electrodes design\r
-*/\r
-#define TSLPRM_USE_3CH_LIN_M1 (1)\r
-#define TSLPRM_USE_3CH_LIN_M2 (1)\r
-#define TSLPRM_USE_3CH_LIN_H (1)\r
-#define TSLPRM_USE_3CH_ROT_M (1)\r
-\r
-#define TSLPRM_USE_4CH_LIN_M1 (1)\r
-#define TSLPRM_USE_4CH_LIN_M2 (1)\r
-#define TSLPRM_USE_4CH_LIN_H (1)\r
-#define TSLPRM_USE_4CH_ROT_M (1)\r
-\r
-#define TSLPRM_USE_5CH_LIN_M1 (1)\r
-#define TSLPRM_USE_5CH_LIN_M2 (1)\r
-#define TSLPRM_USE_5CH_LIN_H (1)\r
-#define TSLPRM_USE_5CH_ROT_M (1)\r
-#define TSLPRM_USE_5CH_ROT_D (1)\r
-\r
-#define TSLPRM_USE_6CH_LIN_M1 (1)\r
-#define TSLPRM_USE_6CH_LIN_M2 (1)\r
-#define TSLPRM_USE_6CH_LIN_H (1)\r
-#define TSLPRM_USE_6CH_ROT_M (1)\r
-\r
-/** @} Common_Parameters_LinRot_used */\r
-\r
-//==============================================================================\r
-// Linear/Rotary sensors position\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Position 08 - Linear/Rotary sensors position\r
- * @{ */\r
-\r
-/** Position resolution in number of bits (range=1..8)\r
- - A Low value will result in a low resolution and will be less subject to noise.\r
- - A High value will result in a high resolution and will be more subject to noise.\r
-*/\r
-#define TSLPRM_LINROT_RESOLUTION (7)\r
-\r
-/** Direction change threshold in position unit (range=0..255)\r
- - Defines the default threshold used during the change direction process.\r
- - A Low value will result in a faster direction change.\r
- - A High value will result in a slower direction change.\r
-*/\r
-#define TSLPRM_LINROT_DIR_CHG_POS (10)\r
-\r
-/** Direction change debounce (range=0..63)\r
- - Defines the default integrator counter used during the change direction process.\r
- - This counter is decremented when the same change in the position is detected and the direction will\r
- change after this counter reaches zero.\r
- - A Low value will result in a faster direction change.\r
- - A High value will result in a slower direction change.\r
-*/\r
-#define TSLPRM_LINROT_DIR_CHG_DEB (1)\r
-\r
-/** @} Common_Parameters_LinRot_Position */\r
-\r
-//==============================================================================\r
-// Debounce counters\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Debounce 09 - Debounce counters\r
- * @{ */\r
-\r
-/** Proximity state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the Proximity detection but with less noise filtering.\r
- - A High value will result in improving the system noise immunity but will increase the system response time.\r
-*/\r
-#define TSLPRM_DEBOUNCE_PROX (3)\r
-\r
-/** Detect state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the detection but with less noise filtering.\r
- - A High value will result in improving the system noise immunity but will increase the system response time.\r
-*/\r
-#define TSLPRM_DEBOUNCE_DETECT (3)\r
-\r
-/** Release state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the end-detection but with less noise filtering.\r
- - A High value will result in a lower sensitivity during the end-detection but with more noise filtering.\r
-*/\r
-#define TSLPRM_DEBOUNCE_RELEASE (3)\r
-\r
-/** Re-calibration state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the recalibration but with less noise filtering.\r
- - A High value will result in a lower sensitivity during the recalibration but with more noise filtering.\r
-*/\r
-#define TSLPRM_DEBOUNCE_CALIB (3)\r
-\r
-/** Error state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity to enter in error state.\r
- - A High value will result in a lower sensitivity to enter in error state.\r
-*/\r
-#define TSLPRM_DEBOUNCE_ERROR (3)\r
-\r
-/** @} Common_Parameters_Debounce */\r
-\r
-//==============================================================================\r
-// Environment Change System (ECS)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_ECS 10 - ECS\r
- * @{ */\r
-\r
-/** Environment Change System Slow K factor (range=0..255)\r
- - The higher value is K, the faster is the response time.\r
-*/\r
-#define TSLPRM_ECS_K_SLOW (10)\r
-\r
-/** Environment Change System Fast K factor (range=0..255)\r
- - The higher value is K, the faster is the response time.\r
-*/\r
-#define TSLPRM_ECS_K_FAST (20)\r
-\r
-/** Environment Change System delay in msec (range=0..5000)\r
- - The ECS will be started after this delay and when all sensors are in Release state.\r
-*/\r
-#define TSLPRM_ECS_DELAY (500)\r
-\r
-/** @} Common_Parameters_ECS */\r
-\r
-//==============================================================================\r
-// Detection Time Out (DTO)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_DTO 11 - DTO\r
- * @{ */\r
-\r
-/** Detection Time Out delay in seconds (range=0..63)\r
- - Value 0: DTO processing not compiled in the code (to gain size if not used).\r
- - Value 1: Default time out infinite.\r
- - Value between 2 and 63: Default time out between value n-1 and n.\r
- - Examples:\r
- - With a DTO equal to 2, the time out is between 1s and 2s.\r
- - With a DTO equal to 63, the time out is between 62s and 63s.\r
-\r
-@note The DTO can be changed in run-time by the application only if the\r
- default value is between 1 and 63.\r
-*/\r
-#define TSLPRM_DTO (5)\r
-\r
-/** @} Common_Parameters_DTO */\r
-\r
-//==============================================================================\r
-// Detection Exclusion System (DXS)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_DXS 12 - DXS\r
- * @{ */\r
-\r
-/** Detection Exclusion System (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_DXS (1)\r
-\r
-/** @} Common_Parameters_DXS */\r
-\r
-//==============================================================================\r
-// Miscellaneous parameters\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Misc 13 - Miscellaneous\r
- * @{ */\r
-\r
-/** Timing tick frequency in Hz (range=125, 250, 500, 1000, 2000)\r
- - Result to a timing interrupt respectively every 8ms, 4ms, 2ms, 1ms, 0.5ms\r
-*/\r
-#define TSLPRM_TICK_FREQ (1000)\r
-\r
-/** @} Common_Parameters_Misc */\r
-\r
-/** @} Common_Parameters */\r
-\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++ MCU PARAMETERS ++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
-/** @defgroup STM32L1xx_Parameters STM32L1xx Parameters\r
- * @{ */\r
-\r
-/** @defgroup STM32L1xx_Parameters_Misc 01 - Miscellaneous\r
- * @{ */\r
-\r
-/** Shield with a channel (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_SHIELD (1)\r
-\r
-/** IOs default mode when no on-going acquisition (range=0..1)\r
- - 0: Output push-pull low\r
- - 1: Input floating\r
-*/\r
-#define TSLPRM_IODEF (1)\r
-\r
-/** Master timer prescaler for HW acquisition only (range=0..65535)\r
- - Divide the timer input clock by this value plus one\r
-*/\r
-#define TSLPRM_TIM_PRESCALER (0)\r
-\r
-/** Master timer reload value for HW acquisition only (range=4..65534, even number)\r
- - Set the auto-reload value for the center aligned counter\r
-*/\r
-#define TSLPRM_TIM_RELOAD (64)\r
-\r
-/** IT disabling for IO protection for SW acquisition only (range=0..1)\r
- - 0: IO not protected\r
- - 1: IO protected\r
-*/\r
-#define TSLPRM_PROTECT_IO_ACCESS (0)\r
-\r
-/** Which GPIO will be used for SW acquisition only (range=0..1)\r
- - 0: Not used\r
- - 1: Used\r
-*/\r
-#define TSLPRM_USE_GPIOA (1)\r
-#define TSLPRM_USE_GPIOB (1)\r
-#define TSLPRM_USE_GPIOC (1)\r
-#define TSLPRM_USE_GPIOF (0)\r
-#define TSLPRM_USE_GPIOG (0)\r
-\r
-/** @} STM32L1xx_Parameters_Misc */\r
-\r
-/** @} STM32L1xx_Parameters */\r
-\r
-// DO NOT REMOVE !!!\r
-#include "tsl_check_config.h"\r
-\r
-#endif /* __TSL_CONF_STM32L1xx_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_conf_stm8tl5x.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief Acquisition parameters for STM8TL5x products.\r
- * @note This file must be copied in the application project and values\r
- * changed for the application.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_CONF_STM8TL5X_H\r
-#define __TSL_CONF_STM8TL5X_H\r
-\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-//+++++++++++++++++++++++++++ COMMON PARAMETERS ++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
-/** @defgroup Common_Parameters Common Parameters\r
- * @{ */\r
-\r
-//==============================================================================\r
-// Number of elements\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Number_Of_Elements 01 - Number of elements\r
- * @{ */\r
-\r
-/** Total number of channels in application (range=1..255)\r
-*/\r
-#define TSLPRM_TOTAL_CHANNELS (1)\r
-\r
-/** Total number of banks in application (range=1..255)\r
-*/\r
-#define TSLPRM_TOTAL_BANKS (1)\r
-\r
-/** Total number of "Extended" TouchKeys in application (range=0..255)\r
-*/\r
-#define TSLPRM_TOTAL_TOUCHKEYS (1)\r
-\r
-/** Total number of "Basic" TouchKeys in application (range=0..255)\r
-*/\r
-#define TSLPRM_TOTAL_TOUCHKEYS_B (1)\r
-\r
-/** Total number of "Extended" Linear and Rotary sensors in application (range=0..255)\r
- - Count also the 1-channel linear sensor used as TouchKey\r
-*/\r
-#define TSLPRM_TOTAL_LINROTS (1)\r
-\r
-/** Total number of "Basic" Linear and Rotary sensors in application (range=0..255)\r
- - Count also the 1-channel linear sensor used as TouchKey\r
-*/\r
-#define TSLPRM_TOTAL_LINROTS_B (1)\r
-\r
-/** Total number of sensors/objects in application (range=1..255)\r
- - Count all TouchKeys, Linear and Rotary sensors\r
-*/\r
-#define TSLPRM_TOTAL_OBJECTS (1)\r
-\r
-/** @} Common_Parameters_Number_Of_Elements */\r
-\r
-//==============================================================================\r
-// Optional features\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Options 02 - Optional features\r
- * @{ */\r
-\r
-/** Record the last measure (0=No, 1=Yes)\r
- - If No the measure is recalculated using the Reference and Delta\r
-*/\r
-#define TSLPRM_USE_MEAS (1)\r
-\r
-/** Zone management usage (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_ZONE (1)\r
-\r
-/** Proximity detection usage (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_PROX (1)\r
-\r
-/** Use the Timer tick callback (0=No, 1=Yes)\r
- - When equal to 1, the function TSL_CallBack_TimerTick must be defined in\r
- the application code. It is called for each timer interruption.\r
-*/\r
-#define TSLPRM_USE_TIMER_CALLBACK (1)\r
-\r
-/** Acquisition interrupt mode (0=No, 1=Yes)\r
- - If No the acquisition is managed in the main routine using polling mode.\r
- - If Yes the acquisition is managed in the interrupt routines.\r
-*/\r
-#define TSLPRM_USE_ACQ_INTERRUPT (1)\r
-\r
-/** @} Common_Parameters_Options */\r
-\r
-//==============================================================================\r
-// Acquisition limits\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Acquisition_Limits 03 - Acquisition limits\r
- * @{ */\r
-\r
-/** Minimum acquisition measurement (range=0..65535)\r
- - This is the minimum acceptable value for the acquisition measure.\r
- - The acquisition will be in error if the measure is below this value.\r
-*/\r
-#define TSLPRM_ACQ_MIN (50)\r
-\r
-/** Maximum acquisition measurement (range=0..65535)\r
- - This is the maximum acceptable value for the acquisition measure.\r
- - The acquisition will be in error if the measure is above this value.\r
-*/\r
-#define TSLPRM_ACQ_MAX (4000)\r
-\r
-/** @} Common_Parameters_Acquisition_Limits */\r
-\r
-//==============================================================================\r
-// Calibration\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Calibration 04 - Calibration\r
- * @{ */\r
-\r
-/** Number of calibration samples (range=4, 8, 16)\r
- - Low value = faster calibration but less precision.\r
- - High value = slower calibration but more precision.\r
-*/\r
-#define TSLPRM_CALIB_SAMPLES (8)\r
-\r
-/** Delay in measurement samples before starting the calibration (range=0..40)\r
- - This is usefull if a noise filter is used.\r
- - Write 0 to disable the delay.\r
-*/\r
-#define TSLPRM_CALIB_DELAY (10)\r
-\r
-/** @} Common_Parameters_Calibration */\r
-\r
-//==============================================================================\r
-// Thresholds for TouchKey sensors\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_TouchKey_Thresholds 05 - Thresholds for TouchKey sensors\r
- * @{ */\r
-\r
-/** TouchKeys Proximity state input threshold (range=0..255)\r
- - Enter Proximity state if delta is above\r
-*/\r
-#define TSLPRM_TKEY_PROX_IN_TH (15)\r
-\r
-/** TouchKeys Proximity state output threshold (range=0..255)\r
- - Exit Proximity state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_PROX_OUT_TH (5)\r
-\r
-/** TouchKeys Detect state input threshold (range=0..255)\r
- - Enter Detect state if delta is above\r
-*/\r
-#define TSLPRM_TKEY_DETECT_IN_TH (50)\r
-\r
-/** TouchKeys Detect state output threshold (range=0..255)\r
- - Exit Detect state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_DETECT_OUT_TH (40)\r
-\r
-/** TouchKeys re-Calibration threshold (range=0..255)\r
- - @warning The value is inverted in the sensor state machine\r
- - Enter Calibration state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_CALIB_TH (20)\r
-\r
-/** TouchKey, Linear and Rotary sensors thresholds coefficient (range=0..4)\r
- This multiplier coefficient is applied on Detect thresholds only.\r
- - 0: feature disabled\r
- - 1: thresholds x 2\r
- - 2: thresholds x 4\r
- - 3: thresholds x 8\r
- - 4: thresholds x 16\r
-*/\r
-#define TSLPRM_COEFF_TH (1)\r
-\r
-/** @} Common_Parameters_TouchKey_Thresholds */\r
-\r
-//==============================================================================\r
-// Thresholds for Linear and Rotary sensors\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Thresholds 06 - Thresholds for Linear and Rotary sensors\r
- * @{ */\r
-\r
-/** Linear/Rotary Proximity state input threshold (range=0..255)\r
- - Enter Proximity state if delta is above\r
-*/\r
-#define TSLPRM_LINROT_PROX_IN_TH (15)\r
-\r
-/** Linear/Rotary Proximity state output threshold (range=0..255)\r
- - Exit Proximity state if delta is below\r
-*/\r
-#define TSLPRM_LINROT_PROX_OUT_TH (5)\r
-\r
-/** Linear/Rotary Detect state input threshold (range=0..255)\r
- - Enter Detect state if delta is above\r
-*/\r
-#define TSLPRM_LINROT_DETECT_IN_TH (50)\r
-\r
-/** Linear/Rotary Detect state output threshold (range=0..255)\r
- - Exit Detect state if delta is below\r
-*/\r
-#define TSLPRM_LINROT_DETECT_OUT_TH (30)\r
-\r
-/** Linear/Rotary re-Calibration threshold (range=0..255)\r
- - @warning The value is inverted in the sensor state machine\r
- - Enter Calibration state if delta is below\r
- - A low absolute value will result in a higher sensitivity and thus some spurious\r
- recalibration may be issued.\r
-*/\r
-#define TSLPRM_LINROT_CALIB_TH (20)\r
-\r
-/** Linear/Rotary Delta normalization (0=No, 1=Yes)\r
- - When this parameter is set, a coefficient is applied on all Delta of all sensors\r
- in order to normalize them and to improve the position calculation.\r
- - These coefficients must be defined in a constant table in the application (see Library examples).\r
- - The MSB is the coefficient integer part, the LSB is the coefficient real part.\r
- - Examples:\r
- - To apply a factor 1.10:\r
- 0x01 to the MSB\r
- 0x1A to the LSB (0.10 x 256 = 25.6 -> rounded to 26 = 0x1A)\r
- - To apply a factor 0.90:\r
- 0x00 to the MSB\r
- 0xE6 to the LSB (0.90 x 256 = 230.4 -> rounded to 230 = 0xE6)\r
- - To apply no factor:\r
- 0x01 to the MSB\r
- 0x00 to the LSB\r
-*/\r
-#define TSLPRM_LINROT_USE_NORMDELTA (1)\r
-\r
-/** @} Common_Parameters_LinRot_Thresholds */\r
-\r
-//==============================================================================\r
-// Linear/Rotary sensors used\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Used 07 - Linear/Rotary sensors used\r
- * @{ */\r
-\r
-/** Select which Linear and Rotary sensors you use in your application.\r
- - 0 = Not Used\r
- - 1 = Used\r
-\r
- LIN = Linear sensor\r
- ROT = Rotary sensor\r
- M1 = Mono electrodes design with 0/255 position at extremities of the sensor\r
- M2 = Mono electrodes design\r
- H = Half-ended electrodes design\r
- D = Dual electrodes design\r
-*/\r
-#define TSLPRM_USE_3CH_LIN_M1 (1)\r
-#define TSLPRM_USE_3CH_LIN_M2 (1)\r
-#define TSLPRM_USE_3CH_LIN_H (1)\r
-#define TSLPRM_USE_3CH_ROT_M (1)\r
-\r
-#define TSLPRM_USE_4CH_LIN_M1 (1)\r
-#define TSLPRM_USE_4CH_LIN_M2 (1)\r
-#define TSLPRM_USE_4CH_LIN_H (1)\r
-#define TSLPRM_USE_4CH_ROT_M (1)\r
-\r
-#define TSLPRM_USE_5CH_LIN_M1 (1)\r
-#define TSLPRM_USE_5CH_LIN_M2 (1)\r
-#define TSLPRM_USE_5CH_LIN_H (1)\r
-#define TSLPRM_USE_5CH_ROT_M (1)\r
-#define TSLPRM_USE_5CH_ROT_D (1)\r
-\r
-#define TSLPRM_USE_6CH_LIN_M1 (1)\r
-#define TSLPRM_USE_6CH_LIN_M2 (1)\r
-#define TSLPRM_USE_6CH_LIN_H (1)\r
-#define TSLPRM_USE_6CH_ROT_M (1)\r
-\r
-/** @} Common_Parameters_LinRot_used */\r
-\r
-//==============================================================================\r
-// Linear/Rotary sensors position\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Position 08 - Linear/Rotary sensors position\r
- * @{ */\r
-\r
-/** Position resolution in number of bits (range=1..8)\r
- - A Low value will result in a low resolution and will be less subject to noise.\r
- - A High value will result in a high resolution and will be more subject to noise.\r
-*/\r
-#define TSLPRM_LINROT_RESOLUTION (7)\r
-\r
-/** Direction change threshold in position unit (range=0..255)\r
- - Defines the default threshold used during the change direction process.\r
- - A Low value will result in a faster direction change.\r
- - A High value will result in a slower direction change.\r
-*/\r
-#define TSLPRM_LINROT_DIR_CHG_POS (10)\r
-\r
-/** Direction change debounce (range=0..63)\r
- - Defines the default integrator counter used during the change direction process.\r
- - This counter is decremented when the same change in the position is detected and the direction will\r
- change after this counter reaches zero.\r
- - A Low value will result in a faster direction change.\r
- - A High value will result in a slower direction change.\r
-*/\r
-#define TSLPRM_LINROT_DIR_CHG_DEB (1)\r
-\r
-/** @} Common_Parameters_LinRot_Position */\r
-\r
-//==============================================================================\r
-// Debounce counters\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Debounce 09 - Debounce counters\r
- * @{ */\r
-\r
-/** Proximity state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the Proximity detection but with less noise filtering.\r
- - A High value will result in improving the system noise immunity but will increase the system response time.\r
-*/\r
-#define TSLPRM_DEBOUNCE_PROX (3)\r
-\r
-/** Detect state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the detection but with less noise filtering.\r
- - A High value will result in improving the system noise immunity but will increase the system response time.\r
-*/\r
-#define TSLPRM_DEBOUNCE_DETECT (3)\r
-\r
-/** Release state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the end-detection but with less noise filtering.\r
- - A High value will result in a lower sensitivity during the end-detection but with more noise filtering.\r
-*/\r
-#define TSLPRM_DEBOUNCE_RELEASE (3)\r
-\r
-/** Re-calibration state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the recalibration but with less noise filtering.\r
- - A High value will result in a lower sensitivity during the recalibration but with more noise filtering.\r
-*/\r
-#define TSLPRM_DEBOUNCE_CALIB (3)\r
-\r
-/** Error state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity to enter in error state.\r
- - A High value will result in a lower sensitivity to enter in error state.\r
-*/\r
-#define TSLPRM_DEBOUNCE_ERROR (3)\r
-\r
-/** @} Common_Parameters_Debounce */\r
-\r
-//==============================================================================\r
-// Environment Change System (ECS)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_ECS 10 - ECS\r
- * @{ */\r
-\r
-/** Environment Change System Slow K factor (range=0..255)\r
- - The higher value is K, the faster is the response time.\r
-*/\r
-#define TSLPRM_ECS_K_SLOW (5)\r
-\r
-/** Environment Change System Fast K factor (range=0..255)\r
- - The higher value is K, the faster is the response time.\r
-*/\r
-#define TSLPRM_ECS_K_FAST (40)\r
-\r
-/** Environment Change System delay in msec (range=0..5000)\r
- - The ECS will be started after this delay and when all sensors are in Release state.\r
-*/\r
-#define TSLPRM_ECS_DELAY (500)\r
-\r
-/** @} Common_Parameters_ECS */\r
-\r
-//==============================================================================\r
-// Detection Time Out (DTO)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_DTO 11 - DTO\r
- * @{ */\r
-\r
-/** Detection Time Out delay in seconds (range=0..63)\r
- - Value 0: DTO processing not compiled in the code (to gain size if not used).\r
- - Value 1: Default time out infinite.\r
- - Value between 2 and 63: Default time out between value n-1 and n.\r
- - Examples:\r
- - With a DTO equal to 2, the time out is between 1s and 2s.\r
- - With a DTO equal to 63, the time out is between 62s and 63s.\r
-\r
-@note The DTO can be changed in run-time by the application only if the\r
- default value is between 1 and 63.\r
-*/\r
-#define TSLPRM_DTO (5)\r
-\r
-/** @} Common_Parameters_DTO */\r
-\r
-//==============================================================================\r
-// Detection Exclusion System (DXS)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_DXS 12 - DXS\r
- * @{ */\r
-\r
-/** Detection Exclusion System (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_DXS (1)\r
-\r
-/** @} Common_Parameters_DXS */\r
-\r
-//==============================================================================\r
-// Miscellaneous parameters\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Misc 13 - Miscellaneous\r
- * @{ */\r
-\r
-/** Timing tick frequency in Hz (range=125, 250, 500, 1000, 2000)\r
- - Result to a timing interrupt respectively every 8ms, 4ms, 2ms, 1ms, 0.5ms\r
-*/\r
-#define TSLPRM_TICK_FREQ (1000)\r
-\r
-/** @} Common_Parameters_Misc */\r
-\r
-/** @} Common_Parameters */\r
-\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++ MCU PARAMETERS ++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
-// DO NOT MODIFY THE LINES BELOW!!!\r
-#define STM8TL53C4 (0)\r
-#define STM8TL53G4 (1)\r
-#define STM8TL53F4 (2)\r
-#define STM8TL52G4 (3)\r
-#define STM8TL52F4 (4)\r
-\r
-/** @defgroup STM8TL5x_Parameters STM8TL5x Parameters\r
- * @{ */\r
-\r
-//==============================================================================\r
-// Device selection\r
-//==============================================================================\r
-\r
-/** @defgroup STM8TL5x_Parameters_Device_Selection 01 - Device Selection\r
- * @{ */\r
-\r
-/** STM8TL5x device selection (range=0..4)\r
- - Select a MCU in the above list\r
-*/\r
-#define TSLPRM_MCU STM8TL53C4\r
-\r
-/** @} STM8TL5x_Parameters_Device_Selection */\r
-\r
-//==============================================================================\r
-// Reference adjustment\r
-//==============================================================================\r
-\r
-/** @defgroup STM8TL5x_Parameters_Reference_Adjustment 02 - Reference adjustment\r
- * @{ */\r
-\r
-/** Used to calibrate the EPCC to get the Reference closed to this value (range=100..2000)\r
- - The range values are recommended values.\r
- - The higher the Reference, the higher the sensitivity\r
-*/\r
-#define TSLPRM_KEY_TARGET_REFERENCE (500)\r
-\r
-/** Used to calibrate the EPCC (range=1..TSLPRM_KEY_TARGET_REFERENCE)\r
-*/\r
-#define TSLPRM_KEY_TARGET_REFERENCE_ERROR (25)\r
-\r
-/** Number of iteration after the dichotomy to fine tune the EPCC value (range=3..5)\r
-*/\r
-#define TSLPRM_PXS_EPCC_FINE_TUNING_ITERATION (3)\r
-\r
-/** Used to calibrate the CS (range=1,2,4,8)\r
-*/\r
-#define TSLPRM_KEY_TARGET_ATTENUATION (4)\r
-\r
-/** Below (TSLPRM_KEY_TARGET_REFERENCE - TSLPRM_TOUCHKEY_REFERENCE_RANGE) the EPCC is updated for the TKeys (range=1..TSLPRM_KEY_TARGET_REFERENCE)\r
-*/\r
-#define TSLPRM_TOUCHKEY_REFERENCE_RANGE (75)\r
-\r
-/** Below (TSLPRM_KEY_TARGET_REFERENCE - TSLPRM_LINROT_REFERENCE_RANGE) the EPCC is updated for the Linear/Rotary (range=1..TSLPRM_KEY_TARGET_REFERENCE)\r
-*/\r
-#define TSLPRM_LINROT_REFERENCE_RANGE (75)\r
-\r
-/** @} STM8TL5x_Parameters_Reference_Adjustment */\r
-\r
-//==============================================================================\r
-// PXS Clock\r
-//==============================================================================\r
-\r
-/** @defgroup STM8TL5x_Parameters_PXS_Clock 03 - PXS Clock\r
- - These parameters define the acquisition clock settings.\r
- * @{ */\r
-\r
-/** Acquisition frequency (values are 16000, 8000, 4000, 2000, 1000, 500, 250 or 125)\r
-*/\r
-#define TSLPRM_PXS_HSI (16000)\r
-\r
-/** Up phase length (range=1..7)\r
-*/\r
-#define TSLPRM_PXS_UP_LENGTH (1)\r
-\r
-/** Pass phase length (range=1..7)\r
-*/\r
-#define TSLPRM_PXS_PASS_LENGTH (1)\r
-\r
-/** @} STM8TL5x_Parameters_PXS_Clock */\r
-\r
-//==============================================================================\r
-// PXS Synchro\r
-//==============================================================================\r
-\r
-/** @defgroup STM8TL5x_Parameters_PXS_Synchro 04 - PXS Synchro\r
- * @{ */\r
-\r
-/** Acquisition synchronized with SYNCHRO pin (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_PXS_SYNCHRONIZE (1)\r
-\r
-/** Synchronization edge (0=Fall, 1=Rise)\r
-*/\r
-#define TSLPRM_PXS_SYNCHRO_EDGE (1)\r
-\r
-/** @} STM8TL5x_Parameters_PXS_Synchro */\r
-\r
-//==============================================================================\r
-// PXS Miscellaneous\r
-//==============================================================================\r
-\r
-/** @defgroup STM8TL5x_Parameters_PXS_Miscellaneous 05 - PXS Miscellaneous\r
- * @{ */\r
-\r
-/** Low power mode between acquisition (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_PXS_LOW_POWER_MODE (1)\r
-\r
-/** RF detection (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_PXS_RF_DETECTION (1)\r
-\r
-/** Transmitter inactive state (0=Grounded, 1=Floating)\r
-*/\r
-#define TSLPRM_PXS_INACTIVE_TX (1)\r
-\r
-/** Receiver inactive state (0=Grounded, 1=Floating)\r
-*/\r
-#define TSLPRM_PXS_INACTIVE_RX (1)\r
-\r
-/** Charge/Discharge cycle behaviour after VTHR is reached (0=stop, 1=continue)\r
-*/\r
-#define TSLPRM_PXS_RX_COUPLING (1)\r
-\r
-/** Stabilization time (values are LONG_STAB, MEDIUM_STAB, SHORT_STAB)\r
-*/\r
-#define TSLPRM_PXS_STAB LONG_STAB\r
-\r
-/** Bias (values are HIGH_BIAS, MEDIUM_BIAS, LOW_BIAS, VERY_LOW_BIAS)\r
-*/\r
-#define TSLPRM_PXS_BIAS HIGH_BIAS\r
-\r
-/** Index maximum of Rx channels ("N" of RxN)\r
- - This value must not exceed 9 with STM8TL53C4 and 7 with STM8TL53G4\r
-*/\r
-#define TSLPRM_HIGH_CHANNEL_NB (9)\r
-\r
-/** @} STM8TL5x_Parameters_PXS_Miscellaneous */\r
-\r
-/** @} STM8TL5x_Parameters */\r
-\r
-// DO NOT REMOVE !!!\r
-#include "tsl_check_config.h"\r
-\r
-#endif /* __TSL_CONF_STM8TL5X_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_H\r
-#define __TSL_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_acq.h"\r
-#include "tsl_time.h"\r
-#include "tsl_touchkey.h"\r
-#include "tsl_linrot.h"\r
-#include "tsl_object.h"\r
-#include "tsl_dxs.h"\r
-#include "tsl_ecs.h"\r
-#include "tsl_filter.h"\r
-#include "tsl_globals.h"\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-/* Exported variables --------------------------------------------------------*/\r
-/* Exported macros -----------------------------------------------------------*/\r
-\r
-/* Exported functions ------------------------------------------------------- */\r
-TSL_Status_enum_T TSL_Init(CONST TSL_Bank_T *bank);\r
-\r
-#endif /* __TSL_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_acq.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_acq.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_ACQ_H\r
-#define __TSL_ACQ_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-\r
-// Check the device selection.\r
-// It must be defined in the toolchain compiler preprocessor.\r
-// The same name as in the Standard Peripheral Library is used.\r
-#if !defined(STM8TL5X) &&\\r
- !defined(STM32F0XX) &&\\r
- !defined(STM32F30X) &&\\r
- !defined(STM32F37X) &&\\r
- !defined(STM32L1XX_HD) &&\\r
- !defined(STM32L1XX_MD) &&\\r
- !defined(STM32L1XX_MDP)\r
-#error "Device family not declared in the toolchain compiler preprocessor."\r
-#endif\r
-\r
-#if defined(STM8TL5X)\r
-#include "tsl_acq_stm8tl5x.h"\r
-#endif\r
-\r
-#if defined(STM32F0XX)\r
-#include "tsl_acq_stm32f0xx.h"\r
-#endif\r
-\r
-#if defined(STM32F30X) || defined(STM32F37X)\r
-#include "tsl_acq_stm32f3xx.h"\r
-#endif\r
-\r
-#if defined(STM32L1XX_HD)\r
-#if defined(TSLPRM_STM32L1XX_SW_ACQ)\r
-#include "tsl_acq_stm32l1xx_sw.h" // Software acquisition\r
-#else\r
-#include "tsl_acq_stm32l1xx_hw.h" // Hardware acquisition with Timers (default)\r
-#endif\r
-#endif\r
-\r
-#if defined(STM32L1XX_MD)\r
-#include "tsl_acq_stm32l1xx_sw.h" // Software acquisition only\r
-#endif\r
-\r
-#if defined(STM32L1XX_MDP)\r
-#if defined(TSLPRM_STM32L1XX_SW_ACQ)\r
-#include "tsl_acq_stm32l1xx_sw.h" // Software acquisition\r
-#else\r
-#include "tsl_acq_stm32l1xx_hw.h" // Hardware acquisition with Timers (default)\r
-#endif\r
-#endif\r
-\r
-/* Defines -------------------------------------------------------------------*/\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-// Filter functions\r
-typedef TSL_tMeas_T(* TSL_pFuncMeasFilter_T)(TSL_tMeas_T, TSL_tMeas_T); /**< Pointer to the Measure filter function */\r
-typedef TSL_tDelta_T(* TSL_pFuncDeltaFilter_T)(TSL_tDelta_T); /**< Pointer to the Delta filter function */\r
-\r
-/** Structure containing all data of a Zone.\r
- * A Zone is a set of Banks.\r
- * Variables of this structure type can be placed in RAM or ROM.\r
- */\r
-typedef struct\r
-{\r
- // Common to all acquisitions\r
- TSL_tIndex_T *BankIndex; /**< Pointer to an array of bank indexes */\r
- TSL_pFuncDeltaFilter_T *dFilter; /**< Pointer to a Delta filter function */\r
- TSL_tNb_T NbBanks; /**< Number of banks in the zone */\r
-}\r
-TSL_Zone_T;\r
-\r
-/* Exported variables --------------------------------------------------------*/\r
-\r
-/* Exported macros -----------------------------------------------------------*/\r
-\r
-/* Exported functions ------------------------------------------------------- */\r
-TSL_Status_enum_T TSL_acq_ZoneConfig(CONST TSL_Zone_T *zone, TSL_tIndex_T idx_bk);\r
-TSL_Status_enum_T TSL_acq_BankGetResult(TSL_tIndex_T idx_bk, TSL_pFuncMeasFilter_T mfilter, TSL_pFuncDeltaFilter_T dfilter);\r
-TSL_Status_enum_T TSL_acq_BankCalibrate(TSL_tIndex_T bank);\r
-void TSL_acq_BankClearData(TSL_tIndex_T bank);\r
-\r
-#endif /* __TSL_ACQ_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_acq_stm32f0xx.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions prototypes that manage the TSC\r
- * acquisition on STM32F0x products.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_ACQ_STM32F0XX_H\r
-#define __TSL_ACQ_STM32F0XX_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "stm32f0xx.h"\r
-#include "tsl_conf_stm32f0xx.h"\r
-#include "tsl_types.h"\r
-\r
-/* Defines -------------------------------------------------------------------*/\r
-\r
-#ifndef CONST\r
-#define CONST const\r
-#endif\r
-\r
-// SysTick enable/disable interrupt macros\r
-#define enableInterrupts() {SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;}\r
-#define disableInterrupts() {SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;}\r
-\r
-#define TSL_NB_GROUPS (6) // Only 6 groups on STM32F0xx\r
-\r
-#define TSL_GROUP1 (0x01)\r
-#define TSL_GROUP2 (0x02)\r
-#define TSL_GROUP3 (0x04)\r
-#define TSL_GROUP4 (0x08)\r
-#define TSL_GROUP5 (0x10)\r
-#define TSL_GROUP6 (0x20)\r
-\r
-// GxIOy masks\r
-#define TSL_GROUP1_IO1 (0x00000001)\r
-#define TSL_GROUP1_IO2 (0x00000002)\r
-#define TSL_GROUP1_IO3 (0x00000004)\r
-#define TSL_GROUP1_IO4 (0x00000008)\r
-#define TSL_GROUP2_IO1 (0x00000010)\r
-#define TSL_GROUP2_IO2 (0x00000020)\r
-#define TSL_GROUP2_IO3 (0x00000040)\r
-#define TSL_GROUP2_IO4 (0x00000080)\r
-#define TSL_GROUP3_IO1 (0x00000100)\r
-#define TSL_GROUP3_IO2 (0x00000200)\r
-#define TSL_GROUP3_IO3 (0x00000400)\r
-#define TSL_GROUP3_IO4 (0x00000800)\r
-#define TSL_GROUP4_IO1 (0x00001000)\r
-#define TSL_GROUP4_IO2 (0x00002000)\r
-#define TSL_GROUP4_IO3 (0x00004000)\r
-#define TSL_GROUP4_IO4 (0x00008000)\r
-#define TSL_GROUP5_IO1 (0x00010000)\r
-#define TSL_GROUP5_IO2 (0x00020000)\r
-#define TSL_GROUP5_IO3 (0x00040000)\r
-#define TSL_GROUP5_IO4 (0x00080000)\r
-#define TSL_GROUP6_IO1 (0x00100000)\r
-#define TSL_GROUP6_IO2 (0x00200000)\r
-#define TSL_GROUP6_IO3 (0x00400000)\r
-#define TSL_GROUP6_IO4 (0x00800000)\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-// For all devices/acquisitions\r
-\r
-typedef uint16_t TSL_tMeas_T; /**< Measurement */\r
-typedef uint16_t TSL_tRef_T; /**< Reference */\r
-typedef int16_t TSL_tDelta_T; /**< Delta */\r
-\r
-typedef uint8_t TSL_tIndexSrc_T; /**< Channel source index */\r
-typedef uint16_t TSL_tIndexDest_T; /**< Channel destination index */\r
-\r
-typedef uint8_t TSL_tRefRest_T; /**< Reference Rest (ECS) */\r
-typedef uint16_t TSL_tKCoeff_T; /**< K coefficient (ECS) */\r
-\r
-typedef uint8_t TSL_tIndex_T; /**< Generic index */\r
-typedef uint16_t TSL_tNb_T; /**< Generic number */\r
-typedef uint8_t TSL_tCounter_T; /**< Generic counter used for debounce */\r
-\r
-typedef uint8_t TSL_tThreshold_T; /**< Delta threshold */\r
-\r
-typedef int16_t TSL_tsignPosition_T; /**< Linear and Rotary sensors position */\r
-typedef uint8_t TSL_tPosition_T; /**< Linear and Rotary sensors position */\r
-\r
-typedef uint16_t TSL_tTick_ms_T; /**< Time in ms */\r
-typedef uint8_t TSL_tTick_sec_T; /**< Time in sec */\r
-\r
-//------------------------------------------------------------------------------\r
-// Channel\r
-//------------------------------------------------------------------------------\r
-\r
-/** Channel destination index\r
- */\r
-typedef struct\r
-{\r
- TSL_tIndexDest_T IdxDest; /**< Index in the Channel data array */\r
-} TSL_ChannelDest_T;\r
-\r
-/** Channel Source and Configuration\r
- */\r
-typedef struct\r
-{\r
- TSL_tIndexSrc_T IdxSrc; /**< Index of TSC->IOGXCR[] registers */\r
- // For stm32f0x TSC acquisition only\r
- uint32_t msk_IOCCR_channel; /**< Mask of the Channel IO (electrodes ONLY) */\r
- uint32_t msk_IOGCSR_group; /**< Mask of the Group used (electrodes ONLY) */\r
-} TSL_ChannelSrc_T;\r
-\r
-/** Channel flags\r
- */\r
-typedef struct\r
-{\r
- unsigned int DataReady : 1; /**< To identify a new measurement (TSL_DataReady_enum_T) */\r
- unsigned int AcqStatus : 2; /**< Acquisition status (TSL_AcqStatus_enum_T) */\r
- unsigned int ObjStatus : 2; /**< Object status (TSL_ObjStatus_enum_T) */\r
-} TSL_ChannelFlags_T;\r
-\r
-/** Channel Data\r
- */\r
-typedef struct\r
-{\r
- TSL_ChannelFlags_T Flags; /**< Flags */\r
- TSL_tRef_T Ref; /**< Reference */\r
- TSL_tRefRest_T RefRest; /**< Reference rest for ECS */\r
- TSL_tDelta_T Delta; /**< Delta */\r
-#if TSLPRM_USE_MEAS > 0\r
- TSL_tMeas_T Meas; /**< Hold the last acquisition measure */\r
-#endif\r
-} TSL_ChannelData_T;\r
-\r
-//------------------------------------------------------------------------------\r
-// Bank\r
-//------------------------------------------------------------------------------\r
-\r
-/** Bank\r
- */\r
-typedef struct\r
-{\r
- // Common to all acquisitions\r
- CONST TSL_ChannelSrc_T *p_chSrc; /**< Pointer to the Channel Source and Configuration */\r
- CONST TSL_ChannelDest_T *p_chDest; /**< Pointer to the Channel Destination */\r
- TSL_ChannelData_T *p_chData; /**< Pointer to the Channel Data */\r
- TSL_tNb_T NbChannels; /**< Number of channels in the bank */\r
- // For STM32F0x TSC acquisition only\r
- uint32_t msk_IOCCR_channels; /**< Mask of all channel IOs (electrodes AND shields) */\r
- uint32_t msk_IOGCSR_groups; /**< Mask of all groups used (electrodes ONLY) */\r
-} TSL_Bank_T;\r
-\r
-/* Exported variables --------------------------------------------------------*/\r
-/* Exported macros -----------------------------------------------------------*/\r
-/* Exported functions ------------------------------------------------------- */\r
-\r
-TSL_Status_enum_T TSL_acq_Init(void);\r
-void TSL_acq_InitGPIOs(void);\r
-TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk);\r
-TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh);\r
-TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh);\r
-TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas);\r
-void TSL_acq_BankStartAcq(void);\r
-TSL_Status_enum_T TSL_acq_BankWaitEOC(void);\r
-TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void);\r
-TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndexSrc_T index);\r
-TSL_tDelta_T TSL_acq_ComputeDelta(TSL_tRef_T ref, TSL_tMeas_T meas);\r
-TSL_tMeas_T TSL_acq_ComputeMeas(TSL_tRef_T ref, TSL_tDelta_T delta);\r
-\r
-#endif /* __TSL_ACQ_STM32F0XX_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_acq_stm32f3xx.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions prototypes that manage the TSC\r
- * acquisition on STM32F3xx products.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_ACQ_STM32F3XX_H\r
-#define __TSL_ACQ_STM32F3XX_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#if defined(STM32F30X)\r
-#include "stm32f30x.h"\r
-#endif\r
-#if defined(STM32F37X)\r
-#include "stm32f37x.h"\r
-#endif\r
-#include "tsl_conf_stm32f3xx.h"\r
-#include "tsl_types.h"\r
-\r
-/* Defines -------------------------------------------------------------------*/\r
-\r
-#ifndef CONST\r
-#define CONST const\r
-#endif\r
-\r
-// SysTick enable/disable interrupt macros\r
-#define enableInterrupts() {SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;}\r
-#define disableInterrupts() {SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;}\r
-\r
-#define TSL_NB_GROUPS (8) // Number of groups available on STM32F3xx devices\r
-\r
-#define TSL_GROUP1 (0x01)\r
-#define TSL_GROUP2 (0x02)\r
-#define TSL_GROUP3 (0x04)\r
-#define TSL_GROUP4 (0x08)\r
-#define TSL_GROUP5 (0x10)\r
-#define TSL_GROUP6 (0x20)\r
-#define TSL_GROUP7 (0x40)\r
-#define TSL_GROUP8 (0x80)\r
-\r
-// GxIOy masks\r
-#define TSL_GROUP1_IO1 (0x00000001)\r
-#define TSL_GROUP1_IO2 (0x00000002)\r
-#define TSL_GROUP1_IO3 (0x00000004)\r
-#define TSL_GROUP1_IO4 (0x00000008)\r
-#define TSL_GROUP2_IO1 (0x00000010)\r
-#define TSL_GROUP2_IO2 (0x00000020)\r
-#define TSL_GROUP2_IO3 (0x00000040)\r
-#define TSL_GROUP2_IO4 (0x00000080)\r
-#define TSL_GROUP3_IO1 (0x00000100)\r
-#define TSL_GROUP3_IO2 (0x00000200)\r
-#define TSL_GROUP3_IO3 (0x00000400)\r
-#define TSL_GROUP3_IO4 (0x00000800)\r
-#define TSL_GROUP4_IO1 (0x00001000)\r
-#define TSL_GROUP4_IO2 (0x00002000)\r
-#define TSL_GROUP4_IO3 (0x00004000)\r
-#define TSL_GROUP4_IO4 (0x00008000)\r
-#define TSL_GROUP5_IO1 (0x00010000)\r
-#define TSL_GROUP5_IO2 (0x00020000)\r
-#define TSL_GROUP5_IO3 (0x00040000)\r
-#define TSL_GROUP5_IO4 (0x00080000)\r
-#define TSL_GROUP6_IO1 (0x00100000)\r
-#define TSL_GROUP6_IO2 (0x00200000)\r
-#define TSL_GROUP6_IO3 (0x00400000)\r
-#define TSL_GROUP6_IO4 (0x00800000)\r
-#define TSL_GROUP7_IO1 (0x01000000)\r
-#define TSL_GROUP7_IO2 (0x02000000)\r
-#define TSL_GROUP7_IO3 (0x04000000)\r
-#define TSL_GROUP7_IO4 (0x08000000)\r
-#define TSL_GROUP8_IO1 (0x10000000)\r
-#define TSL_GROUP8_IO2 (0x20000000)\r
-#define TSL_GROUP8_IO3 (0x40000000)\r
-#define TSL_GROUP8_IO4 (0x80000000)\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-// For all devices/acquisitions\r
-\r
-typedef uint16_t TSL_tMeas_T; /**< Measurement */\r
-typedef uint16_t TSL_tRef_T; /**< Reference */\r
-typedef int16_t TSL_tDelta_T; /**< Delta */\r
-\r
-typedef uint8_t TSL_tIndexSrc_T; /**< Channel source index */\r
-typedef uint16_t TSL_tIndexDest_T; /**< Channel destination index */\r
-\r
-typedef uint8_t TSL_tRefRest_T; /**< Reference Rest (ECS) */\r
-typedef uint16_t TSL_tKCoeff_T; /**< K coefficient (ECS) */\r
-\r
-typedef uint8_t TSL_tIndex_T; /**< Generic index */\r
-typedef uint16_t TSL_tNb_T; /**< Generic number */\r
-typedef uint8_t TSL_tCounter_T; /**< Generic counter used for debounce */\r
-\r
-typedef uint8_t TSL_tThreshold_T; /**< Delta threshold */\r
-\r
-typedef int16_t TSL_tsignPosition_T; /**< Linear and Rotary sensors position */\r
-typedef uint8_t TSL_tPosition_T; /**< Linear and Rotary sensors position */\r
-\r
-typedef uint16_t TSL_tTick_ms_T; /**< Time in ms */\r
-typedef uint8_t TSL_tTick_sec_T; /**< Time in sec */\r
-\r
-//------------------------------------------------------------------------------\r
-// Channel\r
-//------------------------------------------------------------------------------\r
-\r
-/** Channel destination index\r
- */\r
-typedef struct\r
-{\r
- TSL_tIndexDest_T IdxDest; /**< Index in the Channel data array */\r
-} TSL_ChannelDest_T;\r
-\r
-/** Channel Source and Configuration\r
- */\r
-typedef struct\r
-{\r
- TSL_tIndexSrc_T IdxSrc; /**< Index of TSC->IOGXCR[] registers */\r
- // For STM32F3xx TSC acquisition only\r
- uint32_t msk_IOCCR_channel; /**< Mask of the Channel IO (electrodes ONLY) */\r
- uint32_t msk_IOGCSR_group; /**< Mask of the Group used (electrodes ONLY) */\r
-} TSL_ChannelSrc_T;\r
-\r
-/** Channel flags\r
- */\r
-typedef struct\r
-{\r
- unsigned int DataReady : 1; /**< To identify a new measurement (TSL_DataReady_enum_T) */\r
- unsigned int AcqStatus : 2; /**< Acquisition status (TSL_AcqStatus_enum_T) */\r
- unsigned int ObjStatus : 2; /**< Object status (TSL_ObjStatus_enum_T) */\r
-} TSL_ChannelFlags_T;\r
-\r
-/** Channel Data\r
- */\r
-typedef struct\r
-{\r
- TSL_ChannelFlags_T Flags; /**< Flags */\r
- TSL_tRef_T Ref; /**< Reference */\r
- TSL_tRefRest_T RefRest; /**< Reference rest for ECS */\r
- TSL_tDelta_T Delta; /**< Delta */\r
-#if TSLPRM_USE_MEAS > 0\r
- TSL_tMeas_T Meas; /**< Hold the last acquisition measure */\r
-#endif\r
-} TSL_ChannelData_T;\r
-\r
-//------------------------------------------------------------------------------\r
-// Bank\r
-//------------------------------------------------------------------------------\r
-\r
-/** Bank\r
- */\r
-typedef struct\r
-{\r
- // Common to all acquisitions\r
- CONST TSL_ChannelSrc_T *p_chSrc; /**< Pointer to the Channel Source and Configuration */\r
- CONST TSL_ChannelDest_T *p_chDest; /**< Pointer to the Channel Destination */\r
- TSL_ChannelData_T *p_chData; /**< Pointer to the Channel Data */\r
- TSL_tNb_T NbChannels; /**< Number of channels in the bank */\r
- // For STM32F3xx TSC acquisition only\r
- uint32_t msk_IOCCR_channels; /**< Mask of all channel IOs (electrodes AND shields) */\r
- uint32_t msk_IOGCSR_groups; /**< Mask of all groups used (electrodes ONLY) */\r
-} TSL_Bank_T;\r
-\r
-/* Exported variables --------------------------------------------------------*/\r
-/* Exported macros -----------------------------------------------------------*/\r
-/* Exported functions ------------------------------------------------------- */\r
-\r
-TSL_Status_enum_T TSL_acq_Init(void);\r
-void TSL_acq_InitGPIOs(void);\r
-TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk);\r
-TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh);\r
-TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh);\r
-TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas);\r
-void TSL_acq_BankStartAcq(void);\r
-TSL_Status_enum_T TSL_acq_BankWaitEOC(void);\r
-TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void);\r
-TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndexSrc_T index);\r
-TSL_tDelta_T TSL_acq_ComputeDelta(TSL_tRef_T ref, TSL_tMeas_T meas);\r
-TSL_tMeas_T TSL_acq_ComputeMeas(TSL_tRef_T ref, TSL_tDelta_T delta);\r
-\r
-#endif /* __TSL_ACQ_STM32F3XX_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_acq_stm32l1xx_hw.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_acq_stm32l1xx_hw.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_ACQ_STM32L1XX_HW_H\r
-#define __TSL_ACQ_STM32L1XX_HW_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "stm32l1xx.h"\r
-#include "tsl_conf_stm32l1xx.h"\r
-#include "tsl_types.h"\r
-\r
-/* Defines -------------------------------------------------------------------*/\r
-\r
-#ifndef CONST\r
-#define CONST const\r
-#endif\r
-\r
-// SysTick enable/disable interrupt macros\r
-#define enableInterrupts() {SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;}\r
-#define disableInterrupts() {SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;}\r
-\r
-/** Groups list\r
- */\r
-enum\r
-{\r
- GR1,\r
- GR2,\r
- GR3,\r
- GR4,\r
- GR5,\r
- GR6,\r
- GR7,\r
- GR8,\r
- GR9,\r
- GR10,\r
- GR11\r
-};\r
-\r
-/** GPIOs list\r
- High significant nibble for the IO port (GPIOA:0,...,GPIOG:6)\r
- Low significant nibble for the IO number (pin0:0,...,pin15:F)\r
- */\r
-enum\r
-{\r
- PA0 = 0x00, /**< TSL_GROUP1_IO1 */\r
- PA1 = 0x01,\r
- PA2 = 0x02,\r
- PA3 = 0x03,\r
- PA6 = 0x06, /**< TSL_GROUP2_IO1 */\r
- PA7 = 0x07,\r
- PA8 = 0x08,\r
- PA9 = 0x09,\r
- PA10 = 0x0A,\r
- PA13 = 0x0D, /**< TSL_GROUP5_IO1 */\r
- PA14 = 0x0E,\r
- PA15 = 0x0F,\r
- PB0 = 0x10, /**< TSL_GROUP3_IO1 */\r
- PB1 = 0x11,\r
- PB2 = 0x12,\r
- PB4 = 0x14, /**< TSL_GROUP6_IO1 */\r
- PB5 = 0x15,\r
- PB6 = 0x16,\r
- PB7 = 0x17,\r
- PB12 = 0x1C, /**< TSL_GROUP7_IO1 */\r
- PB13 = 0x1D,\r
- PB14 = 0x1E,\r
- PB15 = 0x1F,\r
- PC0 = 0x20, /**< TSL_GROUP8_IO1 */\r
- PC1 = 0x21,\r
- PC2 = 0x22,\r
- PC3 = 0x23,\r
- PC4 = 0x24,\r
- PC5 = 0x25,\r
- PC6 = 0x26,\r
- PC7 = 0x27,\r
- PC8 = 0x28,\r
- PC9 = 0x29,\r
- PF6 = 0x56, /**< TSL_GROUP11_IO1 */\r
- PF7 = 0x57,\r
- PF8 = 0x58,\r
- PF9 = 0x59,\r
- PF10 = 0x5A,\r
- PF11 = 0x5B,\r
- PF12 = 0x5C,\r
- PF13 = 0x5D,\r
- PF14 = 0x5E,\r
- PF15 = 0x5F,\r
- PG0 = 0x60, /**< TSL_GROUP2_IO4 */\r
- PG1 = 0x61,\r
- PG2 = 0x62,\r
- PG3 = 0x63,\r
- PG4 = 0x64\r
-};\r
-\r
-/** GPIOs list:\r
- High significant nibble for the IO port (GPIOA:0,...,GPIOG:6)\r
- Low significant nibble for the IO number (pin0:0,...,pin15:F)\r
- */\r
-enum\r
-{\r
- TSL_GROUP1_IO1 = 0x00, /**< PA0 */\r
- TSL_GROUP1_IO2 = 0x01,\r
- TSL_GROUP1_IO3 = 0x02,\r
- TSL_GROUP1_IO4 = 0x03,\r
- TSL_GROUP2_IO1 = 0x06, /**< PA6 */\r
- TSL_GROUP2_IO2 = 0x07,\r
- TSL_GROUP4_IO1 = 0x08,\r
- TSL_GROUP4_IO2 = 0x09,\r
- TSL_GROUP4_IO3 = 0x0A,\r
- TSL_GROUP5_IO1 = 0x0D, /**< PA13 */\r
- TSL_GROUP5_IO2 = 0x0E,\r
- TSL_GROUP5_IO3 = 0x0F,\r
- TSL_GROUP3_IO1 = 0x10, /**< PB0 */\r
- TSL_GROUP3_IO2 = 0x11,\r
- TSL_GROUP3_IO3 = 0x12,\r
- TSL_GROUP6_IO1 = 0x14, /**< PB4 */\r
- TSL_GROUP6_IO2 = 0x15,\r
- TSL_GROUP6_IO3 = 0x16,\r
- TSL_GROUP6_IO4 = 0x17,\r
- TSL_GROUP7_IO1 = 0x1C, /**< PB12 */\r
- TSL_GROUP7_IO2 = 0x1D,\r
- TSL_GROUP7_IO3 = 0x1E,\r
- TSL_GROUP7_IO4 = 0x1F,\r
- TSL_GROUP8_IO1 = 0x20, /**< PC0 */\r
- TSL_GROUP8_IO2 = 0x21,\r
- TSL_GROUP8_IO3 = 0x22,\r
- TSL_GROUP8_IO4 = 0x23,\r
- TSL_GROUP9_IO1 = 0x24,\r
- TSL_GROUP9_IO2 = 0x25,\r
- TSL_GROUP10_IO1 = 0x26,\r
- TSL_GROUP10_IO2 = 0x27,\r
- TSL_GROUP10_IO3 = 0x28,\r
- TSL_GROUP10_IO4 = 0x29,\r
- TSL_GROUP11_IO1 = 0x56, /**< PF6 */\r
- TSL_GROUP11_IO2 = 0x57,\r
- TSL_GROUP11_IO3 = 0x58,\r
- TSL_GROUP11_IO4 = 0x59,\r
- TSL_GROUP11_IO5 = 0x5A,\r
- TSL_GROUP3_IO4 = 0x5B,\r
- TSL_GROUP3_IO5 = 0x5C,\r
- TSL_GROUP9_IO3 = 0x5D,\r
- TSL_GROUP9_IO4 = 0x5E,\r
- TSL_GROUP2_IO3 = 0x5F,\r
- TSL_GROUP2_IO4 = 0x60, /**< PG0 */\r
- TSL_GROUP2_IO5 = 0x61,\r
- TSL_GROUP7_IO5 = 0x62,\r
- TSL_GROUP7_IO6 = 0x63,\r
- TSL_GROUP7_IO7 = 0x64\r
-};\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-typedef struct\r
-{\r
- // RI\r
- __IO uint32_t ICR;\r
- __IO uint32_t ASCR1;\r
- __IO uint32_t ASCR2;\r
- __IO uint32_t HYSCR1;\r
- __IO uint32_t HYSCR2;\r
- __IO uint32_t HYSCR3;\r
- __IO uint32_t HYSCR4;\r
- // CP\r
- __IO uint32_t ASMR1;\r
- __IO uint32_t CMR1;\r
- __IO uint32_t CICR1;\r
- __IO uint32_t ASMR2;\r
- __IO uint32_t CMR2;\r
- __IO uint32_t CICR2;\r
- __IO uint32_t ASMR3;\r
- __IO uint32_t CMR3;\r
- __IO uint32_t CICR3;\r
- __IO uint32_t ASMR4;\r
- __IO uint32_t CMR4;\r
- __IO uint32_t CICR4;\r
- __IO uint32_t ASMR5;\r
- __IO uint32_t CMR5;\r
- __IO uint32_t CICR5;\r
-} CPRI_TypeDef;\r
-\r
-// For all devices/acquisitions\r
-\r
-typedef uint16_t TSL_tMeas_T; /**< Measurement */\r
-typedef uint16_t TSL_tRef_T; /**< Reference */\r
-typedef int16_t TSL_tDelta_T; /**< Delta */\r
-\r
-typedef uint8_t TSL_tIndexSrc_T; /**< Channel source index */\r
-typedef uint16_t TSL_tIndexDest_T; /**< Channel destination index */\r
-\r
-typedef uint8_t TSL_tRefRest_T; /**< Reference Rest (ECS) */\r
-typedef uint16_t TSL_tKCoeff_T; /**< K coefficient (ECS) */\r
-\r
-typedef uint8_t TSL_tIndex_T; /**< Generic index */\r
-typedef uint16_t TSL_tNb_T; /**< Generic number */\r
-typedef uint8_t TSL_tCounter_T; /**< Generic counter used for debounce */\r
-\r
-typedef uint8_t TSL_tThreshold_T; /**< Delta threshold */\r
-\r
-typedef int16_t TSL_tsignPosition_T; /**< Linear and Rotary sensors position */\r
-typedef uint8_t TSL_tPosition_T; /**< Linear and Rotary sensors position */\r
-\r
-typedef uint16_t TSL_tTick_ms_T; /**< Time in ms */\r
-typedef uint8_t TSL_tTick_sec_T; /**< Time in sec */\r
-\r
-//------------------------------------------------------------------------------\r
-// Channel\r
-//------------------------------------------------------------------------------\r
-\r
-typedef uint8_t TSL_Conf_t;\r
-\r
-/** Channel destination index\r
- */\r
-typedef struct\r
-{\r
- TSL_tIndex_T IdxDest; /**< Index in the Channel data array */\r
-} TSL_ChannelDest_T;\r
-\r
-/** Channel Source and Configuration\r
- */\r
-typedef struct\r
-{\r
- TSL_tIndex_T IdxSrc; /**< Index of source value */\r
- // For stm32l1x acquisition only\r
- TSL_Conf_t t_sample; /**< Indicates which GPIO.n is used for the sample */\r
- TSL_Conf_t t_channel; /**< Indicates which GPIO.n is used for the channel */\r
-} TSL_ChannelSrc_T;\r
-\r
-/** Channel flags\r
- */\r
-typedef struct\r
-{\r
- unsigned int DataReady : 1; /**< To identify a new measurement (TSL_DataReady_enum_T) */\r
- unsigned int AcqStatus : 2; /**< Acquisition status (TSL_AcqStatus_enum_T) */\r
- unsigned int ObjStatus : 2; /**< Object status (TSL_ObjStatus_enum_T) */\r
-} TSL_ChannelFlags_T;\r
-\r
-/** Channel Data\r
- */\r
-typedef struct\r
-{\r
- TSL_ChannelFlags_T Flags; /**< Flags */\r
- TSL_tRef_T Ref; /**< Reference */\r
- TSL_tRefRest_T RefRest; /**< Reference rest for ECS */\r
- TSL_tDelta_T Delta; /**< Delta */\r
-#if TSLPRM_USE_MEAS > 0\r
- TSL_tMeas_T Meas; /**< Hold the last acquisition measure */\r
-#endif\r
-} TSL_ChannelData_T;\r
-\r
-//------------------------------------------------------------------------------\r
-// Bank\r
-//------------------------------------------------------------------------------\r
-\r
-/** Bank\r
- */\r
-typedef struct\r
-{\r
- // Common to all acquisitions\r
- CONST TSL_ChannelSrc_T *p_chSrc; /**< Pointer to the Channel Source and Configuration */\r
- CONST TSL_ChannelDest_T *p_chDest; /**< Pointer to the Channel Destination */\r
- TSL_ChannelData_T *p_chData; /**< Pointer to the Channel Data */\r
- TSL_tNb_T NbChannels; /**< Number of channels in the bank */\r
- // For stm32l1x acquisition only\r
- TSL_Conf_t shield_sample; /**< Indicates which GPIO.n is used for the shield sample */\r
- TSL_Conf_t shield_channel; /**< Indicates which GPIO.n is used for the shield channel */\r
-} TSL_Bank_T;\r
-\r
-/* Exported variables --------------------------------------------------------*/\r
-\r
-/* Exported macros -----------------------------------------------------------*/\r
-\r
-#define CPRI_BASE (APB1PERIPH_BASE + 0x7C04)\r
-#define CPRI ((CPRI_TypeDef *) CPRI_BASE)\r
-\r
-/* Exported functions ------------------------------------------------------- */\r
-\r
-TSL_Status_enum_T TSL_acq_Init(void);\r
-TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk);\r
-void TSL_acq_BankStartAcq(void);\r
-TSL_Status_enum_T TSL_acq_BankWaitEOC(void);\r
-void TSL_acq_ProcessIT(void);\r
-TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndex_T index);\r
-TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void);\r
-TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh);\r
-TSL_tDelta_T TSL_acq_ComputeDelta(TSL_tRef_T ref, TSL_tMeas_T meas);\r
-TSL_tMeas_T TSL_acq_ComputeMeas(TSL_tRef_T ref, TSL_tDelta_T delta);\r
-TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh);\r
-TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas);\r
-\r
-#endif // __TSL_ACQ_STM32L1XX_HW_H\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_acq_stm32l1xx_sw.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_acq_stm32l1xx_sw.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_ACQ_STM32L1XX_SW_H\r
-#define __TSL_ACQ_STM32L1XX_SW_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "stm32l1xx.h"\r
-#include "tsl_conf_stm32l1xx.h"\r
-#include "tsl_types.h"\r
-\r
-/* Defines -------------------------------------------------------------------*/\r
-\r
-#ifndef CONST\r
-#define CONST const\r
-#endif\r
-\r
-// SysTick enable/disable interrupt macros\r
-#define enableInterrupts() {SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;}\r
-#define disableInterrupts() {SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;}\r
-\r
-enum\r
-{\r
- GR1,\r
- GR2,\r
- GR3,\r
- GR4,\r
- GR5,\r
- GR6,\r
- GR7,\r
- GR8,\r
- GR9,\r
- GR10,\r
- GR11\r
-};\r
-\r
-enum\r
-{\r
- TSL_BANK_GPIOA = 0,\r
- TSL_BANK_GPIOB,\r
- TSL_BANK_GPIOC,\r
- TSL_BANK_GPIOE,\r
- TSL_BANK_GPIOF,\r
- TSL_BANK_GPIOG\r
-};\r
-\r
-/** GPIOs list\r
- High significant nibble for the IO port (GPIOA:0,...,GPIOG:6)\r
- Low significant nibble for the IO number (pin0:0,...,pin15:F)\r
- */\r
-enum\r
-{\r
- PA0 = 0x00, /**< TSL_GROUP1_IO1 */\r
- PA1 = 0x01,\r
- PA2 = 0x02,\r
- PA3 = 0x03,\r
- PA6 = 0x06, /**< TSL_GROUP2_IO1 */\r
- PA7 = 0x07,\r
- PA8 = 0x08,\r
- PA9 = 0x09,\r
- PA10 = 0x0A,\r
- PA13 = 0x0D, /**< TSL_GROUP5_IO1 */\r
- PA14 = 0x0E,\r
- PA15 = 0x0F,\r
- PB0 = 0x10, /**< TSL_GROUP3_IO1 */\r
- PB1 = 0x11,\r
- PB2 = 0x12,\r
- PB4 = 0x14, /**< TSL_GROUP6_IO1 */\r
- PB5 = 0x15,\r
- PB6 = 0x16,\r
- PB7 = 0x17,\r
- PB12 = 0x1C, /**< TSL_GROUP7_IO1 */\r
- PB13 = 0x1D,\r
- PB14 = 0x1E,\r
- PB15 = 0x1F,\r
- PC0 = 0x20, /**< TSL_GROUP8_IO1 */\r
- PC1 = 0x21,\r
- PC2 = 0x22,\r
- PC3 = 0x23,\r
- PC4 = 0x24,\r
- PC5 = 0x25,\r
- PC6 = 0x26,\r
- PC7 = 0x27,\r
- PC8 = 0x28,\r
- PC9 = 0x29,\r
- PF6 = 0x56, /**< TSL_GROUP11_IO1 */\r
- PF7 = 0x57,\r
- PF8 = 0x58,\r
- PF9 = 0x59,\r
- PF10 = 0x5A,\r
- PF11 = 0x5B,\r
- PF12 = 0x5C,\r
- PF13 = 0x5D,\r
- PF14 = 0x5E,\r
- PF15 = 0x5F,\r
- PG0 = 0x60, /**< TSL_GROUP2_IO4 */\r
- PG1 = 0x61,\r
- PG2 = 0x62,\r
- PG3 = 0x63,\r
- PG4 = 0x64\r
-};\r
-\r
-/** GPIOs list:\r
- - High significant nibble for the IO port (GPIOA:0,...,GPIOG:6)\r
- - Low significant nibble for the IO number (pin0:0,...,pin15:F)\r
- */\r
-enum\r
-{\r
- TSL_GROUP1_IO1 = 0x00, /**< PA0 */\r
- TSL_GROUP1_IO2 = 0x01,\r
- TSL_GROUP1_IO3 = 0x02,\r
- TSL_GROUP1_IO4 = 0x03,\r
- TSL_GROUP2_IO1 = 0x06, /**< PA6 */\r
- TSL_GROUP2_IO2 = 0x07,\r
- TSL_GROUP4_IO1 = 0x08,\r
- TSL_GROUP4_IO2 = 0x09,\r
- TSL_GROUP4_IO3 = 0x0A,\r
- TSL_GROUP5_IO1 = 0x0D, /**< PA13 */\r
- TSL_GROUP5_IO2 = 0x0E,\r
- TSL_GROUP5_IO3 = 0x0F,\r
- TSL_GROUP3_IO1 = 0x10, /**< PB0 */\r
- TSL_GROUP3_IO2 = 0x11,\r
- TSL_GROUP3_IO3 = 0x12,\r
- TSL_GROUP6_IO1 = 0x14, /**< PB4 */\r
- TSL_GROUP6_IO2 = 0x15,\r
- TSL_GROUP6_IO3 = 0x16,\r
- TSL_GROUP6_IO4 = 0x17,\r
- TSL_GROUP7_IO1 = 0x1C, /**< PB12 */\r
- TSL_GROUP7_IO2 = 0x1D,\r
- TSL_GROUP7_IO3 = 0x1E,\r
- TSL_GROUP7_IO4 = 0x1F,\r
- TSL_GROUP8_IO1 = 0x20, /**< PC0 */\r
- TSL_GROUP8_IO2 = 0x21,\r
- TSL_GROUP8_IO3 = 0x22,\r
- TSL_GROUP8_IO4 = 0x23,\r
- TSL_GROUP9_IO1 = 0x24,\r
- TSL_GROUP9_IO2 = 0x25,\r
- TSL_GROUP10_IO1 = 0x26,\r
- TSL_GROUP10_IO2 = 0x27,\r
- TSL_GROUP10_IO3 = 0x28,\r
- TSL_GROUP10_IO4 = 0x29,\r
- TSL_GROUP11_IO1 = 0x56, /**< PF6 */\r
- TSL_GROUP11_IO2 = 0x57,\r
- TSL_GROUP11_IO3 = 0x58,\r
- TSL_GROUP11_IO4 = 0x59,\r
- TSL_GROUP11_IO5 = 0x5A,\r
- TSL_GROUP3_IO4 = 0x5B,\r
- TSL_GROUP3_IO5 = 0x5C,\r
- TSL_GROUP9_IO3 = 0x5D,\r
- TSL_GROUP9_IO4 = 0x5E,\r
- TSL_GROUP2_IO3 = 0x5F,\r
- TSL_GROUP2_IO4 = 0x60, /**< PG0 */\r
- TSL_GROUP2_IO5 = 0x61,\r
- TSL_GROUP7_IO5 = 0x62,\r
- TSL_GROUP7_IO6 = 0x63,\r
- TSL_GROUP7_IO7 = 0x64\r
-};\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-// For all devices/acquisitions\r
-\r
-typedef uint16_t TSL_tMeas_T; /**< Measurement */\r
-typedef uint16_t TSL_tRef_T; /**< Reference */\r
-typedef int16_t TSL_tDelta_T; /**< Delta */\r
-\r
-typedef uint8_t TSL_tIndexSrc_T; /**< Channel source index */\r
-typedef uint16_t TSL_tIndexDest_T; /**< Channel destination index */\r
-\r
-typedef uint8_t TSL_tRefRest_T; /**< Reference Rest (ECS) */\r
-typedef uint16_t TSL_tKCoeff_T; /**< K coefficient (ECS) */\r
-\r
-typedef uint8_t TSL_tIndex_T; /**< Generic index */\r
-typedef uint16_t TSL_tNb_T; /**< Generic number */\r
-typedef uint8_t TSL_tCounter_T; /**< Generic counter used for debounce */\r
-\r
-typedef uint8_t TSL_tThreshold_T; /**< Delta threshold */\r
-\r
-typedef int16_t TSL_tsignPosition_T; /**< Linear and Rotary sensors position */\r
-typedef uint8_t TSL_tPosition_T; /**< Linear and Rotary sensors position */\r
-\r
-typedef uint16_t TSL_tTick_ms_T; /**< Time in ms */\r
-typedef uint8_t TSL_tTick_sec_T; /**< Time in sec */\r
-\r
-//------------------------------------------------------------------------------\r
-// Channel\r
-//------------------------------------------------------------------------------\r
-\r
-typedef uint8_t TSL_Conf_t;\r
-\r
-/** Channel destination index\r
- */\r
-typedef struct\r
-{\r
- TSL_tIndex_T IdxDest; /**< Index in the Channel data array */\r
-} TSL_ChannelDest_T;\r
-\r
-/** Channel Source and Configuration\r
- */\r
-typedef struct\r
-{\r
- TSL_tIndex_T IdxSrc; /**< Index of source value */\r
- // For stm32l1x acquisition only\r
- TSL_Conf_t t_sample; /**< Indicates which GPIO.n is used for the sample */\r
- TSL_Conf_t t_channel; /**< Indicates which GPIO.n is used for the channel */\r
-} TSL_ChannelSrc_T;\r
-\r
-/** Channel flags\r
- */\r
-typedef struct\r
-{\r
- unsigned int DataReady : 1; /**< To identify a new measurement (TSL_DataReady_enum_T) */\r
- unsigned int AcqStatus : 2; /**< Acquisition status (TSL_AcqStatus_enum_T) */\r
- unsigned int ObjStatus : 2; /**< Object status (TSL_ObjStatus_enum_T) */\r
-} TSL_ChannelFlags_T;\r
-\r
-/** Channel Data\r
- */\r
-typedef struct\r
-{\r
- TSL_ChannelFlags_T Flags; /**< Flags */\r
- TSL_tRef_T Ref; /**< Reference */\r
- TSL_tRefRest_T RefRest; /**< Reference rest for ECS */\r
- TSL_tDelta_T Delta; /**< Delta */\r
-#if TSLPRM_USE_MEAS > 0\r
- TSL_tMeas_T Meas; /**< Hold the last acquisition measure */\r
-#endif\r
-} TSL_ChannelData_T;\r
-\r
-//------------------------------------------------------------------------------\r
-// Bank\r
-//------------------------------------------------------------------------------\r
-\r
-/** Bank\r
- */\r
-typedef struct\r
-{\r
- // Common to all acquisitions\r
- CONST TSL_ChannelSrc_T *p_chSrc; /**< Pointer to the Channel Source and Configuration */\r
- CONST TSL_ChannelDest_T *p_chDest; /**< Pointer to the Channel Destination */\r
- TSL_ChannelData_T *p_chData; /**< Pointer to the Channel Data */\r
- TSL_tNb_T NbChannels; /**< Number of channels in the bank */\r
- // For stm32l1x acquisition only\r
- TSL_Conf_t shield_sample; /**< Indicates which GPIO.n is used for the shield sample */\r
- TSL_Conf_t shield_channel; /**< Indicates which GPIO.n is used for the shield channel */\r
-} TSL_Bank_T;\r
-\r
-/* Exported variables --------------------------------------------------------*/\r
-\r
-/* Exported macros -----------------------------------------------------------*/\r
-/* Exported functions ------------------------------------------------------- */\r
-TSL_Status_enum_T TSL_acq_Init(void);\r
-TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk);\r
-void TSL_acq_BankStartAcq(void);\r
-TSL_Status_enum_T TSL_acq_BankWaitEOC(void);\r
-void TSL_acq_ProcessIT(void);\r
-TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndex_T index);\r
-TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void);\r
-\r
-TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh);\r
-TSL_tDelta_T TSL_acq_ComputeDelta(TSL_tRef_T ref, TSL_tMeas_T meas);\r
-TSL_tMeas_T TSL_acq_ComputeMeas(TSL_tRef_T ref, TSL_tDelta_T delta);\r
-TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh);\r
-TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas);\r
-\r
-#endif /* __TSL_ACQ_STM32L1XX_SW_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_acq_stm8tl5x.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions prototypes that manage the TSC\r
- * acquisition on STM8TL5x products.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_ACQ_STM8TL5X_H\r
-#define __TSL_ACQ_STM8TL5X_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "stm8tl5x.h"\r
-#include "tsl_conf_stm8tl5x.h"\r
-#include "tsl_types.h"\r
-\r
-/*==============================================================================\r
-\r
- *** RECEIVERS AND TRANSMITTERS DESCRIPTION ***\r
-\r
- ProxSense receiver and transmitter description for STM8TL5x\r
- For more details please refer to the Proxsense\r
- section in the reference manual\r
-\r
-\r
- Txi\r
- Group Ai Rx0a __/____ |\r
- Rx1a __/____ |\r
- Rx2a __/____ |\r
- Rx3a __/____ |\r
- Rx4a __/____ |\r
- Rx5a __/____ |\r
- Rx6a __/____ |\r
- Rx7a __/____ |\r
- Rx8a __/____ |\r
- Rx9a __/____ |\r
-\r
- Group Bi Rx0b __/____ |\r
- Rx1b __/____ |\r
- Rx2b __/____ |\r
- Rx3b __/____ |\r
- Rx4b __/____ |\r
- Rx5b __/____ |\r
- Rx6b __/____ |\r
- Rx7b __/____ |\r
- Rx8b __/____ |\r
- Rx9b __/____ |\r
-\r
-==============================================================================*/\r
-\r
-/* Defines -------------------------------------------------------------------*/\r
-\r
-// Receivers\r
-#define RX0 (0+0x8000)\r
-#define RX1 (1+0x8000)\r
-#define RX2 (2+0x8000)\r
-#define RX3 (3+0x8000)\r
-#define RX4 (4+0x8000)\r
-#define RX5 (5+0x8000)\r
-#define RX6 (6+0x8000)\r
-#define RX7 (7+0x8000)\r
-#define RX8 (8+0x8000)\r
-#define RX9 (9+0x8000)\r
-\r
-// Transmitters\r
-#define TX0 (0)\r
-#define TX1 (1)\r
-#define TX2 (2)\r
-#define TX3 (3)\r
-#define TX4 (4)\r
-#define TX5 (5)\r
-#define TX6 (6)\r
-#define TX7 (7)\r
-#define TX8 (8)\r
-#define TX9 (9)\r
-#define TX10 (10)\r
-#define TX11 (11)\r
-#define TX12 (12)\r
-#define TX13 (13)\r
-#define TX14 (14)\r
-\r
-#define BIT_MASK_RX(N) ((uint16_t)1<<(uint8_t)(N & 0xFF))\r
-#define BIT_MASK_TX(N) ((uint16_t)1<< N)\r
-\r
-// Acquisition Bank\r
-#define BANK01 1\r
-#define BANK02 2\r
-#define BANK03 3\r
-#define BANK04 4\r
-#define BANK05 5\r
-#define BANK06 6\r
-#define BANK07 7\r
-#define BANK08 8\r
-#define BANK09 9\r
-#define BANK10 10\r
-#define BANK11 11\r
-#define BANK12 12\r
-#define BANK13 13\r
-#define BANK14 14\r
-#define BANK15 15\r
-#define BANK16 16\r
-#define BANK17 17\r
-#define BANK18 18\r
-#define BANK19 19\r
-#define BANK20 20\r
-#define BANK21 21\r
-#define BANK22 22\r
-#define BANK23 23\r
-#define BANK24 24\r
-#define BANK25 25\r
-#define BANK26 26\r
-#define BANK27 27\r
-#define BANK28 28\r
-#define BANK29 29\r
-#define BANK30 30\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-// For all devices/acquisitions\r
-\r
-typedef uint16_t TSL_tMeas_T; /**< Measurement */\r
-typedef uint16_t TSL_tRef_T; /**< Reference */\r
-typedef int16_t TSL_tDelta_T; /**< Delta */\r
-\r
-typedef uint8_t TSL_tIndexSrc_T; /**< Channel source index */\r
-typedef uint16_t TSL_tIndexDest_T; /**< Channel destination index */\r
-\r
-typedef uint8_t TSL_tRefRest_T; /**< Reference Rest (ECS) */\r
-typedef uint16_t TSL_tKCoeff_T; /**< K coefficient (ECS) */\r
-\r
-typedef uint8_t TSL_tIndex_T; /**< Generic index */\r
-typedef uint16_t TSL_tNb_T; /**< Generic number */\r
-typedef uint8_t TSL_tCounter_T; /**< Generic counter used for debounce */\r
-\r
-typedef uint8_t TSL_tThreshold_T; /**< Delta threshold */\r
-\r
-typedef int16_t TSL_tsignPosition_T; /**< Linear and Rotary sensors position */\r
-typedef uint8_t TSL_tPosition_T; /**< Linear and Rotary sensors position */\r
-\r
-typedef uint16_t TSL_tTick_ms_T; /**< Time in ms */\r
-typedef uint8_t TSL_tTick_sec_T; /**< Time in sec */\r
-\r
-// For STM8TL5X only\r
-\r
-typedef uint16_t TSL_tMaskRX; /**< Receiver mask */\r
-typedef uint16_t TSL_tMaskTX; /**< Transmitter mask */\r
-\r
-//------------------------------------------------------------------------------\r
-// Channel\r
-//------------------------------------------------------------------------------\r
-\r
-/** Channel destination index\r
- */\r
-typedef struct\r
-{\r
- TSL_tIndexDest_T IdxDest; /**< Index in the Channel data array */\r
-} TSL_ChannelDest_T;\r
-\r
-/** Channel Source and Configuration\r
- */\r
-typedef struct\r
-{\r
- TSL_tIndexSrc_T IdxSrc; /**< Index of the receivers (between 0 and 9) */\r
-} TSL_ChannelSrc_T;\r
-\r
-#define TSL_EPCC_CHANGE_MASK (0x04) /**< EPCC change mask */\r
-\r
-/** EPCC status\r
- */\r
-typedef enum\r
-{\r
- TSL_EPCC_STATUS_UNLOCKED = 0, /**< EPCC is unlocked */\r
- TSL_EPCC_STATUS_LOCKED = 1, /**< EPCC is locked */\r
- TSL_EPCC_STATUS_DECREASE = 4, /**< EPCC must decreased */\r
- TSL_EPCC_STATUS_INCREASE = 6 /**< EPCC must be increased */\r
-} TSL_EPCCStatus_enum_T;\r
-\r
-/** Channel flags\r
- */\r
-typedef struct\r
-{\r
- unsigned int DataReady : 1; /**< To identify a new measurement (TSL_DataReady_enum_T) */\r
- unsigned int AcqStatus : 2; /**< Acquisition status (TSL_AcqStatus_enum_T) */\r
- unsigned int EPCCStatus : 3; /**< Acquisition status (TSL_EPCCStatus_enum_T) */\r
- unsigned int ObjStatus : 2; /**< Object status (TSL_ObjStatus_enum_T) */\r
-} TSL_ChannelFlags_T;\r
-\r
-/** Channel Data\r
- */\r
-typedef struct\r
-{\r
- TSL_ChannelFlags_T Flags; /**< Flags */\r
- TSL_tRef_T Ref; /**< Reference */\r
- TSL_tRefRest_T RefRest; /**< Reference rest for ECS */\r
- TSL_tDelta_T Delta; /**< Delta */\r
-#if TSLPRM_USE_MEAS > 0\r
- TSL_tMeas_T Meas; /**< Hold the last acquisition measure */\r
-#endif\r
-} TSL_ChannelData_T;\r
-\r
-//------------------------------------------------------------------------------\r
-// Bank\r
-//------------------------------------------------------------------------------\r
-\r
-/** Bank\r
- */\r
-typedef struct\r
-{\r
- // Common to all acquisitions\r
- CONST TSL_ChannelSrc_T *p_chSrc; /**< Pointer to the Channel Source and Configuration */\r
- CONST TSL_ChannelDest_T *p_chDest; /**< Pointer to the Channel Destination */\r
- TSL_ChannelData_T *p_chData; /**< Pointer to the Channel Data */\r
- TSL_tNb_T NbChannels; /**< Number of channels in the bank */\r
- // For stm8tl5x PXS acquisition only\r
- TSL_tMaskRX msk_channels; /**< Mask of all receivers */\r
- TSL_tMaskTX msk_TX; /**< Mask of Tx */\r
- uint8_t msk_group; /**< Mask of group used (RX_GROUPA or RX_GROUPB) */\r
- TSL_tMaskRX msk_RXEN; /**< Mask of all RX (receivers and transmitters) */\r
-} TSL_Bank_T;\r
-\r
-/** Bank Configuration\r
- */\r
-typedef struct\r
-{\r
- uint8_t CSSEL[TSLPRM_HIGH_CHANNEL_NB+1]; /**< Array of CS values */\r
- uint8_t EPCCSEL[TSLPRM_HIGH_CHANNEL_NB+1]; /**< Array of EPCC values */\r
-} TSL_BankConfig_T;\r
-\r
-/* Exported variables --------------------------------------------------------*/\r
-\r
-/* Exported macros -----------------------------------------------------------*/\r
-#define TSL_acq_ComputeDelta(Reference,Measure) (TSL_tDelta_T)(Measure - Reference) /**< Calculate the Delta */\r
-#define TSL_acq_ComputeMeas(Reference,Delta) (TSL_tMeas_T)(Delta + Reference) /**< Calculate the Measure */\r
-\r
-/* Exported functions ------------------------------------------------------- */\r
-TSL_Status_enum_T TSL_acq_Init(void);\r
-TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk);\r
-TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh);\r
-TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas);\r
-TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh);\r
-void TSL_acq_BankStartAcq(void);\r
-TSL_Status_enum_T TSL_acq_BankWaitEOC(void);\r
-TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void);\r
-TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndexSrc_T index);\r
-void TSL_acq_UpdateCS(uint8_t *pCSSEL, TSL_EPCCStatus_enum_T change);\r
-\r
-#endif /* __TSL_ACQ_STM8TL5X_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_check_config.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains the check of all parameters defined in the\r
- * common configuration file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_CHECK_CONFIG_H\r
-#define __TSL_CHECK_CONFIG_H\r
-\r
-//==============================================================================\r
-// Common parameters check\r
-//==============================================================================\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TOTAL_CHANNELS\r
-#error "TSLPRM_TOTAL_CHANNELS is not defined."\r
-#endif\r
-\r
-#ifndef TSLPRM_TOTAL_BANKS\r
-#error "TSLPRM_TOTAL_BANKS is not defined."\r
-#endif\r
-\r
-#ifndef TSLPRM_TOTAL_TOUCHKEYS\r
-#error "TSLPRM_TOTAL_TOUCHKEYS is not defined."\r
-#endif\r
-\r
-#ifndef TSLPRM_TOTAL_TOUCHKEYS_B\r
-#error "TSLPRM_TOTAL_TOUCHKEYS_B is not defined."\r
-#endif\r
-\r
-#ifndef TSLPRM_TOTAL_LINROTS\r
-#error "TSLPRM_TOTAL_LINROTS is not defined."\r
-#endif\r
-\r
-#ifndef TSLPRM_TOTAL_LINROTS_B\r
-#error "TSLPRM_TOTAL_LINROTS_B is not defined."\r
-#endif\r
-\r
-#ifndef TSLPRM_TOTAL_OBJECTS\r
-#error "TSLPRM_TOTAL_OBJECTS is not defined."\r
-#endif\r
-\r
-#define TSLPRM_TOTAL_TKEYS (TSLPRM_TOTAL_TOUCHKEYS + TSLPRM_TOTAL_TOUCHKEYS_B)\r
-#define TSLPRM_TOTAL_LNRTS (TSLPRM_TOTAL_LINROTS + TSLPRM_TOTAL_LINROTS_B)\r
-\r
-#if ((TSLPRM_TOTAL_TKEYS == 0) && (TSLPRM_TOTAL_LNRTS == 0))\r
-#error "No TouchKey and No Linear/Rotary sensors are defined."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_CALIB_SAMPLES\r
-#error "TSLPRM_CALIB_SAMPLES is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_CALIB_SAMPLES != 4) && (TSLPRM_CALIB_SAMPLES != 8) && (TSLPRM_CALIB_SAMPLES != 16))\r
-#error "TSLPRM_CALIB_SAMPLES is out of range (4, 8, 16)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_CALIB_DELAY\r
-#error "TSLPRM_CALIB_DELAY is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_CALIB_DELAY < 0) || (TSLPRM_CALIB_DELAY > 40))\r
-#error "TSLPRM_CALIB_DELAY is out of range (0..40)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_ACQ_MIN\r
-#error "TSLPRM_ACQ_MIN is not defined."\r
-#endif\r
-\r
-#ifndef TSLPRM_ACQ_MAX\r
-#error "TSLPRM_ACQ_MAX is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_ACQ_MIN < 1) || (TSLPRM_ACQ_MIN > (TSLPRM_ACQ_MAX-1)))\r
-#error "TSLPRM_ACQ_MIN is out of range (1 .. ACQ_MAX-1)."\r
-#endif\r
-\r
-#if ((TSLPRM_ACQ_MAX < (TSLPRM_ACQ_MIN+1)) || (TSLPRM_ACQ_MAX > 50000))\r
-#error "TSLPRM_ACQ_MAX is out of range (ACQ_MIN+1 .. 50000)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TKEY_PROX_IN_TH\r
-#error "TSLPRM_TKEY_PROX_IN_TH is not defined."\r
-#endif\r
-\r
-#ifndef TSLPRM_TKEY_PROX_OUT_TH\r
-#error "TSLPRM_TKEY_PROX_OUT_TH is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TKEY_PROX_OUT_TH < 0) || (TSLPRM_TKEY_PROX_OUT_TH > (TSLPRM_TKEY_PROX_IN_TH-1)))\r
-#error "TSLPRM_TKEY_PROX_OUT_TH is out of range (0 .. TSLPRM_TKEY_PROX_IN_TH-1)."\r
-#endif\r
-\r
-#if TSLPRM_COEFF_TH == 0\r
-#if ((TSLPRM_TKEY_PROX_IN_TH < (TSLPRM_TKEY_PROX_OUT_TH+1)) || (TSLPRM_TKEY_PROX_IN_TH > (TSLPRM_TKEY_DETECT_OUT_TH-1)))\r
-#error "TSLPRM_TKEY_PROX_IN_TH is out of range (TSLPRM_TKEY_PROX_OUT_TH+1 .. TSLPRM_TKEY_DETECT_OUT_TH-1)."\r
-#endif\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_LINROT_PROX_IN_TH\r
-#error "TSLPRM_LINROT_PROX_IN_TH is not defined."\r
-#endif\r
-\r
-#ifndef TSLPRM_LINROT_PROX_OUT_TH\r
-#error "TSLPRM_LINROT_PROX_OUT_TH is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_LINROT_PROX_OUT_TH < 0) || (TSLPRM_LINROT_PROX_OUT_TH > (TSLPRM_LINROT_PROX_IN_TH-1)))\r
-#error "TSLPRM_LINROT_PROX_OUT_TH is out of range (0 .. TSLPRM_LINROT_PROX_IN_TH-1)."\r
-#endif\r
-\r
-#if TSLPRM_COEFF_TH == 0\r
-#if ((TSLPRM_LINROT_PROX_IN_TH < (TSLPRM_LINROT_PROX_OUT_TH+1)) || (TSLPRM_LINROT_PROX_IN_TH > (TSLPRM_LINROT_DETECT_OUT_TH-1)))\r
-#error "TSLPRM_LINROT_PROX_IN_TH is out of range (TSLPRM_LINROT_PROX_OUT_TH+1 .. TSLPRM_LINROT_DETECT_OUT_TH-1)."\r
-#endif\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TKEY_DETECT_IN_TH\r
-#error "TSLPRM_TKEY_DETECT_IN_TH is not defined."\r
-#endif\r
-\r
-#ifndef TSLPRM_TKEY_DETECT_OUT_TH\r
-#error "TSLPRM_TKEY_DETECT_OUT_TH is not defined."\r
-#endif\r
-\r
-#if TSLPRM_COEFF_TH == 0\r
-#if ((TSLPRM_TKEY_DETECT_OUT_TH < (TSLPRM_TKEY_PROX_IN_TH+1)) || (TSLPRM_TKEY_DETECT_OUT_TH > (TSLPRM_TKEY_DETECT_IN_TH-1)))\r
-#error "TSLPRM_TKEY_DETECT_OUT_TH is out of range (TSLPRM_TKEY_PROX_IN_TH+1 .. TSLPRM_TKEY_DETECT_IN_TH-1)."\r
-#endif\r
-#endif\r
-\r
-#if ((TSLPRM_TKEY_DETECT_IN_TH < (TSLPRM_TKEY_DETECT_OUT_TH+1)) || (TSLPRM_TKEY_DETECT_IN_TH > 255))\r
-#error "TSLPRM_TKEY_DETECT_IN_TH is out of range (TSLPRM_TKEY_DETECT_OUT_TH+1 .. 255)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_LINROT_DETECT_IN_TH\r
-#error "TSLPRM_LINROT_DETECT_IN_TH is not defined."\r
-#endif\r
-\r
-#ifndef TSLPRM_LINROT_DETECT_OUT_TH\r
-#error "TSLPRM_LINROT_DETECT_OUT_TH is not defined."\r
-#endif\r
-\r
-#if TSLPRM_COEFF_TH == 0\r
-#if ((TSLPRM_LINROT_DETECT_OUT_TH < (TSLPRM_LINROT_PROX_IN_TH+1)) || (TSLPRM_LINROT_DETECT_OUT_TH > (TSLPRM_LINROT_DETECT_IN_TH-1)))\r
-#error "TSLPRM_LINROT_DETECT_OUT_TH is out of range (TSLPRM_LINROT_PROX_IN_TH+1 .. TSLPRM_LINROT_DETECT_IN_TH-1)."\r
-#endif\r
-#endif\r
-\r
-#if ((TSLPRM_LINROT_DETECT_IN_TH < (TSLPRM_LINROT_DETECT_OUT_TH+1)) || (TSLPRM_LINROT_DETECT_IN_TH > 255))\r
-#error "TSLPRM_LINROT_DETECT_IN_TH is out of range (TSLPRM_LINROT_DETECT_OUT_TH+1 .. 255)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TKEY_CALIB_TH\r
-#error "TSLPRM_TKEY_CALIB_TH is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TKEY_CALIB_TH < 0) || (TSLPRM_TKEY_CALIB_TH > 255))\r
-#error "TSLPRM_TKEY_CALIB_TH is out of range (0 .. 255)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_LINROT_CALIB_TH\r
-#error "TSLPRM_LINROT_CALIB_TH is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_LINROT_CALIB_TH < 0) || (TSLPRM_LINROT_CALIB_TH > 255))\r
-#error "TSLPRM_LINROT_CALIB_TH is out of range (0 .. 255)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_LINROT_USE_NORMDELTA\r
-#error "TSLPRM_LINROT_USE_NORMDELTA is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_LINROT_USE_NORMDELTA < 0) || (TSLPRM_LINROT_USE_NORMDELTA > 1))\r
-#error "TSLPRM_LINROT_USE_NORMDELTA is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_COEFF_TH\r
-#error "TSLPRM_COEFF_TH is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_COEFF_TH < 0) || (TSLPRM_COEFF_TH > 4))\r
-#error "TSLPRM_COEFF_TH is out of range (0 .. 4)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_LINROT_DIR_CHG_POS\r
-#error "TSLPRM_LINROT_DIR_CHG_POS is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_LINROT_DIR_CHG_POS < 0) || (TSLPRM_LINROT_DIR_CHG_POS > 255))\r
-#error "TSLPRM_LINROT_DIR_CHG_POS is out of range (0 .. 255)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_LINROT_RESOLUTION\r
-#error "TSLPRM_LINROT_RESOLUTION is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_LINROT_RESOLUTION < 1) || (TSLPRM_LINROT_RESOLUTION > 8))\r
-#error "TSLPRM_LINROT_RESOLUTION is out of range (1 .. 8)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_DEBOUNCE_PROX\r
-#error "TSLPRM_DEBOUNCE_PROX is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_DEBOUNCE_PROX < 0) || (TSLPRM_DEBOUNCE_PROX > 63))\r
-#error "TSLPRM_DEBOUNCE_PROX is out of range (0 .. 63)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_DEBOUNCE_DETECT\r
-#error "TSLPRM_DEBOUNCE_DETECT is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_DEBOUNCE_DETECT < 0) || (TSLPRM_DEBOUNCE_DETECT > 63))\r
-#error "TSLPRM_DEBOUNCE_DETECT is out of range (0 .. 63)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_DEBOUNCE_RELEASE\r
-#error "TSLPRM_DEBOUNCE_RELEASE is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_DEBOUNCE_RELEASE < 0) || (TSLPRM_DEBOUNCE_RELEASE > 63))\r
-#error "TSLPRM_DEBOUNCE_RELEASE is out of range (0 .. 63)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_DEBOUNCE_CALIB\r
-#error "TSLPRM_DEBOUNCE_CALIB is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_DEBOUNCE_CALIB < 0) || (TSLPRM_DEBOUNCE_CALIB > 63))\r
-#error "TSLPRM_DEBOUNCE_CALIB is out of range (0 .. 63)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_DEBOUNCE_ERROR\r
-#error "TSLPRM_DEBOUNCE_ERROR is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_DEBOUNCE_ERROR < 0) || (TSLPRM_DEBOUNCE_ERROR > 63))\r
-#error "TSLPRM_DEBOUNCE_ERROR is out of range (0 .. 63)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_LINROT_DIR_CHG_DEB\r
-#error "TSLPRM_LINROT_DIR_CHG_DEB is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_LINROT_DIR_CHG_DEB < 0) || (TSLPRM_LINROT_DIR_CHG_DEB > 63))\r
-#error "TSLPRM_LINROT_DIR_CHG_DEB is out of range (0 .. 63)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_ECS_K_SLOW\r
-#error "TSLPRM_ECS_K_SLOW is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_ECS_K_SLOW < 0) || (TSLPRM_ECS_K_SLOW > 255))\r
-#error "TSLPRM_ECS_K_SLOW is out of range (0 .. 255)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_ECS_K_FAST\r
-#error "TSLPRM_ECS_K_FAST is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_ECS_K_FAST < 0) || (TSLPRM_ECS_K_FAST > 255))\r
-#error "TSLPRM_ECS_K_FAST is out of range (0 .. 255)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_ECS_DELAY\r
-#error "TSLPRM_ECS_DELAY is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_ECS_DELAY < 0) || (TSLPRM_ECS_DELAY > 5000))\r
-#error "TSLPRM_ECS_DELAY is out of range (0 .. 5000)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_USE_MEAS\r
-#error "TSLPRM_USE_MEAS is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_MEAS != 0) && (TSLPRM_USE_MEAS != 1))\r
-#error "TSLPRM_USE_MEAS is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_USE_PROX\r
-#error "TSLPRM_USE_PROX is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_PROX != 0) && (TSLPRM_USE_PROX != 1))\r
-#error "TSLPRM_USE_PROX is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_USE_ZONE\r
-#error "TSLPRM_USE_ZONE is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_ZONE != 0) && (TSLPRM_USE_ZONE != 1))\r
-#error "TSLPRM_USE_ZONE is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_USE_ACQ_INTERRUPT\r
-#error "TSLPRM_USE_ACQ_INTERRUPT is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_ACQ_INTERRUPT != 0) && (TSLPRM_USE_ACQ_INTERRUPT != 1))\r
-#error "TSLPRM_USE_ACQ_INTERRUPT is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_DTO\r
-#error "TSLPRM_DTO is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_DTO < 0) || (TSLPRM_DTO > 63))\r
-#error "TSLPRM_DTO is out of range (0 .. 63)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TICK_FREQ\r
-#error "TSLPRM_TICK_FREQ is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TICK_FREQ != 125) && (TSLPRM_TICK_FREQ != 250) && (TSLPRM_TICK_FREQ != 500) &&\\r
- (TSLPRM_TICK_FREQ != 1000) && (TSLPRM_TICK_FREQ != 2000))\r
-#error "TSLPRM_TICK_FREQ is out of range (125, 250, 500, 1000, 2000)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_USE_DXS\r
-#error "TSLPRM_USE_DXS is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_DXS < 0) || (TSLPRM_USE_DXS > 1))\r
-#error "TSLPRM_USE_DXS is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_USE_TIMER_CALLBACK\r
-#error "TSLPRM_USE_TIMER_CALLBACK is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_TIMER_CALLBACK != 0) && (TSLPRM_USE_TIMER_CALLBACK != 1))\r
-#error "TSLPRM_USE_TIMER_CALLBACK is out of range (0 .. 1)."\r
-#endif\r
-\r
-//==============================================================================\r
-// Specific parameters check\r
-//==============================================================================\r
-\r
-#if defined(STM8TL5X)\r
-#include "tsl_check_config_stm8tl5x.h"\r
-#endif\r
-\r
-#if defined(STM32F0XX)\r
-#include "tsl_check_config_stm32f0xx.h"\r
-#endif\r
-\r
-#if defined(STM32F30X) || defined(STM32F37X)\r
-#include "tsl_check_config_stm32f3xx.h"\r
-#endif\r
-\r
-#if defined(STM32L1XX_MD) || defined(STM32L1XX_HD) || defined(STM32L1XX_MDP)\r
-#include "tsl_check_config_stm32l1xx.h"\r
-#endif\r
-\r
-#endif /* __TSL_CHECK_CONFIG_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_check_config_stm32f0xx.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains the check of all parameters defined in the\r
- * STM32F0XX configuration file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_CHECK_CONFIG_STM32F0XX_H\r
-#define __TSL_CHECK_CONFIG_STM32F0XX_H\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if ((TSLPRM_TOTAL_CHANNELS < 1) || (TSLPRM_TOTAL_CHANNELS > 24))\r
-#error "TSLPRM_TOTAL_CHANNELS is out of range (1 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_BANKS < 1) || (TSLPRM_TOTAL_BANKS > 8))\r
-#error "TSLPRM_TOTAL_BANKS is out of range (1 .. 8)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_TOUCHKEYS < 0) || (TSLPRM_TOTAL_TOUCHKEYS > 24))\r
-#error "TSLPRM_TOTAL_TOUCHKEYS is out of range (0 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_TOUCHKEYS_B < 0) || (TSLPRM_TOTAL_TOUCHKEYS_B > 24))\r
-#error "TSLPRM_TOTAL_TOUCHKEYS_B is out of range (0 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_LINROTS < 0) || (TSLPRM_TOTAL_LINROTS > 24))\r
-#error "TSLPRM_TOTAL_LINROTS is out of range (0 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_LINROTS_B < 0) || (TSLPRM_TOTAL_LINROTS_B > 24))\r
-#error "TSLPRM_TOTAL_LINROTS_B is out of range (0 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_OBJECTS < 1) || (TSLPRM_TOTAL_OBJECTS > 24))\r
-#error "TSLPRM_TOTAL_OBJECTS is out of range (1 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_TKEYS + TSLPRM_TOTAL_LNRTS) > 24)\r
-#error "The Sum of TouchKeys and Linear/Rotary sensors exceeds 24."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_GPIO_CONFIG\r
-#error "TSLPRM_TSC_GPIO_CONFIG is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_GPIO_CONFIG < 0) || (TSLPRM_TSC_GPIO_CONFIG > 1))\r
-#error "TSLPRM_TSC_GPIO_CONFIG is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_CTPH\r
-#error "TSLPRM_TSC_CTPH is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_CTPH < 0) || (TSLPRM_TSC_CTPH > 15))\r
-#error "TSLPRM_TSC_CTPH is out of range (0 .. 15)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_CTPL\r
-#error "TSLPRM_TSC_CTPL is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_CTPL < 0) || (TSLPRM_TSC_CTPL > 15))\r
-#error "TSLPRM_TSC_CTPL is out of range (0 .. 15)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_PGPSC\r
-#error "TSLPRM_TSC_PGPSC is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_PGPSC < 0) || (TSLPRM_TSC_PGPSC > 7))\r
-#error "TSLPRM_TSC_PGPSC is out of range (0 .. 7)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if (TSLPRM_ACQ_MAX > 0) && (TSLPRM_ACQ_MAX < 256)\r
-#define TSLPRM_TSC_MCV 0 // 255\r
-#endif\r
-\r
-#if (TSLPRM_ACQ_MAX > 255) && (TSLPRM_ACQ_MAX < 512)\r
-#define TSLPRM_TSC_MCV 1 // 511\r
-#endif\r
-\r
-#if (TSLPRM_ACQ_MAX > 511) && (TSLPRM_ACQ_MAX < 1024)\r
-#define TSLPRM_TSC_MCV 2 // 1023\r
-#endif\r
-\r
-#if (TSLPRM_ACQ_MAX > 1023) && (TSLPRM_ACQ_MAX < 2048)\r
-#define TSLPRM_TSC_MCV 3 // 2047\r
-#endif\r
-\r
-#if (TSLPRM_ACQ_MAX > 2047) && (TSLPRM_ACQ_MAX < 4096)\r
-#define TSLPRM_TSC_MCV 4 // 4095\r
-#endif\r
-\r
-#if (TSLPRM_ACQ_MAX > 4095) && (TSLPRM_ACQ_MAX < 8192)\r
-#define TSLPRM_TSC_MCV 5 // 8191\r
-#endif\r
-\r
-#if (TSLPRM_ACQ_MAX > 8191)\r
-#define TSLPRM_TSC_MCV 6 // 16383\r
-#endif\r
-\r
-#ifndef TSLPRM_TSC_MCV\r
-#error "TSLPRM_TSC_MCV is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_MCV < 0) || (TSLPRM_TSC_MCV > 6))\r
-#error "TSLPRM_TSC_MCV is out of range (0 .. 6)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_IODEF\r
-#error "TSLPRM_TSC_IODEF is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_IODEF < 0) || (TSLPRM_TSC_IODEF > 1))\r
-#error "TSLPRM_TSC_IODEF is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_AM\r
-#error "TSLPRM_TSC_AM is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_AM < 0) || (TSLPRM_TSC_AM > 1))\r
-#error "TSLPRM_TSC_AM is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_SYNC_PIN\r
-#error "TSLPRM_TSC_SYNC_PIN is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_SYNC_PIN < 0) || (TSLPRM_TSC_SYNC_PIN > 1))\r
-#error "TSLPRM_TSC_SYNC_PIN is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_SYNC_POL\r
-#error "TSLPRM_TSC_SYNC_POL is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_SYNC_POL < 0) || (TSLPRM_TSC_SYNC_POL > 1))\r
-#error "TSLPRM_TSC_SYNC_POL is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_USE_SS\r
-#error "TSLPRM_TSC_USE_SS is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_USE_SS < 0) || (TSLPRM_TSC_USE_SS > 1))\r
-#error "TSLPRM_TSC_USE_SS is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_SSD\r
-#error "TSLPRM_TSC_SSD is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_SSD < 0) || (TSLPRM_TSC_SSD > 127))\r
-#error "TSLPRM_TSC_SSD is out of range (0 .. 127)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_SSPSC\r
-#error "TSLPRM_TSC_SSPSC is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_SSPSC < 0) || (TSLPRM_TSC_SSPSC > 1))\r
-#error "TSLPRM_TSC_SSPSC is out of range (0 .. 1)."\r
-#endif\r
-\r
-#endif /* __TSL_CHECK_CONFIG_STM32F0XX_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_check_config_stm32f3xx.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains the check of all parameters defined in the\r
- * STM32F3XX configuration file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_CHECK_CONFIG_STM32F3XX_H\r
-#define __TSL_CHECK_CONFIG_STM32F3XX_H\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if ((TSLPRM_TOTAL_CHANNELS < 1) || (TSLPRM_TOTAL_CHANNELS > 24))\r
-#error "TSLPRM_TOTAL_CHANNELS is out of range (1 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_BANKS < 1) || (TSLPRM_TOTAL_BANKS > 8))\r
-#error "TSLPRM_TOTAL_BANKS is out of range (1 .. 8)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_TOUCHKEYS < 0) || (TSLPRM_TOTAL_TOUCHKEYS > 24))\r
-#error "TSLPRM_TOTAL_TOUCHKEYS is out of range (0 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_TOUCHKEYS_B < 0) || (TSLPRM_TOTAL_TOUCHKEYS_B > 24))\r
-#error "TSLPRM_TOTAL_TOUCHKEYS_B is out of range (0 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_LINROTS < 0) || (TSLPRM_TOTAL_LINROTS > 24))\r
-#error "TSLPRM_TOTAL_LINROTS is out of range (0 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_LINROTS_B < 0) || (TSLPRM_TOTAL_LINROTS_B > 24))\r
-#error "TSLPRM_TOTAL_LINROTS_B is out of range (0 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_OBJECTS < 1) || (TSLPRM_TOTAL_OBJECTS > 24))\r
-#error "TSLPRM_TOTAL_OBJECTS is out of range (1 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_TKEYS + TSLPRM_TOTAL_LNRTS) > 24)\r
-#error "The Sum of TouchKeys and Linear/Rotary sensors exceeds 24."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_GPIO_CONFIG\r
-#error "TSLPRM_TSC_GPIO_CONFIG is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_GPIO_CONFIG < 0) || (TSLPRM_TSC_GPIO_CONFIG > 1))\r
-#error "TSLPRM_TSC_GPIO_CONFIG is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_CTPH\r
-#error "TSLPRM_TSC_CTPH is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_CTPH < 0) || (TSLPRM_TSC_CTPH > 15))\r
-#error "TSLPRM_TSC_CTPH is out of range (0 .. 15)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_CTPL\r
-#error "TSLPRM_TSC_CTPL is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_CTPL < 0) || (TSLPRM_TSC_CTPL > 15))\r
-#error "TSLPRM_TSC_CTPL is out of range (0 .. 15)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_PGPSC\r
-#error "TSLPRM_TSC_PGPSC is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_PGPSC < 0) || (TSLPRM_TSC_PGPSC > 7))\r
-#error "TSLPRM_TSC_PGPSC is out of range (0 .. 7)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if (TSLPRM_ACQ_MAX > 0) && (TSLPRM_ACQ_MAX < 256)\r
-#define TSLPRM_TSC_MCV 0 // 255\r
-#endif\r
-\r
-#if (TSLPRM_ACQ_MAX > 255) && (TSLPRM_ACQ_MAX < 512)\r
-#define TSLPRM_TSC_MCV 1 // 511\r
-#endif\r
-\r
-#if (TSLPRM_ACQ_MAX > 511) && (TSLPRM_ACQ_MAX < 1024)\r
-#define TSLPRM_TSC_MCV 2 // 1023\r
-#endif\r
-\r
-#if (TSLPRM_ACQ_MAX > 1023) && (TSLPRM_ACQ_MAX < 2048)\r
-#define TSLPRM_TSC_MCV 3 // 2047\r
-#endif\r
-\r
-#if (TSLPRM_ACQ_MAX > 2047) && (TSLPRM_ACQ_MAX < 4096)\r
-#define TSLPRM_TSC_MCV 4 // 4095\r
-#endif\r
-\r
-#if (TSLPRM_ACQ_MAX > 4095) && (TSLPRM_ACQ_MAX < 8192)\r
-#define TSLPRM_TSC_MCV 5 // 8191\r
-#endif\r
-\r
-#if (TSLPRM_ACQ_MAX > 8191)\r
-#define TSLPRM_TSC_MCV 6 // 16383\r
-#endif\r
-\r
-#ifndef TSLPRM_TSC_MCV\r
-#error "TSLPRM_TSC_MCV is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_MCV < 0) || (TSLPRM_TSC_MCV > 6))\r
-#error "TSLPRM_TSC_MCV is out of range (0 .. 6)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_IODEF\r
-#error "TSLPRM_TSC_IODEF is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_IODEF < 0) || (TSLPRM_TSC_IODEF > 1))\r
-#error "TSLPRM_TSC_IODEF is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_AM\r
-#error "TSLPRM_TSC_AM is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_AM < 0) || (TSLPRM_TSC_AM > 1))\r
-#error "TSLPRM_TSC_AM is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_SYNC_PIN\r
-#error "TSLPRM_TSC_SYNC_PIN is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_SYNC_PIN < 0) || (TSLPRM_TSC_SYNC_PIN > 1))\r
-#error "TSLPRM_TSC_SYNC_PIN is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_SYNC_POL\r
-#error "TSLPRM_TSC_SYNC_POL is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_SYNC_POL < 0) || (TSLPRM_TSC_SYNC_POL > 1))\r
-#error "TSLPRM_TSC_SYNC_POL is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_USE_SS\r
-#error "TSLPRM_TSC_USE_SS is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_USE_SS < 0) || (TSLPRM_TSC_USE_SS > 1))\r
-#error "TSLPRM_TSC_USE_SS is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_SSD\r
-#error "TSLPRM_TSC_SSD is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_SSD < 0) || (TSLPRM_TSC_SSD > 127))\r
-#error "TSLPRM_TSC_SSD is out of range (0 .. 127)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TSC_SSPSC\r
-#error "TSLPRM_TSC_SSPSC is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TSC_SSPSC < 0) || (TSLPRM_TSC_SSPSC > 1))\r
-#error "TSLPRM_TSC_SSPSC is out of range (0 .. 1)."\r
-#endif\r
-\r
-#endif /* __TSL_CHECK_CONFIG_STM32F3XX_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_check_config_stm32l1xx.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains the check of all parameters defined in the\r
- * STM32L1XX configuration file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_CHECK_CONFIG_STM32L1XX_H\r
-#define __TSL_CHECK_CONFIG_STM32L1XX_H\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if ((TSLPRM_TOTAL_CHANNELS < 1) || (TSLPRM_TOTAL_CHANNELS > 24))\r
-#error "TSLPRM_TOTAL_CHANNELS is out of range (1 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_BANKS < 1) || (TSLPRM_TOTAL_BANKS > 8))\r
-#error "TSLPRM_TOTAL_BANKS is out of range (1 .. 8)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_TOUCHKEYS < 0) || (TSLPRM_TOTAL_TOUCHKEYS > 24))\r
-#error "TSLPRM_TOTAL_TOUCHKEYS is out of range (0 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_TOUCHKEYS_B < 0) || (TSLPRM_TOTAL_TOUCHKEYS_B > 24))\r
-#error "TSLPRM_TOTAL_TOUCHKEYS_B is out of range (0 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_LINROTS < 0) || (TSLPRM_TOTAL_LINROTS > 24))\r
-#error "TSLPRM_TOTAL_LINROTS is out of range (0 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_LINROTS_B < 0) || (TSLPRM_TOTAL_LINROTS_B > 24))\r
-#error "TSLPRM_TOTAL_LINROTS_B is out of range (0 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_OBJECTS < 1) || (TSLPRM_TOTAL_OBJECTS > 24))\r
-#error "TSLPRM_TOTAL_OBJECTS is out of range (1 .. 24)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_TKEYS + TSLPRM_TOTAL_LNRTS) > 24)\r
-#error "The Sum of TouchKeys and Linear/Rotary sensors exceeds 24."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_USE_SHIELD\r
-#error "TSLPRM_USE_SHIELD is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_SHIELD < 0) || (TSLPRM_USE_SHIELD > 1))\r
-#error "TSLPRM_USE_SHIELD is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_IODEF\r
-#error "TSLPRM_IODEF is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_IODEF < 0) || (TSLPRM_IODEF > 1))\r
-#error "TSLPRM_IODEF is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if defined(STM32L1XX_HD) && !defined(TSLPRM_STM32L1XX_HD_SW)\r
-\r
-#ifndef TSLPRM_TIM_PRESCALER\r
-#error "TSLPRM_TIM_PRESCALER is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TIM_PRESCALER < 0) || (TSLPRM_TIM_PRESCALER > 65535))\r
-#error "TSLPRM_TIM_PRESCALER is out of range (0 .. 65535)."\r
-#endif\r
-\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if defined(STM32L1XX_HD) && !defined(TSLPRM_STM32L1XX_HD_SW)\r
-\r
-#ifndef TSLPRM_TIM_RELOAD\r
-#error "TSLPRM_TIM_RELOAD is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TIM_RELOAD < 4) || (TSLPRM_TIM_RELOAD > 65534))\r
-#error "TSLPRM_TIM_RELOAD is out of range (4 .. 65534)."\r
-#endif\r
-\r
-#if ((TSLPRM_TIM_RELOAD % 2) != (0))\r
-#error "TSLPRM_TIM_RELOAD is odd and must be even."\r
-#endif\r
-\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if defined(STM32L1XX_HD) && defined(TSLPRM_STM32L1XX_HD_SW)\r
-\r
-#ifndef TSLPRM_PROTECT_IO_ACCESS\r
-#error "TSLPRM_PROTECT_IO_ACCESS is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PROTECT_IO_ACCESS < 0) || (TSLPRM_PROTECT_IO_ACCESS > 1))\r
-#error "TSLPRM_PROTECT_IO_ACCESS is out of range (0 .. 1)."\r
-#endif\r
-\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if defined(STM32L1XX_HD) && defined(TSLPRM_STM32L1XX_HD_SW)\r
-\r
-#ifndef TSLPRM_USE_GPIOA\r
-#error "TSLPRM_USE_GPIOA is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOA < 0) || (TSLPRM_USE_GPIOA > 1))\r
-#error "TSLPRM_USE_GPIOA is out of range (0 .. 1)."\r
-#endif\r
-\r
-#ifndef TSLPRM_USE_GPIOB\r
-#error "TSLPRM_USE_GPIOB is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOB < 0) || (TSLPRM_USE_GPIOB > 1))\r
-#error "TSLPRM_USE_GPIOB is out of range (0 .. 1)."\r
-#endif\r
-\r
-#ifndef TSLPRM_USE_GPIOC\r
-#error "TSLPRM_USE_GPIOC is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOC < 0) || (TSLPRM_USE_GPIOC > 1))\r
-#error "TSLPRM_USE_GPIOC is out of range (0 .. 1)."\r
-#endif\r
-\r
-#ifndef TSLPRM_USE_GPIOF\r
-#error "TSLPRM_USE_GPIOA is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOF < 0) || (TSLPRM_USE_GPIOF > 1))\r
-#error "TSLPRM_USE_GPIOF is out of range (0 .. 1)."\r
-#endif\r
-\r
-#ifndef TSLPRM_USE_GPIOG\r
-#error "TSLPRM_USE_GPIOG is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOG < 0) || (TSLPRM_USE_GPIOG > 1))\r
-#error "TSLPRM_USE_GPIOG is out of range (0 .. 1)."\r
-#endif\r
-\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if defined(STM32L1XX_MD)\r
-\r
-#ifndef TSLPRM_PROTECT_IO_ACCESS\r
-#error "TSLPRM_PROTECT_IO_ACCESS is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PROTECT_IO_ACCESS < 0) || (TSLPRM_PROTECT_IO_ACCESS > 1))\r
-#error "TSLPRM_PROTECT_IO_ACCESS is out of range (0 .. 1)."\r
-#endif\r
-\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if defined(STM32L1XX_MD)\r
-\r
-#ifndef TSLPRM_USE_GPIOA\r
-#error "TSLPRM_USE_GPIOA is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOA < 0) || (TSLPRM_USE_GPIOA > 1))\r
-#error "TSLPRM_USE_GPIOA is out of range (0 .. 1)."\r
-#endif\r
-\r
-#ifndef TSLPRM_USE_GPIOB\r
-#error "TSLPRM_USE_GPIOB is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOB < 0) || (TSLPRM_USE_GPIOB > 1))\r
-#error "TSLPRM_USE_GPIOB is out of range (0 .. 1)."\r
-#endif\r
-\r
-#ifndef TSLPRM_USE_GPIOC\r
-#error "TSLPRM_USE_GPIOC is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOC < 0) || (TSLPRM_USE_GPIOC > 1))\r
-#error "TSLPRM_USE_GPIOC is out of range (0 .. 1)."\r
-#endif\r
-\r
-#ifndef TSLPRM_USE_GPIOF\r
-#error "TSLPRM_USE_GPIOA is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOF < 0) || (TSLPRM_USE_GPIOF > 1))\r
-#error "TSLPRM_USE_GPIOF is out of range (0 .. 1)."\r
-#endif\r
-\r
-#ifndef TSLPRM_USE_GPIOG\r
-#error "TSLPRM_USE_GPIOG is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOG < 0) || (TSLPRM_USE_GPIOG > 1))\r
-#error "TSLPRM_USE_GPIOG is out of range (0 .. 1)."\r
-#endif\r
-\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if defined(STM32L1XX_MDP) && !defined(TSLPRM_STM32L1XX_MDP_SW)\r
-\r
-#ifndef TSLPRM_TIM_PRESCALER\r
-#error "TSLPRM_TIM_PRESCALER is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TIM_PRESCALER < 0) || (TSLPRM_TIM_PRESCALER > 65535))\r
-#error "TSLPRM_TIM_PRESCALER is out of range (0 .. 65535)."\r
-#endif\r
-\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if defined(STM32L1XX_MDP) && !defined(TSLPRM_STM32L1XX_MDP_SW)\r
-\r
-#ifndef TSLPRM_TIM_RELOAD\r
-#error "TSLPRM_TIM_RELOAD is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TIM_RELOAD < 4) || (TSLPRM_TIM_RELOAD > 65534))\r
-#error "TSLPRM_TIM_RELOAD is out of range (4 .. 65534)."\r
-#endif\r
-\r
-#if ((TSLPRM_TIM_RELOAD % 2) != (0))\r
-#error "TSLPRM_TIM_RELOAD is odd and must be even."\r
-#endif\r
-\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if defined(STM32L1XX_MDP) && defined(TSLPRM_STM32L1XX_MDP_SW)\r
-\r
-#ifndef TSLPRM_PROTECT_IO_ACCESS\r
-#error "TSLPRM_PROTECT_IO_ACCESS is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PROTECT_IO_ACCESS < 0) || (TSLPRM_PROTECT_IO_ACCESS > 1))\r
-#error "TSLPRM_PROTECT_IO_ACCESS is out of range (0 .. 1)."\r
-#endif\r
-\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if defined(STM32L1XX_MDP) && defined(TSLPRM_STM32L1XX_MDP_SW)\r
-\r
-#ifndef TSLPRM_USE_GPIOA\r
-#error "TSLPRM_USE_GPIOA is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOA < 0) || (TSLPRM_USE_GPIOA > 1))\r
-#error "TSLPRM_USE_GPIOA is out of range (0 .. 1)."\r
-#endif\r
-\r
-#ifndef TSLPRM_USE_GPIOB\r
-#error "TSLPRM_USE_GPIOB is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOB < 0) || (TSLPRM_USE_GPIOB > 1))\r
-#error "TSLPRM_USE_GPIOB is out of range (0 .. 1)."\r
-#endif\r
-\r
-#ifndef TSLPRM_USE_GPIOC\r
-#error "TSLPRM_USE_GPIOC is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOC < 0) || (TSLPRM_USE_GPIOC > 1))\r
-#error "TSLPRM_USE_GPIOC is out of range (0 .. 1)."\r
-#endif\r
-\r
-#ifndef TSLPRM_USE_GPIOF\r
-#error "TSLPRM_USE_GPIOA is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOF < 0) || (TSLPRM_USE_GPIOF > 1))\r
-#error "TSLPRM_USE_GPIOF is out of range (0 .. 1)."\r
-#endif\r
-\r
-#ifndef TSLPRM_USE_GPIOG\r
-#error "TSLPRM_USE_GPIOG is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_USE_GPIOG < 0) || (TSLPRM_USE_GPIOG > 1))\r
-#error "TSLPRM_USE_GPIOG is out of range (0 .. 1)."\r
-#endif\r
-\r
-#endif\r
-\r
-#endif /* __TSL_CHECK_CONFIG_STM32L1XX_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_check_config_stm8tl5x.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains the check of all parameters defined in the\r
- * STM8TL5X configuration file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_CHECK_CONFIG_STM8TL5X_H\r
-#define __TSL_CHECK_CONFIG_STM8TL5X_H\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if ((TSLPRM_MCU < 0) && (TSLPRM_MCU > 4))\r
-#error "The MCU selected is not in the STM8TL5x MCU list !"\r
-#endif\r
-\r
-#if (TSLPRM_MCU > 0)\r
-#define __MAX_RX 7\r
-#else\r
-#define __MAX_RX 9\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#if ((TSLPRM_TOTAL_CHANNELS < 1) || (TSLPRM_TOTAL_CHANNELS > 300))\r
-#error "TSLPRM_TOTAL_CHANNELS is out of range (1 .. 300)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_BANKS < 1) || (TSLPRM_TOTAL_BANKS > 15))\r
-#error "TSLPRM_TOTAL_BANKS is out of range (1 .. 15)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_TOUCHKEYS < 0) || (TSLPRM_TOTAL_TOUCHKEYS > 256))\r
-#error "TSLPRM_TOTAL_TOUCHKEYS is out of range (0 .. 256)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_TOUCHKEYS_B < 0) || (TSLPRM_TOTAL_TOUCHKEYS_B > 256))\r
-#error "TSLPRM_TOTAL_TOUCHKEYS_B is out of range (0 .. 256)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_LINROTS < 0) || (TSLPRM_TOTAL_LINROTS > 256))\r
-#error "TSLPRM_TOTAL_LINROTS is out of range (0 .. 256)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_LINROTS_B < 0) || (TSLPRM_TOTAL_LINROTS_B > 256))\r
-#error "TSLPRM_TOTAL_LINROTS_B is out of range (0 .. 256)."\r
-#endif\r
-\r
-#if ((TSLPRM_TOTAL_OBJECTS < 1) || (TSLPRM_TOTAL_OBJECTS > 256))\r
-#error "TSLPRM_TOTAL_OBJECTS is out of range (1 .. 256)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_KEY_TARGET_REFERENCE\r
-#error "TSLPRM_KEY_TARGET_REFERENCE is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_KEY_TARGET_REFERENCE < 100) || (TSLPRM_KEY_TARGET_REFERENCE > 2000))\r
-#error "TSLPRM_KEY_TARGET_REFERENCE is out of range (100 .. 2000)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_KEY_TARGET_REFERENCE_ERROR\r
-#error "TSLPRM_KEY_TARGET_REFERENCE_ERROR is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_KEY_TARGET_REFERENCE_ERROR < 1) || (TSLPRM_KEY_TARGET_REFERENCE_ERROR > TSLPRM_KEY_TARGET_REFERENCE))\r
-#error "TSLPRM_KEY_TARGET_REFERENCE_ERROR is out of range (1 .. TSLPRM_KEY_TARGET_REFERENCE)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_PXS_EPCC_FINE_TUNING_ITERATION\r
-#error "TSLPRM_PXS_EPCC_FINE_TUNING_ITERATION is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PXS_EPCC_FINE_TUNING_ITERATION < 3) || (TSLPRM_PXS_EPCC_FINE_TUNING_ITERATION > 5))\r
-#error "TSLPRM_PXS_EPCC_FINE_TUNING_ITERATION is out of range (3 .. 5)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_KEY_TARGET_ATTENUATION\r
-#error "TSLPRM_KEY_TARGET_ATTENUATION is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_KEY_TARGET_ATTENUATION != 1) && (TSLPRM_KEY_TARGET_ATTENUATION != 2) &&\\r
- (TSLPRM_KEY_TARGET_ATTENUATION != 4) && (TSLPRM_KEY_TARGET_ATTENUATION != 8))\r
-#error "TSLPRM_KEY_TARGET_ATTENUATION is out of range (1,2,4,8)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_TOUCHKEY_REFERENCE_RANGE\r
-#error "TSLPRM_TOUCHKEY_REFERENCE_RANGE is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_TOUCHKEY_REFERENCE_RANGE < 1) || (TSLPRM_TOUCHKEY_REFERENCE_RANGE > TSLPRM_KEY_TARGET_REFERENCE))\r
-#error "TSLPRM_TOUCHKEY_REFERENCE_RANGE is out of range (1 .. TSLPRM_KEY_TARGET_REFERENCE)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_LINROT_REFERENCE_RANGE\r
-#error "TSLPRM_LINROT_REFERENCE_RANGE is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_LINROT_REFERENCE_RANGE < 1) || (TSLPRM_LINROT_REFERENCE_RANGE > TSLPRM_KEY_TARGET_REFERENCE))\r
-#error "TSLPRM_LINROT_REFERENCE_RANGE is out of range (1 .. TSLPRM_KEY_TARGET_REFERENCE)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_PXS_HSI\r
-#error "TSLPRM_PXS_HSI is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PXS_HSI != 16000) && (TSLPRM_PXS_HSI != 8000) && (TSLPRM_PXS_HSI != 4000) && \\r
- (TSLPRM_PXS_HSI != 2000) && (TSLPRM_PXS_HSI != 1000) && (TSLPRM_PXS_HSI != 500) && \\r
- (TSLPRM_PXS_HSI != 250) && (TSLPRM_PXS_HSI != 125))\r
-#error "TSLPRM_PXS_HSI is out of range (16000, 8000, 4000, 2000, 1000, 500, 250, 125)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_PXS_UP_LENGTH\r
-#error "TSLPRM_PXS_UP_LENGTH is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PXS_UP_LENGTH < 1) || (TSLPRM_PXS_UP_LENGTH > 7))\r
-#error "TSLPRM_PXS_UP_LENGTH is out of range (1 .. 7)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_PXS_PASS_LENGTH\r
-#error "TSLPRM_PXS_PASS_LENGTH is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PXS_PASS_LENGTH < 1) || (TSLPRM_PXS_PASS_LENGTH > 7))\r
-#error "TSLPRM_PXS_PASS_LENGTH is out of range (1 .. 7)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_PXS_LOW_POWER_MODE\r
-#error "TSLPRM_PXS_LOW_POWER_MODE is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PXS_LOW_POWER_MODE != 0) && (TSLPRM_PXS_LOW_POWER_MODE != 1))\r
-#error "TSLPRM_PXS_LOW_POWER_MODE is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_PXS_RF_DETECTION\r
-#error "TSLPRM_PXS_RF_DETECTION is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PXS_RF_DETECTION != 0) && (TSLPRM_PXS_RF_DETECTION != 1))\r
-#error "TSLPRM_PXS_RF_DETECTION is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_PXS_SYNCHRONIZE\r
-#error "TSLPRM_PXS_SYNCHRONIZE is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PXS_SYNCHRONIZE != 0) && (TSLPRM_PXS_SYNCHRONIZE != 1))\r
-#error "TSLPRM_PXS_SYNCHRONIZE is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_PXS_SYNCHRO_EDGE\r
-#error "TSLPRM_PXS_SYNCHRO_EDGE is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PXS_SYNCHRO_EDGE != 0) && (TSLPRM_PXS_SYNCHRO_EDGE != 1))\r
-#error "TSLPRM_PXS_SYNCHRO_EDGE is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_PXS_INACTIVE_TX\r
-#error "TSLPRM_PXS_INACTIVE_TX is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PXS_INACTIVE_TX != 0) && (TSLPRM_PXS_INACTIVE_TX != 1))\r
-#error "TSLPRM_PXS_INACTIVE_TX is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_PXS_INACTIVE_RX\r
-#error "TSLPRM_PXS_INACTIVE_RX is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PXS_INACTIVE_RX != 0) && (TSLPRM_PXS_INACTIVE_RX != 1))\r
-#error "TSLPRM_PXS_INACTIVE_RX is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_PXS_RX_COUPLING\r
-#error "TSLPRM_PXS_RX_COUPLING is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PXS_RX_COUPLING != 0) && (TSLPRM_PXS_RX_COUPLING != 1))\r
-#error "TSLPRM_PXS_RX_COUPLING is out of range (0 .. 1)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_PXS_STAB\r
-#error "TSLPRM_PXS_STAB is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PXS_STAB != LONG_STAB) && (TSLPRM_PXS_STAB != MEDIUM_STAB) && (TSLPRM_PXS_STAB != SHORT_STAB))\r
-#error "TSLPRM_PXS_STAB is out of range (LONG_STAB, MEDIUM_STAB, SHORT_STAB)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_PXS_BIAS\r
-#error "TSLPRM_PXS_BIAS is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_PXS_BIAS != HIGH_BIAS) && (TSLPRM_PXS_BIAS != MEDIUM_BIAS) && (TSLPRM_PXS_BIAS != LOW_BIAS) && (TSLPRM_PXS_BIAS != VERY_LOW_BIAS))\r
-#error "TSLPRM_PXS_BIAS is out of range (HIGH_BIAS, MEDIUM_BIAS, LOW_BIAS, VERY_LOW_BIAS)."\r
-#endif\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#ifndef TSLPRM_HIGH_CHANNEL_NB\r
-#error "TSLPRM_HIGH_CHANNEL_NB is not defined."\r
-#endif\r
-\r
-#if ((TSLPRM_HIGH_CHANNEL_NB < 0) || (TSLPRM_HIGH_CHANNEL_NB > __MAX_RX))\r
-#error "TSLPRM_HIGH_CHANNEL_NB is out of range (0..9 for STM8TL53C4, 0..7 for STM8TL53G4)."\r
-#endif\r
-\r
-#endif /* __TSL_CHECK_CONFIG_STM8TL5X_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_dxs.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_dxs.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_DXS_H\r
-#define __TSL_DXS_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_object.h"\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-/* Exported functions --------------------------------------------------------*/\r
-\r
-void TSL_dxs_FirstObj(CONST TSL_ObjectGroup_T *objgrp);\r
-\r
-#endif /* __TSL_DXS_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_ecs.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_ecs.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_ECS_H\r
-#define __TSL_ECS_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_object.h"\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-/* Exported functions --------------------------------------------------------*/\r
-\r
-TSL_tKCoeff_T TSL_ecs_CalcK(CONST TSL_ObjectGroup_T *objgrp, TSL_tKCoeff_T k_slow, TSL_tKCoeff_T k_fast);\r
-void TSL_ecs_ProcessK(CONST TSL_ObjectGroup_T *objgrp, TSL_tKCoeff_T Kcoeff);\r
-TSL_Status_enum_T TSL_ecs_Process(CONST TSL_ObjectGroup_T *objgrp);\r
-\r
-#endif /* __TSL_ECS_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_filter.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_filter.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_FILTER_H\r
-#define __TSL_FILTER_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_acq.h"\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-TSL_tMeas_T TSL_filt_MeasFilter(TSL_tMeas_T measn1, TSL_tMeas_T measn);\r
-TSL_tDelta_T TSL_filt_DeltaFilter(TSL_tDelta_T delta);\r
-\r
-#endif /* __TSL_FILTER_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_globals.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_globals.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_GLOBALS_H\r
-#define __TSL_GLOBALS_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_acq.h"\r
-#include "tsl_object.h"\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-/** Store all global variables shared between the STMTouch Driver and the Application.\r
- */\r
-typedef struct\r
-{\r
- TSL_tTick_ms_T Tick_ms; /**< Incremented each 0.5ms by timing interrupt routine */\r
- TSL_tTick_sec_T Tick_sec; /**< Incremented each second by timing interrupt routine */\r
- CONST TSL_Bank_T *Bank_Array; /**< Pointer to the array containing all Banks */\r
- TSL_tIndex_T This_Bank; /**< Pointer to the current Bank */\r
- CONST TSL_Object_T *This_Obj; /**< Pointer to the current Object */\r
-#if TSLPRM_USE_ZONE > 0\r
- CONST TSL_Zone_T *This_Zone; /**< Pointer to the current Zone */\r
- TSL_tIndex_T Index_In_This_Zone; /**< Index in the current Zone */\r
-#endif\r
-#if TSLPRM_TOTAL_TKEYS > 0\r
- CONST TSL_TouchKey_T *This_TKey; /**< Pointer to the current TKey */\r
-#endif\r
-#if TSLPRM_TOTAL_LNRTS > 0\r
- CONST TSL_LinRot_T *This_LinRot; /**< Pointer to the current Linear or Rotary sensor */\r
-#endif\r
-}\r
-TSL_Globals_T;\r
-\r
-/** Store all global parametersshared between the STMTouch Driver and the Application .\r
- @warning Only one variable of this structure type must be created and be placed\r
- in RAM only.\r
- */\r
-typedef struct\r
-{\r
- TSL_tMeas_T AcqMin; /**< Acquisition minimum limit */\r
- TSL_tMeas_T AcqMax; /**< Acquisition maximum limit */\r
- TSL_tNb_T NbCalibSamples; /**< Number of Calibration samples */\r
- TSL_tTick_sec_T DTO; /**< Detection Time Out */\r
-#if TSLPRM_TOTAL_TKEYS > 0\r
- CONST TSL_State_T *p_TKeySM; /**< Default state machine for TouchKey sensors */\r
- CONST TSL_TouchKeyMethods_T *p_TKeyMT; /**< Default methods for TouchKey sensors */\r
-#endif\r
-#if TSLPRM_TOTAL_LNRTS > 0\r
- CONST TSL_State_T *p_LinRotSM; /**< Default state machine for Linear/Rotary sensors */\r
- CONST TSL_LinRotMethods_T *p_LinRotMT; /**< Default methods for Linear/Rotary sensors */\r
-#endif\r
-}\r
-TSL_Params_T;\r
-\r
-/* Exported variables --------------------------------------------------------*/\r
-extern TSL_Globals_T TSL_Globals;\r
-extern TSL_Params_T TSL_Params;\r
-\r
-#endif /* __TSL_GLOBALS_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_linrot.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_linrot.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_LINROT_H\r
-#define __TSL_LINROT_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_acq.h"\r
-#include "tsl_time.h"\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-/** Contains all data related to Linear and Rotary sensor.\r
- * Variables of this structure type must be placed in RAM only.\r
- */\r
-typedef struct\r
-{\r
- TSL_StateId_enum_T StateId; /**< Current state identifier */\r
- TSL_tPosition_T RawPosition; /**< Raw position */\r
- TSL_tPosition_T Position; /**< Scaled position */\r
- unsigned int Counter : 6; /**< Generic counter for state debounce, calibration & DTO (TSL_tCounter_T) */\r
- unsigned int Change : 1; /**< The State is different from the previous one (TSL_StateChange_enum_T) */\r
- unsigned int PosChange : 1; /**< The RawPosition/Position is different from the previous one (TSL_StateChange_enum_T) */\r
- unsigned int Counter2 : 6; /**< Generic counter for direction debounce (TSL_tCounter_T) */\r
- unsigned int DxSLock : 1; /**< The State is locked by the DxS (TSL_Bool_enum_T) */\r
- unsigned int Direction : 1; /**< Movement direction (TSL_Bool_enum_T) */\r
-}\r
-TSL_LinRotData_T;\r
-\r
-/** Contains all parameters related to Linear and Rotary sensor.\r
- * Variables of this structure type can be placed in RAM or ROM.\r
- */\r
-typedef struct\r
-{\r
- // Thresholds\r
-#if TSLPRM_USE_PROX > 0\r
- TSL_tThreshold_T ProxInTh; /**< Proximity state in threshold */\r
- TSL_tThreshold_T ProxOutTh; /**< Proximity state out threshold */\r
-#endif\r
- TSL_tThreshold_T DetectInTh; /**< Detection state in threshold */\r
- TSL_tThreshold_T DetectOutTh; /**< Detection state out threshold */\r
- TSL_tThreshold_T CalibTh; /**< Calibration state threshold */\r
- // Debounce counters\r
- TSL_tCounter_T CounterDebCalib; /**< Debounce counter to enter in Calibration state */\r
-#if TSLPRM_USE_PROX > 0\r
- TSL_tCounter_T CounterDebProx; /**< Debounce counter to enter in Proximity state */\r
-#endif\r
- TSL_tCounter_T CounterDebDetect; /**< Debounce counter to enter in Detect state */\r
- TSL_tCounter_T CounterDebRelease; /**< Debounce counter to enter in Release state */\r
- TSL_tCounter_T CounterDebError; /**< Debounce counter to enter in Error state */\r
- TSL_tCounter_T CounterDebDirection; /**< Debounce counter for the direction change */\r
- // Other parameters\r
- TSL_tCounter_T Resolution; /**< Position resolution */\r
- TSL_tPosition_T DirChangePos; /**< Direction change position threshold */\r
-}\r
-TSL_LinRotParam_T;\r
-\r
-/** Contains definition of a Linear and Rotary sensor.\r
- * Variables of this structure type can be placed in RAM or ROM.\r
- */\r
-typedef struct\r
-{\r
- TSL_LinRotData_T *p_Data; /**< Data (state id, counter, flags, ...) */\r
- TSL_LinRotParam_T *p_Param; /**< Parameters (thresholds, debounce, ...) */\r
- TSL_ChannelData_T *p_ChD; /**< First Channel Data (Meas, Ref, Delta, ...) */\r
- TSL_tNb_T NbChannels; /**< Number of channels */\r
- CONST uint16_t *p_DeltaCoeff; /**< Coefficient to apply on Delta */\r
- CONST TSL_tsignPosition_T *p_PosOff; /**< Position offset table */\r
- TSL_tIndex_T SctComp; /**< Sector Computation */\r
- TSL_tIndex_T PosCorr; /**< Position Correction */\r
- CONST TSL_State_T *p_SM; /**< State Machine */\r
- CONST TSL_LinRotMethods_T *p_Methods; /**< Methods */\r
-}\r
-TSL_LinRot_T;\r
-\r
-/** Contains definition of a Basic Linear and Rotary sensor.\r
- * Variables of this structure type can be placed in RAM or ROM.\r
- * Basic sensor does not contain its own state machine and methods. It used\r
- * default ones instead to gain memory space.\r
- */\r
-typedef struct\r
-{\r
- TSL_LinRotData_T *p_Data; /**< Data (state id, counter, flags, ...) */\r
- TSL_LinRotParam_T *p_Param; /**< Parameters (thresholds, debounce, ...) */\r
- TSL_ChannelData_T *p_ChD; /**< First Channel Data (Meas, Ref, Delta, ...) */\r
- TSL_tNb_T NbChannels; /**< Number of channels */\r
- CONST uint16_t *p_DeltaCoeff; /**< Coefficient to apply on Delta */\r
- CONST TSL_tsignPosition_T *p_PosOff; /**< Position offset table */\r
- TSL_tIndex_T SctComp; /**< Sector Computation */\r
- TSL_tIndex_T PosCorr; /**< Position Correction */\r
-}\r
-TSL_LinRotB_T;\r
-\r
-/* Exported variables --------------------------------------------------------*/\r
-/* Exported macros -----------------------------------------------------------*/\r
-\r
-/* Exported functions --------------------------------------------------------*/\r
-\r
-// "Object methods" functions\r
-void TSL_linrot_Init(void);\r
-void TSL_linrot_Process(void);\r
-TSL_Status_enum_T TSL_linrot_CalcPos(void);\r
-\r
-// Utility functions\r
-void TSL_linrot_SetStateCalibration(TSL_tCounter_T delay);\r
-void TSL_linrot_SetStateOff(void);\r
-#if !defined(TSLPRM_STM8TL5X) && !defined(STM8TL5X)\r
-void TSL_linrot_SetStateBurstOnly(void);\r
-#endif\r
-TSL_StateId_enum_T TSL_linrot_GetStateId(void);\r
-TSL_StateMask_enum_T TSL_linrot_GetStateMask(void);\r
-TSL_tNb_T TSL_linrot_IsChanged(void);\r
-\r
-// State machine functions\r
-void TSL_linrot_CalibrationStateProcess(void);\r
-void TSL_linrot_DebCalibrationStateProcess(void);\r
-void TSL_linrot_ReleaseStateProcess(void);\r
-void TSL_linrot_DebReleaseProxStateProcess(void);\r
-void TSL_linrot_DebReleaseDetectStateProcess(void);\r
-void TSL_linrot_DebReleaseTouchStateProcess(void);\r
-void TSL_linrot_ProxStateProcess(void);\r
-void TSL_linrot_DebProxStateProcess(void);\r
-void TSL_linrot_DebProxDetectStateProcess(void);\r
-void TSL_linrot_DebProxTouchStateProcess(void);\r
-void TSL_linrot_DetectStateProcess(void);\r
-void TSL_linrot_DebDetectStateProcess(void);\r
-void TSL_linrot_TouchStateProcess(void);\r
-void TSL_linrot_DebTouchStateProcess(void);\r
-void TSL_linrot_ErrorStateProcess(void);\r
-void TSL_linrot_DebErrorStateProcess(void);\r
-void TSL_linrot_OffStateProcess(void);\r
-\r
-// Position offset constant tables and corrections\r
-\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_3CH_LIN_M1[3][3];\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_3CH_LIN_M2[3][3];\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_3CH_LIN_H[3][3];\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_3CH_ROT_M[3][3];\r
-\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_4CH_LIN_M1[4][4];\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_4CH_LIN_M2[4][4];\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_4CH_LIN_H[4][4];\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_4CH_ROT_M[4][4];\r
-\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_5CH_LIN_M1[5][5];\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_5CH_LIN_M2[5][5];\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_5CH_LIN_H[5][5];\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_5CH_ROT_M[5][5];\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_5CH_ROT_D[5][5];\r
-\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_6CH_LIN_M1[6][6];\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_6CH_LIN_M2[6][6];\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_6CH_LIN_H[6][6];\r
-extern CONST TSL_tsignPosition_T TSL_POSOFF_6CH_ROT_M[6][6];\r
-\r
-#define TSL_SCTCOMP_3CH_LIN_M1 (128)\r
-#define TSL_POSCORR_3CH_LIN_M1 (64)\r
-#define TSL_SCTCOMP_3CH_LIN_M2 (256)\r
-#define TSL_POSCORR_3CH_LIN_M2 (256)\r
-\r
-#define TSL_SCTCOMP_3CH_LIN_H (128)\r
-#define TSL_POSCORR_3CH_LIN_H (128)\r
-\r
-#define TSL_SCTCOMP_3CH_ROT_M (85)\r
-\r
-#define TSL_SCTCOMP_4CH_LIN_M1 (85)\r
-#define TSL_POSCORR_4CH_LIN_M1 (43)\r
-#define TSL_SCTCOMP_4CH_LIN_M2 (128)\r
-#define TSL_POSCORR_4CH_LIN_M2 (128)\r
-\r
-#define TSL_SCTCOMP_4CH_LIN_H (85)\r
-#define TSL_POSCORR_4CH_LIN_H (85)\r
-\r
-#define TSL_SCTCOMP_4CH_ROT_M (64)\r
-\r
-#define TSL_SCTCOMP_5CH_LIN_M1 (64)\r
-#define TSL_POSCORR_5CH_LIN_M1 (32)\r
-#define TSL_SCTCOMP_5CH_LIN_M2 (85)\r
-#define TSL_POSCORR_5CH_LIN_M2 (85)\r
-\r
-#define TSL_SCTCOMP_5CH_LIN_H (64)\r
-#define TSL_POSCORR_5CH_LIN_H (64)\r
-\r
-#define TSL_SCTCOMP_5CH_ROT_M (51)\r
-\r
-#define TSL_SCTCOMP_5CH_ROT_D (26)\r
-\r
-#define TSL_SCTCOMP_6CH_LIN_M1 (51)\r
-#define TSL_POSCORR_6CH_LIN_M1 (25)\r
-#define TSL_SCTCOMP_6CH_LIN_M2 (64)\r
-#define TSL_POSCORR_6CH_LIN_M2 (64)\r
-\r
-#define TSL_SCTCOMP_6CH_LIN_H (51)\r
-#define TSL_POSCORR_6CH_LIN_H (51)\r
-\r
-#define TSL_SCTCOMP_6CH_ROT_M (43)\r
-\r
-#endif /* __TSL_LINROT_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_object.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_object.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_OBJECT_H\r
-#define __TSL_OBJECT_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_touchkey.h"\r
-#include "tsl_linrot.h"\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-#define TSL_OBJ_TYPE_TKEY_MASK (0x10) /**< TouchKey object mask */\r
-#define TSL_OBJ_TYPE_LINROT_MASK (0x20) /**< Linear and Rotary objects mask */\r
-#define TSL_OBJ_TYPE_TRACKNAV_MASK (0x40) /**< TrackPad and NaviPad objects mask */\r
-\r
-/** Contains all different kinds of sensors.\r
- */\r
-typedef enum\r
-{\r
- TSL_OBJ_TOUCHKEY = (TSL_OBJ_TYPE_TKEY_MASK + 0), /**< Normal TouchKey */\r
- TSL_OBJ_TOUCHKEYB = (TSL_OBJ_TYPE_TKEY_MASK + 1), /**< Basic TouchKey */\r
- TSL_OBJ_LINEAR = (TSL_OBJ_TYPE_LINROT_MASK + 0), /**< Normal Linear sensor */\r
- TSL_OBJ_LINEARB = (TSL_OBJ_TYPE_LINROT_MASK + 1), /**< Basic Linear sensor */\r
- TSL_OBJ_ROTARY = (TSL_OBJ_TYPE_LINROT_MASK + 2), /**< Normal Rotary sensor */\r
- TSL_OBJ_ROTARYB = (TSL_OBJ_TYPE_LINROT_MASK + 3), /**< Basic Rotary sensor */\r
- TSL_OBJ_TRACKPAD = (TSL_OBJ_TYPE_TRACKNAV_MASK + 0), /**< TrackPad sensor */\r
- TSL_OBJ_NAVIPAD = (TSL_OBJ_TYPE_TRACKNAV_MASK + 1) /**< NaviPad sensor */\r
-}\r
-TSL_ObjectType_enum_T;\r
-\r
-/** Contains the definition of an Object.\r
- * Variables of this structure type can be placed in RAM or ROM.\r
- */\r
-typedef struct\r
-{\r
- TSL_ObjectType_enum_T Type; /**< Object type */\r
- void *Elmt; /**< Pointer to the object */\r
-}\r
-TSL_Object_T;\r
-\r
-/** Contains the definition of a Group of Objects.\r
- * Variables of this structure type must be placed in RAM only.\r
- */\r
-typedef struct\r
-{\r
- CONST TSL_Object_T *p_Obj; /**< Pointer to the first object */\r
- TSL_tNb_T NbObjects; /**< Number of objects in the group */\r
- TSL_tNb_T StateMask; /**< "OR" of all objects state mask */\r
- TSL_StateChange_enum_T Change; /**< The State is different from the previous one */\r
-}\r
-TSL_ObjectGroup_T;\r
-\r
-/* Exported functions --------------------------------------------------------*/\r
-\r
-void TSL_obj_GroupInit(TSL_ObjectGroup_T *objgrp);\r
-void TSL_obj_GroupProcess(TSL_ObjectGroup_T *objgrp);\r
-void TSL_obj_SetGlobalObj(CONST TSL_Object_T *pobj);\r
-\r
-#endif /* __TSL_OBJECT_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_time.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_time.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_TIME_H\r
-#define __TSL_TIME_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-\r
-#if defined(STM8TL5X)\r
-#include "tsl_acq_stm8tl5x.h"\r
-#include "tsl_time_stm8tl5x.h"\r
-#endif\r
-\r
-#if defined(STM32F0XX)\r
-#include "tsl_acq_stm32f0xx.h"\r
-#include "tsl_time_stm32f0xx.h"\r
-#endif\r
-\r
-#if defined(STM32F30X) || defined(STM32F37X)\r
-#include "tsl_acq_stm32f3xx.h"\r
-#include "tsl_time_stm32f3xx.h"\r
-#endif\r
-\r
-#if defined(STM32L1XX_HD)\r
-#if defined(TSLPRM_STM32L1XX_SW_ACQ)\r
-#include "tsl_acq_stm32l1xx_sw.h" // Software acquisition\r
-#else\r
-#include "tsl_acq_stm32l1xx_hw.h" // Hardware acquisition with Timers (default)\r
-#endif\r
-#include "tsl_time_stm32l1xx.h"\r
-#endif\r
-\r
-#if defined(STM32L1XX_MD)\r
-#include "tsl_acq_stm32l1xx_sw.h" // Software acquisition only\r
-#include "tsl_time_stm32l1xx.h"\r
-#endif\r
-\r
-#if defined(STM32L1XX_MDP)\r
-#if defined(TSLPRM_STM32L1XX_SW_ACQ)\r
-#include "tsl_acq_stm32l1xx_sw.h" // Software acquisition\r
-#else\r
-#include "tsl_acq_stm32l1xx_hw.h" // Hardware acquisition with Timers (default)\r
-#endif\r
-#include "tsl_time_stm32l1xx.h"\r
-#endif\r
-\r
-/* Exported functions ------------------------------------------------------- */\r
-\r
-void TSL_tim_ProcessIT(void);\r
-TSL_Status_enum_T TSL_tim_CheckDelay_ms(TSL_tTick_ms_T delay_ms, __IO TSL_tTick_ms_T *last_tick);\r
-TSL_Status_enum_T TSL_tim_CheckDelay_sec(TSL_tTick_sec_T delay_sec, __IO TSL_tTick_sec_T *last_tick);\r
-void TSL_CallBack_TimerTick(void);\r
-\r
-#endif /* __TSL_TIME_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_time_stm32f0xx.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_time_stm32f0xx.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_TIME_STM32F0XX_H\r
-#define __TSL_TIME_STM32F0XX_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "stm32f0xx.h"\r
-#include "tsl_conf_stm32f0xx.h"\r
-#include "tsl_types.h"\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-TSL_Status_enum_T TSL_tim_Init(void);\r
-\r
-#endif /* __TSL_TIME_STM32F0XX_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_time_stm32f3xx.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_time_stm32f3xx.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_TIME_STM32F3XX_H\r
-#define __TSL_TIME_STM32F3XX_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#if defined(STM32F30X)\r
-#include "stm32f30x.h"\r
-#endif\r
-#if defined(STM32F37X)\r
-#include "stm32f37x.h"\r
-#endif\r
-#include "tsl_conf_stm32f3xx.h"\r
-#include "tsl_types.h"\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-TSL_Status_enum_T TSL_tim_Init(void);\r
-\r
-#endif /* __TSL_TIME_STM32F3XX_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_time_stm32l1xx.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_time_stm32l1xx.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_TIME_STM32L1XX_H\r
-#define __TSL_TIME_STM32L1XX_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "stm32l1xx.h"\r
-#include "tsl_conf_stm32l1xx.h"\r
-#include "tsl_types.h"\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-TSL_Status_enum_T TSL_tim_Init(void);\r
-\r
-#endif /* __TSL_TIME_STM32L1XX_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_time_stm8tl5x.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_time_stm8tl5x.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_TIME_STM8TL5X_H\r
-#define __TSL_TIME_STM8TL5X_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "stm8tl5x.h"\r
-#include "tsl_conf_stm8tl5x.h"\r
-#include "tsl_types.h"\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-TSL_Status_enum_T TSL_tim_Init(void);\r
-\r
-#endif /* __TSL_TIME_STM8TL5X_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_touchkey.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains external declarations of the tsl_touchkey.c file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_TOUCHKEY_H\r
-#define __TSL_TOUCHKEY_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_acq.h"\r
-#include "tsl_time.h"\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-/** Contains all data related to TouchKey sensor.\r
- * Variables of this structure type must be placed in RAM only.\r
- */\r
-typedef struct\r
-{\r
- TSL_StateId_enum_T StateId; /**< Current state identifier */\r
- unsigned int Counter : 6; /**< Generic counter for debounce, calibration & DTO */\r
- unsigned int Change : 1; /**< The State is different from the previous one (TSL_StateChange_enum_T) */\r
- unsigned int DxSLock : 1; /**< The State is locked by the DxS (TSL_Bool_enum_T) */\r
-}\r
-TSL_TouchKeyData_T;\r
-\r
-/** Contains all parameters related to TouchKey sensor.\r
- * Variables of this structure type can be placed in RAM or ROM.\r
- */\r
-typedef struct\r
-{\r
-#if TSLPRM_USE_PROX > 0\r
- TSL_tThreshold_T ProxInTh; /**< Proximity in threshold */\r
- TSL_tThreshold_T ProxOutTh; /**< Proximity out threshold */\r
-#endif\r
- TSL_tThreshold_T DetectInTh; /**< Detection in threshold */\r
- TSL_tThreshold_T DetectOutTh; /**< Detection out threshold */\r
- TSL_tThreshold_T CalibTh; /**< Calibration threshold */\r
- TSL_tCounter_T CounterDebCalib; /**< Debounce counter to enter in Calibration state */\r
-#if TSLPRM_USE_PROX > 0\r
- TSL_tCounter_T CounterDebProx; /**< Debounce counter to enter in Proximity state */\r
-#endif\r
- TSL_tCounter_T CounterDebDetect; /**< Debounce counter to enter in Detect state */\r
- TSL_tCounter_T CounterDebRelease; /**< Debounce counter to enter in Release state */\r
- TSL_tCounter_T CounterDebError; /**< Debounce counter to enter in Error state */\r
-}\r
-TSL_TouchKeyParam_T;\r
-\r
-/** Contains definition of a TouchKey sensor.\r
- * Variables of this structure type can be placed in RAM or ROM.\r
- */\r
-typedef struct\r
-{\r
- TSL_TouchKeyData_T *p_Data; /**< Data (state id, counter, flags, ...) */\r
- TSL_TouchKeyParam_T *p_Param; /**< Parameters (thresholds, debounce, ...) */\r
- TSL_ChannelData_T *p_ChD; /**< Channel Data (Meas, Ref, Delta, ...) */\r
- CONST TSL_State_T *p_SM; /**< State Machine */\r
- CONST TSL_TouchKeyMethods_T *p_Methods; /**< Methods */\r
-}\r
-TSL_TouchKey_T;\r
-\r
-/** Contains definition of a Basic TouchKey sensor.\r
- * Variables of this structure type can be placed in RAM or ROM.\r
- * Basic sensor does not contain its own state machine and methods. It used\r
- * default ones instead to gain memory space.\r
- */\r
-typedef struct\r
-{\r
- TSL_TouchKeyData_T *p_Data; /**< Data (state id, counter, flags, ...) */\r
- TSL_TouchKeyParam_T *p_Param; /**< Parameters (thresholds, debounce, ...) */\r
- TSL_ChannelData_T *p_ChD; /**< Channel Data (Meas, Ref, Delta, ...) */\r
-}\r
-TSL_TouchKeyB_T;\r
-\r
-/* Exported variables --------------------------------------------------------*/\r
-/* Exported macros -----------------------------------------------------------*/\r
-\r
-/* Exported functions --------------------------------------------------------*/\r
-\r
-// "Object methods" functions\r
-void TSL_tkey_Init(void);\r
-void TSL_tkey_Process(void);\r
-\r
-// Utility functions\r
-void TSL_tkey_SetStateCalibration(TSL_tCounter_T delay);\r
-void TSL_tkey_SetStateOff(void);\r
-#if !defined(TSLPRM_STM8TL5X) && !defined(STM8TL5X)\r
-void TSL_tkey_SetStateBurstOnly(void);\r
-#endif\r
-TSL_StateId_enum_T TSL_tkey_GetStateId(void);\r
-TSL_StateMask_enum_T TSL_tkey_GetStateMask(void);\r
-TSL_tNb_T TSL_tkey_IsChanged(void);\r
-\r
-// State machine functions\r
-void TSL_tkey_CalibrationStateProcess(void);\r
-void TSL_tkey_DebCalibrationStateProcess(void);\r
-void TSL_tkey_ReleaseStateProcess(void);\r
-void TSL_tkey_DebReleaseProxStateProcess(void);\r
-void TSL_tkey_DebReleaseDetectStateProcess(void);\r
-void TSL_tkey_DebReleaseTouchStateProcess(void);\r
-void TSL_tkey_ProxStateProcess(void);\r
-void TSL_tkey_DebProxStateProcess(void);\r
-void TSL_tkey_DebProxDetectStateProcess(void);\r
-void TSL_tkey_DebProxTouchStateProcess(void);\r
-void TSL_tkey_DetectStateProcess(void);\r
-void TSL_tkey_DebDetectStateProcess(void);\r
-void TSL_tkey_TouchStateProcess(void);\r
-void TSL_tkey_DebTouchStateProcess(void);\r
-void TSL_tkey_ErrorStateProcess(void);\r
-void TSL_tkey_DebErrorStateProcess(void);\r
-void TSL_tkey_OffStateProcess(void);\r
-\r
-#endif /* __TSL_TOUCHKEY_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_types.h\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all general structures definition.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_TYPES_H\r
-#define __TSL_TYPES_H\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-\r
-/** Generic Boolean status\r
-*/\r
-typedef enum\r
-{\r
- TSL_FALSE = 0, /**< A False value */\r
- TSL_TRUE = 1 /**< A True value */\r
-}\r
-TSL_Bool_enum_T;\r
-\r
-/** Generic status returned by functions\r
-*/\r
-typedef enum\r
-{\r
- TSL_STATUS_OK = 0, /**< The function has been executed correctly */\r
- TSL_STATUS_BUSY = 1, /**< The function is in a Busy state */\r
- TSL_STATUS_ERROR = 2 /**< The function has been executed not correctly */\r
-} TSL_Status_enum_T;\r
-\r
-/** DataReady status : 1 bit\r
- - Used by acquisition to indicate if a new measurement is ready or not.\r
-*/\r
-typedef enum\r
-{\r
- TSL_DATA_NOT_READY = 0, /**< No new measurement or measurement treated */\r
- TSL_DATA_READY = 1 /**< A new measurement is ready */\r
-} TSL_DataReady_enum_T;\r
-\r
-/** State change status\r
-*/\r
-typedef enum\r
-{\r
- TSL_STATE_NOT_CHANGED = 0, /**< The object has the same state */\r
- TSL_STATE_CHANGED = 1 /**< The object has changed of state */\r
-} TSL_StateChange_enum_T;\r
-\r
-#define TSL_ACQ_STATUS_ERROR_MASK (0x02) /**< Associated to TSL_AcqStatus_enum_T */\r
-\r
-/** Acquisition status\r
-*/\r
-typedef enum\r
-{\r
- TSL_ACQ_STATUS_OK = 0, /**< The acquisition is correct */\r
- TSL_ACQ_STATUS_NOISE = 1, /**< Noise detected during the acquisition */\r
- TSL_ACQ_STATUS_ERROR_MIN = TSL_ACQ_STATUS_ERROR_MASK, /**< The measure is below the minimum threshold */\r
- TSL_ACQ_STATUS_ERROR_MAX = (TSL_ACQ_STATUS_ERROR_MASK | 0x01) /**< The measure is above the maximum threshold */\r
-} TSL_AcqStatus_enum_T;\r
-\r
-/** Bank status\r
-*/\r
-typedef enum\r
-{\r
- TSL_BANK_STATUS_DISABLED = 0, /**< The bank is disabled */\r
- TSL_BANK_STATUS_ENABLED = 1 /**< The bank is enabled */\r
-} TSL_BankStatus_enum_T;\r
-\r
-/** Zone status\r
-*/\r
-typedef enum\r
-{\r
- TSL_ZONE_STATUS_DISABLED = 0, /**< The zone is disabled */\r
- TSL_ZONE_STATUS_ENABLED = 1 /**< The zone is enabled */\r
-}TSL_ZoneStatus_enum_T;\r
-\r
-#define TSL_OBJ_STATUS_ACQ_MASK (0x01) /**< Associated to TSL_ObjStatus_enum_T */\r
-#define TSL_OBJ_STATUS_BURST_MASK (0x02) /**< Associated to TSL_ObjStatus_enum_T */\r
-\r
-/** Object status\r
-*/\r
-typedef enum\r
-{\r
- TSL_OBJ_STATUS_OFF = 0, /**< No burst and no acquisition */\r
- TSL_OBJ_STATUS_BURST_ONLY = TSL_OBJ_STATUS_BURST_MASK, /**< Burst only */\r
- TSL_OBJ_STATUS_ON = (TSL_OBJ_STATUS_BURST_MASK | TSL_OBJ_STATUS_ACQ_MASK) /**< Burst and acquisition */\r
-} TSL_ObjStatus_enum_T;\r
-\r
-#define TSL_STATE_ERROR_BIT_MASK (0x80) /**< Associated to TSL_StateMask_enum_T */\r
-#define TSL_STATE_OFF_BIT_MASK (0x40) /**< Associated to TSL_StateMask_enum_T */\r
-#define TSL_STATE_DEBOUNCE_BIT_MASK (0x20) /**< Associated to TSL_StateMask_enum_T */\r
-#define TSL_STATE_CALIB_BIT_MASK (0x10) /**< Associated to TSL_StateMask_enum_T */\r
-#define TSL_STATE_TOUCH_BIT_MASK (0x08) /**< Associated to TSL_StateMask_enum_T */\r
-#define TSL_STATE_DETECT_BIT_MASK (0x04) /**< Associated to TSL_StateMask_enum_T */\r
-#define TSL_STATE_PROX_BIT_MASK (0x02) /**< Associated to TSL_StateMask_enum_T */\r
-#define TSL_STATE_RELEASE_BIT_MASK (0x01) /**< Associated to TSL_StateMask_enum_T */\r
-\r
-/** Object state masks\r
-*/\r
-typedef enum\r
-{\r
- // Calibration states\r
- TSL_STATEMASK_CALIB = TSL_STATE_CALIB_BIT_MASK, /**< 0x10 */\r
- TSL_STATEMASK_DEB_CALIB = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_CALIB_BIT_MASK), /**< 0x30 */\r
- // Release states\r
- TSL_STATEMASK_RELEASE = TSL_STATE_RELEASE_BIT_MASK, /**< 0x01 */\r
- TSL_STATEMASK_DEB_RELEASE_PROX = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_RELEASE_BIT_MASK | TSL_STATE_PROX_BIT_MASK), /**< 0x23 */\r
- TSL_STATEMASK_DEB_RELEASE_DETECT = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_RELEASE_BIT_MASK | TSL_STATE_DETECT_BIT_MASK), /**< 0x25 */\r
- TSL_STATEMASK_DEB_RELEASE_TOUCH = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_RELEASE_BIT_MASK | TSL_STATE_TOUCH_BIT_MASK), /**< 0x29 */\r
- // Proximity states\r
- TSL_STATEMASK_PROX = TSL_STATE_PROX_BIT_MASK, /**< 0x02 */\r
- TSL_STATEMASK_DEB_PROX = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_PROX_BIT_MASK), /**< 0x22 */\r
- TSL_STATEMASK_DEB_PROX_DETECT = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_PROX_BIT_MASK | TSL_STATE_DETECT_BIT_MASK), /**< 0x26 */\r
- TSL_STATEMASK_DEB_PROX_TOUCH = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_PROX_BIT_MASK | TSL_STATE_TOUCH_BIT_MASK), /**< 0x2A */\r
- // Detect states\r
- TSL_STATEMASK_DETECT = TSL_STATE_DETECT_BIT_MASK, /**< 0x04 */\r
- TSL_STATEMASK_DEB_DETECT = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_DETECT_BIT_MASK), /**< 0x24 */\r
- // Touch state\r
- TSL_STATEMASK_TOUCH = TSL_STATE_TOUCH_BIT_MASK, /**< 0x08 */\r
- // Error states\r
- TSL_STATEMASK_ERROR = TSL_STATE_ERROR_BIT_MASK, /**< 0x80 */\r
- TSL_STATEMASK_DEB_ERROR_CALIB = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_ERROR_BIT_MASK | TSL_STATE_CALIB_BIT_MASK), /**< 0xB0 */\r
- TSL_STATEMASK_DEB_ERROR_RELEASE = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_ERROR_BIT_MASK | TSL_STATE_RELEASE_BIT_MASK), /**< 0xA1 */\r
- TSL_STATEMASK_DEB_ERROR_PROX = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_ERROR_BIT_MASK | TSL_STATE_PROX_BIT_MASK), /**< 0xA2 */\r
- TSL_STATEMASK_DEB_ERROR_DETECT = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_ERROR_BIT_MASK | TSL_STATE_DETECT_BIT_MASK), /**< 0xA4 */\r
- TSL_STATEMASK_DEB_ERROR_TOUCH = (TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_ERROR_BIT_MASK | TSL_STATE_TOUCH_BIT_MASK), /**< 0xA8 */\r
- // OFF state\r
- TSL_STATEMASK_OFF = TSL_STATE_OFF_BIT_MASK, /**< 0x40 */\r
- // Other states not associated to a state id\r
- 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 */\r
- TSL_STATEMASK_UNKNOWN = 0 /**< 0x00 */\r
-} TSL_StateMask_enum_T;\r
-\r
-/** Object state identifiers\r
-*/\r
-typedef enum\r
-{\r
- // Calibration states\r
- TSL_STATEID_CALIB = 0, /**< 0 - Object is in Calibration */\r
- TSL_STATEID_DEB_CALIB = 1, /**< 1 - Object is in Debounce Calibration */\r
- // Release states\r
- TSL_STATEID_RELEASE = 2, /**< 2 - Object is released */\r
- TSL_STATEID_DEB_RELEASE_PROX = 3, /**< 3 - Object is in Debounce Release from Proximity state */\r
- TSL_STATEID_DEB_RELEASE_DETECT = 4, /**< 4 - Object is in Debounce Release from Detect state */\r
- TSL_STATEID_DEB_RELEASE_TOUCH = 5, /**< 5 - Object is in Debounce Release from Touch state */\r
- // Proximity states\r
- TSL_STATEID_PROX = 6, /**< 6 - Object is in Proximity */\r
- TSL_STATEID_DEB_PROX = 7, /**< 7 - Object is in Debounce Proximity from Release state */\r
- TSL_STATEID_DEB_PROX_DETECT = 8, /**< 8 - Object is in Debounce Proximity from Detect state */\r
- TSL_STATEID_DEB_PROX_TOUCH = 9, /**< 9 - Object is in Debounce Proximity from Detect state */\r
- // Detect states\r
- TSL_STATEID_DETECT = 10, /**< 10 - Object is in Detect */\r
- TSL_STATEID_DEB_DETECT = 11, /**< 11 - Object is in Debounce Detect */\r
- // Touch state\r
- TSL_STATEID_TOUCH = 12, /**< 12 - Object is in Touch */\r
- // Error states\r
- TSL_STATEID_ERROR = 13, /**< 13 - Object is in Error */\r
- TSL_STATEID_DEB_ERROR_CALIB = 14, /**< 14 - Object is in Debounce Error from Calibration */\r
- TSL_STATEID_DEB_ERROR_RELEASE = 15, /**< 15 - Object is in Debounce Error from Release */\r
- TSL_STATEID_DEB_ERROR_PROX = 16, /**< 16 - Object is in Debounce Error from Proximity */\r
- TSL_STATEID_DEB_ERROR_DETECT = 17, /**< 17 - Object is in Debounce Error from Detect */\r
- TSL_STATEID_DEB_ERROR_TOUCH = 18, /**< 18 - Object is in Debounce Error from Touch */\r
- // Other states\r
- TSL_STATEID_OFF = 19 /**< 19 - Object is OFF (no burst, no acquisition) */\r
-} TSL_StateId_enum_T;\r
-\r
-/** Object state\r
-*/\r
-typedef struct\r
-{\r
- TSL_StateMask_enum_T StateMask; /**< Current state mask */\r
- void(* StateFunc)(void); /**< Function executed in the state */\r
-}\r
-TSL_State_T;\r
-\r
-/** Touchkey methods\r
-*/\r
-typedef struct\r
-{\r
- void(* Init)(void); /**< Used to initialize the TouchKey sensor */\r
- void(* Process)(void); /**< Used to execute the TouchKey sensor state machine */\r
-}\r
-TSL_TouchKeyMethods_T;\r
-\r
-/** Linear/Rotary methods\r
-*/\r
-typedef struct\r
-{\r
- void(* Init)(void); /**< Used to initialize the Linear/Rotary sensor */\r
- void(* Process)(void); /**< Used to execute the Linear/Rotary sensor state machine */\r
- TSL_Status_enum_T(* CalcPosition)(void); /**< Used to calculate the Linear/Rotary sensor position */\r
-}\r
-TSL_LinRotMethods_T;\r
-\r
-#endif /* __TSL_TYPES_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains the STMTouch Driver main functions.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-/* Private macros ------------------------------------------------------------*/\r
-/* Private variables ---------------------------------------------------------*/\r
-/* Private functions prototype -----------------------------------------------*/\r
-\r
-/**\r
- * @brief Initializes the TS interface.\r
- * @param bank Array holding all the banks\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_Init(CONST TSL_Bank_T *bank)\r
-{\r
- TSL_Status_enum_T retval;\r
-\r
- // Get banks array\r
- TSL_Globals.Bank_Array = bank;\r
-\r
- // Initialization of the timing module\r
- retval = TSL_tim_Init();\r
-\r
- if (retval == TSL_STATUS_OK)\r
- {\r
- // Initialization of the acquisition module\r
- retval = TSL_acq_Init();\r
- }\r
-\r
- return retval;\r
-}\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_acq.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the acquisition in general.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_acq.h"\r
-#include "tsl_globals.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-\r
-/* Private macros ------------------------------------------------------------*/\r
-#define IS_BANK_INDEX_OK(INDEX) (((INDEX) == 0) || (((INDEX) > 0) && ((INDEX) < TSLPRM_TOTAL_BANKS)))\r
-\r
-/* Private variables ---------------------------------------------------------*/\r
-/* Private functions prototype -----------------------------------------------*/\r
-\r
-/**\r
- * @brief Read all channels measurement of a Bank, calculate Delta\r
- * @param[in] idx_bk Index of the Bank to access\r
- * @param[in] mfilter Pointer to the Measure filter function\r
- * @param[in] dfilter Pointer to the Delta filter function\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_acq_BankGetResult(TSL_tIndex_T idx_bk, TSL_pFuncMeasFilter_T mfilter, TSL_pFuncDeltaFilter_T dfilter)\r
-{\r
- TSL_Status_enum_T retval = TSL_STATUS_OK;\r
- TSL_tIndex_T idx_ch;\r
- TSL_tIndexDest_T idx_dest;\r
- TSL_tMeas_T old_meas, new_meas;\r
- TSL_tDelta_T new_delta;\r
- CONST TSL_Bank_T *bank = &(TSL_Globals.Bank_Array[idx_bk]);\r
- CONST TSL_ChannelDest_T *pchDest = bank->p_chDest;\r
- CONST TSL_ChannelSrc_T *pchSrc = bank->p_chSrc;\r
-\r
- // Check parameters (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_BANK_INDEX_OK(idx_bk));\r
-\r
- // For all channels in the bank copy the measure + calculate delta and store them.\r
- for (idx_ch = 0; idx_ch < bank->NbChannels; idx_ch++)\r
- {\r
-\r
- // Get the Destination Index of the current channel\r
- idx_dest = pchDest->IdxDest;\r
-\r
- if (bank->p_chData[idx_dest].Flags.ObjStatus == TSL_OBJ_STATUS_ON)\r
- {\r
-\r
- // Initialize flag to inform the Object of that a new data is ready\r
- bank->p_chData[idx_dest].Flags.DataReady = TSL_DATA_READY;\r
-\r
- // Get the new measure (the access is different between acquisitions)\r
- new_meas = TSL_acq_GetMeas(pchSrc->IdxSrc);\r
-\r
- // Store last measure for the filter below\r
-#if TSLPRM_USE_MEAS > 0\r
- old_meas = bank->p_chData[idx_dest].Meas;\r
-#else\r
- old_meas = new_meas;\r
-#endif\r
-\r
- // Store the new measure\r
-#if TSLPRM_USE_MEAS > 0\r
- bank->p_chData[idx_dest].Meas = new_meas;\r
-#endif\r
-\r
- // Check acquisition value min/max and set acquisition status flag\r
- if (new_meas < TSL_Params.AcqMin)\r
- {\r
- bank->p_chData[idx_dest].Flags.AcqStatus = TSL_ACQ_STATUS_ERROR_MIN;\r
- bank->p_chData[idx_dest].Delta = 0;\r
- retval = TSL_STATUS_ERROR;\r
- }\r
- else\r
- {\r
- if (new_meas > TSL_Params.AcqMax)\r
- {\r
- bank->p_chData[idx_dest].Flags.AcqStatus = TSL_ACQ_STATUS_ERROR_MAX;\r
- bank->p_chData[idx_dest].Delta = 0;\r
- retval = TSL_STATUS_ERROR;\r
- }\r
- else // The measure is OK\r
- {\r
- if (TSL_acq_UseFilter(&bank->p_chData[idx_dest]))\r
- {\r
- // Apply Measure filter if it exists\r
- if (mfilter)\r
- {\r
- new_meas = mfilter(old_meas, new_meas);\r
- // Store the measure (optional - used for debug purpose)\r
-#if TSLPRM_USE_MEAS > 0\r
- bank->p_chData[idx_dest].Meas = new_meas;\r
-#endif\r
- }\r
-\r
- // Calculate the new Delta\r
- new_delta = TSL_acq_ComputeDelta(bank->p_chData[idx_dest].Ref, new_meas);\r
-\r
- // Check Noise (TSL_ACQ_STATUS_OK if no Noise or if Noise detection is not supported)\r
- bank->p_chData[idx_dest].Flags.AcqStatus = TSL_acq_CheckNoise();\r
-\r
- // Apply Delta filter if it exists\r
- if (dfilter)\r
- {\r
- bank->p_chData[idx_dest].Delta = dfilter(new_delta);\r
- }\r
- else\r
- {\r
- bank->p_chData[idx_dest].Delta = new_delta;\r
- }\r
- }\r
- else\r
- {\r
- // Calculate the new Delta\r
- bank->p_chData[idx_dest].Delta = TSL_acq_ComputeDelta(bank->p_chData[idx_dest].Ref, new_meas);\r
-\r
- // Check Noise (TSL_ACQ_STATUS_OK if no Noise or if Noise detection is not supported)\r
- bank->p_chData[idx_dest].Flags.AcqStatus = TSL_acq_CheckNoise();\r
- }\r
- }\r
- }\r
- }\r
-\r
- // Next channel\r
- pchDest++;\r
- pchSrc++;\r
-\r
- }\r
-\r
- return retval;\r
-}\r
-\r
-\r
-/**\r
- * @brief Calibrate a Bank\r
- * @param[in] idx_bk Index of the Bank to access\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_acq_BankCalibrate(TSL_tIndex_T idx_bk)\r
-{\r
- TSL_Status_enum_T retval;\r
- TSL_Status_enum_T acq_status;\r
- TSL_tIndex_T idx_ch;\r
- TSL_tIndexDest_T idx_dest;\r
- TSL_tMeas_T new_meas;\r
- static TSL_tIndex_T calibration_ongoing = 0;\r
- static TSL_tNb_T calibration_done = 0;\r
- static TSL_tNb_T div;\r
- CONST TSL_Bank_T *bank;\r
- CONST TSL_ChannelDest_T *pchDest; // Pointer to the current channel\r
- CONST TSL_ChannelSrc_T *pchSrc; // Pointer to the current channel\r
-\r
- // Check parameters (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_BANK_INDEX_OK(idx_bk));\r
-\r
- bank = &(TSL_Globals.Bank_Array[idx_bk]);\r
-\r
- if (calibration_ongoing == 0)\r
- {\r
- switch (TSL_Params.NbCalibSamples)\r
- {\r
- case 4:\r
- div = 2;\r
- break;\r
- case 16:\r
- div = 4;\r
- break;\r
- default:\r
- TSL_Params.NbCalibSamples = 8;\r
- div = 3;\r
- break;\r
- }\r
- // Clear data for all channels of the bank\r
- TSL_acq_BankClearData(idx_bk);\r
- // Configure bank\r
- if (TSL_acq_BankConfig(idx_bk) == TSL_STATUS_OK)\r
- {\r
- // Start acquisition\r
- TSL_acq_BankStartAcq();\r
- calibration_ongoing = 1; // Calibration started\r
- calibration_done = TSL_Params.NbCalibSamples;\r
- retval = TSL_STATUS_BUSY;\r
- }\r
- else\r
- {\r
- // Stop calibration\r
- // Clear data for all channels of the bank\r
- TSL_acq_BankClearData(idx_bk);\r
- calibration_ongoing = 0;\r
- retval = TSL_STATUS_ERROR;\r
- }\r
-\r
- }\r
- else // Calibration is on-going\r
- {\r
- // Check End of Acquisition\r
- acq_status = TSL_acq_BankWaitEOC();\r
- if (acq_status == TSL_STATUS_OK)\r
- {\r
-\r
- // Get the first channel of the bank\r
- pchDest = bank->p_chDest;\r
- pchSrc = bank->p_chSrc;\r
-\r
- // Get new measurement for all channels of the bank\r
- for (idx_ch = 0; idx_ch < bank->NbChannels; idx_ch++)\r
- {\r
-\r
- // Get index of the current channel\r
- idx_dest = pchDest->IdxDest;\r
-\r
- // Get the new measure (the access is different between acquisitions)\r
- new_meas = TSL_acq_GetMeas(pchSrc->IdxSrc);\r
-\r
- // Check min/max and set status flag\r
- if ((new_meas < TSL_Params.AcqMin) || (new_meas > TSL_Params.AcqMax))\r
- {\r
- // Stop calibration\r
- // Clear data for all channels of the bank\r
- TSL_acq_BankClearData(idx_bk);\r
- calibration_ongoing = 0;\r
- return TSL_STATUS_ERROR;\r
- }\r
- else\r
- {\r
- // Add the measure\r
- bank->p_chData[idx_dest].Ref += new_meas;\r
- }\r
-\r
- // Next channel\r
- pchDest++;\r
- pchSrc++;\r
- }\r
-\r
- // Check that we have all the needed measurements\r
- calibration_done--;\r
- if (calibration_done == 0)\r
- {\r
-\r
- // Get the first channel of the bank\r
- pchDest = bank->p_chDest;\r
-\r
- // Calculate the Reference for all channels of the bank\r
- for (idx_ch = 0; idx_ch < bank->NbChannels; idx_ch++)\r
- {\r
- // Get index of the current channel\r
- idx_dest = pchDest->IdxDest;\r
- // Divide the Reference by the number of samples\r
- bank->p_chData[idx_dest].Ref >>= div;\r
- // Next channel\r
- pchDest++;\r
- }\r
-\r
- // End\r
- calibration_ongoing = 0;\r
- retval = TSL_STATUS_OK;\r
- }\r
- else // Restart a new measurement on the bank\r
- {\r
- TSL_acq_BankStartAcq();\r
- retval = TSL_STATUS_BUSY;\r
- }\r
- }\r
- else\r
- if (acq_status == TSL_STATUS_ERROR)\r
- {\r
- // Stop calibration\r
- // Clear data for all channels of the bank\r
- TSL_acq_BankClearData(idx_bk);\r
- calibration_ongoing = 0;\r
- retval = TSL_STATUS_ERROR;\r
- }\r
- else\r
- {\r
- retval = TSL_STATUS_BUSY;\r
- }\r
- }\r
-\r
- return retval;\r
-}\r
-\r
-\r
-/**\r
- * @brief Clear Reference and Delta on all channels of a Bank\r
- * @param[in] idx_bk Index of the Bank to access\r
- * @retval None\r
- */\r
-void TSL_acq_BankClearData(TSL_tIndex_T idx_bk)\r
-{\r
- TSL_tIndex_T idx_ch;\r
- TSL_tIndexDest_T idx_Dest;\r
- CONST TSL_Bank_T *bank = &(TSL_Globals.Bank_Array[idx_bk]);\r
- CONST TSL_ChannelDest_T *pchDest = bank->p_chDest;\r
-\r
- // Check parameters (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_BANK_INDEX_OK(idx_bk));\r
-\r
- // For all channels of the bank\r
- for (idx_ch = 0; idx_ch < bank->NbChannels; idx_ch++)\r
- {\r
- idx_Dest = pchDest->IdxDest;\r
- bank->p_chData[idx_Dest].Ref = 0;\r
- bank->p_chData[idx_Dest].Delta = 0;\r
- pchDest++; // Next channel\r
- }\r
-}\r
-\r
-\r
-#if TSLPRM_USE_ZONE > 0\r
-\r
-/**\r
- * @brief Configures a Zone.\r
- * @param[in] zone Zone to configure\r
- * @param[in] idx_bk Bank index in the zone to configure\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_acq_ZoneConfig(CONST TSL_Zone_T *zone, TSL_tIndex_T idx_bk)\r
-{\r
- TSL_Status_enum_T retval;\r
-\r
- // Check parameters (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_BANK_INDEX_OK(idx_bk));\r
-\r
- TSL_Globals.This_Zone = zone;\r
-\r
- do\r
- {\r
- retval = TSL_acq_BankConfig(zone->BankIndex[idx_bk]);\r
- TSL_Globals.This_Bank = zone->BankIndex[idx_bk];\r
- idx_bk++;\r
- }\r
- while ((idx_bk < zone->NbBanks) && (retval == TSL_STATUS_ERROR));\r
-\r
- TSL_Globals.Index_In_This_Zone = idx_bk;\r
-\r
-#if TSLPRM_PXS_LOW_POWER_MODE > 0\r
- if (idx_bk < zone->NbBanks)\r
- {\r
- resetPXSLowPower();\r
- }\r
-#endif\r
-\r
- return(retval);\r
-\r
-}\r
-\r
-#endif\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_acq_stm32f0xx.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the TSC acquisition\r
- * on STM32F0xx products.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_acq_stm32f0xx.h"\r
-#include "tsl_globals.h"\r
-#include "stm32f0xx_it.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-#define TSL_DELAY_DISCHARGE (1000)\r
-\r
-#define NU (0) // Not Used IO\r
-#define CHANNEL (1) // Channel IO\r
-#define SHIELD (2) // Shield IO (= Channel IO but not acquired)\r
-#define SAMPCAP (3) // Sampling Capacitor IO\r
-\r
-/* Private macros ------------------------------------------------------------*/\r
-#define IS_BANK_INDEX_OK(INDEX) (((INDEX) == 0) || (((INDEX) > 0) && ((INDEX) < TSLPRM_TOTAL_BANKS)))\r
-#define IS_SOURCE_INDEX_OK(INDEX) (((INDEX) == 0) || (((INDEX) > 0) && ((INDEX) < TSLPRM_TOTAL_CHANNELS)))\r
-\r
-/* Private variables ---------------------------------------------------------*/\r
-\r
-/* Private functions prototype -----------------------------------------------*/\r
-void SoftDelay(uint32_t val);\r
-\r
-/**\r
- * @brief Initializes the TouchSensing GPIOs.\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_acq_InitGPIOs(void)\r
-{\r
-\r
- GPIO_InitTypeDef GPIO_InitStructure;\r
- uint32_t tmp_value_0;\r
- uint32_t tmp_value_1;\r
-\r
- //====================\r
- // GPIOs configuration\r
- //====================\r
-\r
- // Enable GPIOs clocks\r
- RCC->AHBENR |= (RCC_AHBENR_GPIOAEN | RCC_AHBENR_GPIOBEN | RCC_AHBENR_GPIOCEN);\r
-\r
- // Alternate function Output Open-Drain for Sampling Capacitor IOs\r
- //----------------------------------------------------------------\r
-\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;\r
- GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;\r
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;\r
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;\r
-\r
- // GPIOA\r
- GPIO_InitStructure.GPIO_Pin = 0;\r
-#if TSLPRM_TSC_GROUP1_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_0;\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_1;\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_2;\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_3;\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_4;\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_5;\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_6;\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_7;\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_9;\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_10;\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_11;\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_12;\r
-#endif\r
- if (GPIO_InitStructure.GPIO_Pin != 0)\r
- {\r
- GPIO_Init(GPIOA, &GPIO_InitStructure);\r
- }\r
-\r
- // GPIOB\r
- GPIO_InitStructure.GPIO_Pin = 0;\r
-#if TSLPRM_TSC_GROUP3_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_0;\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_1;\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_2;\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_3;\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_4;\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_6;\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_7;\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_11;\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_12;\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_13;\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_14;\r
-#endif\r
- if (GPIO_InitStructure.GPIO_Pin != 0)\r
- {\r
- GPIO_Init(GPIOB, &GPIO_InitStructure);\r
- }\r
-\r
- // GPIOC\r
-#if TSLPRM_TSC_GROUP3_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;\r
- GPIO_Init(GPIOC, &GPIO_InitStructure);\r
-#endif\r
-\r
- // Alternate function Output Push-Pull for Channel and Shield IOs\r
- //---------------------------------------------------------------\r
-\r
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;\r
-\r
- // GPIOA\r
- GPIO_InitStructure.GPIO_Pin = 0;\r
-#if (TSLPRM_TSC_GROUP1_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP1_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_0;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP1_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP1_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_1;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP1_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP1_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_2;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP1_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP1_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_3;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP2_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP2_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_4;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP2_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP2_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_5;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP2_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP2_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_6;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP2_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP2_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_7;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP4_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP4_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_9;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP4_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP4_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_10;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP4_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP4_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_11;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP4_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP4_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_12;\r
-#endif\r
- if (GPIO_InitStructure.GPIO_Pin != 0)\r
- {\r
- GPIO_Init(GPIOA, &GPIO_InitStructure);\r
- }\r
-\r
- // GPIOB\r
- GPIO_InitStructure.GPIO_Pin = 0;\r
-#if (TSLPRM_TSC_GROUP3_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP3_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_0;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP3_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP3_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_1;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP3_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP3_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_2;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP5_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP5_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_3;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP5_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP5_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_4;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP5_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP5_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_6;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP5_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP5_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_7;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP6_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP6_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_11;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP6_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP6_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_12;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP6_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP6_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_13;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP6_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP6_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_14;\r
-#endif\r
- if (GPIO_InitStructure.GPIO_Pin != 0)\r
- {\r
- GPIO_Init(GPIOB, &GPIO_InitStructure);\r
- }\r
-\r
- // GPIOC\r
-#if (TSLPRM_TSC_GROUP3_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP3_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;\r
- GPIO_Init(GPIOC, &GPIO_InitStructure);\r
-#endif\r
-\r
- // Set Alternate-Function AF3 for GPIOA and GPIOB\r
- //-----------------------------------------------\r
-\r
- // GPIOA\r
- tmp_value_0 = 0;\r
- tmp_value_1 = 0;\r
-#if TSLPRM_TSC_GROUP1_IO1 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (0 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO2 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (1 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO3 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (2 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO4 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (3 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO1 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (4 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO2 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (5 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO3 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (6 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO4 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (7 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO1 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (1 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO2 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (2 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO3 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (3 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO4 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (4 * 4));\r
-#endif\r
- if (tmp_value_0 != 0) {GPIOA->AFR[0] |= tmp_value_0;}\r
- if (tmp_value_1 != 0) {GPIOA->AFR[1] |= tmp_value_1;}\r
-\r
- // GPIOB\r
- tmp_value_0 = 0;\r
- tmp_value_1 = 0;\r
-#if TSLPRM_TSC_GROUP3_IO2 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (0 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO3 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (1 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO4 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (2 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO1 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (3 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO2 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (4 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO3 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (6 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO4 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (7 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO1 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (3 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO2 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (4 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO3 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (5 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO4 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (6 * 4));\r
-#endif\r
- if (tmp_value_0 != 0) {GPIOB->AFR[0] |= tmp_value_0;}\r
- if (tmp_value_1 != 0) {GPIOB->AFR[1] |= tmp_value_1;}\r
-\r
- //==================\r
- // TSC configuration\r
- //==================\r
-\r
- // Enable TSC clock\r
- RCC->AHBENR |= RCC_AHBENR_TSEN;\r
-\r
- // Disable Schmitt trigger hysteresis on all used TS IOs (Channel, Shield and Sampling IOs)\r
- //-----------------------------------------------------------------------------------------\r
-\r
- tmp_value_0 = 0xFFFFFFFF;\r
-#if TSLPRM_TSC_GROUP1_IO1 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 0);\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO2 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 1);\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO3 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 2);\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO4 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 3);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO1 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 4);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO2 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 5);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO3 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 6);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO4 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 7);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO1 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 8);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO2 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 9);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO3 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 10);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO4 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 11);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO1 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 12);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO2 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 13);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO3 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 14);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO4 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 15);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO1 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 16);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO2 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 17);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO3 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 18);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO4 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 19);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO1 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 20);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO2 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 21);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO3 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 22);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO4 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 23);\r
-#endif\r
- if (tmp_value_0 != 0xFFFFFFFF) {TSC->IOHCR &= tmp_value_0;}\r
-\r
- // Set Sampling Capacitor IOs\r
- //---------------------------\r
-\r
- tmp_value_0 = 0;\r
-#if TSLPRM_TSC_GROUP1_IO1 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 0);\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO2 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 1);\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO3 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 2);\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO4 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 3);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO1 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 4);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO2 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 5);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO3 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 6);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO4 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 7);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO1 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 8);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO2 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 9);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO3 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 10);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO4 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 11);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO1 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 12);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO2 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 13);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO3 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 14);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO4 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 15);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO1 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 16);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO2 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 17);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO3 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 18);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO4 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 19);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO1 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 20);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO2 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 21);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO3 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 22);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO4 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 23);\r
-#endif\r
- if (tmp_value_0 != 0) {TSC->IOSCR |= tmp_value_0;}\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief Initializes the acquisition module.\r
- * @param None\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_acq_Init(void)\r
-{\r
-\r
-#if TSLPRM_TSC_GPIO_CONFIG > 0\r
- TSL_acq_InitGPIOs();\r
-#endif\r
-\r
- // Enable TSC clock\r
- RCC->AHBENR |= RCC_AHBENR_TSEN;\r
-\r
- // TSC enabled\r
- TSC->CR = 0x01;\r
-\r
- // Set CTPH\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_CTPH << 28) & 0xF0000000;\r
-\r
- // Set CTPL\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_CTPL << 24) & 0x0F000000;\r
-\r
- // Set SpreadSpectrum\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_USE_SS << 16) & 0x00010000;\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_SSD << 17) & 0x00FE0000;\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_SSPSC << 15) & 0x00008000;\r
-\r
- // Set Prescaler\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_PGPSC << 12) & 0x00007000;\r
-\r
- // Set Max Count\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_MCV << 5) & 0x000000E0;\r
-\r
- // Set IO default in Output PP Low to discharge all capacitors\r
- TSC->CR &= (uint32_t)(~(1 << 4));\r
-\r
- // Set Synchronization Mode\r
-#if TSLPRM_TSC_AM > 0\r
-\r
- // Set Synchronization Pin in Alternate-Function mode\r
- RCC->AHBENR |= RCC_AHBENR_GPIOBEN; // Set GPIOB clock\r
-\r
-#if TSLPRM_TSC_SYNC_PIN == 0 // PB08\r
- GPIOB->MODER &= 0xFFFCFFFF;\r
- GPIOB->MODER |= 0x00020000;\r
- GPIOB->AFR[1] |= 0x00000003;\r
-#else // PB10\r
- GPIOB->MODER &= 0xFFCFFFFF;\r
- GPIOB->MODER |= 0x00200000;\r
- GPIOB->AFR[1] |= 0x00000300;\r
-#endif\r
-\r
- // Set Synchronization Polarity\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_SYNC_POL << 3) & 0x00000008;\r
-\r
-#endif\r
-\r
- // Set acquisition mode\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_AM << 2) & 0x00000004;\r
-\r
-#if TSLPRM_USE_ACQ_INTERRUPT > 0\r
-\r
- // Set both EOA and MCE interrupts\r
- TSC->IER |= 0x03;\r
-\r
- // Configure NVIC\r
- NVIC_SetPriority(TS_IRQn, 0);\r
- NVIC_EnableIRQ(TS_IRQn);\r
-\r
-#endif\r
-\r
- return TSL_STATUS_OK;\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief Configures a Bank.\r
- * @param[in] idx_bk Index of the Bank to configure\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk)\r
-{\r
- TSL_tIndex_T idx_ch;\r
- uint32_t objs; /* bit field of TSL_ObjStatus_enum_T type */\r
- uint32_t gx;\r
- uint32_t ioy;\r
- CONST TSL_Bank_T *bank = &(TSL_Globals.Bank_Array[idx_bk]);\r
- CONST TSL_ChannelSrc_T *pchSrc = bank->p_chSrc;\r
- CONST TSL_ChannelDest_T *pchDest = bank->p_chDest;\r
-\r
- // Check parameters (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_BANK_INDEX_OK(idx_bk));\r
-\r
- // Mark the current bank processed\r
- TSL_Globals.This_Bank = idx_bk;\r
-\r
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
- // Enable the Gx_IOy used as channels (channels + shield)\r
- TSC->IOCCR = bank->msk_IOCCR_channels;\r
- // Enable acquisition on selected Groups\r
- TSC->IOGCSR = bank->msk_IOGCSR_groups;\r
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
- // For all channels of the bank check if they are OFF or BURST_ONLY\r
- // and set acquisition status flag\r
- for (idx_ch = 0; idx_ch < bank->NbChannels; idx_ch++)\r
- {\r
-\r
- // Check Object status flag\r
- objs = bank->p_chData[pchDest->IdxDest].Flags.ObjStatus;\r
-\r
- if (objs != TSL_OBJ_STATUS_ON)\r
- {\r
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
- // Get the Channel Group mask\r
- gx = pchSrc->msk_IOGCSR_group;\r
- // Stop acquisition of the Group\r
- TSC->IOGCSR &= (uint32_t)~gx;\r
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
- if (objs == TSL_OBJ_STATUS_OFF)\r
- {\r
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
- // Get the Channel IO mask\r
- ioy = pchSrc->msk_IOCCR_channel;\r
- // Stop Burst of the Channel\r
- TSC->IOCCR &= (uint32_t)~ioy;\r
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
- }\r
- }\r
-\r
- // Next channel\r
- pchSrc++;\r
- pchDest++;\r
- }\r
-\r
- return TSL_STATUS_OK;\r
-}\r
-\r
-\r
-/**\r
- * @brief Start acquisition on a previously configured bank\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_acq_BankStartAcq(void)\r
-{\r
- // Clear both EOAIC and MCEIC flags\r
- TSC->ICR |= 0x03;\r
-\r
- // Wait capacitors discharge\r
- SoftDelay(TSL_DELAY_DISCHARGE);\r
-\r
-#if TSLPRM_TSC_IODEF > 0 // Default = Input Floating\r
- // Set IO default in Input Floating\r
- TSC->CR |= (1 << 4);\r
-#endif\r
-\r
- // Start acquisition\r
- TSC->CR |= 0x02;\r
-}\r
-\r
-\r
-/**\r
- * @brief Wait end of acquisition\r
- * @param None\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_acq_BankWaitEOC(void)\r
-{\r
- TSL_Status_enum_T retval = TSL_STATUS_BUSY;\r
-\r
- // Check EOAF flag\r
- if (TSC->ISR & 0x01)\r
- {\r
-\r
-#if TSLPRM_TSC_IODEF > 0 // Default = Input Floating\r
- // Set IO default in Output PP Low to discharge all capacitors\r
- TSC->CR &= (uint32_t)(~(1 << 4));\r
-#endif\r
-\r
- // Check MCEF flag\r
- if (TSC->ISR & 0x02)\r
- {\r
- retval = TSL_STATUS_ERROR;\r
- }\r
- else\r
- {\r
- retval = TSL_STATUS_OK;\r
- }\r
- }\r
-\r
- return retval;\r
-}\r
-\r
-\r
-/**\r
- * @brief Return the current measure\r
- * @param[in] index Index of the measure source\r
- * @retval Measure\r
- */\r
-TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndex_T index)\r
-{\r
- return(TSC->IOGXCR[index]);\r
-}\r
-\r
-\r
-/**\r
- * @brief Compute the Delta value\r
- * @param[in] ref Reference value\r
- * @param[in] meas Last Measurement value\r
- * @retval Delta value\r
- */\r
-TSL_tDelta_T TSL_acq_ComputeDelta(TSL_tRef_T ref, TSL_tMeas_T meas)\r
-{\r
- return((TSL_tDelta_T)(ref - meas));\r
-}\r
-\r
-\r
-/**\r
- * @brief Compute the Measurement value\r
- * @param[in] ref Reference value\r
- * @param[in] delta Delta value\r
- * @retval Measurement value\r
- */\r
-TSL_tMeas_T TSL_acq_ComputeMeas(TSL_tRef_T ref, TSL_tDelta_T delta)\r
-{\r
- return((TSL_tMeas_T)(ref - delta));\r
-}\r
-\r
-\r
-/**\r
- * @brief Check noise (not used)\r
- * @param None\r
- * @retval Status\r
- */\r
-TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void)\r
-{\r
- return TSL_ACQ_STATUS_OK;\r
-}\r
-\r
-\r
-/**\r
- * @brief Check if a filter must be used on the current channel (not used)\r
- * @param[in] pCh Pointer on the channel data information\r
- * @retval Result TRUE if a filter can be applied\r
- */\r
-TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh)\r
-{\r
- return TSL_TRUE;\r
-}\r
-\r
-\r
-/**\r
- * @brief Test if the Reference is incorrect (not used)\r
- * @param[in] pCh Pointer on the channel data information\r
- * @retval Result TRUE if the Reference is out of range\r
- */\r
-TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh)\r
-{\r
- return TSL_FALSE;\r
-}\r
-\r
-\r
-/**\r
- * @brief Test if the measure has crossed the reference target (not used)\r
- * @param[in] pCh Pointer on the channel data information\r
- * @param[in] new_meas Measure of the last acquisition on this channel\r
- * @retval Result TRUE if the Reference is valid\r
- */\r
-TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas)\r
-{\r
- return TSL_TRUE;\r
-}\r
-\r
-\r
-#if defined(__IAR_SYSTEMS_ICC__) // IAR/EWARM\r
-#pragma optimize=low\r
-#elif defined(__CC_ARM) // Keil/MDK-ARM\r
-#pragma O1\r
-#pragma Ospace\r
-#elif defined(__TASKING__) // Altium/Tasking\r
-#pragma optimize O0\r
-#elif defined(__GNUC__) // Atollic/True Studio + Raisonance/RKit\r
-#pragma GCC push_options\r
-#pragma GCC optimize ("O0")\r
-#endif\r
-/**\r
- * @brief Software delay (private routine)\r
- * @param val Wait delay\r
- * @retval None\r
- */\r
-void SoftDelay(uint32_t val)\r
-{\r
- __IO uint32_t i;\r
- for (i = val; i > 0; i--)\r
- {}\r
-}\r
-#if defined(__TASKING__)\r
-#pragma endoptimize\r
-#endif\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_acq_stm32f3xx.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the TSC acquisition\r
- * on STM32F3xx products.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_acq_stm32f3xx.h"\r
-#include "tsl_globals.h"\r
-#if defined(STM32F30X)\r
-#include "stm32f30x_it.h"\r
-#endif\r
-#if defined(STM32F37X)\r
-#include "stm32f37x_it.h"\r
-#endif\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-#define TSL_DELAY_DISCHARGE (1000)\r
-\r
-#define NU (0) // Not Used IO\r
-#define CHANNEL (1) // Channel IO\r
-#define SHIELD (2) // Shield IO (= Channel IO but not acquired)\r
-#define SAMPCAP (3) // Sampling Capacitor IO\r
-\r
-/* Private macros ------------------------------------------------------------*/\r
-#define IS_BANK_INDEX_OK(INDEX) (((INDEX) == 0) || (((INDEX) > 0) && ((INDEX) < TSLPRM_TOTAL_BANKS)))\r
-#define IS_SOURCE_INDEX_OK(INDEX) (((INDEX) == 0) || (((INDEX) > 0) && ((INDEX) < TSLPRM_TOTAL_CHANNELS)))\r
-\r
-/* Private variables ---------------------------------------------------------*/\r
-\r
-/* Private functions prototype -----------------------------------------------*/\r
-void SoftDelay(uint32_t val);\r
-\r
-/**\r
- * @brief Initializes the TouchSensing GPIOs.\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_acq_InitGPIOs(void)\r
-{\r
-\r
- GPIO_InitTypeDef GPIO_InitStructure;\r
- uint32_t tmp_value_0;\r
- uint32_t tmp_value_1;\r
-\r
- //====================\r
- // GPIOs configuration\r
- //====================\r
-\r
- // Enable GPIOs clocks\r
- RCC->AHBENR |= (RCC_AHBENR_GPIOAEN | RCC_AHBENR_GPIOBEN | RCC_AHBENR_GPIOCEN);\r
-\r
- // Alternate function Output Open-Drain for Sampling Capacitor IOs\r
- //----------------------------------------------------------------\r
-\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;\r
- GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;\r
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;\r
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;\r
-\r
- // GPIOA\r
- GPIO_InitStructure.GPIO_Pin = 0;\r
-#if TSLPRM_TSC_GROUP1_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_0;\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_1;\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_2;\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_3;\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_4;\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_5;\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_6;\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_7;\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_9;\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_10;\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_13;\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_14;\r
-#endif\r
- if (GPIO_InitStructure.GPIO_Pin != 0)\r
- {\r
- GPIO_Init(GPIOA, &GPIO_InitStructure);\r
- }\r
-\r
- // GPIOB\r
- GPIO_InitStructure.GPIO_Pin = 0;\r
-\r
-#if defined(STM32F30X)\r
-#if TSLPRM_TSC_GROUP3_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_0;\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_1;\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_2;\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_3;\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_4;\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_6;\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_7;\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_11;\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_12;\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_13;\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_14;\r
-#endif\r
-#endif // STM32F30X\r
-\r
-#if defined(STM32F37X)\r
-#if TSLPRM_TSC_GROUP3_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_0;\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_1;\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_3;\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_4;\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_6;\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_7;\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_14;\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_15;\r
-#endif\r
-#endif // STM32F37X\r
-\r
- if (GPIO_InitStructure.GPIO_Pin != 0)\r
- {\r
- GPIO_Init(GPIOB, &GPIO_InitStructure);\r
- }\r
-\r
- // GPIOC\r
-#if defined(STM32F30X)\r
-#if TSLPRM_TSC_GROUP3_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;\r
- GPIO_Init(GPIOC, &GPIO_InitStructure);\r
-#endif\r
-#endif // STM32F30X\r
-\r
-#if defined(STM32F37X)\r
- GPIO_InitStructure.GPIO_Pin = 0;\r
-#if TSLPRM_TSC_GROUP3_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_4;\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_5;\r
-#endif\r
- if (GPIO_InitStructure.GPIO_Pin != 0)\r
- {\r
- GPIO_Init(GPIOC, &GPIO_InitStructure);\r
- }\r
-#endif // STM32F37X\r
-\r
- // GPIOD\r
- GPIO_InitStructure.GPIO_Pin = 0;\r
-\r
-#if defined(STM32F37X)\r
-#if TSLPRM_TSC_GROUP6_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;\r
-#endif\r
-#endif // STM32F37X\r
-\r
-#if TSLPRM_TSC_GROUP8_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;\r
-#endif\r
-#if TSLPRM_TSC_GROUP8_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;\r
-#endif\r
-#if TSLPRM_TSC_GROUP8_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14;\r
-#endif\r
-#if TSLPRM_TSC_GROUP8_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;\r
-#endif\r
- if (GPIO_InitStructure.GPIO_Pin != 0)\r
- {\r
- GPIO_Init(GPIOD, &GPIO_InitStructure);\r
- }\r
-\r
- // GPIOE\r
- GPIO_InitStructure.GPIO_Pin = 0;\r
-#if TSLPRM_TSC_GROUP7_IO1 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;\r
-#endif\r
-#if TSLPRM_TSC_GROUP7_IO2 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;\r
-#endif\r
-#if TSLPRM_TSC_GROUP7_IO3 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;\r
-#endif\r
-#if TSLPRM_TSC_GROUP7_IO4 == SAMPCAP\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;\r
-#endif\r
- if (GPIO_InitStructure.GPIO_Pin != 0)\r
- {\r
- GPIO_Init(GPIOE, &GPIO_InitStructure);\r
- }\r
-\r
- // Alternate function Output Push-Pull for Channel and Shield IOs\r
- //---------------------------------------------------------------\r
-\r
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;\r
-\r
- // GPIOA\r
- GPIO_InitStructure.GPIO_Pin = 0;\r
-#if (TSLPRM_TSC_GROUP1_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP1_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_0;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP1_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP1_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_1;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP1_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP1_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_2;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP1_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP1_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_3;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP2_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP2_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_4;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP2_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP2_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_5;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP2_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP2_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_6;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP2_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP2_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_7;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP4_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP4_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_9;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP4_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP4_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_10;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP4_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP4_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_13;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP4_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP4_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_14;\r
-#endif\r
- if (GPIO_InitStructure.GPIO_Pin != 0)\r
- {\r
- GPIO_Init(GPIOA, &GPIO_InitStructure);\r
- }\r
-\r
- // GPIOB\r
- GPIO_InitStructure.GPIO_Pin = 0;\r
-\r
-#if defined(STM32F30X)\r
-#if (TSLPRM_TSC_GROUP3_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP3_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_0;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP3_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP3_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_1;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP3_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP3_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_2;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP5_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP5_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_3;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP5_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP5_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_4;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP5_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP5_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_6;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP5_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP5_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_7;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP6_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP6_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_11;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP6_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP6_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_12;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP6_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP6_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_13;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP6_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP6_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_14;\r
-#endif\r
-#endif // STM32F30X\r
-\r
-#if defined(STM32F37X)\r
-#if (TSLPRM_TSC_GROUP3_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP3_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_0;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP3_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP3_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_1;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP5_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP5_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_3;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP5_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP5_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_4;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP5_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP5_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_6;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP5_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP5_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_7;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP6_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP6_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_14;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP6_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP6_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_15;\r
-#endif\r
-#endif // STM32F37X\r
-\r
- if (GPIO_InitStructure.GPIO_Pin != 0)\r
- {\r
- GPIO_Init(GPIOB, &GPIO_InitStructure);\r
- }\r
-\r
- // GPIOC\r
-\r
-#if defined(STM32F30X)\r
-#if (TSLPRM_TSC_GROUP3_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP3_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;\r
- GPIO_Init(GPIOC, &GPIO_InitStructure);\r
-#endif\r
-#endif // STM32F30X\r
-\r
-#if defined(STM32F37X)\r
- GPIO_InitStructure.GPIO_Pin = 0;\r
-#if (TSLPRM_TSC_GROUP3_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP3_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_4;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP3_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP3_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_5;\r
-#endif\r
- if (GPIO_InitStructure.GPIO_Pin != 0)\r
- {\r
- GPIO_Init(GPIOC, &GPIO_InitStructure);\r
- }\r
-#endif // STM32F37X\r
-\r
- // GPIOD\r
- GPIO_InitStructure.GPIO_Pin = 0;\r
-\r
-#if defined(STM32F37X)\r
-#if (TSLPRM_TSC_GROUP6_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP6_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_8;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP6_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP6_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_9;\r
-#endif\r
-#endif // STM32F37X\r
-\r
-#if (TSLPRM_TSC_GROUP8_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP8_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_12;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP8_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP8_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_13;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP8_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP8_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_14;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP8_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP8_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_15;\r
-#endif\r
- if (GPIO_InitStructure.GPIO_Pin != 0)\r
- {\r
- GPIO_Init(GPIOD, &GPIO_InitStructure);\r
- }\r
-\r
- // GPIOE\r
- GPIO_InitStructure.GPIO_Pin = 0;\r
-#if (TSLPRM_TSC_GROUP7_IO1 == CHANNEL) || (TSLPRM_TSC_GROUP7_IO1 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_2;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP7_IO2 == CHANNEL) || (TSLPRM_TSC_GROUP7_IO2 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_3;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP7_IO3 == CHANNEL) || (TSLPRM_TSC_GROUP7_IO3 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_4;\r
-#endif\r
-#if (TSLPRM_TSC_GROUP7_IO4 == CHANNEL) || (TSLPRM_TSC_GROUP7_IO4 == SHIELD)\r
- GPIO_InitStructure.GPIO_Pin |= GPIO_Pin_5;\r
-#endif\r
- if (GPIO_InitStructure.GPIO_Pin != 0)\r
- {\r
- GPIO_Init(GPIOE, &GPIO_InitStructure);\r
- }\r
-\r
- // Set Alternate-Function AF3 on used TSC IOs\r
- //-------------------------------------------\r
-\r
- // GPIOA\r
- tmp_value_0 = 0;\r
- tmp_value_1 = 0;\r
-#if TSLPRM_TSC_GROUP1_IO1 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (0 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO2 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (1 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO3 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (2 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO4 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (3 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO1 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (4 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO2 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (5 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO3 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (6 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO4 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (7 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO1 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (1 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO2 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (2 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO3 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (5 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO4 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (6 * 4));\r
-#endif\r
- if (tmp_value_0 != 0) {GPIOA->AFR[0] |= tmp_value_0;}\r
- if (tmp_value_1 != 0) {GPIOA->AFR[1] |= tmp_value_1;}\r
-\r
- // GPIOB\r
- tmp_value_0 = 0;\r
- tmp_value_1 = 0;\r
-\r
-#if defined(STM32F30X)\r
-#if TSLPRM_TSC_GROUP3_IO2 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (0 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO3 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (1 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO4 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (2 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO1 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (3 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO2 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (4 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO3 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (6 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO4 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (7 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO1 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (3 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO2 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (4 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO3 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (5 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO4 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (6 * 4));\r
-#endif\r
-#endif // STM32F30X\r
-\r
-#if defined(STM32F37X)\r
-#if TSLPRM_TSC_GROUP3_IO3 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (0 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO4 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (1 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO1 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (3 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO2 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (4 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO3 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (6 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO4 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (7 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO1 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (6 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO2 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (7 * 4));\r
-#endif\r
-#endif // STM32F37X\r
-\r
- if (tmp_value_0 != 0) {GPIOB->AFR[0] |= tmp_value_0;}\r
- if (tmp_value_1 != 0) {GPIOB->AFR[1] |= tmp_value_1;}\r
-\r
- // GPIOC\r
-#if defined(STM32F30X)\r
-#if TSLPRM_TSC_GROUP3_IO1 != NU\r
- GPIOC->AFR[0] |= (uint32_t)((uint32_t)3 << (5 * 4));\r
-#endif\r
-#endif // STM32F30X\r
-\r
-#if defined(STM32F37X)\r
-#if TSLPRM_TSC_GROUP3_IO1 != NU\r
- GPIOC->AFR[0] |= (uint32_t)((uint32_t)3 << (4 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO2 != NU\r
- GPIOC->AFR[0] |= (uint32_t)((uint32_t)3 << (5 * 4));\r
-#endif\r
-#endif // STM32F37X\r
-\r
- // GPIOD\r
- tmp_value_1 = 0;\r
-\r
-#if defined(STM32F37X)\r
-#if TSLPRM_TSC_GROUP6_IO3 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (0 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO4 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (1 * 4));\r
-#endif\r
-#endif // STM32F37X\r
-\r
-#if TSLPRM_TSC_GROUP8_IO1 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (4 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP8_IO2 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (5 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP8_IO3 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (6 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP8_IO4 != NU\r
- tmp_value_1 |= (uint32_t)((uint32_t)3 << (7 * 4));\r
-#endif\r
- if (tmp_value_1 != 0) {GPIOD->AFR[1] |= tmp_value_1;}\r
-\r
- // GPIOE\r
- tmp_value_0 = 0;\r
-#if TSLPRM_TSC_GROUP7_IO1 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (2 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP7_IO2 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (3 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP7_IO3 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (4 * 4));\r
-#endif\r
-#if TSLPRM_TSC_GROUP7_IO4 != NU\r
- tmp_value_0 |= (uint32_t)((uint32_t)3 << (5 * 4));\r
-#endif\r
- if (tmp_value_0 != 0) {GPIOE->AFR[0] |= tmp_value_0;}\r
-\r
- //==================\r
- // TSC configuration\r
- //==================\r
-\r
- // Enable TSC clock\r
- RCC->AHBENR |= RCC_AHBENR_TSEN;\r
-\r
- // Disable Schmitt trigger hysteresis on all used TS IOs (Channel, Shield and Sampling IOs)\r
- //-----------------------------------------------------------------------------------------\r
-\r
- tmp_value_0 = 0xFFFFFFFF;\r
-#if TSLPRM_TSC_GROUP1_IO1 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 0);\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO2 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 1);\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO3 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 2);\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO4 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 3);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO1 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 4);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO2 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 5);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO3 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 6);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO4 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 7);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO1 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 8);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO2 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 9);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO3 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 10);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO4 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 11);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO1 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 12);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO2 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 13);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO3 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 14);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO4 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 15);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO1 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 16);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO2 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 17);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO3 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 18);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO4 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 19);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO1 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 20);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO2 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 21);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO3 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 22);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO4 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 23);\r
-#endif\r
-#if TSLPRM_TSC_GROUP7_IO1 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 24);\r
-#endif\r
-#if TSLPRM_TSC_GROUP7_IO2 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 25);\r
-#endif\r
-#if TSLPRM_TSC_GROUP7_IO3 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 26);\r
-#endif\r
-#if TSLPRM_TSC_GROUP7_IO4 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 27);\r
-#endif\r
-#if TSLPRM_TSC_GROUP8_IO1 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 28);\r
-#endif\r
-#if TSLPRM_TSC_GROUP8_IO2 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 29);\r
-#endif\r
-#if TSLPRM_TSC_GROUP8_IO3 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 30);\r
-#endif\r
-#if TSLPRM_TSC_GROUP8_IO4 != NU\r
- tmp_value_0 &= (uint32_t)~((uint32_t)1 << 31);\r
-#endif\r
- if (tmp_value_0 != 0xFFFFFFFF) {TSC->IOHCR &= tmp_value_0;}\r
-\r
- // Set Sampling Capacitor IOs\r
- //---------------------------\r
-\r
- tmp_value_0 = 0;\r
-#if TSLPRM_TSC_GROUP1_IO1 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 0);\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO2 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 1);\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO3 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 2);\r
-#endif\r
-#if TSLPRM_TSC_GROUP1_IO4 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 3);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO1 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 4);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO2 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 5);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO3 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 6);\r
-#endif\r
-#if TSLPRM_TSC_GROUP2_IO4 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 7);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO1 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 8);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO2 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 9);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO3 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 10);\r
-#endif\r
-#if TSLPRM_TSC_GROUP3_IO4 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 11);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO1 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 12);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO2 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 13);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO3 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 14);\r
-#endif\r
-#if TSLPRM_TSC_GROUP4_IO4 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 15);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO1 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 16);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO2 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 17);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO3 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 18);\r
-#endif\r
-#if TSLPRM_TSC_GROUP5_IO4 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 19);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO1 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 20);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO2 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 21);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO3 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 22);\r
-#endif\r
-#if TSLPRM_TSC_GROUP6_IO4 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 23);\r
-#endif\r
-#if TSLPRM_TSC_GROUP7_IO1 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 24);\r
-#endif\r
-#if TSLPRM_TSC_GROUP7_IO2 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 25);\r
-#endif\r
-#if TSLPRM_TSC_GROUP7_IO3 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 26);\r
-#endif\r
-#if TSLPRM_TSC_GROUP7_IO4 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 27);\r
-#endif\r
-#if TSLPRM_TSC_GROUP8_IO1 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 28);\r
-#endif\r
-#if TSLPRM_TSC_GROUP8_IO2 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 29);\r
-#endif\r
-#if TSLPRM_TSC_GROUP8_IO3 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 30);\r
-#endif\r
-#if TSLPRM_TSC_GROUP8_IO4 == SAMPCAP\r
- tmp_value_0 |= (uint32_t)((uint32_t)1 << 31);\r
-#endif\r
- if (tmp_value_0 != 0) {TSC->IOSCR |= tmp_value_0;}\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief Initializes the acquisition module.\r
- * @param None\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_acq_Init(void)\r
-{\r
-\r
-#if TSLPRM_TSC_GPIO_CONFIG > 0\r
- TSL_acq_InitGPIOs();\r
-#endif\r
-\r
- // Enable TSC clock\r
- RCC->AHBENR |= RCC_AHBENR_TSEN;\r
-\r
- // TSC enabled\r
- TSC->CR = 0x01;\r
-\r
- // Set CTPH\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_CTPH << 28) & 0xF0000000;\r
-\r
- // Set CTPL\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_CTPL << 24) & 0x0F000000;\r
-\r
- // Set SpreadSpectrum\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_USE_SS << 16) & 0x00010000;\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_SSD << 17) & 0x00FE0000;\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_SSPSC << 15) & 0x00008000;\r
-\r
- // Set Prescaler\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_PGPSC << 12) & 0x00007000;\r
-\r
- // Set Max Count\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_MCV << 5) & 0x000000E0;\r
-\r
- // Set IO default in Output PP Low to discharge all capacitors\r
- TSC->CR &= (uint32_t)(~(1 << 4));\r
-\r
- // Set Synchronization Mode\r
-#if TSLPRM_TSC_AM > 0\r
-\r
- // Set Synchronization Pin in Alternate-Function mode\r
- RCC->AHBENR |= RCC_AHBENR_GPIOBEN; // Set GPIOB clock\r
-\r
-#if TSLPRM_TSC_SYNC_PIN == 0 // PB08\r
- GPIOB->MODER &= 0xFFFCFFFF;\r
- GPIOB->MODER |= 0x00020000;\r
- GPIOB->AFR[1] |= 0x00000003;\r
-#else // PB10\r
- GPIOB->MODER &= 0xFFCFFFFF;\r
- GPIOB->MODER |= 0x00200000;\r
- GPIOB->AFR[1] |= 0x00000300;\r
-#endif\r
-\r
- // Set Synchronization Polarity\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_SYNC_POL << 3) & 0x00000008;\r
-\r
-#endif\r
-\r
- // Set acquisition mode\r
- TSC->CR |= (uint32_t)((uint32_t)TSLPRM_TSC_AM << 2) & 0x00000004;\r
-\r
-#if TSLPRM_USE_ACQ_INTERRUPT > 0\r
-\r
- // Set both EOA and MCE interrupts\r
- TSC->IER |= 0x03;\r
-\r
- // Configure NVIC\r
- NVIC_SetPriority(EXTI2_TS_IRQn, 0);\r
- NVIC_EnableIRQ(EXTI2_TS_IRQn);\r
-\r
-#endif\r
-\r
- return TSL_STATUS_OK;\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief Configures a Bank.\r
- * @param[in] idx_bk Index of the Bank to configure\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk)\r
-{\r
- TSL_tIndex_T idx_ch;\r
- uint32_t objs; /* bit field of TSL_ObjStatus_enum_T type */\r
- uint32_t gx;\r
- uint32_t ioy;\r
- CONST TSL_Bank_T *bank = &(TSL_Globals.Bank_Array[idx_bk]);\r
- CONST TSL_ChannelSrc_T *pchSrc = bank->p_chSrc;\r
- CONST TSL_ChannelDest_T *pchDest = bank->p_chDest;\r
-\r
- // Check parameters (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_BANK_INDEX_OK(idx_bk));\r
-\r
- // Mark the current bank processed\r
- TSL_Globals.This_Bank = idx_bk;\r
-\r
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
- // Enable the Gx_IOy used as channels (channels + shield)\r
- TSC->IOCCR = bank->msk_IOCCR_channels;\r
- // Enable acquisition on selected Groups\r
- TSC->IOGCSR = bank->msk_IOGCSR_groups;\r
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
- // For all channels of the bank check if they are OFF or BURST_ONLY\r
- // and set acquisition status flag\r
- for (idx_ch = 0; idx_ch < bank->NbChannels; idx_ch++)\r
- {\r
-\r
- // Check Object status flag\r
- objs = bank->p_chData[pchDest->IdxDest].Flags.ObjStatus;\r
-\r
- if (objs != TSL_OBJ_STATUS_ON)\r
- {\r
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
- // Get the Channel Group mask\r
- gx = pchSrc->msk_IOGCSR_group;\r
- // Stop acquisition of the Group\r
- TSC->IOGCSR &= (uint32_t)~gx;\r
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
- if (objs == TSL_OBJ_STATUS_OFF)\r
- {\r
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
- // Get the Channel IO mask\r
- ioy = pchSrc->msk_IOCCR_channel;\r
- // Stop Burst of the Channel\r
- TSC->IOCCR &= (uint32_t)~ioy;\r
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
- }\r
- }\r
-\r
- // Next channel\r
- pchSrc++;\r
- pchDest++;\r
- }\r
-\r
- return TSL_STATUS_OK;\r
-}\r
-\r
-\r
-/**\r
- * @brief Start acquisition on a previously configured bank\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_acq_BankStartAcq(void)\r
-{\r
- // Clear both EOAIC and MCEIC flags\r
- TSC->ICR |= 0x03;\r
-\r
- // Wait capacitors discharge\r
- SoftDelay(TSL_DELAY_DISCHARGE);\r
-\r
-#if TSLPRM_TSC_IODEF > 0 // Default = Input Floating\r
- // Set IO default in Input Floating\r
- TSC->CR |= (1 << 4);\r
-#endif\r
-\r
- // Start acquisition\r
- TSC->CR |= 0x02;\r
-}\r
-\r
-\r
-/**\r
- * @brief Wait end of acquisition\r
- * @param None\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_acq_BankWaitEOC(void)\r
-{\r
- TSL_Status_enum_T retval = TSL_STATUS_BUSY;\r
-\r
- // Check EOAF flag\r
- if (TSC->ISR & 0x01)\r
- {\r
-\r
-#if TSLPRM_TSC_IODEF > 0 // Default = Input Floating\r
- // Set IO default in Output PP Low to discharge all capacitors\r
- TSC->CR &= (uint32_t)(~(1 << 4));\r
-#endif\r
-\r
- // Check MCEF flag\r
- if (TSC->ISR & 0x02)\r
- {\r
- retval = TSL_STATUS_ERROR;\r
- }\r
- else\r
- {\r
- retval = TSL_STATUS_OK;\r
- }\r
- }\r
-\r
- return retval;\r
-}\r
-\r
-\r
-/**\r
- * @brief Return the current measure\r
- * @param[in] index Index of the measure source\r
- * @retval Measure\r
- */\r
-TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndex_T index)\r
-{\r
- return(TSC->IOGXCR[index]);\r
-}\r
-\r
-\r
-/**\r
- * @brief Compute the Delta value\r
- * @param[in] ref Reference value\r
- * @param[in] meas Last Measurement value\r
- * @retval Delta value\r
- */\r
-TSL_tDelta_T TSL_acq_ComputeDelta(TSL_tRef_T ref, TSL_tMeas_T meas)\r
-{\r
- return((TSL_tDelta_T)(ref - meas));\r
-}\r
-\r
-\r
-/**\r
- * @brief Compute the Measurement value\r
- * @param[in] ref Reference value\r
- * @param[in] delta Delta value\r
- * @retval Measurement value\r
- */\r
-TSL_tMeas_T TSL_acq_ComputeMeas(TSL_tRef_T ref, TSL_tDelta_T delta)\r
-{\r
- return((TSL_tMeas_T)(ref - delta));\r
-}\r
-\r
-\r
-/**\r
- * @brief Check noise (not used)\r
- * @param None\r
- * @retval Status\r
- */\r
-TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void)\r
-{\r
- return TSL_ACQ_STATUS_OK;\r
-}\r
-\r
-\r
-/**\r
- * @brief Check if a filter must be used on the current channel (not used)\r
- * @param[in] pCh Pointer on the channel data information\r
- * @retval Result TRUE if a filter can be applied\r
- */\r
-TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh)\r
-{\r
- return TSL_TRUE;\r
-}\r
-\r
-\r
-/**\r
- * @brief Test if the Reference is incorrect (not used)\r
- * @param[in] pCh Pointer on the channel data information\r
- * @retval Result TRUE if the Reference is out of range\r
- */\r
-TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh)\r
-{\r
- return TSL_FALSE;\r
-}\r
-\r
-\r
-/**\r
- * @brief Test if the measure has crossed the reference target (not used)\r
- * @param[in] pCh Pointer on the channel data information\r
- * @param[in] new_meas Measure of the last acquisition on this channel\r
- * @retval Result TRUE if the Reference is valid\r
- */\r
-TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas)\r
-{\r
- return TSL_TRUE;\r
-}\r
-\r
-\r
-#if defined(__IAR_SYSTEMS_ICC__) // IAR/EWARM\r
-#pragma optimize=low\r
-#elif defined(__CC_ARM) // Keil/MDK-ARM\r
-#pragma O1\r
-#pragma Ospace\r
-#elif defined(__TASKING__) // Altium/Tasking\r
-#pragma optimize O0\r
-#elif defined(__GNUC__) // Atollic/True Studio + Raisonance/RKit\r
-#pragma GCC push_options\r
-#pragma GCC optimize ("O0")\r
-#endif\r
-/**\r
- * @brief Software delay (private routine)\r
- * @param val Wait delay\r
- * @retval None\r
- */\r
-void SoftDelay(uint32_t val)\r
-{\r
- __IO uint32_t i;\r
- for (i = val; i > 0; i--)\r
- {}\r
-}\r
-#if defined(__TASKING__)\r
-#pragma endoptimize\r
-#endif\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_acq_stm32l1xx_hw.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the acquisition\r
- * on STM32l1xx products using the Hardware mode (with Timers).\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_acq_stm32l1xx_hw.h"\r
-#include "tsl_globals.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-\r
-// Register configuration\r
-typedef struct\r
-{\r
- unsigned int RI_ASCR : 3;\r
- unsigned int RI_ASCR_bit : 5;\r
-} TSL_RIConf_t;\r
-\r
-/* Private defines -----------------------------------------------------------*/\r
-\r
-/* Private macros ------------------------------------------------------------*/\r
-\r
-#define IS_BANK_INDEX_OK(INDEX) (((INDEX) == 0) || (((INDEX) > 0) && ((INDEX) < TSLPRM_TOTAL_BANKS)))\r
-\r
-#define TSL_CHANNEL_PORT(channel) (channel >> 4)\r
-#define TSL_CHANNEL_IO(channel) (channel & 0x0F)\r
-\r
-#define TSL_GPIO_AFR(channel) ((TSL_CHANNEL_IO(channel) < 8) ? 0 : 1)\r
-#define TSL_GPIO_AFR_Shift(channel) ((TSL_CHANNEL_IO(channel) < 8) ? (4 * TSL_CHANNEL_IO(channel)) : (4 * (TSL_CHANNEL_IO(channel) - 8)))\r
-\r
-#define TSL_CPRI_HYSCR_MASK(channel) (1 << TSL_CHANNEL_IO(channel))\r
-#define TSL_CPRI_ASMR_MASK(channel) (1 << TSL_CHANNEL_IO(channel))\r
-#define TSL_CPRI_CMR_MASK(channel) (1 << TSL_CHANNEL_IO(channel))\r
-#define TSL_CPRI_CICR_MASK(channel) (1 << TSL_CHANNEL_IO(channel))\r
-\r
-#define TSL_RCC_AHBENR_Config(channel) (RCC->AHBENR |= TSL_GPIO_Clock_LookUpTable[TSL_CHANNEL_PORT(channel)])\r
-\r
-#define TSL_CPRI_ASCR_Config(channel) (*TSL_CPRI_ASCR_LookUpTable[TSL_RI_Conf_LookUpTable[channel].RI_ASCR] |= (1 << (TSL_RI_Conf_LookUpTable[channel].RI_ASCR_bit)))\r
-#define TSL_CPRI_HYSCR_Config(channel) (*TSL_CPRI_HYSCR_LookUpTable[TSL_CHANNEL_PORT(channel)] |= TSL_CPRI_HYSCR_MASK(channel))\r
-#define TSL_CPRI_ASMR_Config(channel) (*TSL_CPRI_ASMR_LookUpTable[TSL_CHANNEL_PORT(channel)] |= TSL_CPRI_ASMR_MASK(channel))\r
-#define TSL_CPRI_ASMR_Config_Clear(channel) (*TSL_CPRI_ASMR_LookUpTable[TSL_CHANNEL_PORT(channel)] &= (uint32_t)(~TSL_CPRI_ASMR_MASK(channel)))\r
-#define TSL_CPRI_CMR_Config(channel) (*TSL_CPRI_CMR_LookUpTable[TSL_CHANNEL_PORT(channel)] |= TSL_CPRI_CMR_MASK(channel))\r
-#define TSL_CPRI_CMR_Config_Clear(channel) (*TSL_CPRI_CMR_LookUpTable[TSL_CHANNEL_PORT(channel)] &= (uint32_t)(~TSL_CPRI_CMR_MASK(channel)))\r
-#define TSL_CPRI_CICR_Config(channel) (*TSL_CPRI_CICR_LookUpTable[TSL_CHANNEL_PORT(channel)] |= TSL_CPRI_CICR_MASK(channel))\r
-#define TSL_CPRI_CICR_Config_Clear(channel) (*TSL_CPRI_CICR_LookUpTable[TSL_CHANNEL_PORT(channel)] &= (uint32_t)(~TSL_CPRI_CICR_MASK(channel)))\r
-\r
-#define TSL_GPIO_MODER_IN_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->MODER &= (uint32_t)(~(3 << (2 * TSL_CHANNEL_IO(channel)))))\r
-#define TSL_GPIO_MODER_AF_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->MODER = (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->MODER & (uint32_t)(~(3 << (2 * TSL_CHANNEL_IO(channel))))) | (2 << (2 * TSL_CHANNEL_IO(channel))))\r
-#define TSL_GPIO_MODER_OUT_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->MODER = (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->MODER & (uint32_t)(~(3 << (2 * TSL_CHANNEL_IO(channel))))) | (1 << (2 * TSL_CHANNEL_IO(channel))))\r
-#define TSL_GPIO_PUPDR_NO_PUPD_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->PUPDR &= (uint32_t)(~(3 << (2 * TSL_CHANNEL_IO(channel)))))\r
-#define TSL_GPIO_OTYPER_PP_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->OTYPER &= (uint32_t)(~(1 << TSL_CHANNEL_IO(channel))))\r
-#define TSL_GPIO_OSPEEDR_VL_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->OSPEEDR &= (uint32_t)~(3 << (2 * TSL_CHANNEL_IO(channel))))\r
-#define TSL_GPIO_AFR_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->AFR[TSL_GPIO_AFR(channel)] |= (0x0E << (TSL_GPIO_AFR_Shift(channel))))\r
-#define TSL_GPIO_BS_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->BSRRL = (uint16_t)(1 << (TSL_CHANNEL_IO(channel))))\r
-#define TSL_GPIO_BR_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->BSRRH = (uint16_t)(1 << (TSL_CHANNEL_IO(channel))))\r
-\r
-#define TSL_GPIO_AFR_NOAF_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->AFR[TSL_GPIO_AFR(channel)] &= (uint32_t)(~(0x0F << (TSL_GPIO_AFR_Shift(channel)))))\r
-\r
-#define TSL_GPIO_IDR_XOR_CPRI_CMR(channel) ((TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->IDR)^(*TSL_CPRI_CMR_LookUpTable[TSL_CHANNEL_PORT(channel)]))\r
-#define TSL_GPIO_IDR_AND_CPRI_CMR(channel) ((TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->IDR)&(*TSL_CPRI_CMR_LookUpTable[TSL_CHANNEL_PORT(channel)]))\r
-\r
-/* Private variables ---------------------------------------------------------*/\r
-CONST TSL_Bank_T *bank;\r
-TSL_tIndex_T NumberOfChannelOn = 0;\r
-TSL_tNb_T NumberOfChannels = 0;\r
-uint32_t tab_MeasurementCounter[11];\r
-TSL_Status_enum_T TSL_Acq_Status = TSL_STATUS_BUSY;\r
-static uint16_t GroupToCheck = 0;\r
-static TSL_tIndex_T NumberOfChannelChecked = 0;\r
-\r
-uint32_t TSL_GPIO_Clock_LookUpTable[] = {RCC_AHBPeriph_GPIOA, RCC_AHBPeriph_GPIOB, RCC_AHBPeriph_GPIOC, RCC_AHBPeriph_GPIOD, RCC_AHBPeriph_GPIOE, RCC_AHBPeriph_GPIOF, RCC_AHBPeriph_GPIOG, RCC_AHBPeriph_GPIOH};\r
-GPIO_TypeDef *TSL_GPIO_LookUpTable[] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH};\r
-\r
-uint32_t *TSL_CPRI_ASCR_LookUpTable[] = {(uint32_t *)&CPRI->ASCR1, (uint32_t *)&CPRI->ASCR2};\r
-\r
-uint16_t *TSL_CPRI_HYSCR_LookUpTable[] =\r
-{\r
- (uint16_t *)&CPRI->HYSCR1, (uint16_t *)&CPRI->HYSCR1 + 1,\r
- (uint16_t *)&CPRI->HYSCR2, (uint16_t *)&CPRI->HYSCR2 + 1,\r
- (uint16_t *)&CPRI->HYSCR3, (uint16_t *)&CPRI->HYSCR3 + 1,\r
- (uint16_t *)&CPRI->HYSCR4, (uint16_t *)&CPRI->HYSCR4 + 1\r
-};\r
-\r
-uint32_t *TSL_CPRI_ASMR_LookUpTable[] = {(uint32_t *)&CPRI->ASMR1, (uint32_t *)&CPRI->ASMR2, (uint32_t *)&CPRI->ASMR3, 0, 0, (uint32_t *)&CPRI->ASMR4, (uint32_t *)&CPRI->ASMR5};\r
-uint32_t *TSL_CPRI_CMR_LookUpTable[] = {(uint32_t *)&CPRI->CMR1, (uint32_t *)&CPRI->CMR2, (uint32_t *)&CPRI->CMR3, 0, 0, (uint32_t *)&CPRI->CMR4, (uint32_t *)&CPRI->CMR5};\r
-uint32_t *TSL_CPRI_CICR_LookUpTable[] = {(uint32_t *)&CPRI->CICR1, (uint32_t *)&CPRI->CICR2, (uint32_t *)&CPRI->CICR3, 0, 0, (uint32_t *)&CPRI->CICR4, (uint32_t *)&CPRI->CICR5};\r
-\r
-CONST TSL_RIConf_t TSL_RI_Conf_LookUpTable[101] =\r
-{\r
- {0, 0},\r
- {0, 1},\r
- {0, 2},\r
- {0, 3},\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 6},\r
- {0, 7},\r
- {1, 9},\r
- {1, 10},\r
- {1, 11},\r
- {1, 15},\r
- {0, 0},//padding\r
- {1, 6},\r
- {1, 7},\r
- {1, 8},\r
-\r
- {0, 8},\r
- {0, 9},\r
- {1, 16},\r
- {0, 0},//padding\r
- {1, 4},\r
- {1, 5},\r
- {1, 27},\r
- {1, 28},\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 18},\r
- {0, 19},\r
- {0, 20},\r
- {0, 21},\r
-\r
- {0, 10},\r
- {0, 11},\r
- {0, 12},\r
- {0, 13},\r
- {0, 14},\r
- {0, 15},\r
- {1, 0},\r
- {1, 1},\r
- {1, 2},\r
- {1, 3},\r
- {1, 29},\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
-\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
-\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
-\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 27},\r
- {0, 28},\r
- {0, 29},\r
- {0, 30},\r
- {0, 16},\r
- {1, 17},\r
- {1, 18},\r
- {1, 19},\r
- {1, 20},\r
- {1, 21},\r
-\r
- {1, 22},\r
- {1, 23},\r
- {1, 24},\r
- {1, 25},\r
- {1, 26}\r
-};\r
-\r
-/* Private functions prototype -----------------------------------------------*/\r
-void TSL_Init_GPIOs(void);\r
-void TSL_Init_TIMs(void);\r
-void TSL_Init_RI(void);\r
-uint8_t TSL_Check_GPIO_IDR(uint8_t sample);\r
-void SoftDelay(uint16_t val);\r
-\r
-\r
-/**\r
- * @brief Initializes the TouchSensing GPIOs.\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_Init_GPIOs(void)\r
-{\r
- CONST TSL_Bank_T *LocalBank = &(TSL_Globals.Bank_Array[0]);\r
- TSL_tNb_T NumberOfBanks = TSLPRM_TOTAL_BANKS;\r
- TSL_tNb_T LocalNumberOfChannels = 0;\r
- TSL_tIndex_T idx_bk;\r
- TSL_tIndex_T idx_ch;\r
- CONST TSL_ChannelSrc_T *p_chSrc = LocalBank->p_chSrc; // Pointer to the current channel\r
-\r
- for (idx_bk = 0; idx_bk < NumberOfBanks; idx_bk++)\r
- {\r
- LocalBank = &(TSL_Globals.Bank_Array[idx_bk]);\r
- p_chSrc = LocalBank->p_chSrc;\r
-\r
-#if (TSLPRM_USE_SHIELD > 0)\r
- // Enables GPIOs clock\r
- TSL_RCC_AHBENR_Config(LocalBank->shield_sample);\r
-\r
- // Bank shield configuration\r
- TSL_GPIO_OTYPER_PP_Config(LocalBank->shield_channel);\r
- TSL_GPIO_OSPEEDR_VL_Config(LocalBank->shield_channel);\r
- TSL_GPIO_PUPDR_NO_PUPD_Config(LocalBank->shield_channel);\r
- TSL_GPIO_AFR_Config(LocalBank->shield_channel);\r
-\r
- TSL_GPIO_OSPEEDR_VL_Config(LocalBank->shield_sample);\r
- TSL_GPIO_BR_Config(LocalBank->shield_sample);\r
- TSL_GPIO_OTYPER_PP_Config(LocalBank->shield_sample);\r
- TSL_GPIO_PUPDR_NO_PUPD_Config(LocalBank->shield_sample);\r
-\r
- TSL_GPIO_MODER_OUT_Config(LocalBank->shield_sample);\r
- TSL_GPIO_MODER_OUT_Config(LocalBank->shield_channel);\r
-#endif\r
-\r
- LocalNumberOfChannels = LocalBank->NbChannels;\r
-\r
- for (idx_ch = 0;\r
- idx_ch < LocalNumberOfChannels;\r
- idx_ch++)\r
- {\r
- TSL_RCC_AHBENR_Config(p_chSrc->t_sample);\r
- TSL_RCC_AHBENR_Config(p_chSrc->t_channel);\r
-\r
- TSL_GPIO_OTYPER_PP_Config(p_chSrc->t_channel);\r
- TSL_GPIO_OSPEEDR_VL_Config(p_chSrc->t_channel);\r
- TSL_GPIO_PUPDR_NO_PUPD_Config(p_chSrc->t_channel);\r
- TSL_GPIO_AFR_Config(p_chSrc->t_channel);\r
-\r
- TSL_GPIO_OSPEEDR_VL_Config(p_chSrc->t_sample);\r
- TSL_GPIO_BR_Config(p_chSrc->t_sample);\r
- TSL_GPIO_OTYPER_PP_Config(p_chSrc->t_sample);\r
- TSL_GPIO_PUPDR_NO_PUPD_Config(p_chSrc->t_sample);\r
-\r
- TSL_GPIO_MODER_OUT_Config(p_chSrc->t_sample);\r
- TSL_GPIO_MODER_OUT_Config(p_chSrc->t_channel);\r
-\r
- p_chSrc++;\r
- }\r
- }\r
-}\r
-\r
-/**\r
- * @brief Initializes the TouchSensing timers.\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_Init_TIMs(void)\r
-{\r
- // Enable Timers clocks\r
- RCC->APB2ENR |= ((1 << 4) | (1 << 2)); // TIM11, TIM9\r
-\r
- //==============================\r
- // TIMER 9 configuration: Master\r
- //==============================\r
- // Set the option register to redirect cpri_tim9_itr_O to TIM9_itr\r
- TIM9->OR |= 4;\r
- // Set the Autoreload value (signal frequency)\r
- //TIM9->ARR = 64; // freq = (64*2)*31.25ns = 1us\r
- TIM9->ARR = TSLPRM_TIM_RELOAD; // freq = (64*2)*31.25ns = 1us\r
- // Set the Prescaler value\r
- //TIM9->PSC = 0; // fCK_CNT = 32MHz/(0+1) = 32MHz --> T=31.25ns\r
- TIM9->PSC = TSLPRM_TIM_PRESCALER; // fCK_CNT = 32MHz/(1+1) = 32MHz --> T=31.25ns\r
- // Set UP counter, Center-Aligned mode 1\r
- TIM9->CR1 = 0x20;\r
- // OC1REF used as TRGO\r
- TIM9->CR2 |= 0x40; // MMS=100\r
- // Select Master mode\r
- TIM9->SMCR = 0x95;\r
- // Set Update generation\r
- TIM9->EGR |= 0x01;\r
-\r
- // Channel 1 PWM configuration\r
- // Set the Output Compare Mode, PWM2\r
- TIM9->CCMR1 |= 0x0070;\r
- // Set the Pulse value\r
- //TIM9->CCR1 = 34; // duty cycle\r
- TIM9->CCR1 = (TSLPRM_TIM_RELOAD >> 1) + 1; // duty cycle\r
- // Compare output enable, active high\r
- TIM9->CCER |= 0x01;\r
-\r
- // Channel 2 PWM configuration\r
- // Set the Output Compare Mode, PWM2\r
- TIM9->CCMR1 |= 0x6000;\r
- // Set the Pulse value\r
- //TIM9->CCR2 = 30;\r
- TIM9->CCR2 = (TSLPRM_TIM_RELOAD >> 1) - 1;\r
- // Compare output enable, active high\r
- TIM9->CCER |= 0x10;\r
-\r
- //==============================\r
- // TIMER 11 configuration: slave\r
- //==============================\r
- // Set the option register to redirect TIM11_ic_o to TIM11_ti\r
- TIM11->OR |= 8;\r
- // Set the option register to redirect TIM9_tgo_cktim to TIM11_etri\r
- TIM11->OR |= 4;\r
- // Set the Prescaler value\r
- TIM11->PSC = 0;\r
- // Set UP counter, edge-aligned mode\r
- TIM11->CR1 = 0;\r
- // Select Slave mode, Internal Trigger 2 (ITR2 = TIM9), External clock mode 1\r
- TIM11->SMCR = 0x4000; // ECE bit\r
- // Channel 1 configured in Input capture mode\r
- TIM11->CCMR1 = 0x01; // No prescaler, no filter\r
- // Channel 1 capture enable (CCE1 = 1)\r
- TIM11->CCER = 0x01;\r
- // Interrupt Enable, active high\r
- TIM11->DIER |= 0x02;\r
- // Start slave timer\r
- TIM11->CR1 |= 0x01;\r
-}\r
-\r
-\r
-/**\r
- * @brief Init TS routing interface.\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_Init_RI(void)\r
-{\r
- CONST TSL_Bank_T *LocalBank;\r
- TSL_tNb_T NumberOfBanks = TSLPRM_TOTAL_BANKS;\r
- TSL_tNb_T LocalNumberOfChannels = 0;\r
- TSL_tIndex_T idx_bk;\r
- TSL_tIndex_T idx_ch;\r
- CONST TSL_ChannelSrc_T *p_chSrc; // Pointer to the current channel\r
-\r
- RCC->APB1ENR |= (uint32_t)((uint32_t)1 << 31); // COMP enable\r
-\r
- for (idx_bk = 0; idx_bk < NumberOfBanks; idx_bk++)\r
- {\r
- LocalBank = &(TSL_Globals.Bank_Array[idx_bk]);\r
-\r
-#if (TSLPRM_USE_SHIELD > 0)\r
- TSL_CPRI_HYSCR_Config(LocalBank->shield_sample);\r
- TSL_CPRI_CICR_Config(LocalBank->shield_sample);\r
- TSL_CPRI_CICR_Config_Clear(LocalBank->shield_channel);\r
-\r
- TSL_CPRI_ASCR_Config(LocalBank->shield_sample);\r
-#endif\r
-\r
- LocalNumberOfChannels = LocalBank->NbChannels;\r
-\r
- p_chSrc = LocalBank->p_chSrc;\r
- for (idx_ch = 0; idx_ch < LocalNumberOfChannels; idx_ch++)\r
- {\r
- TSL_CPRI_HYSCR_Config(p_chSrc->t_sample);\r
- TSL_CPRI_CICR_Config(p_chSrc->t_sample);\r
- TSL_CPRI_CICR_Config_Clear(p_chSrc->t_channel);\r
- TSL_CPRI_ASCR_Config(p_chSrc->t_sample);\r
- p_chSrc++;\r
- }\r
- }\r
-\r
- // Reset TSUSP bit, TIM9 ITR enabled to suspend OC TIM9 generation\r
- COMP->CSR &= (uint32_t)(~0x80000000);\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief Initializes the acquisition module.\r
- * @param None\r
- * @retval retval\r
- */\r
-TSL_Status_enum_T TSL_acq_Init(void)\r
-{\r
- NVIC_InitTypeDef NVIC_InitStructure;\r
-\r
- NVIC_InitStructure.NVIC_IRQChannel = TIM11_IRQn;\r
- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;\r
- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;\r
- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\r
- NVIC_Init(&NVIC_InitStructure);\r
-\r
- TSL_Init_GPIOs();\r
- TSL_Init_TIMs();\r
- TSL_Init_RI();\r
-\r
- return TSL_STATUS_OK;\r
-}\r
-\r
-\r
-/**\r
- * @brief Configures a Bank.\r
- * @param[in] idx_bk Index of the Bank to configure\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk)\r
-{\r
- TSL_tIndex_T idx_dest;\r
- TSL_tIndex_T idx_ch;\r
- CONST TSL_ChannelDest_T *p_chDest; // Pointer to the current channel\r
- CONST TSL_ChannelSrc_T *p_chSrc; // Pointer to the current channel\r
-\r
- // Check parameters (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_BANK_INDEX_OK(idx_bk));\r
-\r
- bank = &(TSL_Globals.Bank_Array[idx_bk]);\r
-\r
- NumberOfChannels = bank->NbChannels;\r
-\r
- GroupToCheck = 0;//init group to check\r
- NumberOfChannelOn = 0;//init number of channel on\r
-\r
- // init CPRI ASMR\r
- CPRI->ASMR1 = 0;\r
- CPRI->ASMR2 = 0;\r
- CPRI->ASMR3 = 0;\r
- CPRI->ASMR4 = 0;\r
- CPRI->ASMR5 = 0;\r
-\r
- p_chDest = bank->p_chDest;\r
- p_chSrc = bank->p_chSrc;\r
- for (idx_ch = 0; idx_ch < NumberOfChannels; idx_ch++)\r
- {\r
- // Get index in the result array associated to the current channel\r
- idx_dest = p_chDest->IdxDest;\r
- if (bank->p_chData[idx_dest].Flags.ObjStatus != TSL_OBJ_STATUS_OFF)\r
- {\r
- TSL_CPRI_CMR_Config(p_chSrc->t_sample);\r
- TSL_CPRI_ASMR_Config(p_chSrc->t_channel);\r
- GroupToCheck |= (1 << (p_chSrc->IdxSrc));\r
- NumberOfChannelOn++;\r
- }\r
- p_chDest++;\r
- p_chSrc++;\r
- }\r
-\r
- return TSL_STATUS_OK;\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief Start acquisition on a previously configured bank\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_acq_BankStartAcq(void)\r
-{\r
-#if (TSLPRM_IODEF > 0)\r
- CONST TSL_Bank_T *LocalBank = &(TSL_Globals.Bank_Array[0]);\r
- TSL_tNb_T NumberOfBanks = TSLPRM_TOTAL_BANKS;\r
- TSL_tNb_T LocalNumberOfChannels = 0;\r
- TSL_tIndex_T BankIndex;\r
-#endif\r
- CONST TSL_ChannelSrc_T *p_chSrc;\r
- CONST TSL_ChannelDest_T *p_chDest;\r
- TSL_tIndex_T idx_dest;\r
- TSL_tIndex_T idx_ch;\r
-\r
- if (NumberOfChannelOn)\r
- {\r
-#if (TSLPRM_IODEF > 0)\r
- //============================\r
- // All GPIOs in Input floating\r
- //============================\r
- for (BankIndex = 0; BankIndex < NumberOfBanks; BankIndex++)\r
- {\r
- LocalBank = &(TSL_Globals.Bank_Array[BankIndex]);\r
- p_chSrc = LocalBank->p_chSrc;\r
-\r
-#if (TSLPRM_USE_SHIELD > 0)\r
- TSL_GPIO_MODER_IN_Config(LocalBank->shield_sample);\r
- TSL_GPIO_MODER_IN_Config(LocalBank->shield_channel);\r
-#endif\r
-\r
- LocalNumberOfChannels = LocalBank->NbChannels;\r
-\r
- for (idx_ch = 0;\r
- idx_ch < LocalNumberOfChannels;\r
- idx_ch++)\r
- {\r
- TSL_GPIO_MODER_IN_Config(p_chSrc->t_sample);\r
- TSL_GPIO_MODER_IN_Config(p_chSrc->t_channel);\r
-\r
- p_chSrc++;\r
- }\r
- }\r
-#endif\r
-\r
-\r
- // Reset count\r
- TIM11->CNT = 0;\r
-\r
- // Discharge sample capacitors\r
- p_chDest = bank->p_chDest;\r
- p_chSrc = bank->p_chSrc;\r
- for (idx_ch = 0; idx_ch < NumberOfChannels; idx_ch++)\r
- {\r
- // Get index in the result array associated to the current channel\r
- idx_dest = p_chDest->IdxDest;\r
- if (bank->p_chData[idx_dest].Flags.ObjStatus != TSL_OBJ_STATUS_OFF)\r
- {\r
- TSL_GPIO_MODER_OUT_Config(p_chSrc->t_sample);\r
- }\r
- p_chDest++;\r
- p_chSrc++;\r
- }\r
-\r
-#if (TSLPRM_USE_SHIELD > 0)\r
- // Discharge shield sample capacitor\r
- TSL_GPIO_MODER_OUT_Config(bank->shield_sample);\r
-#endif\r
-\r
- // Wait for capa discharge\r
- SoftDelay(0x80);\r
-\r
-#if (TSLPRM_USE_SHIELD > 0)\r
- // Init sample shield in floating input\r
- TSL_GPIO_MODER_IN_Config(bank->shield_sample);\r
- TSL_GPIO_MODER_AF_Config(bank->shield_channel);\r
-\r
- TSL_CPRI_ASMR_Config(bank->shield_channel);\r
-#endif\r
-\r
- // Init samples in floating input and channels in alternate\r
- p_chDest = bank->p_chDest;\r
- p_chSrc = bank->p_chSrc;\r
- for (idx_ch = 0; idx_ch < NumberOfChannels; idx_ch++)\r
- {\r
- // Get index in the result array associated to the current channel\r
- idx_dest = p_chDest->IdxDest;\r
-\r
- if (bank->p_chData[idx_dest].Flags.ObjStatus != TSL_OBJ_STATUS_OFF)\r
- {\r
- TSL_GPIO_MODER_IN_Config(p_chSrc->t_sample);\r
- TSL_GPIO_MODER_AF_Config(p_chSrc->t_channel);\r
- }\r
-\r
- p_chDest++;\r
- p_chSrc++;\r
- }\r
-\r
- /* Start acquisition */\r
- TSL_Acq_Status = TSL_STATUS_BUSY;\r
- TIM9 ->CR1 |= 0x01; // Master\r
- }\r
- else\r
- {\r
- TSL_Acq_Status = TSL_STATUS_OK;\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Wait end of acquisition\r
- * @param None\r
- * @retval status\r
- */\r
-TSL_Status_enum_T TSL_acq_BankWaitEOC(void)\r
-{\r
- return TSL_Acq_Status;\r
-}\r
-\r
-\r
-/**\r
- * @brief Return the current measure\r
- * @param[in] index Index of the measure source\r
- * @retval Measure\r
- */\r
-TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndex_T index)\r
-{\r
- return(tab_MeasurementCounter[index]);\r
-}\r
-\r
-\r
-/**\r
- * @brief Check noise (not used)\r
- * @param None\r
- * @retval Status\r
- */\r
-TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void)\r
-{\r
- return TSL_ACQ_STATUS_OK;\r
-}\r
-\r
-\r
-/**\r
- * @brief Check GPIO IDR for the sample\r
- * @param[in] sample\r
- * @retval Status\r
- */\r
-uint8_t TSL_Check_GPIO_IDR(uint8_t sample)\r
-{\r
- GPIO_TypeDef *GPIO;\r
- uint32_t GPIO_IDR_Mask = 0;\r
-\r
- GPIO = TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(sample)];\r
-\r
- GPIO_IDR_Mask = (1 << (sample & 0x0F));\r
-\r
- if (((GPIO->IDR) & GPIO_IDR_Mask) == GPIO_IDR_Mask)\r
- {\r
- return 1;\r
- }\r
- else\r
- {\r
- return 0;\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Process the TS Interrupt routine\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_acq_ProcessIT(void)\r
-{\r
- CONST TSL_Bank_T *LocalBank = &(TSL_Globals.Bank_Array[0]);\r
- TSL_tNb_T NumberOfBanks = TSLPRM_TOTAL_BANKS;\r
- TSL_tNb_T LocalNumberOfChannels = 0;\r
- TSL_tIndex_T BankIndex;\r
-\r
- CONST TSL_ChannelSrc_T *p_chSrc;\r
- CONST TSL_ChannelDest_T *p_chDest;\r
- TSL_tIndex_T idx_dest;\r
- TSL_tIndex_T idx_ch;\r
-\r
- // Reset flags\r
- TIM11->SR = 0;\r
- idx_ch = 0;\r
-\r
- p_chDest = bank->p_chDest;\r
- p_chSrc = bank->p_chSrc;\r
- do\r
- {\r
- // Get index in the result array associated to the current channel\r
- idx_dest = p_chDest->IdxDest;\r
-\r
- if (bank->p_chData[idx_dest].Flags.ObjStatus != TSL_OBJ_STATUS_OFF)\r
- {\r
- if ((TSL_Check_GPIO_IDR(p_chSrc->t_sample)) &&\r
- ((GroupToCheck & (1 << (p_chSrc->IdxSrc))) == (1 << (p_chSrc->IdxSrc))))\r
- {\r
- tab_MeasurementCounter[p_chSrc->IdxSrc] = TIM11->CCR1;\r
- NumberOfChannelChecked++;\r
- GroupToCheck &= (uint32_t)(~(1 << (p_chSrc->IdxSrc)));\r
-\r
- // Reset CMR register to restart the timer\r
- TSL_CPRI_CMR_Config_Clear(p_chSrc->t_sample);\r
- }\r
- }\r
- p_chDest++;\r
- p_chSrc++;\r
- idx_ch++;\r
- }\r
- while (idx_ch < NumberOfChannels);\r
-\r
- if (NumberOfChannelChecked >= NumberOfChannelOn)\r
- {\r
- NumberOfChannelOn = 0;\r
- NumberOfChannelChecked = 0;\r
-\r
- // Disable master counter\r
- TIM9->CR1 &= (uint16_t)(~0x01);\r
-\r
- //====================\r
- // All GPIOs in PP Low\r
- //====================\r
- for (BankIndex = 0; BankIndex < NumberOfBanks; BankIndex++)\r
- {\r
- LocalBank = &(TSL_Globals.Bank_Array[BankIndex]);\r
- p_chSrc = LocalBank->p_chSrc;\r
-\r
-#if (TSLPRM_USE_SHIELD > 0)\r
- TSL_GPIO_BR_Config(LocalBank->shield_sample);\r
- TSL_GPIO_BR_Config(LocalBank->shield_channel);\r
- TSL_GPIO_MODER_OUT_Config(LocalBank->shield_sample);\r
- TSL_GPIO_MODER_OUT_Config(LocalBank->shield_channel);\r
-#endif\r
-\r
- LocalNumberOfChannels = LocalBank->NbChannels;\r
-\r
- for (idx_ch = 0;\r
- idx_ch < LocalNumberOfChannels;\r
- idx_ch++)\r
- {\r
- TSL_GPIO_BR_Config(p_chSrc->t_sample);\r
- TSL_GPIO_BR_Config(p_chSrc->t_channel);\r
- TSL_GPIO_MODER_OUT_Config(p_chSrc->t_sample);\r
- TSL_GPIO_MODER_OUT_Config(p_chSrc->t_channel);\r
-\r
- p_chSrc++;\r
- }\r
- }\r
- TSL_Acq_Status = TSL_STATUS_OK;\r
- }\r
-\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief Check if a filter must be used on the current channel (not used)\r
- * @param[in] pCh Pointer on the channel data information\r
- * @retval Result TRUE if a filter can be applied\r
- */\r
-TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh)\r
-{\r
- return TSL_TRUE;\r
-}\r
-\r
-\r
-/**\r
- * @brief Compute the Delta value\r
- * @param[in] ref Reference value\r
- * @param[in] meas Last Measurement value\r
- * @retval Delta value\r
- */\r
-TSL_tDelta_T TSL_acq_ComputeDelta(TSL_tRef_T ref, TSL_tMeas_T meas)\r
-{\r
- return((TSL_tDelta_T)(ref - meas));\r
-}\r
-\r
-\r
-/**\r
- * @brief Compute the Measurement value\r
- * @param[in] ref Reference value\r
- * @param[in] delta Delta value\r
- * @retval Measurement value\r
- */\r
-TSL_tMeas_T TSL_acq_ComputeMeas(TSL_tRef_T ref, TSL_tDelta_T delta)\r
-{\r
- return((TSL_tMeas_T)(ref - delta));\r
-}\r
-\r
-\r
-/**\r
- * @brief Test if the Reference is incorrect (not used)\r
- * @param[in] pCh Pointer on the channel data information\r
- * @retval Result TRUE if the Reference is out of range\r
- */\r
-TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh)\r
-{\r
- return TSL_FALSE;\r
-}\r
-\r
-\r
-/**\r
- * @brief Test if the measure has crossed the reference target (not used)\r
- * @param[in] pCh Pointer on the channel data information\r
- * @param[in] new_meas Measure of the last acquisition on this channel\r
- * @retval Result TRUE if the Reference is valid\r
- */\r
-TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas)\r
-{\r
- return TSL_TRUE;\r
-}\r
-\r
-\r
-#if defined(__IAR_SYSTEMS_ICC__) // IAR/EWARM\r
-#pragma optimize=medium\r
-#elif defined(__CC_ARM) // Keil/MDK-ARM\r
-#pragma O1\r
-#pragma Ospace\r
-#elif defined(__TASKING__) // Altium/Tasking\r
-#pragma optimize O0\r
-#elif defined(__GNUC__) // Atollic/True Studio + Raisonance/RKit\r
-#pragma GCC push_options\r
-#pragma GCC optimize ("O0")\r
-#endif\r
-/**\r
- * @brief Software delay (private routine)\r
- * @param val Wait delay\r
- * With fHCLK = 32MHz: 1 = ~1µs, 50 = ~14µs, 100 = ~25µs, 200 = ~50µs\r
- * @retval None\r
- */\r
-void SoftDelay(uint16_t val)\r
-{\r
- __IO uint16_t i;\r
- for (i = val; i > 0; i--)\r
- {}\r
-}\r
-#if defined(__TASKING__)\r
-#pragma endoptimize\r
-#endif\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_acq_stm32l1xx_sw.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the acquisition\r
- * on STM32l1xx products using the software mode.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_acq_stm32l1xx_sw.h"\r
-#include "tsl_globals.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-\r
-// Register configuration\r
-typedef struct\r
-{\r
- unsigned int RI_ASCR : 3;\r
- unsigned int RI_ASCR_bit : 5;\r
-} TSL_RIConf_t;\r
-\r
-/* Private defines -----------------------------------------------------------*/\r
-#define SIZEOFBANKCONF (17) //2 mask RIRs + 5 ports x 3 mask registers(MODER input, output, ODR) => 17 registers\r
-\r
-/* Private macros ------------------------------------------------------------*/\r
-#define IS_BANK_INDEX_OK(INDEX) (((INDEX) == 0) || (((INDEX) > 0) && ((INDEX) < TSLPRM_TOTAL_BANKS)))\r
-\r
-#define TSL_CHANNEL_PORT(channel) (channel >> 4)\r
-#define TSL_CHANNEL_IO(channel) (channel & 0x0F)\r
-\r
-\r
-#define TSL_RI_HYSCR_MASK(channel) (1 << TSL_CHANNEL_IO(channel))\r
-\r
-#define TSL_RCC_AHBENR_Config(channel) (RCC->AHBENR |= TSL_GPIO_Clock_LookUpTable[TSL_CHANNEL_PORT(channel)])\r
-\r
-#define TSL_RI_HYSCR_Config(channel) (*TSL_RI_HYSCR_LookUpTable[TSL_CHANNEL_PORT(channel)] |= TSL_RI_HYSCR_MASK(channel))\r
-\r
-#define TSL_GPIO_MODER_IN_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->MODER &= (uint32_t)(~(3 << (2 * TSL_CHANNEL_IO(channel)))))\r
-#define TSL_GPIO_MODER_OUT_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->MODER = (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->MODER & (uint32_t)(~(3 << (2 * TSL_CHANNEL_IO(channel))))) | (1 << (2 * TSL_CHANNEL_IO(channel))))\r
-#define TSL_GPIO_PUPDR_NO_PUPD_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->PUPDR &= (uint32_t)(~(3 << (2 * TSL_CHANNEL_IO(channel)))))\r
-#define TSL_GPIO_OTYPER_PP_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->OTYPER &= (uint32_t)(~(1 << TSL_CHANNEL_IO(channel))))\r
-#define TSL_GPIO_OSPEEDR_VL_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->OSPEEDR &= (uint32_t)~(3 << (2 * TSL_CHANNEL_IO(channel))))\r
-#define TSL_GPIO_BS_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->BSRRL = (uint16_t)(1 << (TSL_CHANNEL_IO(channel))))\r
-#define TSL_GPIO_BR_Config(channel) (TSL_GPIO_LookUpTable[TSL_CHANNEL_PORT(channel)]->BSRRH = (uint16_t)(1 << (TSL_CHANNEL_IO(channel))))\r
-\r
-\r
-/* Private variables ---------------------------------------------------------*/\r
-uint32_t TSL_BankSampleConf[SIZEOFBANKCONF];\r
-uint32_t TSL_BankChannelConf[SIZEOFBANKCONF];\r
-uint32_t tab_MeasurementCounter[11];\r
-extern TSL_Params_T TSL_Params;\r
-\r
-CONST TSL_Bank_T *bank;\r
-TSL_tIndex_T NumberOfChannelOn = 0;\r
-TSL_tNb_T NumberOfChannels = 0;\r
-TSL_Status_enum_T TSL_Acq_Status = TSL_STATUS_BUSY;\r
-uint16_t GroupToCheck = 0;\r
-\r
-uint32_t TSL_GPIO_Clock_LookUpTable[] = {RCC_AHBPeriph_GPIOA, RCC_AHBPeriph_GPIOB, RCC_AHBPeriph_GPIOC, RCC_AHBPeriph_GPIOD, RCC_AHBPeriph_GPIOE, RCC_AHBPeriph_GPIOF, RCC_AHBPeriph_GPIOG, RCC_AHBPeriph_GPIOH};\r
-GPIO_TypeDef *TSL_GPIO_LookUpTable[] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH};\r
-\r
-uint16_t *TSL_RI_HYSCR_LookUpTable[] =\r
-{\r
- (uint16_t *)&RI->HYSCR1, (uint16_t *)&RI->HYSCR1 + 1,\r
- (uint16_t *)&RI->HYSCR2, (uint16_t *)&RI->HYSCR2 + 1,\r
- (uint16_t *)&RI->HYSCR3, (uint16_t *)&RI->HYSCR3 + 1,\r
- (uint16_t *)&RI->HYSCR4, (uint16_t *)&RI->HYSCR4 + 1\r
-};\r
-\r
-CONST TSL_RIConf_t TSL_RI_Conf_LookUpTable[101] =\r
-{\r
- {0, 0},\r
- {0, 1},\r
- {0, 2},\r
- {0, 3},\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 6},\r
- {0, 7},\r
- {1, 9},\r
- {1, 10},\r
- {1, 11},\r
- {1, 15},\r
- {0, 0},//padding\r
- {1, 6},\r
- {1, 7},\r
- {1, 8},\r
-\r
- {0, 8},\r
- {0, 9},\r
- {1, 16},\r
- {0, 0},//padding\r
- {1, 4},\r
- {1, 5},\r
- {1, 27},\r
- {1, 28},\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 18},\r
- {0, 19},\r
- {0, 20},\r
- {0, 21},\r
-\r
- {0, 10},\r
- {0, 11},\r
- {0, 12},\r
- {0, 13},\r
- {0, 14},\r
- {0, 15},\r
- {1, 0},\r
- {1, 1},\r
- {1, 2},\r
- {1, 3},\r
- {1, 29},\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
-\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
-\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
-\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 0},//padding\r
- {0, 27},\r
- {0, 28},\r
- {0, 29},\r
- {0, 30},\r
- {0, 16},\r
- {1, 17},\r
- {1, 18},\r
- {1, 19},\r
- {1, 20},\r
- {1, 21},\r
-\r
- {1, 22},\r
- {1, 23},\r
- {1, 24},\r
- {1, 25},\r
- {1, 26}\r
-};\r
-\r
-#if (TSLPRM_USE_GPIOA)\r
-uint32_t GPIOA_IDR_Mask = 0;\r
-#endif\r
-#if (TSLPRM_USE_GPIOB)\r
-uint32_t GPIOB_IDR_Mask = 0;\r
-#endif\r
-#if (TSLPRM_USE_GPIOC)\r
-uint32_t GPIOC_IDR_Mask = 0;\r
-#endif\r
-#if (TSLPRM_USE_GPIOF)\r
-uint32_t GPIOF_IDR_Mask = 0;\r
-#endif\r
-#if (TSLPRM_USE_GPIOG)\r
-uint32_t GPIOG_IDR_Mask = 0;\r
-#endif\r
-\r
-/* Private functions prototype -----------------------------------------------*/\r
-void SoftDelay(uint16_t val);\r
-void TSL_BankConf(uint32_t * BankConf, TSL_Conf_t Conf);\r
-void TSL_acq_GroupDone(uint16_t EndedGroup);\r
-\r
-/**\r
- * @brief Configures the acquisition module.\r
- * @param[in] BankConf Pointer to the bank to configure\r
- * @param[in] Conf Configuration\r
- * @retval None\r
- */\r
-void TSL_BankConf(uint32_t *BankConf, TSL_Conf_t Conf)\r
-{\r
- BankConf[TSL_RI_Conf_LookUpTable[Conf].RI_ASCR] |= (1 << (TSL_RI_Conf_LookUpTable[Conf].RI_ASCR_bit));\r
-\r
- switch (TSL_CHANNEL_PORT(Conf))\r
- {\r
- case TSL_BANK_GPIOA: BankConf[2] |= (3 << (2 * (TSL_CHANNEL_IO(Conf)))); //MODER input\r
- BankConf[3] |= (1 << (2 * (TSL_CHANNEL_IO(Conf)))); //MODER output\r
- BankConf[4] |= (1 << (TSL_CHANNEL_IO(Conf))); //ODR\r
- break;\r
- case TSL_BANK_GPIOB: BankConf[5] |= (3 << (2 * (TSL_CHANNEL_IO(Conf)))); //MODER input\r
- BankConf[6] |= (1 << (2 * (TSL_CHANNEL_IO(Conf)))); //MODER output\r
- BankConf[7] |= (1 << (TSL_CHANNEL_IO(Conf))); //ODR\r
- break;\r
- case TSL_BANK_GPIOC: BankConf[8] |= (3 << (2 * (TSL_CHANNEL_IO(Conf)))); //MODER input\r
- BankConf[9] |= (1 << (2 * (TSL_CHANNEL_IO(Conf)))); //MODER output\r
- BankConf[10] |= (1 << (TSL_CHANNEL_IO(Conf))); //ODR\r
- break;\r
- case TSL_BANK_GPIOF: BankConf[11] |= (3 << (2 * (TSL_CHANNEL_IO(Conf)))); //MODER input\r
- BankConf[12] |= (1 << (2 * (TSL_CHANNEL_IO(Conf)))); //MODER output\r
- BankConf[13] |= (1 << (TSL_CHANNEL_IO(Conf))); //ODR\r
- break;\r
- case TSL_BANK_GPIOG: BankConf[14] |= (3 << (2 * (TSL_CHANNEL_IO(Conf)))); //MODER input\r
- BankConf[15] |= (1 << (2 * (TSL_CHANNEL_IO(Conf)))); //MODER output\r
- BankConf[16] |= (1 << (TSL_CHANNEL_IO(Conf))); //ODR\r
- break;\r
- default: break;\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Initializes the acquisition module.\r
- * @param None\r
- * @retval None\r
- */\r
-TSL_Status_enum_T TSL_acq_Init(void)\r
-{\r
- CONST TSL_Bank_T *LocalBank = &(TSL_Globals.Bank_Array[0]);\r
- TSL_tNb_T NumberOfBanks = TSLPRM_TOTAL_BANKS;\r
- TSL_tNb_T LocalNumberOfChannels = 0;\r
- TSL_tIndex_T idx_bk;\r
- TSL_tIndex_T idx_ch;\r
- CONST TSL_ChannelSrc_T *p_chSrc = LocalBank->p_chSrc; // Pointer to the current channel\r
-\r
- /* Enables the comparator interface clock */\r
- RCC->APB1ENR |= RCC_APB1Periph_COMP;\r
-\r
- //====================\r
- // GPIOs configuration\r
- //====================\r
- for (idx_bk = 0; idx_bk < NumberOfBanks; idx_bk++)\r
- {\r
- LocalBank = &(TSL_Globals.Bank_Array[idx_bk]);\r
- p_chSrc = LocalBank->p_chSrc;\r
-\r
-#if (TSLPRM_USE_SHIELD > 0)\r
- // Enables GPIOs clock\r
- TSL_RCC_AHBENR_Config(LocalBank->shield_sample);\r
-\r
- // Bank shield configuration\r
- /* Disables Hysteresis Register */\r
- TSL_RI_HYSCR_Config(LocalBank->shield_sample);\r
-\r
- /* Output PP config */\r
- TSL_GPIO_OTYPER_PP_Config(p_chSrc->t_sample);\r
- TSL_GPIO_OTYPER_PP_Config(p_chSrc->t_channel);\r
- /* 400kHz config */\r
- TSL_GPIO_OSPEEDR_VL_Config(p_chSrc->t_sample);\r
- TSL_GPIO_OSPEEDR_VL_Config(p_chSrc->t_channel);\r
- /* No pull up/pull down config */\r
- TSL_GPIO_PUPDR_NO_PUPD_Config(LocalBank->shield_sample);\r
- TSL_GPIO_PUPDR_NO_PUPD_Config(LocalBank->shield_channel);\r
- /* Set ODR */\r
- TSL_GPIO_BR_Config(LocalBank->shield_sample);\r
- TSL_GPIO_BR_Config(LocalBank->shield_channel);\r
- /* Output mode */\r
- TSL_GPIO_MODER_OUT_Config(LocalBank->shield_sample);\r
- TSL_GPIO_MODER_OUT_Config(LocalBank->shield_channel);\r
-#endif\r
-\r
- LocalNumberOfChannels = LocalBank->NbChannels;\r
-\r
- for (idx_ch = 0;\r
- idx_ch < LocalNumberOfChannels;\r
- idx_ch++)\r
- {\r
- /* Enables GPIOs clock */\r
- TSL_RCC_AHBENR_Config(p_chSrc->t_sample);\r
- TSL_RCC_AHBENR_Config(p_chSrc->t_channel);\r
-\r
- // Bank/channel configuration\r
- /* Disables Hysteresis Register */\r
- TSL_RI_HYSCR_Config(p_chSrc->t_sample);\r
- /* Output PP config */\r
- TSL_GPIO_OTYPER_PP_Config(p_chSrc->t_sample);\r
- TSL_GPIO_OTYPER_PP_Config(p_chSrc->t_channel);\r
- /* 400kHz config */\r
- TSL_GPIO_OSPEEDR_VL_Config(p_chSrc->t_sample);\r
- TSL_GPIO_OSPEEDR_VL_Config(p_chSrc->t_channel);\r
- /* No pull up/pull down config */\r
- TSL_GPIO_PUPDR_NO_PUPD_Config(p_chSrc->t_sample);\r
- TSL_GPIO_PUPDR_NO_PUPD_Config(p_chSrc->t_channel);\r
- /* Set ODR */\r
- TSL_GPIO_BR_Config(p_chSrc->t_sample);\r
- TSL_GPIO_BR_Config(p_chSrc->t_channel);\r
- /* Output mode */\r
- TSL_GPIO_MODER_OUT_Config(p_chSrc->t_sample);\r
- TSL_GPIO_MODER_OUT_Config(p_chSrc->t_channel);\r
-\r
- p_chSrc++;\r
- }\r
- }\r
-\r
- /* Enable RI Switch */\r
- RI->ASCR1 &= (uint32_t)(~0x80000000); // ADC analog switches open !!!\r
-\r
- return TSL_STATUS_OK;\r
-}\r
-\r
-\r
-/**\r
- * @brief Configures a Bank.\r
- * @param[in] idx_bk Index of the Bank to configure\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk)\r
-{\r
- TSL_tIndex_T index;\r
- TSL_tIndex_T idx_dest;\r
- TSL_tIndex_T idx_ch;\r
- CONST TSL_ChannelDest_T *p_chDest; // Pointer to the current channel\r
- CONST TSL_ChannelSrc_T *p_chSrc; // Pointer to the current channel\r
-\r
- // Check parameters (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_BANK_INDEX_OK(idx_bk));\r
-\r
- bank = &(TSL_Globals.Bank_Array[idx_bk]);\r
-\r
- for (index = 0;index < SIZEOFBANKCONF;index++)\r
- {\r
- TSL_BankSampleConf[index] = 0x00000000;\r
- TSL_BankChannelConf[index] = 0x00000000;\r
- }\r
-\r
- NumberOfChannels = bank->NbChannels;\r
- NumberOfChannelOn = 0;\r
- GroupToCheck = 0;//init group to check\r
-\r
- p_chDest = bank->p_chDest;\r
- p_chSrc = bank->p_chSrc;\r
- for (idx_ch = 0; idx_ch < NumberOfChannels; idx_ch++)\r
- {\r
- // Get index in the result array associated to the current channel\r
- idx_dest = p_chDest->IdxDest;\r
-\r
- if (bank->p_chData[idx_dest].Flags.ObjStatus != TSL_OBJ_STATUS_OFF)\r
- {\r
- TSL_BankConf(TSL_BankSampleConf, p_chSrc->t_sample);\r
- TSL_BankConf(TSL_BankChannelConf, p_chSrc->t_channel);\r
- GroupToCheck |= (1 << (p_chSrc->IdxSrc));\r
- NumberOfChannelOn++;\r
- }\r
-\r
- p_chSrc++;\r
- p_chDest++;\r
- }\r
-\r
-#if (TSLPRM_USE_GPIOA)\r
- GPIOA_IDR_Mask = TSL_BankSampleConf[4];\r
-#endif\r
-\r
-#if (TSLPRM_USE_GPIOB)\r
- GPIOB_IDR_Mask = TSL_BankSampleConf[7];\r
-#endif\r
-\r
-#if (TSLPRM_USE_GPIOC)\r
- GPIOC_IDR_Mask = TSL_BankSampleConf[10];\r
-#endif\r
-\r
-#if (TSLPRM_USE_GPIOF)\r
- GPIOF_IDR_Mask = TSL_BankSampleConf[13];\r
-#endif\r
-\r
-#if (TSLPRM_USE_GPIOG)\r
- GPIOG_IDR_Mask = TSL_BankSampleConf[16];\r
-#endif\r
-\r
-\r
-#if (TSLPRM_USE_SHIELD > 0)\r
- if (NumberOfChannelOn != 0)\r
- {\r
- TSL_BankConf(TSL_BankSampleConf, bank->shield_sample);\r
- TSL_BankConf(TSL_BankChannelConf, bank->shield_channel);\r
- }\r
-#endif\r
-\r
- return TSL_STATUS_OK;\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief Check which group is not over\r
- * @param[in] EndedGroup\r
- * @retval None\r
- */\r
-void TSL_acq_GroupDone(uint16_t EndedGroup)\r
-{\r
- uint16_t i;\r
-\r
- for (i = 0;i < 11;i++)\r
- {\r
- if ((EndedGroup & (1 << i)) != (1 << i))\r
- {\r
- tab_MeasurementCounter[i] = TSL_Params.AcqMax + 1;\r
- }\r
- }\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief Start acquisition on a previously configured bank\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_acq_BankStartAcq(void)\r
-{\r
- CONST TSL_Bank_T *LocalBank = &(TSL_Globals.Bank_Array[0]);\r
- TSL_tNb_T NumberOfBanks = TSLPRM_TOTAL_BANKS;\r
- TSL_tNb_T LocalNumberOfChannels = 0;\r
- TSL_tIndex_T BankIndex;\r
-\r
- uint16_t MeasurementCounter = 0;\r
- CONST TSL_ChannelSrc_T *p_chSrc;\r
- TSL_tIndex_T idx_ch;\r
- uint16_t GroupToCheckMask = 0;\r
- uint32_t GPIO_IDR_Mask = 0;\r
- uint8_t Check_Input = 0;\r
-\r
-#if (TSLPRM_USE_GPIOA)\r
- uint16_t TSL_GPIOA_IDR = 0;\r
-#endif\r
-#if (TSLPRM_USE_GPIOB)\r
- uint16_t TSL_GPIOB_IDR = 0;\r
-#endif\r
-#if (TSLPRM_USE_GPIOC)\r
- uint16_t TSL_GPIOC_IDR = 0;\r
-#endif\r
-#if (TSLPRM_USE_GPIOF)\r
- uint16_t TSL_GPIOF_IDR = 0;\r
-#endif\r
-#if (TSLPRM_USE_GPIOG)\r
- uint16_t TSL_GPIOG_IDR = 0;\r
-#endif\r
- uint16_t GPIO_IDR = 0;\r
-\r
-#if (TSLPRM_PROTECT_IO_ACCESS > 0)\r
- __disable_irq();\r
-#endif\r
-#if (TSLPRM_IODEF > 0)\r
- //============================\r
- // All GPIOs in Input floating\r
- //============================\r
- for (BankIndex = 0; BankIndex < NumberOfBanks; BankIndex++)\r
- {\r
- LocalBank = &(TSL_Globals.Bank_Array[BankIndex]);\r
- p_chSrc = LocalBank->p_chSrc;\r
-\r
-#if (TSLPRM_USE_SHIELD > 0)\r
- TSL_GPIO_MODER_IN_Config(LocalBank->shield_sample);\r
- TSL_GPIO_MODER_IN_Config(LocalBank->shield_channel);\r
-#endif\r
-\r
- LocalNumberOfChannels = LocalBank->NbChannels;\r
-\r
- for (idx_ch = 0;\r
- idx_ch < LocalNumberOfChannels;\r
- idx_ch++)\r
- {\r
- TSL_GPIO_MODER_IN_Config(p_chSrc->t_sample);\r
- TSL_GPIO_MODER_IN_Config(p_chSrc->t_channel);\r
-\r
- p_chSrc++;\r
- }\r
- }\r
-#endif\r
-#if (TSLPRM_PROTECT_IO_ACCESS > 0)\r
- __enable_irq();\r
-#endif\r
-\r
- /* Open the analog switches */\r
- RI->ASCR1 &= (uint32_t)(~(TSL_BankSampleConf[0] | TSL_BankChannelConf[0]));\r
- RI->ASCR2 &= (uint32_t)(~(TSL_BankSampleConf[1] | TSL_BankChannelConf[1]));\r
-\r
- /* All IO to pushpull LOW for discharging all capacitors (Ctouch and Csense) */\r
-#if (TSLPRM_PROTECT_IO_ACCESS > 0)\r
- __disable_irq();\r
-#endif\r
- /* Discharging sampling capacitor and CTouch */\r
-#if (TSLPRM_USE_GPIOA)\r
- GPIOA->ODR &= (uint32_t)(~(TSL_BankSampleConf[4] | TSL_BankChannelConf[4]));\r
- GPIOA->MODER = (GPIOA->MODER & (uint32_t)(~(TSL_BankSampleConf[2] | TSL_BankChannelConf[2]))) | (TSL_BankSampleConf[3] | TSL_BankChannelConf[3]);\r
-#endif\r
-#if (TSLPRM_USE_GPIOB)\r
- GPIOB->ODR &= (uint32_t)(~(TSL_BankSampleConf[7] | TSL_BankChannelConf[7]));\r
- GPIOB->MODER = (GPIOB->MODER & (uint32_t)(~(TSL_BankSampleConf[5] | TSL_BankChannelConf[5]))) | (TSL_BankSampleConf[6] | TSL_BankChannelConf[6]);\r
-#endif\r
-#if (TSLPRM_USE_GPIOC)\r
- GPIOC->ODR &= (uint32_t)(~(TSL_BankSampleConf[10] | TSL_BankChannelConf[10]));\r
- GPIOC->MODER = (GPIOC->MODER & (uint32_t)(~(TSL_BankSampleConf[8] | TSL_BankChannelConf[8]))) | (TSL_BankSampleConf[9] | TSL_BankChannelConf[9]);\r
-#endif\r
-#if (TSLPRM_USE_GPIOF)\r
- GPIOF->ODR &= (uint32_t)(~(TSL_BankSampleConf[13] | TSL_BankChannelConf[13]));\r
- GPIOF->MODER = (GPIOF->MODER & (uint32_t)(~(TSL_BankSampleConf[11] | TSL_BankChannelConf[11]))) | (TSL_BankSampleConf[12] | TSL_BankChannelConf[12]);\r
-#endif\r
-#if (TSLPRM_USE_GPIOG)\r
- GPIOG->ODR &= (uint32_t)(~(TSL_BankSampleConf[16] | TSL_BankChannelConf[16]));\r
- GPIOG->MODER = (GPIOG->MODER & (uint32_t)(~(TSL_BankSampleConf[14] | TSL_BankChannelConf[14]))) | (TSL_BankSampleConf[15] | TSL_BankChannelConf[15]);\r
-#endif\r
-\r
-\r
-\r
-#if (TSLPRM_PROTECT_IO_ACCESS > 0)\r
- __enable_irq();\r
-#endif\r
-\r
- /* Wait a while for a good discharging of all capacitors */\r
- SoftDelay(50); // ~14µs with fHCLK = 32MHz\r
- //this time depends of the size of the sampling capacitor\r
-\r
-#if (TSLPRM_PROTECT_IO_ACCESS > 0)\r
- __disable_irq();\r
-#endif\r
- /* All IO in input floating */\r
-#if (TSLPRM_USE_GPIOA)\r
- GPIOA->MODER &= (uint32_t)(~(TSL_BankSampleConf[2] | TSL_BankChannelConf[2]));\r
-#endif\r
-#if (TSLPRM_USE_GPIOB)\r
- GPIOB->MODER &= (uint32_t)(~(TSL_BankSampleConf[5] | TSL_BankChannelConf[5]));\r
-#endif\r
-#if (TSLPRM_USE_GPIOC)\r
- GPIOC->MODER &= (uint32_t)(~(TSL_BankSampleConf[8] | TSL_BankChannelConf[8]));\r
-#endif\r
-#if (TSLPRM_USE_GPIOF)\r
- GPIOF->MODER &= (uint32_t)(~(TSL_BankSampleConf[11] | TSL_BankChannelConf[11]));\r
-#endif\r
-#if (TSLPRM_USE_GPIOG)\r
- GPIOG->MODER &= (uint32_t)(~(TSL_BankSampleConf[14] | TSL_BankChannelConf[14]));\r
-#endif\r
-\r
- /* set the IO to Vdd (io in push-pull HIGH when in output mode) */\r
-#if (TSLPRM_USE_GPIOA)\r
- GPIOA->ODR |= (TSL_BankSampleConf[4] | TSL_BankChannelConf[4]); /* HIGH level */\r
-#endif\r
-#if (TSLPRM_USE_GPIOB)\r
- GPIOB->ODR |= (TSL_BankSampleConf[7] | TSL_BankChannelConf[7]); /* HIGH level */\r
-#endif\r
-#if (TSLPRM_USE_GPIOC)\r
- GPIOC->ODR |= (TSL_BankSampleConf[10] | TSL_BankChannelConf[10]); /* HIGH level */\r
-#endif\r
-#if (TSLPRM_USE_GPIOF)\r
- GPIOF->ODR |= (TSL_BankSampleConf[13] | TSL_BankChannelConf[13]); /* HIGH level */\r
-#endif\r
-#if (TSLPRM_USE_GPIOG)\r
- GPIOG->ODR |= (TSL_BankSampleConf[16] | TSL_BankChannelConf[16]); /* HIGH level */\r
-#endif\r
-\r
-#if (TSLPRM_PROTECT_IO_ACCESS > 0)\r
- __enable_irq();\r
-#endif\r
-\r
- /* Close the sampling capacitor analog switch */\r
- RI->ASCR1 |= (TSL_BankSampleConf[0]);\r
- RI->ASCR2 |= (TSL_BankSampleConf[1]);\r
-\r
-\r
- /* Loop while all the 1st channel of each group have not reach the VIH level */\r
- do\r
- {\r
-\r
-#if (TSLPRM_PROTECT_IO_ACCESS > 0)\r
- __disable_irq();\r
-#endif\r
- /* Charging Ctouch by connecting the IO to Vdd (io in push-pull HIGH) */\r
-#if (TSLPRM_USE_GPIOA)\r
- GPIOA->MODER |= (TSL_BankChannelConf[3]); /* Output push pull config */\r
-#endif\r
-#if (TSLPRM_USE_GPIOB)\r
- GPIOB->MODER |= (TSL_BankChannelConf[6]); /* Output push pull config */\r
-#endif\r
-#if (TSLPRM_USE_GPIOC)\r
- GPIOC->MODER |= (TSL_BankChannelConf[9]); /* Output push pull config */\r
-#endif\r
-#if (TSLPRM_USE_GPIOF)\r
- GPIOF->MODER |= (TSL_BankChannelConf[12]); /* Output push pull config */\r
-#endif\r
-#if (TSLPRM_USE_GPIOG)\r
- GPIOG->MODER |= (TSL_BankChannelConf[15]); /* Output push pull config */\r
-#endif\r
-#if (TSLPRM_PROTECT_IO_ACCESS > 0)\r
- __enable_irq();\r
-#endif\r
-\r
- /* Wait a while for a good charging (programmable delay) */\r
- SoftDelay(1);\r
-\r
- /* test GPIOx->IDR bit + group configuration for each channel */\r
-\r
-#if (TSLPRM_USE_GPIOA)\r
- TSL_GPIOA_IDR = GPIOA->IDR;\r
- if ((TSL_GPIOA_IDR & GPIOA_IDR_Mask) != 0)\r
- {\r
- Check_Input = 1;\r
- GPIOA_IDR_Mask &= (uint32_t)(~TSL_GPIOA_IDR);\r
- }\r
-#endif\r
-\r
-#if (TSLPRM_USE_GPIOB)\r
- TSL_GPIOB_IDR = GPIOB->IDR;\r
- if ((TSL_GPIOB_IDR & GPIOB_IDR_Mask) != 0)\r
- {\r
- Check_Input = (1 << 1);\r
- GPIOB_IDR_Mask &= (uint32_t)(~TSL_GPIOB_IDR);\r
- }\r
-#endif\r
-\r
-#if (TSLPRM_USE_GPIOC)\r
- TSL_GPIOC_IDR = GPIOC->IDR;\r
- if ((TSL_GPIOC_IDR & GPIOC_IDR_Mask) != 0)\r
- {\r
- Check_Input = (1 << 2);\r
- GPIOC_IDR_Mask &= (uint32_t)(~TSL_GPIOC_IDR);\r
- }\r
-#endif\r
-\r
-#if (TSLPRM_USE_GPIOF)\r
- TSL_GPIOF_IDR = GPIOF->IDR;\r
- if ((TSL_GPIOF_IDR & GPIOF_IDR_Mask) != 0)\r
- {\r
- Check_Input = (1 << 5);\r
- GPIOF_IDR_Mask &= (uint32_t)(~TSL_GPIOF_IDR);\r
- }\r
-#endif\r
-\r
-#if (TSLPRM_USE_GPIOG)\r
- TSL_GPIOG_IDR = GPIOG->IDR;\r
- if ((TSL_GPIOG_IDR & GPIOG_IDR_Mask) != 0)\r
- {\r
- Check_Input = (1 << 6);\r
- GPIOG_IDR_Mask &= (uint32_t)(~TSL_GPIOG_IDR);\r
- }\r
-#endif\r
-\r
-\r
- if (Check_Input)\r
- {\r
- p_chSrc = bank->p_chSrc;\r
- for (idx_ch = 0; idx_ch < NumberOfChannels; idx_ch++)\r
- {\r
- GroupToCheckMask = (1 << (p_chSrc->IdxSrc));\r
- if ((GroupToCheck & GroupToCheckMask) == (GroupToCheckMask))\r
- {\r
- GPIO_IDR_Mask = (1 << TSL_CHANNEL_IO(p_chSrc->t_sample));\r
-\r
- switch (TSL_CHANNEL_PORT(p_chSrc->t_sample))\r
- {\r
-#if (TSLPRM_USE_GPIOA)\r
- case 0: GPIO_IDR = TSL_GPIOA_IDR; break;\r
-#endif\r
-#if (TSLPRM_USE_GPIOB)\r
- case 1: GPIO_IDR = TSL_GPIOB_IDR; break;\r
-#endif\r
-#if (TSLPRM_USE_GPIOC)\r
- case 2: GPIO_IDR = TSL_GPIOC_IDR; break;\r
-#endif\r
-#if (TSLPRM_USE_GPIOF)\r
- case 5: GPIO_IDR = TSL_GPIOF_IDR; break;\r
-#endif\r
-#if (TSLPRM_USE_GPIOG)\r
- case 6: GPIO_IDR = TSL_GPIOG_IDR; break;\r
-#endif\r
- default: break;\r
- }\r
-\r
- if ((GPIO_IDR & GPIO_IDR_Mask) == GPIO_IDR_Mask)\r
- {\r
- tab_MeasurementCounter[p_chSrc->IdxSrc] = MeasurementCounter;\r
- GroupToCheck &= (uint32_t)(~(1 << (p_chSrc->IdxSrc)));\r
- Check_Input &= (uint32_t)(~(1 << TSL_CHANNEL_PORT(p_chSrc->t_sample)));\r
- }\r
- }\r
- p_chSrc++;\r
- }\r
- }\r
-\r
- MeasurementCounter++;\r
-\r
-#if (TSLPRM_PROTECT_IO_ACCESS > 0)\r
- __disable_irq();\r
-#endif\r
- /* Configure All channels in input floating */\r
-#if (TSLPRM_USE_GPIOA)\r
- GPIOA->MODER &= (uint32_t)(~(TSL_BankChannelConf[2]));\r
-#endif\r
-#if (TSLPRM_USE_GPIOB)\r
- GPIOB->MODER &= (uint32_t)(~(TSL_BankChannelConf[5]));\r
-#endif\r
-#if (TSLPRM_USE_GPIOC)\r
- GPIOC->MODER &= (uint32_t)(~(TSL_BankChannelConf[8]));\r
-#endif\r
-#if (TSLPRM_USE_GPIOF)\r
- GPIOF->MODER &= (uint32_t)(~(TSL_BankChannelConf[11]));\r
-#endif\r
-#if (TSLPRM_USE_GPIOG)\r
- GPIOG->MODER &= (uint32_t)(~(TSL_BankChannelConf[14]));\r
-#endif\r
-\r
-#if (TSLPRM_PROTECT_IO_ACCESS > 0)\r
- __enable_irq();\r
-#endif\r
-\r
- /* Charging the Csense cap with connecting it to Ctouch by closing the analog switch */\r
- RI->ASCR1 |= (TSL_BankChannelConf[0]);\r
- RI->ASCR2 |= (TSL_BankChannelConf[1]);\r
-\r
- /* Wait a while for a good charge transfering (programmable delay) */\r
- SoftDelay(1);\r
-\r
- RI->ASCR1 &= (uint32_t)(~(TSL_BankChannelConf[0]));\r
- RI->ASCR2 &= (uint32_t)(~(TSL_BankChannelConf[1]));\r
-\r
- /*it's better to implement this like that because it's much more faster than to put this test in the "while test" below */\r
- if (MeasurementCounter > TSL_Params.AcqMax)\r
- {\r
- TSL_acq_GroupDone(GroupToCheck);\r
- __NOP();\r
- break;\r
- }\r
-\r
- }\r
- while (GroupToCheck != 0);\r
-\r
-\r
-#if (TSLPRM_PROTECT_IO_ACCESS > 0)\r
- __disable_irq();\r
-#endif\r
- //====================\r
- // All GPIOs in PP Low\r
- //====================\r
- for (BankIndex = 0; BankIndex < NumberOfBanks; BankIndex++)\r
- {\r
- LocalBank = &(TSL_Globals.Bank_Array[BankIndex]);\r
- p_chSrc = LocalBank->p_chSrc;\r
-\r
-#if (TSLPRM_USE_SHIELD > 0)\r
- TSL_GPIO_BR_Config(LocalBank->shield_sample);\r
- TSL_GPIO_BR_Config(LocalBank->shield_channel);\r
- TSL_GPIO_MODER_OUT_Config(LocalBank->shield_sample);\r
- TSL_GPIO_MODER_OUT_Config(LocalBank->shield_channel);\r
-#endif\r
-\r
- LocalNumberOfChannels = LocalBank->NbChannels;\r
-\r
- for (idx_ch = 0;\r
- idx_ch < LocalNumberOfChannels;\r
- idx_ch++)\r
- {\r
- TSL_GPIO_BR_Config(p_chSrc->t_sample);\r
- TSL_GPIO_BR_Config(p_chSrc->t_channel);\r
- TSL_GPIO_MODER_OUT_Config(p_chSrc->t_sample);\r
- TSL_GPIO_MODER_OUT_Config(p_chSrc->t_channel);\r
-\r
- p_chSrc++;\r
- }\r
- }\r
-#if (TSLPRM_PROTECT_IO_ACCESS > 0)\r
- __enable_irq();\r
-#endif\r
-\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief Wait end of acquisition\r
- * @param None\r
- * @retval status\r
- */\r
-TSL_Status_enum_T TSL_acq_BankWaitEOC(void)\r
-{\r
- TSL_Status_enum_T retval = TSL_STATUS_BUSY;\r
- retval = TSL_STATUS_OK;\r
- return retval;\r
-}\r
-\r
-\r
-/**\r
- * @brief Return the current measure\r
- * @param[in] index Index of the measure source\r
- * @retval Measure\r
- */\r
-TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndex_T index)\r
-{\r
- return(tab_MeasurementCounter[index]);\r
-}\r
-\r
-\r
-/**\r
- * @brief Check noise (not used)\r
- * @param None\r
- * @retval Status\r
- */\r
-TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void)\r
-{\r
- return TSL_ACQ_STATUS_OK;\r
-}\r
-\r
-\r
-/**\r
- * @brief Process the TS Interrupt routine\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_acq_ProcessIT(void)\r
-{\r
-}\r
-\r
-/**\r
- * @brief Check if a filter must be used on the current channel (not used)\r
- * @param[in] pCh Pointer on the channel data information\r
- * @retval Result TRUE if a filter can be applied\r
- */\r
-TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh)\r
-{\r
- return TSL_TRUE;\r
-}\r
-\r
-\r
-/**\r
- * @brief Compute the Delta value\r
- * @param[in] ref Reference value\r
- * @param[in] meas Last Measurement value\r
- * @retval Delta value\r
- */\r
-TSL_tDelta_T TSL_acq_ComputeDelta(TSL_tRef_T ref, TSL_tMeas_T meas)\r
-{\r
- return((TSL_tDelta_T)(ref - meas));\r
-}\r
-\r
-\r
-/**\r
- * @brief Compute the Measurement value\r
- * @param[in] ref Reference value\r
- * @param[in] delta Delta value\r
- * @retval Measurement value\r
- */\r
-TSL_tMeas_T TSL_acq_ComputeMeas(TSL_tRef_T ref, TSL_tDelta_T delta)\r
-{\r
- return((TSL_tMeas_T)(ref - delta));\r
-}\r
-\r
-\r
-/**\r
- * @brief Test if the Reference is incorrect (not used)\r
- * @param[in] pCh Pointer on the channel data information\r
- * @retval Result TRUE if the Reference is out of range\r
- */\r
-TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh)\r
-{\r
- return TSL_FALSE;\r
-}\r
-\r
-\r
-/**\r
- * @brief Test if the measure has crossed the reference target (not used)\r
- * @param[in] pCh Pointer on the channel data information\r
- * @param[in] new_meas Measure of the last acquisition on this channel\r
- * @retval Result TRUE if the Reference is valid\r
- */\r
-TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas)\r
-{\r
- return TSL_TRUE;\r
-}\r
-\r
-\r
-#if defined(__IAR_SYSTEMS_ICC__) // IAR/EWARM\r
-#pragma optimize=medium\r
-#elif defined(__CC_ARM) // Keil/MDK-ARM\r
-#pragma O1\r
-#pragma Ospace\r
-#elif defined(__TASKING__) // Altium/Tasking\r
-#pragma optimize O0\r
-#elif defined(__GNUC__) // Atollic/True Studio + Raisonance/RKit\r
-#pragma GCC push_options\r
-#pragma GCC optimize ("O0")\r
-#endif\r
-/**\r
- * @brief Software delay (private routine)\r
- * @param val Wait delay\r
- * With fHCLK = 32MHz: 1 = ~1µs, 50 = ~14µs, 100 = ~25µs, 200 = ~50µs\r
- * @retval None\r
- */\r
-void SoftDelay(uint16_t val)\r
-{\r
- __IO uint16_t i;\r
- for (i = val; i > 0; i--)\r
- {}\r
-}\r
-#if defined(__TASKING__)\r
-#pragma endoptimize\r
-#endif\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_acq_stm8tl5x.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the PXS acquisition\r
- * on STM8TL5x products.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_acq_stm8tl5x.h"\r
-#include "tsl_globals.h"\r
-#include "stm8tl5x_it.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-\r
-/* Private defines -----------------------------------------------------------*/\r
-#define EPCC_INIT_VALUE (0x80)\r
-#define CS_MIDDLE_VALUE (17)\r
-#define CS_MAX_VALUE (32)\r
-#define MAX_MEASURE (0xFFFF)\r
-\r
-/* Private macros ------------------------------------------------------------*/\r
-#define IS_BANK_INDEX_OK(INDEX) (((INDEX) == 0) || (((INDEX) > 0) && ((INDEX) < TSLPRM_TOTAL_BANKS)))\r
-#define IS_SOURCE_INDEX_OK(INDEX) (((INDEX) == 0) || (((INDEX) > 0) && ((INDEX) < TSLPRM_TOTAL_CHANNELS)))\r
-#define IS_EPCC_STATUS_OK(STATUS) ((STATUS & TSL_EPCC_CHANGE_MASK) != 0)\r
-#define IS_CSSEL_OK(CSSEL) (((CSSEL) == 0) || (((CSSEL) > 0) && ((CSSEL) < CS_MAX_VALUE)))\r
-\r
-/* Private variables ---------------------------------------------------------*/\r
-TSL_BankConfig_T PXS_BankConfig[TSLPRM_TOTAL_BANKS];\r
-CONST uint8_t PXS_CSsorting[] = {0, 1, 2, 8, 3, 4, 5, 9, 6, 10, 16, 11, 7, 12, 17, 13, 18, 19, 14, 24, 15, 20, 25, 21, 26, 22, 27, 23, 28, 29, 30, 31};\r
-\r
-/* Private functions prototype -----------------------------------------------*/\r
-void TSL_PXS_CS_CalibrateBank(TSL_tIndex_T idx_bk);\r
-int8_t TSL_PXS_EPCC_CalibrateBank(TSL_tIndex_T bank);\r
-TSL_Status_enum_T TSL_PXS_EPCC_CalibrateZone(CONST TSL_Zone_T *);\r
-void SoftDelay(uint32_t val);\r
-\r
-/**\r
- * @brief Initializes the acquisition module.\r
- * @param None\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_acq_Init(void)\r
-{\r
-\r
- TSL_Status_enum_T retval = TSL_STATUS_OK;\r
-\r
- TSL_tIndex_T i;\r
- TSL_tIndex_T j;\r
- TSL_tIndex_T idx_bk; // Bank index\r
- uint16_t TxInUseMask = 0;\r
- uint16_t RxInUseMask = 0;\r
- CONST TSL_Bank_T *bank;\r
- uint8_t *CSArray;\r
-\r
- // Enable the PXS IP clock\r
- CLK->PCKENR1 |= CLK_PCKENR1_PXS;\r
-\r
- // Initialization of PXS IP\r
- PXS->CKCR1 &= (uint8_t)~PXS_CKCR1_PRESC;\r
-\r
-#if (TSLPRM_PXS_HSI == 16000)\r
- PXS->CKCR1 |= PXS_CKCR1_16MHZ;\r
-#elif (TSLPRM_PXS_HSI == 8000)\r
- PXS->CKCR1 |= PXS_CKCR1_8MHZ;\r
-#elif (TSLPRM_PXS_HSI == 4000)\r
- PXS->CKCR1 |= PXS_CKCR1_4MHZ;\r
-#elif (TSLPRM_PXS_HSI == 2000)\r
- PXS->CKCR1 |= PXS_CKCR1_2MHZ;\r
-#elif (TSLPRM_PXS_HSI == 1000)\r
- PXS->CKCR1 |= PXS_CKCR1_1MHZ;\r
-#elif (TSLPRM_PXS_HSI == 500)\r
- PXS->CKCR1 |= PXS_CKCR1_500KHZ;\r
-#elif (TSLPRM_PXS_HSI == 250)\r
- PXS->CKCR1 |= PXS_CKCR1_250KHZ;\r
-#elif (TSLPRM_PXS_HSI == 125)\r
- PXS->CKCR1 |= PXS_CKCR1_125KHZ;\r
-#else\r
- PXS->CKCR1 |= PXS_CKCR1_16MHZ; // Default\r
-#endif\r
-\r
- PXS->CKCR2 = (uint8_t)(((uint8_t)TSLPRM_PXS_UP_LENGTH & 0x07) << 4) | ((uint8_t)TSLPRM_PXS_PASS_LENGTH & 0x07);\r
-\r
-#if TSLPRM_PXS_RF_DETECTION > 0\r
- enablePXSNoiseDetection();\r
-#endif\r
-\r
- setPXSStab(TSLPRM_PXS_STAB);\r
- setPXSBias(TSLPRM_PXS_BIAS);\r
-\r
- // Initialization of the GPIO shared with the used TX\r
- for (i = 0; i < TSLPRM_TOTAL_BANKS; i++)\r
- {\r
- bank = &(TSL_Globals.Bank_Array[i]);\r
- CSArray = PXS_BankConfig[i].CSSEL;\r
- TxInUseMask |= bank->msk_TX;\r
- // Set the mask with the receivers use as receiver or as transmitter\r
- RxInUseMask |= bank->msk_RXEN;\r
- // Set the CS to 0\r
- for (j = 0; j <= TSLPRM_HIGH_CHANNEL_NB; j++)\r
- {\r
- *CSArray = 0;\r
- CSArray++;\r
- }\r
- }\r
-\r
- GPIOD->ODR &= (uint8_t)(~(TxInUseMask & 0x00FF));\r
- // Set the port as output\r
- GPIOD->DDR |= (uint8_t)(TxInUseMask & 0x00FF);\r
- // Configure the port as open-drain\r
- GPIOD->CR1 &= (uint8_t)(~(TxInUseMask & 0x00FF));\r
-#if TSLPRM_PXS_INACTIVE_TX > 0\r
- // Configure as floating\r
- GPIOD->ODR |= (uint8_t)(TxInUseMask & 0x00FF);\r
-#else\r
- // Drive them to VSS\r
- GPIOD->ODR &= (uint8_t)(~(TxInUseMask & 0x00FF));\r
-#endif\r
- GPIOB->ODR &= (uint8_t)(~((TxInUseMask & 0xFF00) >> 8));\r
- // Set the port as output\r
- GPIOB->DDR |= (uint8_t)((TxInUseMask & 0xFF00) >> 8);\r
- // Configure the port as open-drain\r
- GPIOB->CR1 &= (uint8_t)(~((TxInUseMask & 0xFF00) >> 8));\r
-#if TSLPRM_PXS_INACTIVE_TX > 0\r
- // Configure as floating\r
- GPIOB->ODR |= (uint8_t)((TxInUseMask & 0xFF00) >> 8);\r
-#else\r
- // Drive it to VSS\r
- GPIOB->ODR &= (uint8_t)(~((TxInUseMask & 0xFF00) >> 8));\r
-#endif\r
-\r
- enablePXS();\r
-\r
-#if TSLPRM_PXS_INACTIVE_RX > 0\r
- PXS->RXINSR = 0x3FF;\r
-#else\r
- PXS->RXINSR = 0x0000;\r
-#endif\r
-\r
-#if TSLPRM_PXS_RX_COUPLING > 0\r
- enablePXSCoupling();\r
-#else\r
- disablePXSCoupling()\r
-#endif\r
-\r
-#if TSLPRM_PXS_SYNCHRONIZE > 0\r
- enablePXSSync();\r
-#if TSLPRM_PXS_SYNCHRO_EDGE > 0\r
- selectPXSSyncRisingEdge();\r
-#else\r
- selectPXSSyncFallingEdge();\r
-#endif\r
-#else\r
- disablePXSSync();\r
-#endif\r
-\r
-#if TSLPRM_USE_ACQ_INTERRUPT > 0\r
- enablePXSInterrupts(PXS_CR2_EOCITEN);\r
-#endif\r
- // Configure the acquisition mode\r
- PXS->RXCR3 = (uint16_t)RxInUseMask;\r
- PXS->RXCR2 = (uint16_t)RxInUseMask;\r
-\r
-#if TSLPRM_ACQ_MAX > 0\r
- PXS->MAXR = TSLPRM_ACQ_MAX;\r
- PXS->MAXENR = 0x03FF;\r
-#else\r
- PXS->MAXENR = 0;\r
-#endif\r
-\r
- // Calibrate the CS for all banks\r
- for (idx_bk = 0;idx_bk < TSLPRM_TOTAL_BANKS;idx_bk++)\r
- {\r
- TSL_PXS_CS_CalibrateBank(idx_bk);\r
- }\r
-\r
-\r
- // Calibrate the EPCC for all banks\r
- for (idx_bk = 0;idx_bk < TSLPRM_TOTAL_BANKS;idx_bk++)\r
- {\r
- if (TSL_PXS_EPCC_CalibrateBank(idx_bk) > 0)\r
- {\r
- retval = TSL_STATUS_ERROR;\r
- }\r
- }\r
-#if TSLPRM_PXS_LOW_POWER_MODE > 0\r
- setPXSLowPower();\r
-#else\r
- resetPXSLowPower();\r
-#endif\r
-\r
- return retval;\r
-\r
-}\r
-\r
-/**\r
- * @brief Calibrate the CS for a selected acquisition bank\r
- * @param[in] idx_bk Index of the bank\r
- * @retval Number of Receivers not correctly calibrated\r
- */\r
-void TSL_PXS_CS_CalibrateBank(TSL_tIndex_T idx_bk)\r
-{\r
- TSL_tIndex_T idx_ch;\r
- uint8_t currentCS = 24;\r
- uint8_t CS_delta = 4; // Value to add/substract to/from the current CS\r
- CONST TSL_Bank_T *bank;\r
- CONST uint16_t targetCount = TSLPRM_KEY_TARGET_REFERENCE / TSLPRM_KEY_TARGET_ATTENUATION;\r
- CONST uint16_t targetCountError = targetCount >> 3;\r
- bool CalibrationDone = FALSE;\r
- uint16_t measSup[TSLPRM_HIGH_CHANNEL_NB+1];\r
- uint16_t measInf[TSLPRM_HIGH_CHANNEL_NB+1];\r
- uint8_t CSsup[TSLPRM_HIGH_CHANNEL_NB+1];\r
- uint8_t CSinf[TSLPRM_HIGH_CHANNEL_NB+1];\r
-\r
- // Check parameters (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_BANK_INDEX_OK(idx_bk));\r
-#if TSLPRM_USE_ACQ_INTERRUPT == 0\r
- enablePXSInterrupts(PXS_CR2_EOCITEN);\r
-#endif\r
-\r
- bank = &(TSL_Globals.Bank_Array[idx_bk]);\r
- resetPXSLowPower();\r
- TSL_acq_BankConfig(idx_bk);\r
-\r
- PXS->MAXR = TSLPRM_KEY_TARGET_REFERENCE;\r
-\r
- WFE->CR1 |= WFE_CR1_PXS_EV;\r
- for (idx_ch = 0; idx_ch <= TSLPRM_HIGH_CHANNEL_NB; idx_ch++)\r
- {\r
- PXS->RXEPCCSELR[idx_ch] = 0;\r
- PXS->RXCSSELR[idx_ch] = currentCS;\r
- CSsup[idx_ch] = 0;\r
- CSinf[idx_ch] = 0;\r
- measInf[idx_ch] = 0;\r
- measSup[idx_ch] = 0xFFFF;\r
-\r
- }\r
- do\r
- {\r
- startPXSAcquisition();\r
- wfe();\r
- clearPXS_ISR_EOCF;\r
- for (idx_ch = 0; idx_ch <= TSLPRM_HIGH_CHANNEL_NB; idx_ch++)\r
- {\r
- if (bank->msk_channels & (uint16_t)((uint16_t)1 << idx_ch))\r
- {\r
- if (!(PXS->RXSR & (uint16_t)((uint16_t)1 << idx_ch)) || (PXS->RXCNTR[idx_ch] > targetCount - targetCountError))\r
- {\r
- PXS->RXCSSELR[idx_ch] -= 8;\r
- }\r
- }\r
- }\r
- currentCS -= 8;\r
- }\r
- while (currentCS);\r
-\r
-\r
- for (idx_ch = 0; idx_ch <= TSLPRM_HIGH_CHANNEL_NB; idx_ch++)\r
- {\r
- PXS->RXCSSELR[idx_ch] += CS_delta;\r
- }\r
-\r
- do\r
- {\r
- CS_delta >>= 1;\r
- if ((CS_delta == 0) && (CalibrationDone == FALSE))\r
- {\r
- CalibrationDone = TRUE;\r
- CS_delta = 1;\r
- }\r
-\r
- startPXSAcquisition();\r
- wfe();\r
- clearPXS_ISR_EOCF;\r
- for (idx_ch = 0; idx_ch <= TSLPRM_HIGH_CHANNEL_NB; idx_ch++)\r
- {\r
- if (bank->msk_channels & (uint16_t)((uint16_t)1 << idx_ch))\r
- {\r
- if (!(PXS->RXSR & (uint16_t)((uint16_t)1 << idx_ch)) || (PXS->RXCNTR[idx_ch] > targetCount))\r
- {\r
- measSup[idx_ch] = PXS->RXCNTR[idx_ch];\r
- CSsup[idx_ch] = PXS->RXCSSELR[idx_ch];\r
- PXS->RXCSSELR[idx_ch] -= CS_delta;\r
- }\r
- else //if (PXS->RXCNTR[idx_ch] < targetCount )\r
- {\r
- measInf[idx_ch] = PXS->RXCNTR[idx_ch];\r
- CSinf[idx_ch] = PXS->RXCSSELR[idx_ch];\r
- PXS->RXCSSELR[idx_ch] += CS_delta;\r
- }\r
-// else\r
-// {\r
- // Do nothing (MISRA requirement)\r
-// }\r
- }\r
- }\r
- }\r
- while ((CalibrationDone == FALSE) || (CS_delta != 0));\r
-\r
-\r
- // Restore configuration\r
-#if TSLPRM_ACQ_MAX > 0\r
- PXS->MAXR = TSLPRM_ACQ_MAX;\r
-#else\r
- PXS->MAXENR = 0;\r
-#endif\r
-\r
- WFE->CR1 &= (uint8_t)~WFE_CR1_PXS_EV;\r
-#if TSLPRM_USE_ACQ_INTERRUPT == 0\r
- disablePXSInterrupts(PXS_CR2_EOCITEN);\r
-#endif\r
-\r
- // Store the CS\r
- for (idx_ch = 0;idx_ch <= TSLPRM_HIGH_CHANNEL_NB;idx_ch++)\r
- {\r
- if ((measSup[idx_ch] == 0) || ((measSup[idx_ch] - targetCount) > (targetCount - measInf[idx_ch])))\r
- {\r
- PXS_BankConfig[idx_bk].CSSEL[idx_ch] = CSinf[idx_ch];\r
- }\r
- else\r
- {\r
- PXS_BankConfig[idx_bk].CSSEL[idx_ch] = CSsup[idx_ch];\r
- }\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Calibrate the EPCC for a selected acquisition bank\r
- * @param[in] idx_bk Index of the bank\r
- * @retval Number Number of Receivers not correctly calibrated\r
- */\r
-int8_t TSL_PXS_EPCC_CalibrateBank(TSL_tIndex_T idx_bk)\r
-{\r
- TSL_tIndex_T idx_ch;\r
- uint8_t currentEPCC, trial, goodEPCC = 0;\r
- uint8_t EPCCtoCompute = 0; // Used to define if all the EPCC have their final value\r
- uint8_t EPCC_delta = EPCC_INIT_VALUE; // Value to add/substract to/from the current EPCC\r
- CONST TSL_Bank_T *bank;\r
-\r
- // Check parameters (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_BANK_INDEX_OK(idx_bk));\r
-#if TSLPRM_USE_ACQ_INTERRUPT == 0\r
- enablePXSInterrupts(PXS_CR2_EOCITEN);\r
-#endif\r
-\r
- bank = &(TSL_Globals.Bank_Array[idx_bk]);\r
- resetPXSLowPower();\r
- TSL_acq_BankConfig(idx_bk);\r
-\r
- PXS->MAXR = 2 * TSLPRM_KEY_TARGET_REFERENCE;\r
-\r
- WFE->CR1 |= WFE_CR1_PXS_EV;\r
- for (idx_ch = 0; idx_ch <= TSLPRM_HIGH_CHANNEL_NB; idx_ch++)\r
- {\r
- PXS->RXEPCCSELR[idx_ch] = EPCC_delta;\r
- if (bank->msk_channels & (uint16_t)((uint16_t)1 << idx_ch))\r
- {\r
- EPCCtoCompute++;\r
- }\r
- }\r
- do\r
- {\r
- EPCC_delta >>= 1;\r
- startPXSAcquisition();\r
- wfe();\r
- clearPXS_ISR_EOCF;\r
- for (idx_ch = 0; idx_ch <= TSLPRM_HIGH_CHANNEL_NB; idx_ch++)\r
- {\r
- if (bank->msk_channels & (uint16_t)((uint16_t)1 << idx_ch))\r
- {\r
- if (!(PXS->RXSR & (uint16_t)((uint16_t)1 << idx_ch)) || (PXS->RXCNTR[idx_ch] > TSLPRM_KEY_TARGET_REFERENCE))\r
- {\r
- PXS->RXEPCCSELR[idx_ch] -= EPCC_delta;\r
- }\r
- else if (PXS->RXCNTR[idx_ch] < TSLPRM_KEY_TARGET_REFERENCE)\r
- {\r
- PXS->RXEPCCSELR[idx_ch] += EPCC_delta;\r
- }\r
- else\r
- {\r
- // Do nothing (MISRA requirement)\r
- }\r
- }\r
- }\r
- }\r
- while (EPCC_delta >= 1);\r
- // Second pass to fine-tune\r
- trial = TSLPRM_PXS_EPCC_FINE_TUNING_ITERATION;\r
- do\r
- {\r
- startPXSAcquisition();\r
- goodEPCC = 0; // Reset the goodEPCC variable\r
- wfe();\r
- clearPXS_ISR_EOCF;\r
- for (idx_ch = 0; idx_ch <= TSLPRM_HIGH_CHANNEL_NB; idx_ch++)\r
- {\r
- if (bank->msk_channels & (uint16_t)((uint16_t)1 << idx_ch))\r
- {\r
- currentEPCC = PXS->RXEPCCSELR[idx_ch]; //this affectation allow to avoid computation of the structure address\r
- if (!(PXS->RXSR & (uint16_t)((uint16_t)1 << idx_ch)) || (PXS->RXCNTR[idx_ch] > (TSLPRM_KEY_TARGET_REFERENCE + TSLPRM_KEY_TARGET_REFERENCE_ERROR)))\r
- {\r
- if (currentEPCC > 0)\r
- {\r
- if ((currentEPCC & 0x07) != 0)\r
- {\r
- currentEPCC--;\r
- }\r
- else\r
- {\r
- currentEPCC -= 3; // This is due to the non linearity of the EPCC\r
- }\r
- }\r
- }\r
- else if (PXS->RXCNTR[idx_ch] < (TSLPRM_KEY_TARGET_REFERENCE - TSLPRM_KEY_TARGET_REFERENCE_ERROR))\r
- {\r
- if (currentEPCC < 0xFF)\r
- {\r
- if ((currentEPCC & 0x07) != 0x07)\r
- {\r
- currentEPCC++;\r
- }\r
- else\r
- {\r
- currentEPCC += 2; // This is due to the non linearity of the EPCC\r
- }\r
- }\r
- else // Invert the change in case the sorting is not reliable\r
- {\r
- currentEPCC--;\r
- }\r
- }\r
- else\r
- {\r
- goodEPCC++;\r
- }\r
- PXS->RXEPCCSELR[idx_ch] = currentEPCC;\r
- }\r
- }\r
- trial--;\r
- }\r
- while ((goodEPCC < EPCCtoCompute) && (trial));\r
-\r
- // Restore configuration\r
-#if TSLPRM_ACQ_MAX > 0\r
- PXS->MAXR = TSLPRM_ACQ_MAX;\r
-#else\r
- PXS->MAXENR = 0;\r
-#endif\r
-\r
- WFE->CR1 &= (uint8_t)~WFE_CR1_PXS_EV;\r
-#if TSLPRM_USE_ACQ_INTERRUPT == 0\r
- disablePXSInterrupts(PXS_CR2_EOCITEN);\r
-#endif\r
-\r
- // Store the EPCC\r
- for (idx_ch = 0;idx_ch <= TSLPRM_HIGH_CHANNEL_NB;idx_ch++)\r
- {\r
- PXS_BankConfig[idx_bk].EPCCSEL[idx_ch] = PXS->RXEPCCSELR[idx_ch];\r
- }\r
-\r
- return((int8_t)(EPCCtoCompute - goodEPCC));\r
-}\r
-\r
-\r
-#if TSLPRM_USE_ZONE > 0\r
-/**\r
- * @brief Calibrate the EPCC for a set of acquisition banks.\r
- * @param[in] zone Set of banks to calibrate the EPCC\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_PXS_EPCC_CalibrateZone(CONST TSL_Zone_T *zone)\r
-{\r
- uint16_t idx_bk;\r
- TSL_Status_enum_T retval = TSL_STATUS_OK;\r
- for (idx_bk = 0; idx_bk < zone->NbBanks; idx_bk++)\r
- {\r
- if (TSL_PXS_EPCC_CalibrateBank(zone->BankIndex[idx_bk]) > 0)\r
- {\r
- retval = TSL_STATUS_ERROR;\r
- }\r
- }\r
- return(retval);\r
-}\r
-#endif\r
-\r
-\r
-/**\r
- * @brief Test the reference and update the EPCC/CS if needed\r
- * @param[in] pCh pointer on the channel data information\r
- * @retval Result\r
- */\r
-TSL_Bool_enum_T TSL_acq_TestReferenceOutOfRange(TSL_ChannelData_T *pCh)\r
-{\r
- uint16_t reference, target_error = 0;\r
- TSL_Bool_enum_T result = TSL_FALSE;\r
-\r
- if (pCh->Flags.EPCCStatus != TSL_EPCC_STATUS_LOCKED)\r
- {\r
- reference = pCh->Ref;\r
-#if TSLPRM_TOTAL_TKEYS > 0\r
- if (TSL_Globals.This_Obj->Type & TSL_OBJ_TYPE_TKEY_MASK)\r
- {\r
- target_error = TSLPRM_TOUCHKEY_REFERENCE_RANGE;\r
- }\r
-#endif\r
-\r
-#if TSLPRM_TOTAL_LNRTS > 0\r
- if (TSL_Globals.This_Obj->Type & TSL_OBJ_TYPE_LINROT_MASK)\r
- {\r
- target_error = TSLPRM_LINROT_REFERENCE_RANGE;\r
- }\r
-#endif\r
- if ((reference != 0) && ((reference > (TSLPRM_KEY_TARGET_REFERENCE + target_error)) || (reference < (TSLPRM_KEY_TARGET_REFERENCE - target_error))))\r
- {\r
- if (reference < (TSLPRM_KEY_TARGET_REFERENCE - target_error))\r
- {\r
- pCh->Flags.EPCCStatus = TSL_EPCC_STATUS_INCREASE;\r
- }\r
- else if (reference > (TSLPRM_KEY_TARGET_REFERENCE + target_error))\r
- {\r
- pCh->Flags.EPCCStatus = TSL_EPCC_STATUS_DECREASE;\r
- }\r
- else\r
- {\r
- // Do nothing (MISRA requirement)\r
- }\r
- result = TSL_TRUE;\r
- }\r
- }\r
- return(result);\r
-}\r
-\r
-/**\r
- * @brief Test if the measure has crossed the reference target\r
- * @param[in] pCh Pointer to the channel Data under test\r
- * @param[in] new_meas Measure of the last acquisition on this channel\r
- * @retval Result Result of the test\r
- */\r
-TSL_Bool_enum_T TSL_acq_TestFirstReferenceIsValid(TSL_ChannelData_T *pCh, TSL_tMeas_T new_meas)\r
-{\r
- TSL_Bool_enum_T result = TSL_TRUE;\r
- TSL_EPCCStatus_enum_T EPCCStatus;\r
-\r
- EPCCStatus = pCh->Flags.EPCCStatus;\r
- if (EPCCStatus & TSL_EPCC_CHANGE_MASK)\r
- {\r
- // If the previous reference and the new one are on each side of the reference target\r
- // the EPCC is no more tested and the calibration continues.\r
- if (((EPCCStatus == TSL_EPCC_STATUS_INCREASE) && (new_meas >= TSLPRM_KEY_TARGET_REFERENCE))\r
- || ((EPCCStatus == TSL_EPCC_STATUS_DECREASE) && (new_meas <= TSLPRM_KEY_TARGET_REFERENCE)))\r
- {\r
- pCh->Flags.EPCCStatus = TSL_EPCC_STATUS_UNLOCKED;\r
- }\r
- else\r
- {\r
- result = TSL_FALSE;\r
- }\r
- }\r
-\r
- return(result);\r
-}\r
-\r
-\r
-/**\r
- * @brief Increase or decrease the CS value\r
- * @param[in] pCSSEL Address of the CS to be modified\r
- * @param[in] change Define if the Cs must be increased or decreased\r
- * @retval None\r
- */\r
-void TSL_acq_UpdateCS(uint8_t *pCSSEL, TSL_EPCCStatus_enum_T change)\r
-{\r
- uint16_t indexCS;\r
-\r
- assert_param(IS_EPCC_STATUS_OK(change));\r
- assert_param(IS_CSSEL_OK(*pCSSEL));\r
-\r
- if (*pCSSEL > CS_MIDDLE_VALUE)\r
- {\r
- indexCS = (CS_MIDDLE_VALUE - 1);\r
- }\r
- else\r
- {\r
- indexCS = 0;\r
- }\r
- while ((PXS_CSsorting[indexCS] != *pCSSEL) && (indexCS < CS_MAX_VALUE))\r
- {\r
- indexCS++;\r
- }\r
- if (change == TSL_EPCC_STATUS_INCREASE)\r
- {\r
- *pCSSEL = PXS_CSsorting[indexCS + 1];\r
- }\r
- else\r
- {\r
- *pCSSEL = PXS_CSsorting[indexCS - 1];\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Configures a Bank.\r
- * @param[in] idx_bk Index of the Bank to configure\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_acq_BankConfig(TSL_tIndex_T idx_bk)\r
-{\r
- TSL_Status_enum_T retval = TSL_STATUS_OK;\r
- uint16_t idx_ch;\r
- TSL_ChannelFlags_T flags;\r
- CONST TSL_Bank_T *bank = &(TSL_Globals.Bank_Array[idx_bk]);\r
- CONST TSL_ChannelSrc_T *pchSrc = bank->p_chSrc;\r
- CONST TSL_ChannelDest_T *pchDest = bank->p_chDest;\r
- TSL_tMaskRX enabledRX = 0;\r
- uint8_t *pEPCCSEL, *pCSSEL;\r
-\r
- // Check parameters (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_BANK_INDEX_OK(idx_bk));\r
-\r
- TSL_Globals.This_Bank = idx_bk;\r
-\r
- selectPXSRxGroup(bank->msk_group);\r
- for (idx_ch = 0;idx_ch < bank->NbChannels;idx_ch++)\r
- {\r
- flags = bank->p_chData[pchDest->IdxDest].Flags;\r
- if (flags.ObjStatus == TSL_OBJ_STATUS_ON)\r
- {\r
- enabledRX |= (1 << pchSrc->IdxSrc);\r
- if (flags.EPCCStatus & TSL_EPCC_CHANGE_MASK)\r
- {\r
- pEPCCSEL = &PXS_BankConfig[idx_bk].EPCCSEL[pchSrc->IdxSrc];\r
- if (flags.EPCCStatus == TSL_EPCC_STATUS_INCREASE)\r
- {\r
- if ((*pEPCCSEL) < 0xFF)\r
- {\r
- if (((*pEPCCSEL) & 0x07) != 0x07)\r
- {\r
- (*pEPCCSEL)++;\r
- }\r
- else\r
- {\r
- if ((*pEPCCSEL) < 0xFE)\r
- {\r
- (*pEPCCSEL) += 2; // This is due to the non linearity of the PCC\r
- }\r
- else\r
- {\r
- (*pEPCCSEL)++;\r
- }\r
- }\r
-\r
- }\r
- else\r
- {\r
- pCSSEL = &PXS_BankConfig[idx_bk].CSSEL[pchSrc->IdxSrc];\r
- if (*pCSSEL < 0x1F)\r
- {\r
- TSL_acq_UpdateCS(pCSSEL, TSL_EPCC_STATUS_INCREASE);\r
- }\r
- else\r
- {}\r
- }\r
- }\r
- else\r
- {\r
- if ((*pEPCCSEL) > 0)\r
- {\r
- if (((*pEPCCSEL) & 0x07) != 0)\r
- {\r
- (*pEPCCSEL)--;\r
- }\r
- else\r
- {\r
- if ((*pEPCCSEL) > 3)\r
- {\r
- (*pEPCCSEL) -= 3; // This is due to the non linearity of the PCC\r
- }\r
- else\r
- {\r
- (*pEPCCSEL)--;\r
- }\r
- }\r
- }\r
- else\r
- {\r
- pCSSEL = &PXS_BankConfig[idx_bk].CSSEL[pchSrc->IdxSrc];\r
- if (*pCSSEL > 0)\r
- {\r
- TSL_acq_UpdateCS(pCSSEL, TSL_EPCC_STATUS_DECREASE);\r
- }\r
- else\r
- {}\r
- }\r
- }\r
- }\r
- }\r
-\r
- // Next channel\r
- pchSrc++;\r
- pchDest++;\r
- }\r
-\r
- // The two following loops are more efficient than the two instructions in the same loop\r
- for (idx_ch = 0;idx_ch <= TSLPRM_HIGH_CHANNEL_NB;idx_ch++)\r
- {\r
- PXS->RXCSSELR[idx_ch] = PXS_BankConfig[idx_bk].CSSEL[idx_ch];\r
- }\r
- for (idx_ch = 0;idx_ch <= TSLPRM_HIGH_CHANNEL_NB;idx_ch++)\r
- {\r
- PXS->RXEPCCSELR[idx_ch] = PXS_BankConfig[idx_bk].EPCCSEL[idx_ch];\r
- }\r
-\r
- PXS->TXENR = bank->msk_TX; // Enable the Tx selected (if any)\r
- PXS->RXCR1 = bank->msk_channels; // Configure the Rx and the Tx function modes\r
-\r
- // Enable the Rx which are not disabled including the potential Rx configured as Tx\r
- PXS->RXENR = bank->msk_RXEN & ((uint16_t)(~bank->msk_channels) | enabledRX);\r
-\r
- if (enabledRX == 0)\r
- {\r
- retval = TSL_STATUS_ERROR;\r
- }\r
-\r
- return(retval);\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief Test if EPCC are changing\r
- * @param[in] pCh Channel to be processed\r
- * @retval bool Test result\r
- */\r
-TSL_Bool_enum_T TSL_acq_UseFilter(TSL_ChannelData_T *pCh)\r
-{\r
- if (pCh->Flags.EPCCStatus & TSL_EPCC_CHANGE_MASK)\r
- {\r
- return (TSL_FALSE);\r
- }\r
- else\r
- {\r
- return(TSL_TRUE);\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Start acquisition on a previously configured bank\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_acq_BankStartAcq(void)\r
-{\r
- // Start acquisition\r
- startPXSAcquisition();\r
-}\r
-\r
-\r
-/**\r
- * @brief Wait end of acquisition\r
- * @param None\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_acq_BankWaitEOC(void)\r
-{\r
- TSL_Status_enum_T retval = TSL_STATUS_BUSY;\r
-\r
- if (checkPXSInterruptStatusFlag(PXS_ISR_EOCF)) // Check EOC flag\r
- {\r
- if (PXS->RXSR != TSL_Globals.Bank_Array[TSL_Globals.This_Bank].msk_channels) // Check MCE flag\r
- {\r
- retval = TSL_STATUS_ERROR;\r
- }\r
- else\r
- {\r
- retval = TSL_STATUS_OK;\r
- }\r
- }\r
-\r
- return retval;\r
-}\r
-\r
-\r
-/**\r
- * @brief Check noise detection\r
- * @param None\r
- * @retval Status\r
- */\r
-TSL_AcqStatus_enum_T TSL_acq_CheckNoise(void)\r
-{\r
- TSL_AcqStatus_enum_T retval = TSL_ACQ_STATUS_OK;\r
-#if TSLPRM_PXS_RF_DETECTION > 0\r
- if (checkPXSInterruptStatusFlag(PXS_ISR_NOISEDETF) == PXS_ISR_NOISEDETF)\r
- {\r
- retval = TSL_ACQ_STATUS_NOISE;\r
- }\r
-#endif\r
- return(retval);\r
-}\r
-\r
-\r
-/**\r
- * @brief Return the current measure\r
- * @param[in] index Index of the measure source\r
- * @retval Measure\r
- */\r
-TSL_tMeas_T TSL_acq_GetMeas(TSL_tIndexSrc_T index)\r
-{\r
- uint16_t CurrentReceiver;\r
-\r
- // Check parameters (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_SOURCE_INDEX_OK(index));\r
-\r
- CurrentReceiver = (uint16_t)(((uint16_t)1) << index);\r
-\r
- if (PXS->RXSR & CurrentReceiver)\r
- {\r
- return(PXS->RXCNTR[index]);\r
- }\r
- else\r
- {\r
- return(MAX_MEASURE);\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Process the PXS Interrupt routine\r
- * @param None\r
- * @retval None\r
- */\r
-INTERRUPT_HANDLER(TSL_acq_ProcessIT, 2)\r
-{\r
- clearPXS_ISR_EOCF;\r
-\r
- TSL_acq_BankGetResult(TSL_Globals.This_Bank, 0, 0); // No noise filter\r
-\r
-#if TSLPRM_USE_ZONE > 0\r
- if ((TSL_Globals.This_Zone == 0) || (TSL_Globals.Index_In_This_Zone >= TSL_Globals.This_Zone->NbBanks))\r
- {\r
- CFG->GCR &= (uint8_t)(~CFG_GCR_AL); // Reset Activation level to resume main processing\r
- PXS->RXENR = 0; // To reduce consumption\r
- PXS->TXENR = 0; // To reduce consumption\r
- TSL_Globals.This_Bank = 0;\r
- }\r
- else\r
- {\r
- if (TSL_acq_ZoneConfig(TSL_Globals.This_Zone, TSL_Globals.Index_In_This_Zone) != TSL_STATUS_ERROR)\r
- {\r
- // Start Bank acquisition\r
- TSL_acq_BankStartAcq();\r
-#if TSLPRM_PXS_LOW_POWER_MODE > 0\r
- if (TSL_Globals.Index_In_This_Zone >= TSL_Globals.This_Zone->NbBanks)\r
- {\r
- setPXSLowPower();\r
- }\r
-#endif\r
- }\r
-\r
- }\r
-#else\r
- CFG->GCR &= (uint8_t)(~CFG_GCR_AL); // Reset Activation level to resume main processing\r
- PXS->RXENR = 0; // To reduce consumption\r
- PXS->TXENR = 0; // To reduce consumption\r
-#endif\r
-}\r
-\r
-\r
-#ifdef __IAR_SYSTEMS_ICC__\r
-#pragma optimize=low\r
-#elif defined (__CC_ARM)\r
-#pragma O1\r
-#pragma Ospace\r
-#endif\r
-/**\r
- * @brief Software delay (private routine)\r
- * @param val Wait delay\r
- * @retval None\r
- */\r
-void SoftDelay(uint32_t val)\r
-{\r
- uint32_t i;\r
- for (i = val; i > 0; i--)\r
- {}\r
-}\r
-\r
-/******************* (C) COPYRIGHT 2013 STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_dxs.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the\r
- * Detection Exclusion System (DxS) algorithm.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_dxs.h"\r
-#include "tsl_globals.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-\r
-#define THIS_OBJ_TYPE TSL_Globals.This_Obj->Type\r
-\r
-#define THIS_TKEY TSL_Globals.This_TKey\r
-#define THIS_TKEY_STATEID TSL_Globals.This_TKey->p_Data->StateId\r
-#define THIS_TKEY_DXSLOCK TSL_Globals.This_TKey->p_Data->DxSLock\r
-#define THIS_TKEY_CHANGE TSL_Globals.This_TKey->p_Data->Change\r
-\r
-#define THIS_LINROT TSL_Globals.This_LinRot\r
-#define THIS_LINROT_STATEID TSL_Globals.This_LinRot->p_Data->StateId\r
-#define THIS_LINROT_DXSLOCK TSL_Globals.This_LinRot->p_Data->DxSLock\r
-#define THIS_LINROT_CHANGE TSL_Globals.This_LinRot->p_Data->Change\r
-\r
-/* Private macros ------------------------------------------------------------*/\r
-/* Private variables ---------------------------------------------------------*/\r
-/* Private functions prototype -----------------------------------------------*/\r
-\r
-/**\r
- * @brief Detection Exclusion System on the first object in detect state\r
- * @param[in] objgrp Pointer to the objects group to process\r
- * @retval None\r
- */\r
-void TSL_dxs_FirstObj(CONST TSL_ObjectGroup_T *objgrp)\r
-{\r
-#if TSLPRM_USE_DXS > 0\r
-\r
- TSL_tIndex_T idx_obj;\r
- CONST TSL_Object_T *pobj;\r
- CONST TSL_Object_T *pobj_candidate = 0; // Candidate object for being in Detect state + DxSLock flag\r
- TSL_tIndex_T obj_locked = 0; // Object with Lock flag\r
-\r
- // Exit if no object are in DETECT state.\r
- if ((objgrp->StateMask & TSL_STATE_DETECT_BIT_MASK) == 0)\r
- {\r
- return;\r
- }\r
-\r
- pobj = objgrp->p_Obj; // First object in the group\r
-\r
- // Process all objects\r
- for (idx_obj = 0; idx_obj < objgrp->NbObjects; idx_obj++)\r
- {\r
-\r
- // Assign global object\r
- TSL_obj_SetGlobalObj(pobj);\r
-\r
- //--------------------------------------------------------------------------\r
-#if TSLPRM_TOTAL_TKEYS > 0\r
- if ((THIS_OBJ_TYPE == TSL_OBJ_TOUCHKEY) || (THIS_OBJ_TYPE == TSL_OBJ_TOUCHKEYB))\r
- {\r
- if (THIS_TKEY_STATEID == TSL_STATEID_DETECT)\r
- {\r
- if (THIS_TKEY_DXSLOCK == TSL_TRUE)\r
- {\r
- if (!obj_locked)\r
- {\r
- obj_locked = 1;\r
- pobj_candidate = 0;\r
- }\r
- else\r
- {\r
- THIS_TKEY_STATEID = TSL_STATEID_TOUCH;\r
- THIS_TKEY_CHANGE = TSL_STATE_CHANGED;\r
- }\r
- }\r
- else\r
- {\r
- THIS_TKEY_STATEID = TSL_STATEID_TOUCH;\r
- THIS_TKEY_CHANGE = TSL_STATE_CHANGED;\r
- if ((!pobj_candidate) && (!obj_locked))\r
- {\r
- pobj_candidate = pobj;\r
- }\r
- }\r
- }\r
- }\r
-#endif // TSLPRM_TOTAL_TKEYS > 0\r
-\r
- //--------------------------------------------------------------------------\r
-#if TSLPRM_TOTAL_LNRTS > 0\r
- if ((THIS_OBJ_TYPE == TSL_OBJ_LINEAR) || (THIS_OBJ_TYPE == TSL_OBJ_LINEARB) ||\r
- (THIS_OBJ_TYPE == TSL_OBJ_ROTARY) || (THIS_OBJ_TYPE == TSL_OBJ_ROTARYB))\r
- {\r
- if (THIS_LINROT_STATEID == TSL_STATEID_DETECT)\r
- {\r
- if (THIS_LINROT_DXSLOCK == TSL_TRUE)\r
- {\r
- if (!obj_locked)\r
- {\r
- obj_locked = 1;\r
- pobj_candidate = 0;\r
- }\r
- else\r
- {\r
- THIS_LINROT_STATEID = TSL_STATEID_TOUCH;\r
- THIS_LINROT_CHANGE = TSL_STATE_CHANGED;\r
- }\r
- }\r
- else\r
- {\r
- THIS_LINROT_STATEID = TSL_STATEID_TOUCH;\r
- THIS_LINROT_CHANGE = TSL_STATE_CHANGED;\r
- if ((!pobj_candidate) && (!obj_locked))\r
- {\r
- pobj_candidate = pobj;\r
- }\r
- }\r
- }\r
- }\r
-#endif // TSLPRM_TOTAL_LNRTS > 0\r
-\r
- pobj++; // Next object\r
-\r
- } // // for all objects\r
-\r
- // Change state from TOUCH to DETECT + DxSLock flag on the candidate object only\r
- if (pobj_candidate)\r
- {\r
-\r
- // Assign global object\r
- TSL_obj_SetGlobalObj(pobj_candidate);\r
-\r
-#if TSLPRM_TOTAL_TKEYS > 0\r
- if ((THIS_OBJ_TYPE == TSL_OBJ_TOUCHKEY) || (THIS_OBJ_TYPE == TSL_OBJ_TOUCHKEYB))\r
- {\r
- THIS_TKEY_STATEID = TSL_STATEID_DETECT;\r
- THIS_TKEY_CHANGE = TSL_STATE_CHANGED;\r
- THIS_TKEY_DXSLOCK = TSL_TRUE;\r
- }\r
-#endif // TSLPRM_TOTAL_TKEYS > 0\r
-\r
-#if TSLPRM_TOTAL_LNRTS > 0\r
- if ((THIS_OBJ_TYPE == TSL_OBJ_LINEAR) || (THIS_OBJ_TYPE == TSL_OBJ_LINEARB) ||\r
- (THIS_OBJ_TYPE == TSL_OBJ_ROTARY) || (THIS_OBJ_TYPE == TSL_OBJ_ROTARYB))\r
- {\r
- THIS_LINROT_STATEID = TSL_STATEID_DETECT;\r
- THIS_LINROT_CHANGE = TSL_STATE_CHANGED;\r
- THIS_LINROT_DXSLOCK = TSL_TRUE;\r
- }\r
-#endif // TSLPRM_TOTAL_LNRTS > 0\r
-\r
- }\r
-\r
-#endif // TSLPRM_USE_DXS > 0\r
-}\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_ecs.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the ECS.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_ecs.h"\r
-#include "tsl_globals.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-\r
-#define THIS_OBJ_TYPE TSL_Globals.This_Obj->Type\r
-#define THIS_TKEY_REF TSL_Globals.This_TKey->p_ChD->Ref\r
-#define THIS_TKEY_REFREST TSL_Globals.This_TKey->p_ChD->RefRest\r
-#define THIS_TKEY_DELTA TSL_Globals.This_TKey->p_ChD->Delta\r
-#define THIS_TKEY_STATEID TSL_Globals.This_TKey->p_Data->StateId\r
-\r
-#define THIS_LINROT_STATEID TSL_Globals.This_LinRot->p_Data->StateId\r
-#define THIS_LINROT_NB_CHANNELS TSL_Globals.This_LinRot->NbChannels\r
-\r
-/* Private macros ------------------------------------------------------------*/\r
-#define IS_K_COEFF_OK(COEFF) (((COEFF) == 0) || (((COEFF) > 0) && ((COEFF) < 256)))\r
-#define IS_POINTER_INITIALIZED(POINTER) ((POINTER) != 0)\r
-\r
-/* Private variables ---------------------------------------------------------*/\r
-/* Private functions prototype -----------------------------------------------*/\r
-\r
-/**\r
- * @brief Calculate the K coefficient\r
- * @param[in] objgrp Pointer to the objects group to process\r
- * @param[in] k_slow K coefficient when objects have different delta variation\r
- * @param[in] k_fast K coefficient when objects have the same delta variation\r
- * @retval K coefficient (slow or fast)\r
- */\r
-TSL_tKCoeff_T TSL_ecs_CalcK(CONST TSL_ObjectGroup_T *objgrp, TSL_tKCoeff_T k_slow, TSL_tKCoeff_T k_fast)\r
-{\r
- TSL_tIndex_T idx_obj; // Index of current object\r
- TSL_tIndex_T idx_ch; // Index of current channel\r
- TSL_tDelta_T ldelta = 0; // Temporary delta\r
- TSL_tDelta_T ECS_Fast_Enable = 1;\r
- TSL_tDelta_T ECS_Fast_Direction = 0;\r
- CONST TSL_Object_T *pobj;\r
- TSL_tKCoeff_T retval = k_slow;\r
- TSL_tNb_T nb_channels = 0; // Number of channels inside current object\r
- TSL_ChannelData_T *p_Ch = 0;\r
-\r
- // Check parameters (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_K_COEFF_OK(k_slow));\r
- assert_param(IS_K_COEFF_OK(k_fast));\r
-\r
- pobj = objgrp->p_Obj; // First object in the group\r
-\r
- // Process all objects\r
- for (idx_obj = 0; idx_obj < objgrp->NbObjects; idx_obj++)\r
- {\r
-\r
- // Assign global object\r
- TSL_obj_SetGlobalObj(pobj);\r
-\r
-#if TSLPRM_TOTAL_TKEYS > 0\r
- if ((THIS_OBJ_TYPE == TSL_OBJ_TOUCHKEY) || (THIS_OBJ_TYPE == TSL_OBJ_TOUCHKEYB))\r
- {\r
- // Ignore object if not in Release state\r
- if (THIS_TKEY_STATEID != TSL_STATEID_RELEASE)\r
- {\r
- continue; // Take next object\r
- }\r
- nb_channels = 1;\r
- p_Ch = TSL_Globals.This_TKey->p_ChD;\r
- }\r
-#endif\r
-\r
-#if TSLPRM_TOTAL_LNRTS > 0\r
- if ((THIS_OBJ_TYPE == TSL_OBJ_LINEAR) || (THIS_OBJ_TYPE == TSL_OBJ_LINEARB) ||\r
- (THIS_OBJ_TYPE == TSL_OBJ_ROTARY) || (THIS_OBJ_TYPE == TSL_OBJ_ROTARYB))\r
- {\r
- // Ignore object if not in Release state\r
- if (THIS_LINROT_STATEID != TSL_STATEID_RELEASE)\r
- {\r
- continue; // Take next object\r
- }\r
- nb_channels = THIS_LINROT_NB_CHANNELS;\r
- p_Ch = TSL_Globals.This_LinRot->p_ChD;\r
- }\r
-#endif\r
-\r
- // Check channel pointer variable (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_POINTER_INITIALIZED(p_Ch));\r
-\r
- // Check all channels of current object\r
- for (idx_ch = 0; idx_ch < nb_channels; idx_ch++)\r
- {\r
-\r
- ldelta = p_Ch->Delta;\r
-\r
- // Check delta\r
- if (ldelta == 0) // No Fast ECS !\r
- {\r
- ECS_Fast_Enable = 0;\r
- }\r
- else\r
- {\r
- if (ldelta < 0)\r
- {\r
- if (ECS_Fast_Direction > 0) // No Fast ECS !\r
- {\r
- ECS_Fast_Enable = 0;\r
- }\r
- else\r
- {\r
- ECS_Fast_Direction = -1;\r
- }\r
- }\r
- else\r
- {\r
- if (ECS_Fast_Direction < 0) // No Fast ECS !\r
- {\r
- ECS_Fast_Enable = 0;\r
- }\r
- else\r
- {\r
- ECS_Fast_Direction = 1;\r
- }\r
- }\r
- }\r
-\r
- p_Ch++; // Next channel\r
-\r
- } // for all channels of current object\r
-\r
- pobj++; // Next object\r
-\r
- } // for all objects\r
-\r
- // Assign K fast following Delta variations\r
- if (ECS_Fast_Enable)\r
- {\r
- retval = k_fast;\r
- }\r
-\r
- return retval;\r
-}\r
-\r
-\r
-/**\r
- * @brief Calculate the new Reference on a group of objects\r
- * @param[in] objgrp Pointer to the objects group to process\r
- * @param[in] Kcoeff K coefficient to apply\r
- * @retval None\r
- */\r
-void TSL_ecs_ProcessK(CONST TSL_ObjectGroup_T *objgrp, TSL_tKCoeff_T Kcoeff)\r
-{\r
- TSL_tIndex_T idx_obj; // Index of current object\r
- TSL_tIndex_T idx_ch; // Index of current channel\r
- CONST TSL_Object_T *pobj;\r
- TSL_tKCoeff_T Kcoeff_comp;\r
- uint32_t ECS_meas;\r
- uint32_t ECS_ref;\r
- TSL_tNb_T nb_channels = 0; // Number of channels inside current object\r
- TSL_ChannelData_T *p_Ch = 0;\r
- void(*pFunc_SetStateCalibration)(TSL_tCounter_T delay) = 0;\r
-\r
- // Check parameters (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_K_COEFF_OK(Kcoeff));\r
-\r
- pobj = objgrp->p_Obj; // First object in the group\r
-\r
- // Calculate the K coefficient complement\r
- Kcoeff_comp = (0xFF ^ Kcoeff) + 1;\r
-\r
- // Process all objects\r
- for (idx_obj = 0; idx_obj < objgrp->NbObjects; idx_obj++)\r
- {\r
-\r
- // Assign global object\r
- TSL_obj_SetGlobalObj(pobj);\r
-\r
-#if TSLPRM_TOTAL_TKEYS > 0\r
- if ((THIS_OBJ_TYPE == TSL_OBJ_TOUCHKEY) || (THIS_OBJ_TYPE == TSL_OBJ_TOUCHKEYB))\r
- {\r
- // Ignore object if not in Release state\r
- if (THIS_TKEY_STATEID != TSL_STATEID_RELEASE)\r
- {\r
- continue; // Take next object\r
- }\r
- nb_channels = 1;\r
- p_Ch = TSL_Globals.This_TKey->p_ChD;\r
- pFunc_SetStateCalibration = &TSL_tkey_SetStateCalibration;\r
- }\r
-#endif\r
-\r
-#if TSLPRM_TOTAL_LNRTS > 0\r
- if ((THIS_OBJ_TYPE == TSL_OBJ_LINEAR) || (THIS_OBJ_TYPE == TSL_OBJ_LINEARB) ||\r
- (THIS_OBJ_TYPE == TSL_OBJ_ROTARY) || (THIS_OBJ_TYPE == TSL_OBJ_ROTARYB))\r
- {\r
- // Ignore object if not in Release state\r
- if (THIS_LINROT_STATEID != TSL_STATEID_RELEASE)\r
- {\r
- continue; // Take next object\r
- }\r
- nb_channels = THIS_LINROT_NB_CHANNELS;\r
- p_Ch = TSL_Globals.This_LinRot->p_ChD;\r
- pFunc_SetStateCalibration = &TSL_linrot_SetStateCalibration;\r
- }\r
-#endif\r
-\r
- // Check channel pointer variable (if USE_FULL_ASSERT is defined)\r
- assert_param(IS_POINTER_INITIALIZED(p_Ch));\r
-\r
- // Calculate the new reference + rest for all channels\r
- for (idx_ch = 0; idx_ch < nb_channels; idx_ch++)\r
- {\r
- ECS_meas = TSL_acq_ComputeMeas(p_Ch->Ref, p_Ch->Delta);\r
- ECS_meas <<= 8;\r
-\r
- ECS_ref = (uint32_t)(p_Ch->Ref);\r
- ECS_ref <<= 8;\r
- ECS_ref += p_Ch->RefRest;\r
- ECS_ref *= Kcoeff_comp;\r
- ECS_ref += (Kcoeff * ECS_meas);\r
-\r
- p_Ch->RefRest = (TSL_tRefRest_T)((ECS_ref >> 8) & 0xFF);\r
- p_Ch->Ref = (TSL_tRef_T)(ECS_ref >> 16);\r
-\r
- // Go in Calibration state in the Reference is out of Range\r
- if (TSL_acq_TestReferenceOutOfRange(p_Ch) == TSL_TRUE)\r
- {\r
- pFunc_SetStateCalibration(0);\r
- }\r
-\r
- p_Ch++; // Next channel\r
- }\r
-\r
- pobj++; // Next object\r
-\r
- } // for all objects\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief ECS algorithm on a group of objects\r
- * The ECS is only performed if at least an object is in Release state and\r
- * if no objects are in active states (Prox, Detect or Touch)\r
- * An optional delay is added after the ECS condition (all sensors in Release state) is reached.\r
- * @param[in] objgrp Pointer to the objects group to process\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_ecs_Process(CONST TSL_ObjectGroup_T *objgrp)\r
-{\r
- TSL_tKCoeff_T MyKcoeff;\r
- TSL_Status_enum_T retval;\r
- static TSL_tIndex_T exec = 0;\r
-#if TSLPRM_ECS_DELAY > 0\r
- static TSL_tIndex_T wait = 0;\r
- static TSL_tTick_ms_T start_time;\r
-#endif\r
-\r
- if ((objgrp->StateMask & TSL_STATE_RELEASE_BIT_MASK) && !(objgrp->StateMask & TSL_STATEMASK_ACTIVE))\r
- {\r
-#if TSLPRM_ECS_DELAY > 0\r
- if (!wait)\r
- {\r
- disableInterrupts();\r
- start_time = TSL_Globals.Tick_ms; // Save the current time\r
- enableInterrupts();\r
- wait = 1;\r
- exec = 0;\r
- }\r
-#else\r
- exec = 1;\r
-#endif\r
- }\r
- else\r
- {\r
-#if TSLPRM_ECS_DELAY > 0\r
- wait = 0;\r
-#endif\r
- exec = 0;\r
- }\r
-\r
-#if TSLPRM_ECS_DELAY > 0\r
- if ((wait) && (!exec))\r
- {\r
- // Execute the ECS only when the delay has elapsed\r
- if (TSL_tim_CheckDelay_ms(TSLPRM_ECS_DELAY, &start_time) == TSL_STATUS_OK)\r
- {\r
- exec = 1;\r
- }\r
- }\r
-#endif\r
-\r
- if (exec)\r
- {\r
- // Calculate the K coefficient\r
- MyKcoeff = TSL_ecs_CalcK(objgrp, TSLPRM_ECS_K_SLOW, TSLPRM_ECS_K_FAST);\r
- // Process the objects\r
- TSL_ecs_ProcessK(objgrp, MyKcoeff);\r
- retval = TSL_STATUS_OK;\r
- }\r
- else\r
- {\r
- retval = TSL_STATUS_BUSY;\r
- }\r
-\r
- return retval;\r
-}\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_filter.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the signal or delta filters.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_filter.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-/* Private macros ------------------------------------------------------------*/\r
-/* Private variables ---------------------------------------------------------*/\r
-/* Private functions prototype -----------------------------------------------*/\r
-\r
-/* Noise Filter description\r
- ------------------------\r
-\r
-The noise filter is a first order IRR digital filter based on the following formula:\r
-\r
-S(n) = (1-k).S(n-1)+ k.N(n)\r
-\r
-S(n) : sample number n of the filtered signal\r
-N(n) : sample number n of the raw signal\r
-k : filter coefficient parameter in [0..1]\r
-\r
-The filter sampling rate is the acquisition rate.\r
-\r
-In order to optimize the implementation in the firmware, the above formula is\r
-modified in order to have only one multiply operation:\r
-\r
-S(n) = S(n-1) + k.(N(n) - S(n-1))\r
-\r
-Additionally, we use k = K/256 with K an unsigned 8-bit integer.\r
-\r
-The K is given by the ACQ_FILTER_COEFF constant.\r
-\r
-S(n) = S(n-1) + K.(N(n) - S(n-1))/(2^8)\r
-\r
-and the division can be done easily with bit shifting.\r
-\r
-As we are in the digital world, this formula presents a drawback:\r
-if the difference between S(n-1) and N(n) is less than 1/k, there will be no\r
-difference between S(n-1) and S(n).\r
-\r
-As a consequence, there will be a static error of up to 1/k.\r
-\r
-In the STMTouch Driver, the S(n) is stored in the Meas element of the data\r
-structure after each acquisition:\r
-\r
-Meas(n) = S(n) = N(n)\r
-\r
-The formula is then:\r
-\r
-Meas(n) = Meas(n-1) + K.(Meas(n) - Meas(n-1))/(2^8)\r
-\r
-In order to reduce the static error, we can use "Meas(n) = S(n).2^P".\r
-\r
-The P is given by the ACQ_FILTER_RANGE constant.\r
-\r
-This would shift the signal value left and provides a few additional low\r
-significant bits useful to reduce the static error.\r
-\r
-Warning: all thresholds must be shifted accordingly if the parameter P is\r
-different from 0.\r
-\r
-If we report this into the filter formula we obtain:\r
-\r
-Meas(n) = Meas(n-1) + K.[ Meas(n)*2^P - Meas(n-1)]/2^8\r
-\r
-In this case the static error is reduced to 1/(k.2^P)\r
-*/\r
-\r
-#define ACQ_FILTER_RANGE (0) /* Range[0..5] - Warning: all thresholds must be shifted if different from 0 */\r
-\r
-#define ACQ_FILTER_COEFF (128) /* Range[1..255] - First order filter coefficient (k = ACQ_FILTER_COEFF/256) */\r
-\r
-/**\r
- * @brief Example of measure value filter\r
- * @param[in] measn1 Previous measure value\r
- * @param[in] measn Current measure value\r
- * @retval Filtered measure\r
- */\r
-TSL_tMeas_T TSL_filt_MeasFilter(TSL_tMeas_T measn1, TSL_tMeas_T measn)\r
-{\r
- TSL_tMeas_T val;\r
-\r
- val = (TSL_tMeas_T)(measn << ACQ_FILTER_RANGE);\r
-\r
- if (measn1 != 0)\r
- {\r
- if (val > measn1)\r
- {\r
- val = measn1 + ((ACQ_FILTER_COEFF * (val - measn1)) >> 8);\r
- }\r
- else\r
- {\r
- val = measn1 - ((ACQ_FILTER_COEFF * (measn1 - val)) >> 8);\r
- }\r
- }\r
-\r
- return(val);\r
-}\r
-\r
-\r
-/**\r
- * @brief Example of delta value filter\r
- * @param[in] delta Delta value to modify\r
- * @retval Filtered delta\r
- */\r
-TSL_tDelta_T TSL_filt_DeltaFilter(TSL_tDelta_T delta)\r
-{\r
- return(delta);\r
-}\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_globals.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains global variables.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_globals.h"\r
-\r
-TSL_Globals_T TSL_Globals; /**< Global variables used by main() and TSL modules */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_linrot.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage Linear and Rotary sensors.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_linrot.h"\r
-#include "tsl_globals.h"\r
-\r
-#if TSLPRM_TOTAL_LNRTS > 0\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-\r
-/* Private macros ------------------------------------------------------------*/\r
-\r
-#define THIS_OBJ_TYPE TSL_Globals.This_Obj->Type\r
-\r
-#define THIS_STATEID TSL_Globals.This_LinRot->p_Data->StateId\r
-#define THIS_RAW_POSITION TSL_Globals.This_LinRot->p_Data->RawPosition\r
-#define THIS_POSITION TSL_Globals.This_LinRot->p_Data->Position\r
-#define THIS_CHANGE TSL_Globals.This_LinRot->p_Data->Change\r
-#define THIS_POSCHANGE TSL_Globals.This_LinRot->p_Data->PosChange\r
-#define THIS_COUNTER TSL_Globals.This_LinRot->p_Data->Counter\r
-#define THIS_COUNTER2 TSL_Globals.This_LinRot->p_Data->Counter2\r
-#define THIS_DXSLOCK TSL_Globals.This_LinRot->p_Data->DxSLock\r
-#define THIS_DIRECTION TSL_Globals.This_LinRot->p_Data->Direction\r
-\r
-#define THIS_PROXIN_TH TSL_Globals.This_LinRot->p_Param->ProxInTh\r
-#define THIS_PROXOUT_TH TSL_Globals.This_LinRot->p_Param->ProxOutTh\r
-#define THIS_DETECTIN_TH TSL_Globals.This_LinRot->p_Param->DetectInTh\r
-#define THIS_DETECTOUT_TH TSL_Globals.This_LinRot->p_Param->DetectOutTh\r
-#define THIS_CALIB_TH TSL_Globals.This_LinRot->p_Param->CalibTh\r
-\r
-#define THIS_RESOLUTION TSL_Globals.This_LinRot->p_Param->Resolution\r
-#define THIS_DIR_CHG_POS TSL_Globals.This_LinRot->p_Param->DirChangePos\r
-\r
-#define THIS_COUNTER_DEB_CALIB TSL_Globals.This_LinRot->p_Param->CounterDebCalib\r
-#define THIS_COUNTER_DEB_PROX TSL_Globals.This_LinRot->p_Param->CounterDebProx\r
-#define THIS_COUNTER_DEB_DETECT TSL_Globals.This_LinRot->p_Param->CounterDebDetect\r
-#define THIS_COUNTER_DEB_RELEASE TSL_Globals.This_LinRot->p_Param->CounterDebRelease\r
-#define THIS_COUNTER_DEB_ERROR TSL_Globals.This_LinRot->p_Param->CounterDebError\r
-#define THIS_COUNTER_DEB_DIRECTION TSL_Globals.This_LinRot->p_Param->CounterDebDirection\r
-\r
-#define THIS_NB_CHANNELS TSL_Globals.This_LinRot->NbChannels\r
-#define THIS_SCT_COMP TSL_Globals.This_LinRot->SctComp\r
-#define THIS_POS_CORR TSL_Globals.This_LinRot->PosCorr\r
-\r
-#if TSLPRM_DTO > 0\r
-#define DTO_GET_TIME {TSL_linrot_DTOGetTime();}\r
-#else\r
-#define DTO_GET_TIME\r
-#endif\r
-\r
-/* Private variables ---------------------------------------------------------*/\r
-\r
-//================================================================\r
-// See AN2869 for more details on Linear and Rotary sensors design\r
-//================================================================\r
-\r
-//==============================================================================\r
-// 3 CHANNELS - LINEAR - MONO - 0/255 at extremities\r
-// i.e. CH1 CH2 CH3\r
-//==============================================================================\r
-#if TSLPRM_USE_3CH_LIN_M1 > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_3CH_LIN_M1[3][3] =\r
-{\r
-// sec = 1 2 3\r
-// j = 0 1 2\r
- { 0, -96, 0 }, // maj = 1; i = 0\r
- { 32, 0, -160 }, // maj = 2; i = 1\r
- { 0, 96, 0 } // maj = 3; i = 2\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 3 CHANNELS - LINEAR - MONO\r
-// i.e. CH1 CH2 CH3\r
-//==============================================================================\r
-#if TSLPRM_USE_3CH_LIN_M2 > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_3CH_LIN_M2[3][3] =\r
-{\r
-// sec = 1 2 3\r
-// j = 0 1 2\r
- { 0, -192, 0 }, // maj = 1; i = 0\r
- { 64, 0, -320 }, // maj = 2; i = 1\r
- { 0, 192, 0 } // maj = 3; i = 2\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 3 CHANNELS - LINEAR - HALF-ENDED\r
-// i.e. CH1 CH2 CH3 CH1\r
-//==============================================================================\r
-#if TSLPRM_USE_3CH_LIN_H > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_3CH_LIN_H[3][3] =\r
-{\r
-// sec = 1 2 3\r
-// j = 0 1 2\r
- { 0, -96, 160 }, // maj = 1; i = 0\r
- { 32, 0, -160 }, // maj = 2; i = 1\r
- { -224, 96, 0 } // maj = 3; i = 2\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 3 CHANNELS - ROTARY - MONO\r
-// i.e. CH1 CH2 CH3\r
-//==============================================================================\r
-#if TSLPRM_USE_3CH_ROT_M > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_3CH_ROT_M[3][3] =\r
-{\r
-// sec = 1 2 3\r
-// j = 0 1 2\r
- { 0, -64, 107 }, // maj = 1; i = 0\r
- { 21, 0, -107 }, // maj = 2; i = 1\r
- { -149, 64, 0 } // maj = 3; i = 2\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 4 CHANNELS - LINEAR - MONO - 0/255 at extremities\r
-// i.e. CH1 CH2 CH3 CH4\r
-//==============================================================================\r
-#if TSLPRM_USE_4CH_LIN_M1 > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_4CH_LIN_M1[4][4] =\r
-{\r
-// sec = 1 2 3 4\r
-// j = 0 1 2 3\r
- { 0, -64, 0, 0 }, // maj = 1; i = 0\r
- { 21, 0, -107, 0 }, // maj = 2; i = 1\r
- { 0, 64, 0, -149 }, // maj = 3; i = 2\r
- { 0, 0, 107, 0 } // maj = 4; i = 3\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 4 CHANNELS - LINEAR - MONO\r
-// i.e. CH1 CH2 CH3 CH4\r
-//==============================================================================\r
-#if TSLPRM_USE_4CH_LIN_M2 > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_4CH_LIN_M2[4][4] =\r
-{\r
-// sec = 1 2 3 4\r
-// j = 0 1 2 3\r
- { 0, -96, 0, 0 }, // maj = 1; i = 0\r
- { 32, 0, -160, 0 }, // maj = 2; i = 1\r
- { 0, 96, 0, -224 }, // maj = 3; i = 2\r
- { 0, 0, 160, 0 } // maj = 4; i = 3\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 4 CHANNELS - LINEAR - HALF-ENDED\r
-// i.e. CH1 CH2 CH3 CH4 CH1\r
-//==============================================================================\r
-#if TSLPRM_USE_4CH_LIN_H > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_4CH_LIN_H[4][4] =\r
-{\r
-// sec = 1 2 3 4\r
-// j = 0 1 2 3\r
- { 0, -64, 0, 149 }, // maj = 1; i = 0\r
- { 21, 0, -107, 0 }, // maj = 2; i = 1\r
- { 0, 64, 0, -149 }, // maj = 3; i = 2\r
- { -192, 0, 107, 0 } // maj = 4; i = 3\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 4 CHANNELS - ROTARY - MONO\r
-// i.e. CH1 CH2 CH3 CH4\r
-//==============================================================================\r
-#if TSLPRM_USE_4CH_ROT_M > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_4CH_ROT_M[4][4] =\r
-{\r
-// sec = 1 2 3 4\r
-// j = 0 1 2 3\r
- { 0, -48, 0, 112 }, // maj = 1; i = 0\r
- { 16, 0, -80, 0 }, // maj = 2; i = 1\r
- { 0, 48, 0, -112 }, // maj = 3; i = 2\r
- { -144, 0, 80, 0 } // maj = 4; i = 3\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 5 CHANNELS - LINEAR - MONO - 0/255 at extremities\r
-// i.e. CH1 CH2 CH3 CH4 CH5\r
-//==============================================================================\r
-#if TSLPRM_USE_5CH_LIN_M1 > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_5CH_LIN_M1[5][5] =\r
-{\r
-// sec = 1 2 3 4 5\r
-// j = 0 1 2 3 4\r
- { 0, -48, 0, 0, 0 }, // maj = 1; i = 0\r
- { 16, 0, -80, 0, 0 }, // maj = 2; i = 1\r
- { 0, 48, 0, -112, 0 }, // maj = 3; i = 2\r
- { 0, 0, 80, 0, -144 }, // maj = 4; i = 3\r
- { 0, 0, 0, 112, 0 } // maj = 5; i = 4\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 5 CHANNELS - LINEAR - MONO\r
-// i.e. CH1 CH2 CH3 CH4 CH5\r
-//==============================================================================\r
-#if TSLPRM_USE_5CH_LIN_M2 > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_5CH_LIN_M2[5][5] =\r
-{\r
-// sec = 1 2 3 4 5\r
-// j = 0 1 2 3 4\r
- { 0, -64, 0, 0, 0 }, // maj = 1; i = 0\r
- { 21, 0, -107, 0, 0 }, // maj = 2; i = 1\r
- { 0, 64, 0, -149, 0 }, // maj = 3; i = 2\r
- { 0, 0, 107, 0, -192 }, // maj = 4; i = 3\r
- { 0, 0, 0, 149, 0 } // maj = 5; i = 4\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 5 CHANNELS - LINEAR - HALF-ENDED\r
-// i.e. CH1 CH2 CH3 CH4 CH5 CH1\r
-//==============================================================================\r
-#if TSLPRM_USE_5CH_LIN_H > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_5CH_LIN_H[5][5] =\r
-{\r
-// sec = 1 2 3 4 5\r
-// j = 0 1 2 3 4\r
- { 0, -48, 0, 0, 144 }, // maj = 1; i = 0\r
- { 16, 0, -80, 0, 0 }, // maj = 2; i = 1\r
- { 0, 48, 0, -112, 0 }, // maj = 3; i = 2\r
- { 0, 0, 80, 0, -144 }, // maj = 4; i = 3\r
- { -176, 0, 0, 112, 0 } // maj = 5; i = 4\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 5 CHANNELS - ROTARY - MONO\r
-// i.e. CH1 CH2 CH3 CH4 CH5\r
-//==============================================================================\r
-#if TSLPRM_USE_5CH_ROT_M > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_5CH_ROT_M[5][5] =\r
-{\r
-// sec = 1 2 3 4 5\r
-// j = 0 1 2 3 4\r
- { 0, -38, 0, 0, 115 }, // maj = 1; i = 0\r
- { 13, 0, -64, 0, 0 }, // maj = 2; i = 1\r
- { 0, 38, 0, -90, 0 }, // maj = 3; i = 2\r
- { 0, 0, 64, 0, -115 }, // maj = 4; i = 3\r
- {-141, 0, 0, 90, 0 } // maj = 5; i = 4\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 5 CHANNELS - ROTARY - DUAL\r
-// i.e. CH1 CH2 CH3 CH4 CH5 CH1 CH3 CH5 CH2 CH4\r
-//==============================================================================\r
-#if TSLPRM_USE_5CH_ROT_D > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_5CH_ROT_D[5][5] =\r
-{\r
-// sec = 1 2 3 4 5\r
-// j = 0 1 2 3 4\r
- { 0, -19, -83, 122, 58 }, // maj = 1; i = 0\r
- { 6, 0, -32, -122, 96 }, // maj = 2; i = 1\r
- { 70, 19, 0, -45, -96 }, // maj = 3; i = 2\r
- {-134, 109, 32, 0, -58 }, // maj = 4; i = 3\r
- { -70, -109, 83, 45, 0 } // maj = 5; i = 4\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 6 CHANNELS - LINEAR - MONO - 0/255 at extremities\r
-// i.e. CH1 CH2 CH3 CH4 CH5 CH6\r
-//==============================================================================\r
-#if TSLPRM_USE_6CH_LIN_M1 > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_6CH_LIN_M1[6][6] =\r
-{\r
-// sec = 1 2 3 4 5 6\r
-// j = 0 1 2 3 4 5\r
- { 0, -38, 0, 0, 0, 0 }, // maj = 1; i = 0\r
- { 13, 0, -64, 0, 0, 0 }, // maj = 2; i = 1\r
- { 0, 38, 0, -90, 0, 0 }, // maj = 3; i = 2\r
- { 0, 0, 64, 0, -115, 0 }, // maj = 4; i = 3\r
- { 0, 0, 0, 90, 0, -141 }, // maj = 5; i = 4\r
- { 0, 0, 0, 0, 115, 0 } // maj = 6; i = 5\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 6 CHANNELS - LINEAR - MONO\r
-// i.e. CH1 CH2 CH3 CH4 CH5 CH6\r
-//==============================================================================\r
-#if TSLPRM_USE_6CH_LIN_M2 > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_6CH_LIN_M2[6][6] =\r
-{\r
-// sec = 1 2 3 4 5 6\r
-// j = 0 1 2 3 4 5\r
- { 0, -48, 0, 0, 0, 0 }, // maj = 1; i = 0\r
- { 16, 0, -80, 0, 0, 0 }, // maj = 2; i = 1\r
- { 0, 48, 0, -112, 0, 0 }, // maj = 3; i = 2\r
- { 0, 0, 80, 0, -144, 0 }, // maj = 4; i = 3\r
- { 0, 0, 0, 112, 0, -176 }, // maj = 5; i = 4\r
- { 0, 0, 0, 0, 144, 0 } // maj = 6; i = 5\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 6 CHANNELS - LINEAR - HALF-ENDED\r
-// i.e. CH1 CH2 CH3 CH4 CH5 CH6 CH1\r
-//==============================================================================\r
-#if TSLPRM_USE_6CH_LIN_H > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_6CH_LIN_H[6][6] =\r
-{\r
-// sec = 1 2 3 4 5 6\r
-// j = 0 1 2 3 4 5\r
- { 0, -38, 0, 0, 0, 141 }, // maj = 1; i = 0\r
- { 13, 0, -64, 0, 0, 0 }, // maj = 2; i = 1\r
- { 0, 38, 0, -90, 0, 0 }, // maj = 3; i = 2\r
- { 0, 0, 64, 0, -115, 0 }, // maj = 4; i = 3\r
- { 0, 0, 0, 90, 0, -141 }, // maj = 5; i = 4\r
- {-166, 0, 0, 0, 115, 0 } // maj = 6; i = 5\r
-};\r
-#endif\r
-\r
-//==============================================================================\r
-// 6 CHANNELS - ROTARY - MONO\r
-// i.e. CH1 CH2 CH3 CH4 CH5 CH6\r
-//==============================================================================\r
-#if TSLPRM_USE_6CH_ROT_M > 0\r
-CONST TSL_tsignPosition_T TSL_POSOFF_6CH_ROT_M[6][6] =\r
-{\r
-// sec = 1 2 3 4 5 6\r
-// j = 0 1 2 3 4 5\r
- { 0, -32, 0, 0, 0, 117 }, // maj = 1; i = 0\r
- { 11, 0, -53, 0, 0, 0 }, // maj = 2; i = 1\r
- { 0, 32, 0, -75, 0, 0 }, // maj = 3; i = 2\r
- { 0, 0, 53, 0, -96, 0 }, // maj = 4; i = 3\r
- { 0, 0, 0, 75, 0, -117 }, // maj = 5; i = 4\r
- {-139, 0, 0, 0, 96, 0 } // maj = 6; i = 5\r
-};\r
-#endif\r
-\r
-//------------------\r
-// Common parameters\r
-//------------------\r
-\r
-#define DIRECTION_CHANGE_MAX_DISPLACEMENT (255)\r
-#define DIRECTION_CHANGE_TOTAL_STEPS (256)\r
-#define RESOLUTION_CALCULATION (8)\r
-\r
-static TSL_tNb_T CalibDiv;\r
-\r
-/* Private functions prototype -----------------------------------------------*/\r
-\r
-void TSL_linrot_DTOGetTime(void);\r
-void TSL_linrot_ProcessCh_All_SetStatus(TSL_ObjStatus_enum_T sts);\r
-TSL_Status_enum_T TSL_linrot_ProcessCh_One_DataReady(void);\r
-TSL_Status_enum_T TSL_linrot_ProcessCh_All_AcqStatus(TSL_AcqStatus_enum_T sts);\r
-TSL_Status_enum_T TSL_linrot_ProcessCh_One_AcqStatusError(void);\r
-TSL_Status_enum_T TSL_linrot_ProcessCh_One_DeltaBelowEquMinus(TSL_tThreshold_T th);\r
-TSL_Status_enum_T TSL_linrot_ProcessCh_One_DeltaAboveEqu(TSL_tThreshold_T th, TSL_tIndex_T coeff);\r
-TSL_Status_enum_T TSL_linrot_ProcessCh_One_DeltaAbove(TSL_tThreshold_T th, TSL_tIndex_T coeff);\r
-TSL_Status_enum_T TSL_linrot_ProcessCh_All_DeltaBelowEqu(TSL_tThreshold_T th, TSL_tIndex_T coeff);\r
-void TSL_linrot_ProcessCh_All_ClearRef(void);\r
-TSL_tDelta_T TSL_linrot_NormDelta(TSL_ChannelData_T *ch, TSL_tIndex_T idx);\r
-\r
-\r
-//==============================================================================\r
-// "Object methods" functions\r
-//==============================================================================\r
-\r
-/**\r
- * @brief Init parameters with default values from configuration file\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_Init(void)\r
-{\r
- // Thresholds\r
-#if TSLPRM_USE_PROX > 0\r
- THIS_PROXIN_TH = TSLPRM_LINROT_PROX_IN_TH;\r
- THIS_PROXOUT_TH = TSLPRM_LINROT_PROX_OUT_TH;\r
-#endif\r
- THIS_DETECTIN_TH = TSLPRM_LINROT_DETECT_IN_TH;\r
- THIS_DETECTOUT_TH = TSLPRM_LINROT_DETECT_OUT_TH;\r
- THIS_CALIB_TH = TSLPRM_LINROT_CALIB_TH;\r
-\r
- // Debounce counters\r
- THIS_COUNTER_DEB_CALIB = TSLPRM_DEBOUNCE_CALIB;\r
-#if TSLPRM_USE_PROX > 0\r
- THIS_COUNTER_DEB_PROX = TSLPRM_DEBOUNCE_PROX;\r
-#endif\r
- THIS_COUNTER_DEB_DETECT = TSLPRM_DEBOUNCE_DETECT;\r
- THIS_COUNTER_DEB_RELEASE = TSLPRM_DEBOUNCE_RELEASE;\r
- THIS_COUNTER_DEB_ERROR = TSLPRM_DEBOUNCE_ERROR;\r
-\r
- // Other parameters for linear/rotary only\r
- THIS_RESOLUTION = TSLPRM_LINROT_RESOLUTION;\r
- THIS_DIR_CHG_POS = TSLPRM_LINROT_DIR_CHG_POS;\r
- THIS_COUNTER_DEB_DIRECTION = TSLPRM_LINROT_DIR_CHG_DEB;\r
-\r
- // Initial state\r
- TSL_linrot_SetStateCalibration(TSLPRM_CALIB_DELAY);\r
-}\r
-\r
-\r
-/**\r
- * @brief Process the State Machine\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_Process(void)\r
-{\r
- TSL_StateId_enum_T prev_state_id;\r
-\r
- // Check if at least one channel has a data ready\r
- if ((TSL_linrot_ProcessCh_One_DataReady() == TSL_STATUS_OK) || (THIS_STATEID == TSL_STATEID_OFF))\r
- {\r
-\r
- prev_state_id = THIS_STATEID;\r
-\r
-#if TSLPRM_TOTAL_LINROTS > 0\r
- if ((TSL_Globals.This_Obj->Type == TSL_OBJ_LINEAR) ||\r
- (TSL_Globals.This_Obj->Type == TSL_OBJ_ROTARY))\r
- {\r
- // Launch the object state function\r
- TSL_Globals.This_LinRot->p_SM[THIS_STATEID].StateFunc();\r
- }\r
-#endif\r
-\r
-#if TSLPRM_TOTAL_LINROTS_B > 0\r
- if ((TSL_Globals.This_Obj->Type == TSL_OBJ_LINEARB) ||\r
- (TSL_Globals.This_Obj->Type == TSL_OBJ_ROTARYB))\r
- {\r
- // Launch the TSL_Params state function\r
- TSL_Params.p_LinRotSM[THIS_STATEID].StateFunc();\r
- }\r
-#endif\r
-\r
- // Check if the new state has changed\r
- if (THIS_STATEID == prev_state_id)\r
- {\r
- THIS_CHANGE = TSL_STATE_NOT_CHANGED;\r
- }\r
- else\r
- {\r
- THIS_CHANGE = TSL_STATE_CHANGED;\r
- }\r
-\r
-#if TSLPRM_USE_DXS > 0\r
- if (THIS_STATEID != TSL_STATEID_DETECT)\r
- {\r
- THIS_DXSLOCK = TSL_FALSE;\r
- }\r
- if (THIS_STATEID == TSL_STATEID_TOUCH)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- }\r
-#endif\r
-\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Calculate the position\r
- * @param None\r
- * @retval Status Return OK if position calculation is correct\r
- * @note The position is calculated only if the number of channels is greater than 2\r
- */\r
-TSL_Status_enum_T TSL_linrot_CalcPos(void)\r
-{\r
- TSL_tIndex_T idx;\r
- TSL_ChannelData_T *p_Ch = TSL_Globals.This_LinRot->p_ChD;\r
- TSL_tDelta_T norm_delta;\r
- static TSL_tDelta_T delta1, delta2, delta3;\r
- static TSL_tIndex_T index1, index2;\r
- TSL_tNb_T minor, major;\r
- TSL_tNb_T sector_computation = 0;\r
- TSL_tsignPosition_T new_position = 0;\r
- TSL_tPosition_T u_new_position = 0;\r
- TSL_tPosition_T position_correction = 0;\r
-\r
- delta1 = 0;\r
- delta2 = 0;\r
- delta3 = 0;\r
-\r
- index1 = 0;\r
- index2 = 0;\r
-\r
- // The position change flag will be set only if a new position is detected.\r
- THIS_POSCHANGE = TSL_STATE_NOT_CHANGED;\r
-\r
- // The position is calculated only if the number of channels is greater than 2\r
- if (THIS_NB_CHANNELS < 3)\r
- {\r
- return TSL_STATUS_ERROR;\r
- }\r
-\r
- //--------------------------------------------------------------------------\r
- // Sort the channels' delta\r
- // - delta1 and index1 = biggest\r
- // - delta2 and index2 = middle\r
- // - delta3 and index3 = lowest\r
- //--------------------------------------------------------------------------\r
- for (idx = 0; idx < THIS_NB_CHANNELS; idx++)\r
- {\r
-\r
-#if TSLPRM_LINROT_USE_NORMDELTA > 0\r
- norm_delta = TSL_linrot_NormDelta(p_Ch, idx); // Normalize the Delta\r
-#else\r
- norm_delta = p_Ch->Delta; // Take only the Delta\r
-#endif\r
-\r
- // The Delta must be positive only otherwise it is noise\r
- if (norm_delta < 0) {norm_delta = 0;}\r
-\r
- if (norm_delta > delta1)\r
- {\r
- delta3 = delta2;\r
- delta2 = delta1;\r
- delta1 = norm_delta;\r
- index2 = index1;\r
- index1 = idx;\r
- }\r
- else\r
- {\r
- if (norm_delta > delta2)\r
- {\r
- delta3 = delta2;\r
- delta2 = norm_delta;\r
- index2 = idx;\r
- }\r
- else\r
- {\r
- if (norm_delta > delta3)\r
- {\r
- delta3 = norm_delta;\r
- }\r
- }\r
- }\r
-\r
- p_Ch++; // Next channel\r
-\r
- } // for all channels\r
-\r
- // Noise filter: we need at least two significant Delta measurements\r
- if (delta2 < ((TSL_tThreshold_T)(THIS_DETECTOUT_TH >> 1) - 1))\r
- {\r
- return TSL_STATUS_ERROR;\r
- }\r
-\r
- //----------------------------------------------------------------------------\r
- // Position calculation...\r
- //----------------------------------------------------------------------------\r
-\r
- /*----------------------------------------------------------------------------\r
- B = Biggest signal measured (Delta1/Index1)\r
- M = Middle signal measured (Delta2/Index2)\r
- S = Smallest signal measured (Delta3/Index3)\r
- \r
- - The equation to find the position is:\r
- Position = Offset +/- [ Sector_Size x ( Major / (Major + Minor) ) ]\r
- \r
- - The Offset is the position of the middle of the Middle signal segment.\r
- All the Offset values are stored in the ROM table Table_POSITION_OFFSET.\r
- \r
- - Major = Biggest - Smallest signals\r
- Minor = Middle - Smallest signals\r
- \r
- - The Sector_Size depends of the number of channels used\r
- ----------------------------------------------------------------------------*/\r
-\r
- // Calculates the Major and Minor parameters\r
- minor = (TSL_tNb_T)(delta2 - delta3); // Middle - Smallest signals\r
- major = (TSL_tNb_T)(delta1 - delta3); // Biggest - Smallest signals\r
-\r
- // Select the offset position in the position offset constant table\r
- // Equal to: new_position = TABLE_POSITION_OFFSET_xCH_xxx[index1][index2];\r
- new_position = *(TSL_Globals.This_LinRot->p_PosOff + (index1 * THIS_NB_CHANNELS) + index2);\r
- sector_computation = THIS_SCT_COMP;\r
- position_correction = THIS_POS_CORR;\r
-\r
- // Calculates: [ Sector_Size x ( Major / (Major + Minor) ) ]\r
- sector_computation = major * sector_computation;\r
- sector_computation = sector_computation / (major + minor);\r
-\r
- // Use the sign bit from position table to define the interpretation direction.\r
- // The NewPosition is multiplied by 2 because the Offset stored in the ROM\r
- // table is divided by 2...\r
- if (new_position > 0) // Means Offset is > 0 in the position table\r
- {\r
- new_position = (TSL_tsignPosition_T)(new_position << 1);\r
- new_position += sector_computation;\r
- }\r
- else // means Offset is <= 0 in the ROM table\r
- {\r
- new_position = (TSL_tsignPosition_T)((-new_position) << 1);\r
- new_position -= sector_computation;\r
- }\r
-\r
- // Position is calculated differently if LINEAR or ROTARY sensor\r
- if ((THIS_OBJ_TYPE == TSL_OBJ_LINEAR) || (THIS_OBJ_TYPE == TSL_OBJ_LINEARB))\r
- {\r
-\r
- // First adjustment used to shift all the values to obtain the "zero"\r
- if (new_position > 0)\r
- {\r
- new_position -= position_correction;\r
- }\r
- else\r
- {\r
- new_position = new_position + (256 - position_correction);\r
- }\r
-\r
- // Second adjustment used to clamp the values at both ends of sensor\r
- if (new_position < 0)\r
- {\r
- new_position = 0;\r
- }\r
-\r
- if (new_position > 255)\r
- {\r
- new_position = 255;\r
- }\r
-\r
- }\r
- else // ROTARY sensor: keep only the low byte\r
- {\r
- new_position = (TSL_tPosition_T)new_position;\r
- }\r
-\r
- //----------------------------------------------------------------------------\r
- // Direction Change Process\r
- //----------------------------------------------------------------------------\r
-\r
- if (THIS_DIRECTION == TSL_TRUE) // Anticlockwise direction ...\r
- {\r
-\r
- // Check Direction changed and Position overflow from 0x00 to 0xFF not realized !\r
- if (((TSL_tPosition_T)new_position > THIS_RAW_POSITION) && (((TSL_tPosition_T)new_position - THIS_RAW_POSITION) < DIRECTION_CHANGE_MAX_DISPLACEMENT))\r
- {\r
- if (new_position < (uint16_t)(THIS_RAW_POSITION + THIS_DIR_CHG_POS))\r
- {\r
- THIS_COUNTER2 = THIS_COUNTER_DEB_DIRECTION;\r
- return TSL_STATUS_ERROR;\r
- }\r
- else\r
- {\r
- THIS_COUNTER2--;\r
- if (!THIS_COUNTER2)\r
- {\r
- THIS_COUNTER2 = THIS_COUNTER_DEB_DIRECTION;\r
- THIS_DIRECTION = TSL_FALSE; // New direction accepted: clockwise.\r
- }\r
- else\r
- {\r
- return TSL_STATUS_ERROR;\r
- }\r
- }\r
- }\r
-\r
- // Check position overflow from 0xFF to 0x00 to be filtered !\r
- if ((new_position + DIRECTION_CHANGE_MAX_DISPLACEMENT) < THIS_RAW_POSITION)\r
- {\r
- if ((new_position + DIRECTION_CHANGE_TOTAL_STEPS) < (uint16_t)(THIS_RAW_POSITION + THIS_DIR_CHG_POS))\r
- {\r
- THIS_COUNTER2 = THIS_COUNTER_DEB_DIRECTION;\r
- return TSL_STATUS_ERROR;\r
- }\r
- else\r
- {\r
- THIS_COUNTER2--;\r
- if (!THIS_COUNTER2)\r
- {\r
- THIS_COUNTER2 = THIS_COUNTER_DEB_DIRECTION;\r
- THIS_DIRECTION = TSL_FALSE; // New direction accepted: clockwise.\r
- }\r
- else\r
- {\r
- return TSL_STATUS_ERROR;\r
- }\r
- }\r
- }\r
-\r
- }\r
- else // Clockwise direction... DEFAULT SETTING !\r
- {\r
-\r
- // Check Direction changed and Position overflow from 0xFF to 0x00 not realized !\r
- if (((TSL_tPosition_T)new_position < THIS_RAW_POSITION) && ((THIS_RAW_POSITION - (TSL_tPosition_T)new_position) < DIRECTION_CHANGE_MAX_DISPLACEMENT))\r
- {\r
- if ((new_position + THIS_DIR_CHG_POS) > THIS_RAW_POSITION)\r
- {\r
- THIS_COUNTER2 = THIS_COUNTER_DEB_DIRECTION;\r
- return TSL_STATUS_ERROR;\r
- }\r
- else\r
- {\r
- THIS_COUNTER2--;\r
- if (!THIS_COUNTER2)\r
- {\r
- THIS_COUNTER2 = THIS_COUNTER_DEB_DIRECTION;\r
- THIS_DIRECTION = TSL_TRUE; // New direction accepted: anticlockwise.\r
- }\r
- else\r
- {\r
- return TSL_STATUS_ERROR;\r
- }\r
- }\r
- }\r
-\r
- // Check position overflow from 0x00 to 0xFF to be filtered !\r
- if (new_position > (uint16_t)(THIS_RAW_POSITION + DIRECTION_CHANGE_MAX_DISPLACEMENT))\r
- {\r
- if ((new_position + THIS_DIR_CHG_POS) > (uint16_t)(THIS_RAW_POSITION + DIRECTION_CHANGE_TOTAL_STEPS))\r
- {\r
- THIS_COUNTER2 = THIS_COUNTER_DEB_DIRECTION;\r
- return TSL_STATUS_ERROR;\r
- }\r
- else\r
- {\r
- THIS_COUNTER2--;\r
- if (!THIS_COUNTER2)\r
- {\r
- THIS_COUNTER2 = THIS_COUNTER_DEB_DIRECTION;\r
- THIS_DIRECTION = TSL_TRUE; // New direction accepted: anticlockwise.\r
- }\r
- else\r
- {\r
- return TSL_STATUS_ERROR;\r
- }\r
- }\r
- }\r
-\r
- }\r
-\r
- //----------------------------------------------------------------------------\r
- // Final result...\r
- //----------------------------------------------------------------------------\r
-\r
- // The Raw Position is always updated\r
- // The Position is updated only if different from the previous one\r
-\r
- THIS_RAW_POSITION = (TSL_tPosition_T)new_position;\r
-\r
- u_new_position = (TSL_tPosition_T)((TSL_tPosition_T)new_position >> (RESOLUTION_CALCULATION - THIS_RESOLUTION));\r
-\r
- if (THIS_POSITION == u_new_position)\r
- {\r
- return TSL_STATUS_ERROR;\r
- }\r
- else\r
- {\r
- THIS_POSITION = u_new_position;\r
- THIS_POSCHANGE = TSL_STATE_CHANGED;\r
- return TSL_STATUS_OK;\r
- }\r
-\r
-}\r
-\r
-\r
-//==============================================================================\r
-// Utility functions\r
-//==============================================================================\r
-\r
-/**\r
- * @brief Go in Calibration state\r
- * @param[in] delay Delay before calibration starts (stabilization of noise filter)\r
- * @retval None\r
- */\r
-void TSL_linrot_SetStateCalibration(TSL_tCounter_T delay)\r
-{\r
- THIS_STATEID = TSL_STATEID_CALIB;\r
- THIS_CHANGE = TSL_STATE_CHANGED;\r
- TSL_linrot_ProcessCh_All_SetStatus(TSL_OBJ_STATUS_ON);\r
-\r
- switch (TSL_Params.NbCalibSamples)\r
- {\r
- case 4:\r
- CalibDiv = 2;\r
- break;\r
- case 16:\r
- CalibDiv = 4;\r
- break;\r
- default:\r
- TSL_Params.NbCalibSamples = 8;\r
- CalibDiv = 3;\r
- break;\r
- }\r
-\r
- // If a noise filter is used, the counter must be initialized to a value\r
- // different from 0 in order to stabilize the filter.\r
- THIS_COUNTER = (TSL_tCounter_T)(delay + (TSL_tCounter_T)TSL_Params.NbCalibSamples);\r
- TSL_linrot_ProcessCh_All_ClearRef();\r
-}\r
-\r
-\r
-/**\r
- * @brief Go in Off state with sensor "off"\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_SetStateOff(void)\r
-{\r
- THIS_STATEID = TSL_STATEID_OFF;\r
- THIS_CHANGE = TSL_STATE_CHANGED;\r
- TSL_linrot_ProcessCh_All_SetStatus(TSL_OBJ_STATUS_OFF);\r
-}\r
-\r
-\r
-#if !defined(TSLPRM_STM8TL5X) && !defined(STM8TL5X)\r
-/**\r
- * @brief Go in Off state with sensor in "Burst mode only"\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_SetStateBurstOnly(void)\r
-{\r
- THIS_STATEID = TSL_STATEID_OFF;\r
- THIS_CHANGE = TSL_STATE_CHANGED;\r
- TSL_linrot_ProcessCh_All_SetStatus(TSL_OBJ_STATUS_BURST_ONLY);\r
-}\r
-#endif\r
-\r
-\r
-/**\r
- * @brief Return the current state identifier\r
- * @param None\r
- * @retval State id\r
- */\r
-TSL_StateId_enum_T TSL_linrot_GetStateId(void)\r
-{\r
- return(THIS_STATEID);\r
-}\r
-\r
-\r
-/**\r
- * @brief Return the current state mask\r
- * @param None\r
- * @retval State mask\r
- */\r
-TSL_StateMask_enum_T TSL_linrot_GetStateMask(void)\r
-{\r
- TSL_StateMask_enum_T state_mask = TSL_STATEMASK_UNKNOWN;\r
-\r
-#if TSLPRM_TOTAL_LINROTS > 0\r
- if ((TSL_Globals.This_Obj->Type == TSL_OBJ_LINEAR) ||\r
- (TSL_Globals.This_Obj->Type == TSL_OBJ_ROTARY))\r
- {\r
- state_mask = TSL_Globals.This_LinRot->p_SM[THIS_STATEID].StateMask;\r
- }\r
-#endif\r
-\r
-#if TSLPRM_TOTAL_LINROTS_B > 0\r
- if ((TSL_Globals.This_Obj->Type == TSL_OBJ_LINEARB) ||\r
- (TSL_Globals.This_Obj->Type == TSL_OBJ_ROTARYB))\r
- {\r
- state_mask = TSL_Params.p_LinRotSM[THIS_STATEID].StateMask;\r
- }\r
-#endif\r
-\r
- return state_mask;\r
-}\r
-\r
-\r
-/**\r
- * @brief Return the Change flag\r
- * @param None\r
- * @retval Change flag status\r
- */\r
-TSL_tNb_T TSL_linrot_IsChanged(void)\r
-{\r
- return(THIS_CHANGE);\r
-}\r
-\r
-\r
-//==============================================================================\r
-// State machine functions\r
-//==============================================================================\r
-\r
-#if TSLPRM_USE_PROX > 0\r
-/**\r
- * @brief Debounce Release processing (previous state = Proximity)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_DebReleaseProxStateProcess(void)\r
-{\r
- if (TSL_linrot_ProcessCh_One_AcqStatusError() == TSL_STATUS_OK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX; // Go back to the previous state\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if (TSL_linrot_ProcessCh_One_DeltaAbove(THIS_PROXOUT_TH, 0) == TSL_STATUS_OK)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX; // Go back to the previous state\r
- }\r
- else\r
- {\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- // else stay in Debounce Release\r
- }\r
- }\r
-}\r
-#endif // if TSLPRM_USE_PROX > 0\r
-\r
-\r
-/**\r
- * @brief Debounce Release processing (previous state = Detect)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_DebReleaseDetectStateProcess(void)\r
-{\r
- if (TSL_linrot_ProcessCh_One_AcqStatusError() == TSL_STATUS_OK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT; // Go back to the previous state\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if (TSL_linrot_ProcessCh_One_DeltaAbove(THIS_DETECTOUT_TH, 1) == TSL_STATUS_OK)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- }\r
- else\r
- {\r
-#if TSLPRM_USE_PROX > 0\r
- if (TSL_linrot_ProcessCh_One_DeltaAbove(THIS_PROXOUT_TH, 0) == TSL_STATUS_OK)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- return;\r
- }\r
-#endif\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- // else stay in Debounce Release\r
- }\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Debounce Release processing (previous state = Touch)\r
- * Same as Debounce Release Detect processing\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_DebReleaseTouchStateProcess(void)\r
-{\r
- if (TSL_linrot_ProcessCh_One_AcqStatusError() == TSL_STATUS_OK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_TOUCH; // Go back to the previous state\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if (TSL_linrot_ProcessCh_One_DeltaAbove(THIS_DETECTOUT_TH, 1) == TSL_STATUS_OK)\r
- {\r
- THIS_STATEID = TSL_STATEID_TOUCH;\r
- }\r
- else\r
- {\r
-#if TSLPRM_USE_PROX > 0\r
- if (TSL_linrot_ProcessCh_One_DeltaAbove(THIS_PROXOUT_TH, 0) == TSL_STATUS_OK)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- return;\r
- }\r
-#endif\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- // else stay in Debounce Release\r
- }\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Release state processing\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_ReleaseStateProcess(void)\r
-{\r
- if (TSL_linrot_ProcessCh_One_AcqStatusError() == TSL_STATUS_OK) // Acquisition error (min or max)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_ERROR;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_ERROR;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_ERROR_RELEASE;\r
- }\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if (TSL_linrot_ProcessCh_One_DeltaAboveEqu(THIS_DETECTIN_TH, 1) == TSL_STATUS_OK)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_DETECT;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_DETECT;\r
- }\r
- return;\r
- }\r
-\r
-#if TSLPRM_USE_PROX > 0\r
- if (TSL_linrot_ProcessCh_One_DeltaAboveEqu(THIS_PROXIN_TH, 0) == TSL_STATUS_OK)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_PROX;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_PROX;\r
- }\r
- return;\r
- }\r
-#endif\r
-\r
- // Check delta for re-calibration\r
- if (TSL_linrot_ProcessCh_One_DeltaBelowEquMinus(THIS_CALIB_TH) == TSL_STATUS_OK)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_CALIB;\r
- if (THIS_COUNTER == 0)\r
- {\r
- TSL_linrot_SetStateCalibration(0);\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_CALIB;\r
- }\r
- }\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Debounce Calibration processing (previous state = Release)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_DebCalibrationStateProcess(void)\r
-{\r
- if (TSL_linrot_ProcessCh_One_AcqStatusError() == TSL_STATUS_OK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE; // Go back to the previous state\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if (TSL_linrot_ProcessCh_One_DeltaBelowEquMinus(THIS_CALIB_TH) == TSL_STATUS_OK) // Still below recalibration threshold\r
- {\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- TSL_linrot_SetStateCalibration(0);\r
- }\r
- // else stay in Debounce Calibration\r
- }\r
- else // Go back to previous state\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Calibration state processing\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_CalibrationStateProcess(void)\r
-{\r
- TSL_tMeas_T new_meas;\r
- TSL_tIndex_T idx;\r
- TSL_ChannelData_T *p_Ch;\r
-\r
-#if TSLPRM_CALIB_DELAY > 0\r
- // Noise filter stabilization time\r
- if (THIS_COUNTER > (TSL_tCounter_T)TSL_Params.NbCalibSamples)\r
- {\r
- THIS_COUNTER--;\r
- return; // Skip the sample\r
- }\r
-#endif\r
-\r
- if (TSL_linrot_ProcessCh_One_AcqStatusError() == TSL_STATUS_OK) // Acquisition error (min or max)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_ERROR;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_ERROR;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_ERROR_CALIB;\r
- }\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- // Process all channels\r
- p_Ch = TSL_Globals.This_LinRot->p_ChD;\r
-\r
- for (idx = 0; idx < THIS_NB_CHANNELS; idx++)\r
- {\r
-\r
- // Get the new measure or Calculate it\r
-#if TSLPRM_USE_MEAS > 0\r
- new_meas = p_Ch->Meas;\r
-#else // Calculate it\r
- new_meas = TSL_acq_ComputeMeas(p_Ch->Ref, p_Ch->Delta);\r
-#endif\r
-\r
- // Verify the first Reference value\r
- if (THIS_COUNTER == (TSL_tCounter_T)TSL_Params.NbCalibSamples)\r
- {\r
- if (TSL_acq_TestFirstReferenceIsValid(p_Ch, new_meas))\r
- {\r
- p_Ch->Ref = new_meas;\r
- }\r
- else\r
- {\r
- p_Ch->Ref = 0;\r
- return;\r
- }\r
- }\r
- else\r
- {\r
- // Add the measure in temporary Reference\r
- p_Ch->Ref += new_meas;\r
-\r
- // Check reference overflow\r
- if (p_Ch->Ref < new_meas)\r
- {\r
- p_Ch->Ref = 0; // Suppress the bad reference\r
- THIS_STATEID = TSL_STATEID_ERROR;\r
- return;\r
- }\r
- }\r
-\r
- p_Ch++; // Next channel\r
- }\r
-\r
- // Check that we have all the needed measurements\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- // Process all channels\r
- p_Ch = TSL_Globals.This_LinRot->p_ChD;\r
- for (idx = 0; idx < THIS_NB_CHANNELS; idx++)\r
- {\r
- // Divide temporary Reference by the number of samples\r
- p_Ch->Ref >>= CalibDiv;\r
- p_Ch->RefRest = 0;\r
- p_Ch->Delta = 0;\r
- p_Ch++; // Next channel\r
- }\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- }\r
-}\r
-\r
-\r
-#if TSLPRM_USE_PROX > 0\r
-/**\r
- * @brief Debounce Proximity processing (previous state = Release)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_DebProxStateProcess(void)\r
-{\r
- if (TSL_linrot_ProcessCh_One_AcqStatusError() == TSL_STATUS_OK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if (TSL_linrot_ProcessCh_One_DeltaAboveEqu(THIS_DETECTIN_TH, 1) == TSL_STATUS_OK)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_DETECT;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_DETECT;\r
- }\r
- return;\r
- }\r
-\r
- if (TSL_linrot_ProcessCh_One_DeltaAboveEqu(THIS_PROXIN_TH, 0) == TSL_STATUS_OK)\r
- {\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- // else stay in Debounce Proximity\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- }\r
-}\r
-#endif\r
-\r
-\r
-#if TSLPRM_USE_PROX > 0\r
-/**\r
- * @brief Debounce Proximity processing (previous state = Detect)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_DebProxDetectStateProcess(void)\r
-{\r
- if (TSL_linrot_ProcessCh_One_AcqStatusError() == TSL_STATUS_OK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if (TSL_linrot_ProcessCh_One_DeltaAbove(THIS_DETECTOUT_TH, 1) == TSL_STATUS_OK)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- return;\r
- }\r
-\r
- if (TSL_linrot_ProcessCh_One_DeltaAbove(THIS_PROXOUT_TH, 0) == TSL_STATUS_OK)\r
- {\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- // else stay in Debounce Proximity\r
- }\r
- else\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_RELEASE;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_RELEASE_DETECT;\r
- }\r
- }\r
- }\r
-}\r
-#endif\r
-\r
-\r
-#if TSLPRM_USE_PROX > 0\r
-/**\r
- * @brief Debounce Proximity processing (previous state = Touch)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_DebProxTouchStateProcess(void)\r
-{\r
- if (TSL_linrot_ProcessCh_One_AcqStatusError() == TSL_STATUS_OK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_TOUCH;\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if (TSL_linrot_ProcessCh_One_DeltaAbove(THIS_DETECTOUT_TH, 1) == TSL_STATUS_OK)\r
- {\r
- THIS_STATEID = TSL_STATEID_TOUCH;\r
- return;\r
- }\r
-\r
- if (TSL_linrot_ProcessCh_One_DeltaAbove(THIS_PROXOUT_TH, 0) == TSL_STATUS_OK)\r
- {\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- // else stay in Debounce Proximity\r
- }\r
- else\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_RELEASE;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_RELEASE_TOUCH;\r
- }\r
- }\r
- }\r
-}\r
-#endif\r
-\r
-\r
-#if TSLPRM_USE_PROX > 0\r
-/**\r
- * @brief Proximity state processing\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_ProxStateProcess(void)\r
-{\r
-#if TSLPRM_DTO > 0\r
- TSL_tTick_sec_T tick_detected;\r
-#endif\r
-\r
- if (TSL_linrot_ProcessCh_One_AcqStatusError() == TSL_STATUS_OK) // Acquisition error (min or max)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_ERROR;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_ERROR;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_ERROR_PROX;\r
- }\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if (TSL_linrot_ProcessCh_One_DeltaAboveEqu(THIS_DETECTIN_TH, 1) == TSL_STATUS_OK)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_DETECT;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_DETECT;\r
- }\r
- return;\r
- }\r
-\r
- if (TSL_linrot_ProcessCh_All_DeltaBelowEqu(THIS_PROXOUT_TH, 0) == TSL_STATUS_OK)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_RELEASE;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_RELEASE_PROX;\r
- }\r
- return;\r
- }\r
-\r
- // Stay in Proximity state\r
-#if TSLPRM_DTO > 0\r
- //------------------------------------\r
- // Detection Time Out (DTO) processing\r
- //------------------------------------\r
- if ((TSL_Params.DTO > 1) && (TSL_Params.DTO < 64))\r
- {\r
- tick_detected = THIS_COUNTER; // Get the detected time previously saved\r
- // Enter in calibration state if the DTO duration has elapsed\r
- if (TSL_tim_CheckDelay_sec(TSL_Params.DTO, &tick_detected) == TSL_STATUS_OK)\r
- {\r
- TSL_linrot_SetStateCalibration(0);\r
- }\r
- }\r
-#endif\r
-\r
- }\r
-}\r
-#endif\r
-\r
-\r
-/**\r
- * @brief Debounce Detect processing (previous state = Release or Proximity)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_DebDetectStateProcess(void)\r
-{\r
- if (TSL_linrot_ProcessCh_One_AcqStatusError() == TSL_STATUS_OK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if (TSL_linrot_ProcessCh_One_DeltaAboveEqu(THIS_DETECTIN_TH, 1) == TSL_STATUS_OK)\r
- {\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- // else stay in Debounce Detect\r
- }\r
- else\r
- {\r
-#if TSLPRM_USE_PROX > 0\r
- if (TSL_linrot_ProcessCh_One_DeltaAboveEqu(THIS_PROXIN_TH, 0) == TSL_STATUS_OK)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_PROX;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_PROX;\r
- }\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
-#else\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
-#endif\r
- }\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Detect state processing\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_DetectStateProcess(void)\r
-{\r
-#if TSLPRM_DTO > 0\r
- TSL_Status_enum_T pos_sts;\r
- TSL_tTick_sec_T tick_detected;\r
-#endif\r
-\r
- if (TSL_linrot_ProcessCh_One_AcqStatusError() == TSL_STATUS_OK) // Acquisition error (min or max)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_ERROR;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_ERROR;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_ERROR_DETECT;\r
- }\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
-\r
- if (TSL_linrot_ProcessCh_One_DeltaAbove(THIS_DETECTOUT_TH, 1) == TSL_STATUS_OK)\r
- {\r
- //-------------------\r
- // Calculate position\r
- //-------------------\r
- if ((THIS_OBJ_TYPE == TSL_OBJ_LINEAR) || (THIS_OBJ_TYPE == TSL_OBJ_ROTARY))\r
- {\r
- // Call the specific method\r
-#if TSLPRM_DTO > 0\r
- pos_sts = TSL_Globals.This_LinRot->p_Methods->CalcPosition();\r
-#else\r
- TSL_Globals.This_LinRot->p_Methods->CalcPosition();\r
-#endif\r
- }\r
- else // TSL_OBJ_LINEARB or TSL_OBJ_ROTARYB\r
- {\r
- // Call the default method\r
-#if TSLPRM_DTO > 0\r
- pos_sts = TSL_Params.p_LinRotMT->CalcPosition();\r
-#else\r
- TSL_Params.p_LinRotMT->CalcPosition();\r
-#endif\r
- }\r
-#if TSLPRM_DTO > 0\r
- //------------------------------------\r
- // Detection Time Out (DTO) processing\r
- // Only if the Position has NOT changed\r
- //-------------------------------------\r
- if (pos_sts == TSL_STATUS_OK)\r
- {\r
- DTO_GET_TIME; // Take current time\r
- }\r
- else\r
- {\r
- if ((TSL_Params.DTO > 1) && (TSL_Params.DTO < 64))\r
- {\r
- tick_detected = THIS_COUNTER; // Get the detected time previously saved\r
- // Enter in calibration state if the DTO duration has elapsed\r
- if (TSL_tim_CheckDelay_sec(TSL_Params.DTO, &tick_detected) == TSL_STATUS_OK)\r
- {\r
- TSL_linrot_SetStateCalibration(0);\r
- }\r
- }\r
- }\r
-#endif\r
- return; // Normal operation, stay in Detect state\r
- }\r
-\r
-#if TSLPRM_USE_PROX > 0\r
- if (TSL_linrot_ProcessCh_One_DeltaAbove(THIS_PROXOUT_TH, 0) == TSL_STATUS_OK)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_PROX;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_PROX_DETECT;\r
- }\r
- return;\r
- }\r
-#endif\r
-\r
- THIS_COUNTER = THIS_COUNTER_DEB_RELEASE;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_RELEASE_DETECT;\r
- }\r
-\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Touch state processing\r
- * Same as Detect state\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_TouchStateProcess(void)\r
-{\r
-#if TSLPRM_DTO > 0\r
- TSL_Status_enum_T pos_sts;\r
- TSL_tTick_sec_T tick_detected;\r
-#endif\r
-\r
- if (TSL_linrot_ProcessCh_One_AcqStatusError() == TSL_STATUS_OK) // Acquisition error (min or max)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_ERROR;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_ERROR;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_ERROR_TOUCH;\r
- }\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
-\r
- if (TSL_linrot_ProcessCh_One_DeltaAbove(THIS_DETECTOUT_TH, 1) == TSL_STATUS_OK)\r
- {\r
- //-------------------\r
- // Calculate position\r
- //-------------------\r
- if ((THIS_OBJ_TYPE == TSL_OBJ_LINEAR) || (THIS_OBJ_TYPE == TSL_OBJ_ROTARY))\r
- {\r
- // Call the specific method\r
-#if TSLPRM_DTO > 0\r
- pos_sts = TSL_Globals.This_LinRot->p_Methods->CalcPosition();\r
-#else\r
- TSL_Globals.This_LinRot->p_Methods->CalcPosition();\r
-#endif\r
- }\r
- else // TSL_OBJ_LINEARB or TSL_OBJ_ROTARYB\r
- {\r
- // Call the default method\r
-#if TSLPRM_DTO > 0\r
- pos_sts = TSL_Params.p_LinRotMT->CalcPosition();\r
-#else\r
- TSL_Params.p_LinRotMT->CalcPosition();\r
-#endif\r
- }\r
-#if TSLPRM_DTO > 0\r
- //------------------------------------\r
- // Detection Time Out (DTO) processing\r
- // Only if the Position has NOT changed\r
- //-------------------------------------\r
- if (pos_sts == TSL_STATUS_OK)\r
- {\r
- DTO_GET_TIME; // Take current time\r
- }\r
- else\r
- {\r
- if ((TSL_Params.DTO > 1) && (TSL_Params.DTO < 64))\r
- {\r
- tick_detected = THIS_COUNTER; // Get the detected time previously saved\r
- // Enter in calibration state if the DTO duration has elapsed\r
- if (TSL_tim_CheckDelay_sec(TSL_Params.DTO, &tick_detected) == TSL_STATUS_OK)\r
- {\r
- TSL_linrot_SetStateCalibration(0);\r
- }\r
- }\r
- }\r
-#endif\r
- return; // Normal operation, stay in Touch state\r
- }\r
-\r
-#if TSLPRM_USE_PROX > 0\r
- if (TSL_linrot_ProcessCh_One_DeltaAbove(THIS_PROXOUT_TH, 0) == TSL_STATUS_OK)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_PROX;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_PROX_TOUCH;\r
- }\r
- return;\r
- }\r
-#endif\r
-\r
- THIS_COUNTER = THIS_COUNTER_DEB_RELEASE;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_RELEASE_TOUCH;\r
- }\r
-\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Debounce error state processing\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_DebErrorStateProcess(void)\r
-{\r
- volatile TSL_StateMask_enum_T mask;\r
-\r
- if (TSL_linrot_ProcessCh_One_AcqStatusError() == TSL_STATUS_OK) // Acquisition error (min or max)\r
- {\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_ERROR;\r
- }\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- // Get state mask\r
- mask = TSL_linrot_GetStateMask();\r
- // Mask Error and Debounce bits\r
-#ifdef _RAISONANCE_\r
- mask &= ~(TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_ERROR_BIT_MASK);\r
-#else\r
- mask &= (TSL_StateMask_enum_T)(~(TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_ERROR_BIT_MASK));\r
-#endif\r
- // Go back to the previous state\r
- switch (mask)\r
- {\r
- case TSL_STATEMASK_RELEASE :\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- break;\r
- case TSL_STATEMASK_PROX :\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- break;\r
- case TSL_STATEMASK_DETECT :\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- break;\r
- case TSL_STATEMASK_TOUCH :\r
- THIS_STATEID = TSL_STATEID_TOUCH;\r
- break;\r
- default:\r
- TSL_linrot_SetStateCalibration(0);\r
- break;\r
- }\r
- }\r
-}\r
-\r
-\r
-//==============================================================================\r
-// Private functions\r
-//==============================================================================\r
-\r
-/**\r
- * @brief Get the current time in second and affect it to the DTO counter (Private)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_DTOGetTime(void)\r
-{\r
- disableInterrupts();\r
- THIS_COUNTER = (TSL_tCounter_T)TSL_Globals.Tick_sec;\r
- enableInterrupts();\r
-}\r
-\r
-\r
-/**\r
- * @brief Set all channels status to ON, OFF or BURST ONLY\r
- * @param sts Channel status\r
- * @retval None\r
- */\r
-void TSL_linrot_ProcessCh_All_SetStatus(TSL_ObjStatus_enum_T sts)\r
-{\r
- TSL_tIndex_T idx;\r
- TSL_ChannelData_T *p_Ch = TSL_Globals.This_LinRot->p_ChD;\r
- // Init channels status\r
- for (idx = 0; idx < THIS_NB_CHANNELS; idx++)\r
- {\r
- p_Ch->Flags.ObjStatus = sts;\r
- p_Ch++;\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Check if at least one channel has a data ready\r
- * @param None\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_linrot_ProcessCh_One_DataReady(void)\r
-{\r
- TSL_tIndex_T idx;\r
- TSL_ChannelData_T *p_Ch = TSL_Globals.This_LinRot->p_ChD;\r
- TSL_Status_enum_T retval = TSL_STATUS_ERROR;\r
- // Return OK if at least one channel has a data ready\r
- for (idx = 0; idx < THIS_NB_CHANNELS; idx++)\r
- {\r
- if (p_Ch->Flags.DataReady == TSL_DATA_READY)\r
- {\r
- p_Ch->Flags.DataReady = TSL_DATA_NOT_READY; // The new data is processed\r
- retval = TSL_STATUS_OK;\r
- }\r
- p_Ch++;\r
- }\r
- return retval;\r
-}\r
-\r
-\r
-/**\r
- * @brief Check if all channels are equal to the status passed\r
- * @param sts Status to be checked\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_linrot_ProcessCh_All_AcqStatus(TSL_AcqStatus_enum_T sts)\r
-{\r
- TSL_tIndex_T idx;\r
- TSL_ChannelData_T *p_Ch = TSL_Globals.This_LinRot->p_ChD;\r
- // Return OK if ALL channels have the correct acq status\r
- for (idx = 0; idx < THIS_NB_CHANNELS; idx++)\r
- {\r
- if (p_Ch->Flags.AcqStatus != sts)\r
- {\r
- return TSL_STATUS_ERROR;\r
- }\r
- p_Ch++;\r
- }\r
- return TSL_STATUS_OK;\r
-}\r
-\r
-\r
-/**\r
- * @brief Check if at least one channel is in error\r
- * @param None\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_linrot_ProcessCh_One_AcqStatusError(void)\r
-{\r
- TSL_tIndex_T idx;\r
- TSL_ChannelData_T *p_Ch = TSL_Globals.This_LinRot->p_ChD;\r
- // Return OK if at least one channel is in acquisition error min or max\r
- for (idx = 0; idx < THIS_NB_CHANNELS; idx++)\r
- {\r
- if (p_Ch->Flags.AcqStatus & TSL_ACQ_STATUS_ERROR_MASK)\r
- {\r
- return TSL_STATUS_OK;\r
- }\r
- p_Ch++;\r
- }\r
- return TSL_STATUS_ERROR;\r
-}\r
-\r
-\r
-/**\r
- * @brief Check if at least one channel is below or equal a threshold (inverted)\r
- * @param th Threshold\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_linrot_ProcessCh_One_DeltaBelowEquMinus(TSL_tThreshold_T th)\r
-{\r
- TSL_tIndex_T idx;\r
- TSL_ChannelData_T *p_Ch = TSL_Globals.This_LinRot->p_ChD;\r
- TSL_tDelta_T norm_delta;\r
-\r
- // Return OK if at least one channel is below or equal the threshold\r
- for (idx = 0; idx < THIS_NB_CHANNELS; idx++)\r
- {\r
-\r
-#if TSLPRM_LINROT_USE_NORMDELTA > 0\r
- norm_delta = TSL_linrot_NormDelta(p_Ch, idx); // Normalize the Delta\r
-#else\r
- norm_delta = p_Ch->Delta; // Take only the Delta\r
-#endif\r
-\r
- if (norm_delta <= -th) // Warning!!! The threshold is inverted\r
- {\r
- return TSL_STATUS_OK;\r
- }\r
- p_Ch++;\r
- }\r
- return TSL_STATUS_ERROR;\r
-}\r
-\r
-\r
-/**\r
- * @brief Check if at least one channel is above or equal a threshold\r
- * @param th Threshold\r
- * @param coeff Enable or Disable the multiplier coefficient on threshold\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_linrot_ProcessCh_One_DeltaAboveEqu(TSL_tThreshold_T th, TSL_tIndex_T coeff)\r
-{\r
- TSL_tIndex_T idx;\r
- TSL_ChannelData_T *p_Ch = TSL_Globals.This_LinRot->p_ChD;\r
- TSL_tDelta_T norm_delta;\r
-\r
-#if TSLPRM_COEFF_TH > 0\r
- uint16_t lth;\r
- if (coeff)\r
- {\r
- lth = (uint16_t)((uint16_t)th << TSLPRM_COEFF_TH);\r
- }\r
- else\r
- {\r
- lth = th;\r
- }\r
-#endif\r
-\r
- // Return OK if at least one channel is above or equal the threshold\r
- for (idx = 0; idx < THIS_NB_CHANNELS; idx++)\r
- {\r
-\r
-#if TSLPRM_LINROT_USE_NORMDELTA > 0\r
- norm_delta = TSL_linrot_NormDelta(p_Ch, idx); // Normalize the Delta\r
-#else\r
- norm_delta = p_Ch->Delta; // Take only the Delta\r
-#endif\r
-\r
-#if TSLPRM_COEFF_TH > 0\r
- if (norm_delta >= lth)\r
-#else\r
- if (norm_delta >= th)\r
-#endif\r
- {\r
-#if TSLPRM_COEFF_TH > 0\r
- if (norm_delta < 0)\r
- {\r
- p_Ch++;\r
- continue;\r
- }\r
-#endif\r
- return TSL_STATUS_OK;\r
- }\r
- p_Ch++;\r
- }\r
- return TSL_STATUS_ERROR;\r
-}\r
-\r
-\r
-/**\r
- * @brief Check if at least one channel is stricly above a threshold\r
- * @param th Threshold\r
- * @param coeff Enable or Disable the multiplier coefficient on threshold\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_linrot_ProcessCh_One_DeltaAbove(TSL_tThreshold_T th, TSL_tIndex_T coeff)\r
-{\r
- TSL_tIndex_T idx;\r
- TSL_ChannelData_T *p_Ch = TSL_Globals.This_LinRot->p_ChD;\r
- TSL_tDelta_T norm_delta;\r
-\r
-#if TSLPRM_COEFF_TH > 0\r
- uint16_t lth;\r
- if (coeff)\r
- {\r
- lth = (uint16_t)((uint16_t)th << TSLPRM_COEFF_TH);\r
- }\r
- else\r
- {\r
- lth = th;\r
- }\r
-#endif\r
-\r
- // Return OK if at least one channel is above the threshold\r
- for (idx = 0; idx < THIS_NB_CHANNELS; idx++)\r
- {\r
-\r
-#if TSLPRM_LINROT_USE_NORMDELTA > 0\r
- norm_delta = TSL_linrot_NormDelta(p_Ch, idx); // Normalize the Delta\r
-#else\r
- norm_delta = p_Ch->Delta; // Take only the Delta\r
-#endif\r
-\r
-#if TSLPRM_COEFF_TH > 0\r
- if (norm_delta > lth)\r
-#else\r
- if (norm_delta > th)\r
-#endif\r
- {\r
-#if TSLPRM_COEFF_TH > 0\r
- if (norm_delta < 0)\r
- {\r
- p_Ch++;\r
- continue;\r
- }\r
-#endif\r
- return TSL_STATUS_OK;\r
- }\r
- p_Ch++;\r
- }\r
- return TSL_STATUS_ERROR;\r
-}\r
-\r
-\r
-/**\r
- * @brief Check if all channels are below or equal a threshold\r
- * @param th Threshold\r
- * @param coeff Enable or Disable the multiplier coefficient on threshold\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_linrot_ProcessCh_All_DeltaBelowEqu(TSL_tThreshold_T th, TSL_tIndex_T coeff)\r
-{\r
- TSL_tIndex_T idx;\r
- TSL_ChannelData_T *p_Ch = TSL_Globals.This_LinRot->p_ChD;\r
- TSL_tDelta_T norm_delta;\r
-\r
-#if TSLPRM_COEFF_TH > 0\r
- uint16_t lth;\r
- if (coeff)\r
- {\r
- lth = (uint16_t)((uint16_t)th << TSLPRM_COEFF_TH);\r
- }\r
- else\r
- {\r
- lth = th;\r
- }\r
-#endif\r
-\r
- // Return OK if ALL channels are below or equal the threshold\r
- for (idx = 0; idx < THIS_NB_CHANNELS; idx++)\r
- {\r
-\r
-#if TSLPRM_LINROT_USE_NORMDELTA > 0\r
- norm_delta = TSL_linrot_NormDelta(p_Ch, idx); // Normalize the Delta\r
-#else\r
- norm_delta = p_Ch->Delta; // Take only the Delta\r
-#endif\r
-\r
-#if TSLPRM_COEFF_TH > 0\r
- if (norm_delta > lth)\r
-#else\r
- if (norm_delta > th)\r
-#endif\r
- {\r
-#if TSLPRM_COEFF_TH > 0\r
- if (norm_delta < 0)\r
- {\r
- p_Ch++;\r
- continue;\r
- }\r
-#endif\r
- return TSL_STATUS_ERROR;\r
- }\r
- p_Ch++;\r
- }\r
- return TSL_STATUS_OK;\r
-}\r
-\r
-\r
-/**\r
- * @brief Clear the Reference and ReferenceRest for all channels\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_linrot_ProcessCh_All_ClearRef(void)\r
-{\r
- TSL_tIndex_T idx;\r
- TSL_ChannelData_T *p_Ch = TSL_Globals.This_LinRot->p_ChD;\r
- for (idx = 0; idx < THIS_NB_CHANNELS; idx++)\r
- {\r
- p_Ch->Ref = 0;\r
- p_Ch->RefRest = 0;\r
- p_Ch++;\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Normalize a Delta value\r
- * @param ch Pointer to the current channel\r
- * @param idx Index of the channel\r
- * @retval Normalized Delta value\r
- */\r
-TSL_tDelta_T TSL_linrot_NormDelta(TSL_ChannelData_T *ch, TSL_tIndex_T idx)\r
-{\r
- uint32_t tmpdelta = ch->Delta;\r
-\r
- // Apply coefficient\r
- if (TSL_Globals.This_LinRot->p_DeltaCoeff[idx] != 0x0100)\r
- {\r
- tmpdelta = (uint32_t)(tmpdelta * TSL_Globals.This_LinRot->p_DeltaCoeff[idx]);\r
- tmpdelta = tmpdelta >> (uint8_t)8;\r
- }\r
-\r
- return (TSL_tDelta_T)tmpdelta;\r
-}\r
-\r
-#endif\r
-// #if TSLPRM_TOTAL_LNRTS > 0\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_object.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the sensors in general.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_object.h"\r
-#include "tsl_globals.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-/* Private macros ------------------------------------------------------------*/\r
-/* Private variables ---------------------------------------------------------*/\r
-\r
-/* Private functions prototype -----------------------------------------------*/\r
-\r
-/**\r
- * @brief Initialize a group of Objects\r
- * @param[in] objgrp Pointer to the group of objects\r
- * @retval None\r
- */\r
-void TSL_obj_GroupInit(TSL_ObjectGroup_T *objgrp)\r
-{\r
- TSL_tIndex_T idx_obj;\r
- CONST TSL_Object_T *pobj;\r
- TSL_tNb_T objgrp_state_mask = 0;\r
-\r
- pobj = objgrp->p_Obj; // First object in the group\r
-\r
- objgrp->Change = TSL_STATE_NOT_CHANGED;\r
-\r
- // Process all objects\r
- for (idx_obj = 0; idx_obj < objgrp->NbObjects; idx_obj++)\r
- {\r
-\r
- // Assign global object\r
- TSL_obj_SetGlobalObj(pobj);\r
-\r
- switch (pobj->Type)\r
- {\r
- //------------------------------------------------------------------------\r
-#if TSLPRM_TOTAL_TOUCHKEYS > 0\r
- case TSL_OBJ_TOUCHKEY:\r
- // Call the specific method\r
- TSL_Globals.This_TKey->p_Methods->Init();\r
- // Check if the object has changed of state\r
- if (TSL_Globals.This_TKey->p_Data->Change)\r
- {\r
- objgrp->Change = TSL_STATE_CHANGED;\r
- }\r
- // Update object group state mask\r
- objgrp_state_mask |= TSL_Globals.This_TKey->p_SM[TSL_Globals.This_TKey->p_Data->StateId].StateMask;\r
- break;\r
-#endif\r
- //------------------------------------------------------------------------\r
-#if TSLPRM_TOTAL_TOUCHKEYS_B > 0\r
- case TSL_OBJ_TOUCHKEYB:\r
- // Call the default method\r
- TSL_Params.p_TKeyMT->Init();\r
- // Check if the object has changed of state\r
- if (TSL_Globals.This_TKey->p_Data->Change)\r
- {\r
- objgrp->Change = TSL_STATE_CHANGED;\r
- }\r
- // Get object state mask from state machine in TSL_Params\r
- objgrp_state_mask |= TSL_Params.p_TKeySM[TSL_Globals.This_TKey->p_Data->StateId].StateMask;\r
- break;\r
-#endif\r
- //------------------------------------------------------------------------\r
-#if TSLPRM_TOTAL_LINROTS > 0\r
- case TSL_OBJ_LINEAR:\r
- case TSL_OBJ_ROTARY:\r
- // Call the specific method\r
- TSL_Globals.This_LinRot->p_Methods->Init();\r
- // Check if the object has changed of state\r
- if (TSL_Globals.This_LinRot->p_Data->Change)\r
- {\r
- objgrp->Change = TSL_STATE_CHANGED;\r
- }\r
- // Update object group state mask\r
- objgrp_state_mask |= TSL_Globals.This_LinRot->p_SM[TSL_Globals.This_LinRot->p_Data->StateId].StateMask;\r
- break;\r
-#endif\r
- //------------------------------------------------------------------------\r
-#if TSLPRM_TOTAL_LINROTS_B > 0\r
- case TSL_OBJ_LINEARB:\r
- case TSL_OBJ_ROTARYB:\r
- // Call the default method\r
- TSL_Params.p_LinRotMT->Init();\r
- // Check if the object has changed of state\r
- if (TSL_Globals.This_LinRot->p_Data->Change)\r
- {\r
- objgrp->Change = TSL_STATE_CHANGED;\r
- }\r
- // Get object state mask from state machine in TSL_Params\r
- objgrp_state_mask |= TSL_Params.p_LinRotSM[TSL_Globals.This_LinRot->p_Data->StateId].StateMask;\r
- break;\r
-#endif\r
- default:\r
- break;\r
- }\r
-\r
- pobj++; // Next object\r
- }\r
-\r
- // Update the object group state mask\r
- objgrp->StateMask = objgrp_state_mask;\r
-}\r
-\r
-\r
-/**\r
- * @brief Process the state machine on a group of Objects\r
- * @param[in] objgrp Pointer to the group of objects to process\r
- * @retval None\r
- */\r
-void TSL_obj_GroupProcess(TSL_ObjectGroup_T *objgrp)\r
-{\r
- TSL_tIndex_T idx_obj;\r
- CONST TSL_Object_T *pobj;\r
- TSL_tNb_T objgrp_state_mask = 0;\r
-\r
- pobj = objgrp->p_Obj; // First object in the group\r
-\r
- objgrp->Change = TSL_STATE_NOT_CHANGED;\r
-\r
- // Process all objects\r
- for (idx_obj = 0; idx_obj < objgrp->NbObjects; idx_obj++)\r
- {\r
-\r
- // Assign global object\r
- TSL_obj_SetGlobalObj(pobj);\r
-\r
- switch (pobj->Type)\r
- {\r
- //------------------------------------------------------------------------\r
-#if TSLPRM_TOTAL_TOUCHKEYS > 0\r
- case TSL_OBJ_TOUCHKEY:\r
- // Call the specific method\r
- TSL_Globals.This_TKey->p_Methods->Process();\r
- // Check if the object has changed of state\r
- if (TSL_Globals.This_TKey->p_Data->Change)\r
- {\r
- objgrp->Change = TSL_STATE_CHANGED;\r
- }\r
- // Update object group state mask\r
- objgrp_state_mask |= TSL_Globals.This_TKey->p_SM[TSL_Globals.This_TKey->p_Data->StateId].StateMask;\r
- break;\r
-#endif\r
- //------------------------------------------------------------------------\r
-#if TSLPRM_TOTAL_TOUCHKEYS_B > 0\r
- case TSL_OBJ_TOUCHKEYB:\r
- // Call the default method\r
- TSL_Params.p_TKeyMT->Process();\r
- // Check if the object has changed of state\r
- if (TSL_Globals.This_TKey->p_Data->Change)\r
- {\r
- objgrp->Change = TSL_STATE_CHANGED;\r
- }\r
- // Get object state mask from state machine in TSL_Params\r
- objgrp_state_mask |= TSL_Params.p_TKeySM[TSL_Globals.This_TKey->p_Data->StateId].StateMask;\r
- break;\r
-#endif\r
- //------------------------------------------------------------------------\r
-#if TSLPRM_TOTAL_LINROTS > 0\r
- case TSL_OBJ_LINEAR:\r
- case TSL_OBJ_ROTARY:\r
- // Call the specific method\r
- TSL_Globals.This_LinRot->p_Methods->Process();\r
- // Check if the object has changed of state\r
- if (TSL_Globals.This_LinRot->p_Data->Change)\r
- {\r
- objgrp->Change = TSL_STATE_CHANGED;\r
- }\r
- // Update object group state mask\r
- objgrp_state_mask |= TSL_Globals.This_LinRot->p_SM[TSL_Globals.This_LinRot->p_Data->StateId].StateMask;\r
- break;\r
-#endif\r
- //------------------------------------------------------------------------\r
-#if TSLPRM_TOTAL_LINROTS_B > 0\r
- case TSL_OBJ_LINEARB:\r
- case TSL_OBJ_ROTARYB:\r
- // Call the default method\r
- TSL_Params.p_LinRotMT->Process();\r
- // Check if the object has changed of state\r
- if (TSL_Globals.This_LinRot->p_Data->Change)\r
- {\r
- objgrp->Change = TSL_STATE_CHANGED;\r
- }\r
- // Get object state mask from state machine in TSL_Params\r
- objgrp_state_mask |= TSL_Params.p_LinRotSM[TSL_Globals.This_LinRot->p_Data->StateId].StateMask;\r
- break;\r
-#endif\r
- default:\r
- break;\r
- }\r
-\r
- pobj++; // Next object\r
- }\r
-\r
- // Update the object group state mask\r
- objgrp->StateMask = objgrp_state_mask;\r
-}\r
-\r
-\r
-/**\r
- * @brief Set the global object variable\r
- * @param[in] pobj Pointer to the object to process\r
- * @retval None\r
- */\r
-void TSL_obj_SetGlobalObj(CONST TSL_Object_T *pobj)\r
-{\r
-\r
- TSL_Globals.This_Obj = pobj;\r
-\r
- switch (pobj->Type)\r
- {\r
-#if TSLPRM_TOTAL_TKEYS > 0\r
- case TSL_OBJ_TOUCHKEY:\r
- case TSL_OBJ_TOUCHKEYB:\r
- TSL_Globals.This_TKey = (TSL_TouchKey_T *)pobj->Elmt;\r
- break;\r
-#endif\r
-#if TSLPRM_TOTAL_LNRTS > 0\r
- case TSL_OBJ_LINEAR:\r
- case TSL_OBJ_LINEARB:\r
- case TSL_OBJ_ROTARY:\r
- case TSL_OBJ_ROTARYB:\r
- TSL_Globals.This_LinRot = (TSL_LinRot_T *)pobj->Elmt;\r
- break;\r
-#endif\r
- default:\r
- break;\r
- }\r
-}\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_time.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the timings in general.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_time.h"\r
-#include "tsl_globals.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-/* Private macros ------------------------------------------------------------*/\r
-/* Private variables ---------------------------------------------------------*/\r
-/* Private functions prototype -----------------------------------------------*/\r
-\r
-/**\r
- * @brief Management of the timing module interrupt service routine.\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tim_ProcessIT(void)\r
-{\r
- static TSL_tTick_ms_T count_1s = 0;\r
-\r
- // Count 1 global tick every xxx ms (defined by TSLPRM_TICK_FREQ parameter)\r
- TSL_Globals.Tick_ms++;\r
-\r
- // Check if 1 second has elapsed\r
- count_1s++;\r
- if (count_1s > (TSLPRM_TICK_FREQ - 1))\r
- {\r
- TSL_Globals.Tick_sec++; // 1 global tick every second\r
- if (TSL_Globals.Tick_sec > 63) // Due to DTO counter on 6 bits...\r
- {\r
- TSL_Globals.Tick_sec = 0;\r
- }\r
- count_1s = 0;\r
- }\r
-\r
-// Callback function\r
-#if TSLPRM_USE_TIMER_CALLBACK > 0\r
- TSL_CallBack_TimerTick();\r
-#endif\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief Check if a delay (in ms) has elapsed.\r
- * This function must be called regularly due to counter Roll-over only managed one time.\r
- * @param[in] delay_ms Delay in ms\r
- * @param[in] last_tick Variable holding the last tick value\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_tim_CheckDelay_ms(TSL_tTick_ms_T delay_ms, __IO TSL_tTick_ms_T *last_tick)\r
-{\r
- TSL_tTick_ms_T tick;\r
- TSL_tTick_ms_T diff;\r
-\r
- disableInterrupts();\r
-\r
- tick = TSL_Globals.Tick_ms;\r
-\r
- if (delay_ms == 0)\r
- {\r
- enableInterrupts();\r
- return TSL_STATUS_ERROR;\r
- }\r
-\r
- // Counter Roll-over management\r
- if (tick >= *last_tick)\r
- {\r
- diff = tick - *last_tick;\r
- }\r
- else\r
- {\r
- diff = (0xFFFF - *last_tick) + tick + 1;\r
- }\r
-\r
-#if (TSLPRM_TICK_FREQ == 125)\r
- if (diff >= (TSL_tTick_ms_T)(delay_ms >> 3)) // Divide by 8 for 8ms tick\r
-#endif\r
-#if (TSLPRM_TICK_FREQ == 250)\r
- if (diff >= (TSL_tTick_ms_T)(delay_ms >> 2)) // Divide by 4 for 4ms tick\r
-#endif\r
-#if (TSLPRM_TICK_FREQ == 500)\r
- if (diff >= (TSL_tTick_ms_T)(delay_ms >> 1)) // Divide by 2 for 2ms tick\r
-#endif\r
-#if (TSLPRM_TICK_FREQ == 1000)\r
- if (diff >= (TSL_tTick_ms_T)delay_ms) // Direct value for 1ms tick\r
-#endif\r
-#if (TSLPRM_TICK_FREQ == 2000)\r
- if (diff >= (TSL_tTick_ms_T)(delay_ms << 1)) // Multiply by 2 for 0.5ms tick\r
-#endif\r
- {\r
- // Save current time\r
- *last_tick = tick;\r
- enableInterrupts();\r
- return TSL_STATUS_OK;\r
- }\r
-\r
- enableInterrupts();\r
- return TSL_STATUS_BUSY;\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief Check if a delay (in s) has elapsed.\r
- * @param[in] delay_sec Delay in seconds\r
- * @param[in] last_tick Variable holding the last tick value\r
- * @retval Status\r
- */\r
-TSL_Status_enum_T TSL_tim_CheckDelay_sec(TSL_tTick_sec_T delay_sec, __IO TSL_tTick_sec_T *last_tick)\r
-{\r
- TSL_tTick_sec_T tick;\r
- TSL_tTick_sec_T diff;\r
-\r
- disableInterrupts();\r
-\r
- tick = TSL_Globals.Tick_sec;\r
-\r
- if (delay_sec == 0)\r
- {\r
- enableInterrupts();\r
- return TSL_STATUS_ERROR;\r
- }\r
-\r
- // Counter Roll-over management\r
- if (tick >= *last_tick)\r
- {\r
- diff = (TSL_tTick_sec_T)(tick - *last_tick);\r
- }\r
- else\r
- {\r
- diff = (TSL_tTick_sec_T)((63 - *last_tick) + tick + 1); // DTO counter is on 6 bits\r
- }\r
-\r
- if (diff >= delay_sec)\r
- {\r
- // Save current time\r
- *last_tick = tick;\r
- enableInterrupts();\r
- return TSL_STATUS_OK;\r
- }\r
-\r
- enableInterrupts();\r
- return TSL_STATUS_BUSY;\r
-\r
-}\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_time_stm32f0xx.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the timing with STM32F0xx products.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_time_stm32f0xx.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-/* Private macros ------------------------------------------------------------*/\r
-/* Private variables ---------------------------------------------------------*/\r
-/* Private functions prototype -----------------------------------------------*/\r
-\r
-/**\r
- * @brief Initialization of the timing module.\r
- * @param None\r
- * @retval Status Return TSL_STATUS_ERROR if the Systick configuration has failed.\r
- */\r
-TSL_Status_enum_T TSL_tim_Init(void)\r
-{\r
- // Program one systick interrupt every (1 / TSLPRM_TICK_FREQ) ms\r
- if (SysTick_Config(SystemCoreClock / TSLPRM_TICK_FREQ))\r
- {\r
- return TSL_STATUS_ERROR;\r
- }\r
- else\r
- {\r
- return TSL_STATUS_OK;\r
- }\r
-}\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_time_stm32f3xx.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the timing with STM32F3xx products.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_time_stm32f3xx.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-/* Private macros ------------------------------------------------------------*/\r
-/* Private variables ---------------------------------------------------------*/\r
-/* Private functions prototype -----------------------------------------------*/\r
-\r
-/**\r
- * @brief Initialization of the timing module.\r
- * @param None\r
- * @retval Status Return TSL_STATUS_ERROR if the Systick configuration has failed.\r
- */\r
-TSL_Status_enum_T TSL_tim_Init(void)\r
-{\r
- // Program one systick interrupt every (1 / TSLPRM_TICK_FREQ) ms\r
- if (SysTick_Config(SystemCoreClock / TSLPRM_TICK_FREQ))\r
- {\r
- return TSL_STATUS_ERROR;\r
- }\r
- else\r
- {\r
- return TSL_STATUS_OK;\r
- }\r
-}\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_time_stm32l1xx.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the timing with STM32L1xx products.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_time_stm32l1xx.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-/* Private macros ------------------------------------------------------------*/\r
-/* Private variables ---------------------------------------------------------*/\r
-/* Private functions prototype -----------------------------------------------*/\r
-\r
-/**\r
- * @brief Initialization of the timing module.\r
- * @param None\r
- * @retval Status Return TSL_STATUS_ERROR if the Systick configuration has failed.\r
- */\r
-TSL_Status_enum_T TSL_tim_Init(void)\r
-{\r
- // Program one systick interrupt every (1 / TSLPRM_TICK_FREQ) ms\r
- if (SysTick_Config(SystemCoreClock / TSLPRM_TICK_FREQ))\r
- {\r
- return TSL_STATUS_ERROR;\r
- }\r
- else\r
- {\r
- return TSL_STATUS_OK;\r
- }\r
-}\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_time_stm8tl5x.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage the timing with STM8TL5x products.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_time_stm8tl5x.h"\r
-#include "tsl_time.h"\r
-#include "stm8tl5x_it.h"\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-/* Private macros ------------------------------------------------------------*/\r
-/* Private variables ---------------------------------------------------------*/\r
-/* Private functions prototype -----------------------------------------------*/\r
-\r
-/**\r
- * @brief Initialization of the timing module to generate periodic interruptions\r
- * @warning The CPU frequency must be equal to 16 MHz\r
- * @param None\r
- * @retval Status Return TSL_STATUS_ERROR if the CPU freq in uncorrect.\r
- */\r
-TSL_Status_enum_T TSL_tim_Init(void)\r
-{\r
- CLK->PCKENR1 |= CLK_PCKENR1_TIM4; // The peripheral clock are not enable by default\r
-\r
- if (CLK->CKDIVR != 0x00) // The CPU frequency must be equal to 16 MHz\r
- {\r
- return TSL_STATUS_ERROR;\r
- }\r
-\r
- TIM4->SR1 = 0; // Clear overflow flag\r
-\r
-#if (TSLPRM_TICK_FREQ == 2000)\r
- TIM4->PSCR = 6; // 16 MHz / 64 = 4 us clock\r
- TIM4->ARR = 124; // 125 * 4 us = 0.5 ms\r
-#endif\r
-\r
-#if (TSLPRM_TICK_FREQ == 1000)\r
- TIM4->PSCR = 6; // 16 MHz / 64 = 4 us clock\r
- TIM4->ARR = 249; // 250 * 4 us = 1 ms\r
-#endif\r
-\r
-#if (TSLPRM_TICK_FREQ == 500)\r
- TIM4->PSCR = 8; // 16 MHz / 256 = 16 us clock\r
- TIM4->ARR = 124; // 125 * 16 us = 2 ms\r
-#endif\r
-\r
-#if (TSLPRM_TICK_FREQ == 250)\r
- TIM4->PSCR = 8; // 16 MHz / 256 = 16 us clock\r
- TIM4->ARR = 249; // 250 * 16 us = 4 ms\r
-#endif\r
-\r
-#if (TSLPRM_TICK_FREQ == 125)\r
- TIM4->PSCR = 10; // 16 MHz / 1024 = 64 us clock\r
- TIM4->ARR = 124; // 125 * 64 us = 8 ms\r
-#endif\r
-\r
- TIM4->IER = 0x01; // Enable interrupt\r
- TIM4->CR1 = 0x01; // Start timer\r
-\r
- return TSL_STATUS_OK;\r
-}\r
-\r
-\r
-/**\r
- * @brief Interrupt handler for TIM4 dedicated to ECS\r
- * @param None\r
- * @retval None\r
- */\r
-#if defined(_COSMIC_)\r
-// 'svlreg option' is added to force the saving of the virtual long register\r
-@svlreg INTERRUPT_HANDLER(TSL_Timer_ISR, 25)\r
-#else\r
-INTERRUPT_HANDLER(TSL_Timer_ISR, 25)\r
-#endif\r
-{\r
- TIM4->SR1 &= (uint8_t)(~TIM4_SR1_UIF);\r
- TSL_tim_ProcessIT();\r
-}\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file tsl_touchkey.c\r
- * @author MCD Application Team\r
- * @version V1.3.2\r
- * @date 22-January-2013\r
- * @brief This file contains all functions to manage TouchKey sensors.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "tsl_touchkey.h"\r
-#include "tsl_globals.h"\r
-\r
-#if TSLPRM_TOTAL_TKEYS > 0\r
-\r
-/* Private typedefs ----------------------------------------------------------*/\r
-/* Private defines -----------------------------------------------------------*/\r
-\r
-/* Private macros ------------------------------------------------------------*/\r
-\r
-#define THIS_MEAS TSL_Globals.This_TKey->p_ChD->Meas\r
-#define THIS_DELTA TSL_Globals.This_TKey->p_ChD->Delta\r
-#define THIS_REF TSL_Globals.This_TKey->p_ChD->Ref\r
-#define THIS_REFREST TSL_Globals.This_TKey->p_ChD->RefRest\r
-#define THIS_CHANNEL_DATA TSL_Globals.This_TKey->p_ChD\r
-#define THIS_ACQ_STATUS TSL_Globals.This_TKey->p_ChD->Flags.AcqStatus\r
-#define THIS_OBJ_STATUS TSL_Globals.This_TKey->p_ChD->Flags.ObjStatus\r
-#define THIS_DATA_READY TSL_Globals.This_TKey->p_ChD->Flags.DataReady\r
-\r
-#define THIS_STATEID TSL_Globals.This_TKey->p_Data->StateId\r
-#define THIS_CHANGE TSL_Globals.This_TKey->p_Data->Change\r
-#define THIS_COUNTER TSL_Globals.This_TKey->p_Data->Counter\r
-#define THIS_DXSLOCK TSL_Globals.This_TKey->p_Data->DxSLock\r
-\r
-#define THIS_PROXIN_TH TSL_Globals.This_TKey->p_Param->ProxInTh\r
-#define THIS_PROXOUT_TH TSL_Globals.This_TKey->p_Param->ProxOutTh\r
-#define THIS_DETECTIN_TH TSL_Globals.This_TKey->p_Param->DetectInTh\r
-#define THIS_DETECTOUT_TH TSL_Globals.This_TKey->p_Param->DetectOutTh\r
-#define THIS_CALIB_TH TSL_Globals.This_TKey->p_Param->CalibTh\r
-\r
-#define THIS_COUNTER_DEB_CALIB TSL_Globals.This_TKey->p_Param->CounterDebCalib\r
-#define THIS_COUNTER_DEB_PROX TSL_Globals.This_TKey->p_Param->CounterDebProx\r
-#define THIS_COUNTER_DEB_DETECT TSL_Globals.This_TKey->p_Param->CounterDebDetect\r
-#define THIS_COUNTER_DEB_RELEASE TSL_Globals.This_TKey->p_Param->CounterDebRelease\r
-#define THIS_COUNTER_DEB_ERROR TSL_Globals.This_TKey->p_Param->CounterDebError\r
-\r
-#if TSLPRM_DTO > 0\r
-#define DTO_GET_TIME {TSL_tkey_DTOGetTime();}\r
-#else\r
-#define DTO_GET_TIME\r
-#endif\r
-\r
-#if TSLPRM_COEFF_TH > 0\r
-#define TEST_DELTA(OPER,TH) (THIS_DELTA OPER (uint16_t)((uint16_t)TH << TSLPRM_COEFF_TH))\r
-#define TEST_DELTA_NEGATIVE {if (THIS_DELTA < 0) {return;}}\r
-#else\r
-#define TEST_DELTA(OPER,TH) (THIS_DELTA OPER TH)\r
-#define TEST_DELTA_NEGATIVE\r
-#endif\r
-\r
-/* Private variables ---------------------------------------------------------*/\r
-\r
-static TSL_tNb_T CalibDiv;\r
-\r
-/* Private functions prototype -----------------------------------------------*/\r
-\r
-void TSL_tkey_DTOGetTime(void);\r
-\r
-\r
-//==============================================================================\r
-// "Object methods" functions\r
-//==============================================================================\r
-\r
-/**\r
- * @brief Init parameters with default values from configuration file\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_Init(void)\r
-{\r
- // Thresholds\r
-#if TSLPRM_USE_PROX > 0\r
- THIS_PROXIN_TH = TSLPRM_TKEY_PROX_IN_TH;\r
- THIS_PROXOUT_TH = TSLPRM_TKEY_PROX_OUT_TH;\r
-#endif\r
- THIS_DETECTIN_TH = TSLPRM_TKEY_DETECT_IN_TH;\r
- THIS_DETECTOUT_TH = TSLPRM_TKEY_DETECT_OUT_TH;\r
- THIS_CALIB_TH = TSLPRM_TKEY_CALIB_TH;\r
-\r
- // Debounce counters\r
- THIS_COUNTER_DEB_CALIB = TSLPRM_DEBOUNCE_CALIB;\r
-#if TSLPRM_USE_PROX > 0\r
- THIS_COUNTER_DEB_PROX = TSLPRM_DEBOUNCE_PROX;\r
-#endif\r
- THIS_COUNTER_DEB_DETECT = TSLPRM_DEBOUNCE_DETECT;\r
- THIS_COUNTER_DEB_RELEASE = TSLPRM_DEBOUNCE_RELEASE;\r
- THIS_COUNTER_DEB_ERROR = TSLPRM_DEBOUNCE_ERROR;\r
-\r
- // Initial state\r
- TSL_tkey_SetStateCalibration(TSLPRM_CALIB_DELAY);\r
-}\r
-\r
-\r
-/**\r
- * @brief Process the State Machine\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_Process(void)\r
-{\r
- TSL_StateId_enum_T prev_state_id;\r
-\r
- if ((THIS_DATA_READY != 0) || (THIS_STATEID == TSL_STATEID_OFF))\r
- {\r
-\r
- THIS_DATA_READY = TSL_DATA_NOT_READY; // The new data is processed\r
-\r
- prev_state_id = THIS_STATEID;\r
-\r
-#if TSLPRM_TOTAL_TOUCHKEYS > 0\r
- if (TSL_Globals.This_Obj->Type == TSL_OBJ_TOUCHKEY)\r
- {\r
- // Launch the TKey state function\r
- TSL_Globals.This_TKey->p_SM[THIS_STATEID].StateFunc();\r
- }\r
-#endif\r
-\r
-#if TSLPRM_TOTAL_TOUCHKEYS_B > 0\r
- if (TSL_Globals.This_Obj->Type == TSL_OBJ_TOUCHKEYB)\r
- {\r
- // Launch the TSL_Params state function\r
- TSL_Params.p_TKeySM[THIS_STATEID].StateFunc();\r
- }\r
-#endif\r
-\r
- // Check if the new state has changed\r
- if (THIS_STATEID == prev_state_id)\r
- {\r
- THIS_CHANGE = TSL_STATE_NOT_CHANGED;\r
- }\r
- else\r
- {\r
- THIS_CHANGE = TSL_STATE_CHANGED;\r
- }\r
-\r
-#if TSLPRM_USE_DXS > 0\r
- if (THIS_STATEID != TSL_STATEID_DETECT)\r
- {\r
- THIS_DXSLOCK = TSL_FALSE;\r
- }\r
- if (THIS_STATEID == TSL_STATEID_TOUCH)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- }\r
-#endif\r
-\r
- }\r
-}\r
-\r
-\r
-//==============================================================================\r
-// Utility functions\r
-//==============================================================================\r
-\r
-/**\r
- * @brief Go in Calibration state\r
- * @param[in] delay Delay before calibration starts (stabilization of noise filter)\r
- * @retval None\r
- */\r
-void TSL_tkey_SetStateCalibration(TSL_tCounter_T delay)\r
-{\r
- THIS_STATEID = TSL_STATEID_CALIB;\r
- THIS_CHANGE = TSL_STATE_CHANGED;\r
- THIS_OBJ_STATUS = TSL_OBJ_STATUS_ON;\r
-\r
- switch (TSL_Params.NbCalibSamples)\r
- {\r
- case 4:\r
- CalibDiv = 2;\r
- break;\r
- case 16:\r
- CalibDiv = 4;\r
- break;\r
- default:\r
- TSL_Params.NbCalibSamples = 8;\r
- CalibDiv = 3;\r
- break;\r
- }\r
-\r
- // If a noise filter is used, the counter must be initialized to a value\r
- // different from 0 in order to stabilize the filter.\r
- THIS_COUNTER = (TSL_tCounter_T)(delay + (TSL_tCounter_T)TSL_Params.NbCalibSamples);\r
- THIS_REF = 0;\r
-}\r
-\r
-\r
-/**\r
- * @brief Go in Off state with sensor "off"\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_SetStateOff(void)\r
-{\r
- THIS_STATEID = TSL_STATEID_OFF;\r
- THIS_CHANGE = TSL_STATE_CHANGED;\r
- THIS_OBJ_STATUS = TSL_OBJ_STATUS_OFF;\r
-}\r
-\r
-\r
-#if !defined(TSLPRM_STM8TL5X) && !defined(STM8TL5X)\r
-/**\r
- * @brief Go in Off state with sensor in "Burst mode only"\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_SetStateBurstOnly(void)\r
-{\r
- THIS_STATEID = TSL_STATEID_OFF;\r
- THIS_CHANGE = TSL_STATE_CHANGED;\r
- THIS_OBJ_STATUS = TSL_OBJ_STATUS_BURST_ONLY;\r
-}\r
-#endif\r
-\r
-\r
-/**\r
- * @brief Return the current state identifier\r
- * @param None\r
- * @retval State id\r
- */\r
-TSL_StateId_enum_T TSL_tkey_GetStateId(void)\r
-{\r
- return(THIS_STATEID);\r
-}\r
-\r
-\r
-/**\r
- * @brief Return the current state mask\r
- * @param None\r
- * @retval State mask\r
- */\r
-TSL_StateMask_enum_T TSL_tkey_GetStateMask(void)\r
-{\r
- TSL_StateMask_enum_T state_mask = TSL_STATEMASK_UNKNOWN;\r
-\r
-#if TSLPRM_TOTAL_TOUCHKEYS > 0\r
- if (TSL_Globals.This_Obj->Type == TSL_OBJ_TOUCHKEY)\r
- {\r
- state_mask = TSL_Globals.This_TKey->p_SM[THIS_STATEID].StateMask;\r
- }\r
-#endif\r
-\r
-#if TSLPRM_TOTAL_TOUCHKEYS_B > 0\r
- if (TSL_Globals.This_Obj->Type == TSL_OBJ_TOUCHKEYB)\r
- {\r
- state_mask = TSL_Params.p_TKeySM[THIS_STATEID].StateMask;\r
- }\r
-#endif\r
-\r
- return state_mask;\r
-}\r
-\r
-\r
-/**\r
- * @brief Return the Change flag\r
- * @param None\r
- * @retval Change flag status\r
- */\r
-TSL_tNb_T TSL_tkey_IsChanged(void)\r
-{\r
- return(THIS_CHANGE);\r
-}\r
-\r
-\r
-//==============================================================================\r
-// State machine functions\r
-//==============================================================================\r
-\r
-#if TSLPRM_USE_PROX > 0\r
-/**\r
- * @brief Debounce Release processing (previous state = Proximity)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_DebReleaseProxStateProcess(void)\r
-{\r
- if (THIS_ACQ_STATUS & TSL_ACQ_STATUS_ERROR_MASK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX; // Go back to the previous state\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if (THIS_DELTA > THIS_PROXOUT_TH)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX; // Go back to the previous state\r
- }\r
- else\r
- {\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- // else stay in Debounce Release\r
- }\r
- }\r
-}\r
-#endif // if TSLPRM_USE_PROX > 0\r
-\r
-\r
-/**\r
- * @brief Debounce Release processing (previous state = Detect)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_DebReleaseDetectStateProcess(void)\r
-{\r
- if (THIS_ACQ_STATUS & TSL_ACQ_STATUS_ERROR_MASK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT; // Go back to the previous state\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if TEST_DELTA(>, THIS_DETECTOUT_TH)\r
- {\r
- TEST_DELTA_NEGATIVE;\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- }\r
- else\r
- {\r
-#if TSLPRM_USE_PROX > 0\r
- if (THIS_DELTA > THIS_PROXOUT_TH)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- return;\r
- }\r
-#endif\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- // else stay in Debounce Release\r
- }\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Debounce Release processing (previous state = Touch)\r
- * Same as Debounce Release Detect processing\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_DebReleaseTouchStateProcess(void)\r
-{\r
- if (THIS_ACQ_STATUS & TSL_ACQ_STATUS_ERROR_MASK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_TOUCH; // Go back to the previous state\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if TEST_DELTA(>, THIS_DETECTOUT_TH)\r
- {\r
- TEST_DELTA_NEGATIVE;\r
- THIS_STATEID = TSL_STATEID_TOUCH;\r
- }\r
- else\r
- {\r
-#if TSLPRM_USE_PROX > 0\r
- if (THIS_DELTA > THIS_PROXOUT_TH)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- return;\r
- }\r
-#endif\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- // else stay in Debounce Release\r
- }\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Release state processing\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_ReleaseStateProcess(void)\r
-{\r
- if (THIS_ACQ_STATUS & TSL_ACQ_STATUS_ERROR_MASK) // Acquisition error (min or max)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_ERROR;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_ERROR;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_ERROR_RELEASE;\r
- }\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if TEST_DELTA(>=, THIS_DETECTIN_TH)\r
- {\r
- TEST_DELTA_NEGATIVE;\r
- THIS_COUNTER = THIS_COUNTER_DEB_DETECT;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_DETECT;\r
- }\r
- return;\r
- }\r
-\r
-#if TSLPRM_USE_PROX > 0\r
- if (THIS_DELTA >= THIS_PROXIN_TH)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_PROX;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_PROX;\r
- }\r
- return;\r
- }\r
-#endif\r
-\r
- // Check delta for re-calibration\r
- // Warning: the threshold value is inverted\r
- if (THIS_DELTA <= -THIS_CALIB_TH)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_CALIB;\r
- if (THIS_COUNTER == 0)\r
- {\r
- TSL_tkey_SetStateCalibration(0);\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_CALIB;\r
- }\r
- }\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Debounce Calibration processing (previous state = Release)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_DebCalibrationStateProcess(void)\r
-{\r
- if (THIS_ACQ_STATUS & TSL_ACQ_STATUS_ERROR_MASK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE; // Go back to the previous state\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- // Still below recalibration threshold\r
- // Warning: the threshold value is inverted\r
- if (THIS_DELTA <= -THIS_CALIB_TH)\r
- {\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- TSL_tkey_SetStateCalibration(0);\r
- }\r
- // else stay in Debounce Calibration\r
- }\r
- else // Go back to previous state\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Calibration state processing\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_CalibrationStateProcess(void)\r
-{\r
- TSL_tMeas_T new_meas;\r
-\r
-#if TSLPRM_CALIB_DELAY > 0\r
- // Noise filter stabilization time\r
- if (THIS_COUNTER > (TSL_tCounter_T)TSL_Params.NbCalibSamples)\r
- {\r
- THIS_COUNTER--;\r
- return; // Skip the sample\r
- }\r
-#endif\r
-\r
- if (THIS_ACQ_STATUS & TSL_ACQ_STATUS_ERROR_MASK) // Acquisition error (min or max)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_ERROR;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_ERROR;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_ERROR_CALIB;\r
- }\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
-\r
- // Get the new measure or Calculate it\r
-#if TSLPRM_USE_MEAS > 0\r
- new_meas = THIS_MEAS;\r
-#else // Calculate it\r
- new_meas = TSL_acq_ComputeMeas(THIS_REF, THIS_DELTA);\r
-#endif\r
-\r
- // Verify the first Reference value\r
- if (THIS_COUNTER == (TSL_tCounter_T)TSL_Params.NbCalibSamples)\r
- {\r
- if (TSL_acq_TestFirstReferenceIsValid(THIS_CHANNEL_DATA, new_meas))\r
- {\r
- THIS_REF = new_meas;\r
- }\r
- else\r
- {\r
- THIS_REF = 0;\r
- return;\r
- }\r
- }\r
- else\r
- {\r
- // Add the measure in temporary Reference\r
- THIS_REF += new_meas;\r
-\r
- // Check reference overflow\r
- if (THIS_REF < new_meas)\r
- {\r
- THIS_REF = 0; // Suppress the bad reference\r
- THIS_STATEID = TSL_STATEID_ERROR;\r
- return;\r
- }\r
- }\r
-\r
- // Check that we have all the needed measurements\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- // Divide temporary Reference by the number of samples\r
- THIS_REF >>= CalibDiv;\r
- THIS_REFREST = 0;\r
- THIS_DELTA = 0;\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- }\r
-}\r
-\r
-\r
-#if TSLPRM_USE_PROX > 0\r
-/**\r
- * @brief Debounce Proximity processing (previous state = Release)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_DebProxStateProcess(void)\r
-{\r
- if (THIS_ACQ_STATUS & TSL_ACQ_STATUS_ERROR_MASK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if TEST_DELTA(>=, THIS_DETECTIN_TH)\r
- {\r
- TEST_DELTA_NEGATIVE;\r
- THIS_COUNTER = THIS_COUNTER_DEB_DETECT;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_DETECT;\r
- }\r
- return;\r
- }\r
-\r
- if (THIS_DELTA >= THIS_PROXIN_TH)\r
- {\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- // else stay in Debounce Proximity\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- }\r
-}\r
-#endif\r
-\r
-\r
-#if TSLPRM_USE_PROX > 0\r
-/**\r
- * @brief Debounce Proximity processing (previous state = Detect)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_DebProxDetectStateProcess(void)\r
-{\r
- if (THIS_ACQ_STATUS & TSL_ACQ_STATUS_ERROR_MASK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if TEST_DELTA(>, THIS_DETECTOUT_TH)\r
- {\r
- TEST_DELTA_NEGATIVE;\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- return;\r
- }\r
-\r
- if (THIS_DELTA > THIS_PROXOUT_TH)\r
- {\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- // else stay in Debounce Proximity\r
- }\r
- else\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_RELEASE;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_RELEASE_DETECT;\r
- }\r
- }\r
- }\r
-}\r
-#endif\r
-\r
-\r
-#if TSLPRM_USE_PROX > 0\r
-/**\r
- * @brief Debounce Proximity processing (previous state = Touch)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_DebProxTouchStateProcess(void)\r
-{\r
- if (THIS_ACQ_STATUS & TSL_ACQ_STATUS_ERROR_MASK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_TOUCH;\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if TEST_DELTA(>, THIS_DETECTOUT_TH)\r
- {\r
- TEST_DELTA_NEGATIVE;\r
- THIS_STATEID = TSL_STATEID_TOUCH;\r
- return;\r
- }\r
-\r
- if (THIS_DELTA > THIS_PROXOUT_TH)\r
- {\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- // else stay in Debounce Proximity\r
- }\r
- else\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_RELEASE;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_RELEASE_TOUCH;\r
- }\r
- }\r
- }\r
-}\r
-#endif\r
-\r
-\r
-#if TSLPRM_USE_PROX > 0\r
-/**\r
- * @brief Proximity state processing\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_ProxStateProcess(void)\r
-{\r
-#if TSLPRM_DTO > 0\r
- TSL_tTick_sec_T tick_detected;\r
-#endif\r
-\r
- if (THIS_ACQ_STATUS & TSL_ACQ_STATUS_ERROR_MASK) // Acquisition error (min or max)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_ERROR;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_ERROR;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_ERROR_PROX;\r
- }\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if TEST_DELTA(>=, THIS_DETECTIN_TH)\r
- {\r
- TEST_DELTA_NEGATIVE;\r
- THIS_COUNTER = THIS_COUNTER_DEB_DETECT;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_DETECT;\r
- }\r
- return;\r
- }\r
-\r
- if (THIS_DELTA <= THIS_PROXOUT_TH)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_RELEASE;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_RELEASE_PROX;\r
- }\r
- return;\r
- }\r
-\r
- // Stay in Proximity state\r
-#if TSLPRM_DTO > 0\r
- //------------------------------------\r
- // Detection Time Out (DTO) processing\r
- //------------------------------------\r
- if ((TSL_Params.DTO > 1) && (TSL_Params.DTO < 64))\r
- {\r
- tick_detected = THIS_COUNTER; // Get the detected time previously saved\r
- // Enter in calibration state if the DTO duration has elapsed\r
- if (TSL_tim_CheckDelay_sec(TSL_Params.DTO, &tick_detected) == TSL_STATUS_OK)\r
- {\r
- TSL_tkey_SetStateCalibration(0);\r
- }\r
- }\r
-#endif\r
-\r
- }\r
-}\r
-#endif\r
-\r
-\r
-/**\r
- * @brief Debounce Detect processing (previous state = Release or Proximity)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_DebDetectStateProcess(void)\r
-{\r
- if (THIS_ACQ_STATUS & TSL_ACQ_STATUS_ERROR_MASK) // Acquisition error (min or max)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if TEST_DELTA(>=, THIS_DETECTIN_TH)\r
- {\r
- TEST_DELTA_NEGATIVE;\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- // else stay in Debounce Detect\r
- }\r
- else\r
- {\r
-#if TSLPRM_USE_PROX > 0\r
- if (THIS_DELTA >= THIS_PROXIN_TH)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_PROX;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_PROX;\r
- }\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
-#else\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
-#endif\r
- }\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Detect state processing\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_DetectStateProcess(void)\r
-{\r
-#if TSLPRM_DTO > 0\r
- TSL_tTick_sec_T tick_detected;\r
-#endif\r
-\r
- if (THIS_ACQ_STATUS & TSL_ACQ_STATUS_ERROR_MASK) // Acquisition error (min or max)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_ERROR;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_ERROR;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_ERROR_DETECT;\r
- }\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if TEST_DELTA(>, THIS_DETECTOUT_TH)\r
- {\r
- TEST_DELTA_NEGATIVE;\r
-#if TSLPRM_DTO > 0\r
- //------------------------------------\r
- // Detection Time Out (DTO) processing\r
- //------------------------------------\r
- if ((TSL_Params.DTO > 1) && (TSL_Params.DTO < 64))\r
- {\r
- tick_detected = THIS_COUNTER; // Get the detected time previously saved\r
- // Enter in calibration state if the DTO duration has elapsed\r
- if (TSL_tim_CheckDelay_sec(TSL_Params.DTO, &tick_detected) == TSL_STATUS_OK)\r
- {\r
- TSL_tkey_SetStateCalibration(0);\r
- }\r
- }\r
-#endif\r
- return; // Normal operation, stay in Detect state\r
- }\r
-\r
-#if TSLPRM_USE_PROX > 0\r
- if (THIS_DELTA > THIS_PROXOUT_TH)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_PROX;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_PROX_DETECT;\r
- }\r
- return;\r
- }\r
-#endif\r
-\r
- THIS_COUNTER = THIS_COUNTER_DEB_RELEASE;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_RELEASE_DETECT;\r
- }\r
-\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Touch state processing\r
- * Same as Detect state\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_TouchStateProcess(void)\r
-{\r
-#if TSLPRM_DTO > 0\r
- TSL_tTick_sec_T tick_detected;\r
-#endif\r
-\r
- if (THIS_ACQ_STATUS & TSL_ACQ_STATUS_ERROR_MASK) // Acquisition error (min or max)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_ERROR;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_ERROR;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_ERROR_TOUCH;\r
- }\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- if TEST_DELTA(>, THIS_DETECTOUT_TH)\r
- {\r
- TEST_DELTA_NEGATIVE;\r
-#if TSLPRM_DTO > 0\r
- //------------------------------------\r
- // Detection Time Out (DTO) processing\r
- //------------------------------------\r
- if ((TSL_Params.DTO > 1) && (TSL_Params.DTO < 64))\r
- {\r
- tick_detected = THIS_COUNTER; // Get the detected time previously saved\r
- // Enter in calibration state if the DTO duration has elapsed\r
- if (TSL_tim_CheckDelay_sec(TSL_Params.DTO, &tick_detected) == TSL_STATUS_OK)\r
- {\r
- TSL_tkey_SetStateCalibration(0);\r
- }\r
- }\r
-#endif\r
- return; // Normal operation, stay in Touch state\r
- }\r
-\r
-#if TSLPRM_USE_PROX > 0\r
- if (THIS_DELTA > THIS_PROXOUT_TH)\r
- {\r
- THIS_COUNTER = THIS_COUNTER_DEB_PROX;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- DTO_GET_TIME; // Take current time for DTO processing\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_PROX_TOUCH;\r
- }\r
- return;\r
- }\r
-#endif\r
-\r
- THIS_COUNTER = THIS_COUNTER_DEB_RELEASE;\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- }\r
- else\r
- {\r
- THIS_STATEID = TSL_STATEID_DEB_RELEASE_TOUCH;\r
- }\r
-\r
- }\r
-}\r
-\r
-\r
-/**\r
- * @brief Debounce error state processing\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_DebErrorStateProcess(void)\r
-{\r
- volatile TSL_StateMask_enum_T mask;\r
-\r
- if (THIS_ACQ_STATUS & TSL_ACQ_STATUS_ERROR_MASK) // Acquisition error (min or max)\r
- {\r
- if (THIS_COUNTER > 0) {THIS_COUNTER--;}\r
- if (THIS_COUNTER == 0)\r
- {\r
- THIS_STATEID = TSL_STATEID_ERROR;\r
- }\r
- }\r
- else // Acquisition is OK or has NOISE\r
- {\r
- // Get state mask\r
- mask = TSL_tkey_GetStateMask();\r
- // Mask Error and Debounce bits\r
-#ifdef _RAISONANCE_\r
- mask &= ~(TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_ERROR_BIT_MASK);\r
-#else\r
- mask &= (TSL_StateMask_enum_T)(~(TSL_STATE_DEBOUNCE_BIT_MASK | TSL_STATE_ERROR_BIT_MASK));\r
-#endif\r
- // Go back to the previous state\r
- switch (mask)\r
- {\r
- case TSL_STATEMASK_RELEASE :\r
- THIS_STATEID = TSL_STATEID_RELEASE;\r
- break;\r
- case TSL_STATEMASK_PROX :\r
- THIS_STATEID = TSL_STATEID_PROX;\r
- break;\r
- case TSL_STATEMASK_DETECT :\r
- THIS_STATEID = TSL_STATEID_DETECT;\r
- break;\r
- case TSL_STATEMASK_TOUCH :\r
- THIS_STATEID = TSL_STATEID_TOUCH;\r
- break;\r
- default:\r
- TSL_tkey_SetStateCalibration(0);\r
- break;\r
- }\r
- }\r
-}\r
-\r
-\r
-//==============================================================================\r
-// Private functions\r
-//==============================================================================\r
-\r
-/**\r
- * @brief Get the current time in second and affect it to the DTO counter (Private)\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_tkey_DTOGetTime(void)\r
-{\r
- disableInterrupts();\r
- THIS_COUNTER = (TSL_tCounter_T)TSL_Globals.Tick_sec;\r
- enableInterrupts();\r
-}\r
-\r
-#endif\r
-// #if TSLPRM_TOTAL_TKEYS > 0\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
* @author Microcontroller Division\r
* @version V1.0.3\r
* @date May-2013\r
- * @brief This file includes driver for the glass LCD Module mounted on \r
+ * @brief This file includes driver for the glass LCD Module mounted on\r
* STM32l discovery board MB963\r
******************************************************************************\r
* @copy\r
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
*\r
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>\r
- */ \r
+ */\r
\r
/* Includes ------------------------------------------------------------------*/\r
#include "stm32l_discovery_lcd.h"\r
#include "discover_board.h"\r
#include "stm32l1xx_lcd.h"\r
-#include "main.h"\r
\r
/* this variable can be used for accelerate the scrolling exit when push user button */\r
-volatile bool KeyPressed = FALSE; \r
- \r
+volatile bool KeyPressed = FALSE;\r
+\r
/* LCD BAR status: We don't write directly in LCD RAM for save the bar setting */\r
uint8_t t_bar[2]={0x0,0X0};\r
- \r
+\r
/* =========================================================================\r
LCD MAPPING\r
=========================================================================\r
COL |_| --G-- --M--\r
| /| \ |\r
E| Q | N |C\r
- _ | / |P \| \r
-DP |_| ----------- \r
- D \r
+ _ | / |P \|\r
+DP |_| -----------\r
+ D\r
\r
An LCD character coding is based on the following matrix:\r
{ E , D , P , N }\r
{\r
LCD_InitTypeDef LCD_InitStruct;\r
\r
- \r
+\r
LCD_InitStruct.LCD_Prescaler = LCD_Prescaler_1;\r
LCD_InitStruct.LCD_Divider = LCD_Divider_31;\r
LCD_InitStruct.LCD_Duty = LCD_Duty_1_4;\r
LCD_InitStruct.LCD_Bias = LCD_Bias_1_3;\r
LCD_InitStruct.LCD_VoltageSource = LCD_VoltageSource_Internal;\r
\r
- \r
+\r
/* Initialize the LCD */\r
LCD_Init(&LCD_InitStruct);\r
- \r
+\r
LCD_MuxSegmentCmd(ENABLE);\r
- \r
+\r
/* To set contrast to mean value */\r
LCD_ContrastConfig(LCD_Contrast_Level_4);\r
- \r
+\r
LCD_DeadTimeConfig(LCD_DeadTime_0);\r
LCD_PulseOnDurationConfig(LCD_PulseOnDuration_4);\r
\r
/* Wait Until the LCD FCR register is synchronized */\r
LCD_WaitForSynchro();\r
- \r
+\r
/* Enable LCD peripheral */\r
LCD_Cmd(ENABLE);\r
- \r
+\r
/* Wait Until the LCD is enabled */\r
while(LCD_GetFlagStatus(LCD_FLAG_ENS) == RESET)\r
{\r
}\r
- /*!< Wait Until the LCD Booster is ready */ \r
+ /*!< Wait Until the LCD Booster is ready */\r
while(LCD_GetFlagStatus(LCD_FLAG_RDY) == RESET)\r
{\r
- } \r
+ }\r
\r
- LCD_BlinkConfig(LCD_BlinkMode_Off,LCD_BlinkFrequency_Div32); \r
+ LCD_BlinkConfig(LCD_BlinkMode_Off,LCD_BlinkFrequency_Div32);\r
LCD_GLASS_Clear();\r
}\r
\r
void LCD_GLASS_Configure_GPIO(void)\r
{\r
GPIO_InitTypeDef GPIO_InitStructure;\r
- \r
-/* Enable GPIOs clock */ \r
+\r
+/* Enable GPIOs clock */\r
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC |\r
RCC_AHBPeriph_GPIOD | RCC_AHBPeriph_GPIOE | RCC_AHBPeriph_GPIOH, ENABLE);\r
\r
- \r
+\r
/* Configure Output for LCD */\r
/* Port A */\r
GPIO_StructInit(&GPIO_InitStructure);\r
GPIO_PinAFConfig(GPIOA, GPIO_PinSource8,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOA, GPIO_PinSource9,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOA, GPIO_PinSource10,GPIO_AF_LCD) ;\r
- GPIO_PinAFConfig(GPIOA, GPIO_PinSource15,GPIO_AF_LCD) ; \r
- \r
+ GPIO_PinAFConfig(GPIOA, GPIO_PinSource15,GPIO_AF_LCD) ;\r
+\r
/* Configure Output for LCD */\r
-/* Port B */ \r
+/* Port B */\r
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_8 | GPIO_Pin_9 \\r
- | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; \r
+ | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;\r
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;\r
GPIO_Init( GPIOB, &GPIO_InitStructure);\r
- \r
+\r
GPIO_PinAFConfig(GPIOB, GPIO_PinSource3,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOB, GPIO_PinSource4,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOB, GPIO_PinSource5,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOB, GPIO_PinSource8,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOB, GPIO_PinSource9,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOB, GPIO_PinSource10,GPIO_AF_LCD) ;\r
- GPIO_PinAFConfig(GPIOB, GPIO_PinSource11,GPIO_AF_LCD) ; \r
+ GPIO_PinAFConfig(GPIOB, GPIO_PinSource11,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOB, GPIO_PinSource12,GPIO_AF_LCD) ;\r
- GPIO_PinAFConfig(GPIOB, GPIO_PinSource13,GPIO_AF_LCD) ; \r
+ GPIO_PinAFConfig(GPIOB, GPIO_PinSource13,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOB, GPIO_PinSource14,GPIO_AF_LCD) ;\r
- GPIO_PinAFConfig(GPIOB, GPIO_PinSource15,GPIO_AF_LCD) ; \r
- \r
+ GPIO_PinAFConfig(GPIOB, GPIO_PinSource15,GPIO_AF_LCD) ;\r
+\r
/* Configure Output for LCD */\r
-/* Port C*/ \r
+/* Port C*/\r
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_6 \\r
- | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 |GPIO_Pin_11 ; \r
+ | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 |GPIO_Pin_11 ;\r
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;\r
- GPIO_Init( GPIOC, &GPIO_InitStructure); \r
- \r
+ GPIO_Init( GPIOC, &GPIO_InitStructure);\r
+\r
\r
GPIO_PinAFConfig(GPIOC, GPIO_PinSource0,GPIO_AF_LCD) ;\r
- GPIO_PinAFConfig(GPIOC, GPIO_PinSource1,GPIO_AF_LCD) ; \r
+ GPIO_PinAFConfig(GPIOC, GPIO_PinSource1,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOC, GPIO_PinSource2,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOC, GPIO_PinSource3,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOC, GPIO_PinSource6,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOC, GPIO_PinSource7,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOC, GPIO_PinSource8,GPIO_AF_LCD) ;\r
GPIO_PinAFConfig(GPIOC, GPIO_PinSource9,GPIO_AF_LCD) ;\r
- GPIO_PinAFConfig(GPIOC, GPIO_PinSource10,GPIO_AF_LCD) ; \r
- GPIO_PinAFConfig(GPIOC, GPIO_PinSource11,GPIO_AF_LCD) ; \r
+ GPIO_PinAFConfig(GPIOC, GPIO_PinSource10,GPIO_AF_LCD) ;\r
+ GPIO_PinAFConfig(GPIOC, GPIO_PinSource11,GPIO_AF_LCD) ;\r
\r
-/* Disable GPIOs clock */ \r
+/* Disable GPIOs clock */\r
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC |\r
RCC_AHBPeriph_GPIOD | RCC_AHBPeriph_GPIOE | RCC_AHBPeriph_GPIOH, DISABLE);\r
- \r
+\r
}\r
\r
/**\r
void LCD_contrast()\r
{\r
uint32_t contrast ;\r
- \r
+\r
/* To get the actual contrast value in register */\r
contrast = LCD->FCR & LCD_Contrast_Level_7;\r
- \r
+\r
while ((GPIOC->IDR & USERBUTTON_GPIO_PIN) == 0x0)\r
{\r
- contrast += LCD_Contrast_Level_1; \r
- \r
+ contrast += LCD_Contrast_Level_1;\r
+\r
if (contrast > LCD_Contrast_Level_7)\r
contrast=LCD_Contrast_Level_0;\r
- \r
+\r
LCD_ContrastConfig(contrast);\r
- Delay(100);\r
+ //Delay(100);\r
}\r
}\r
\r
/**\r
- * @brief Setting bar on LCD, writes bar value in LCD frame buffer \r
+ * @brief Setting bar on LCD, writes bar value in LCD frame buffer\r
* @param None\r
* @retval None\r
*/\r
void LCD_bar()\r
{\r
- \r
+\r
LCD->RAM[LCD_RAMRegister_4] &= 0xffff5fff;\r
LCD->RAM[LCD_RAMRegister_6] &= 0xffff5fff;\r
/* bar1 bar3 */\r
LCD->RAM[LCD_RAMRegister_4] |= (uint32_t)(t_bar[0]<<12);\r
- \r
+\r
/*bar0 bar2 */\r
LCD->RAM[LCD_RAMRegister_6] |= (uint32_t)(t_bar[1]<<12);\r
- \r
+\r
}\r
\r
/**\r
* @param column : flag indicating if a column has to be add in front\r
* of displayed character.\r
* This parameter can be: COLUMN_OFF or COLUMN_ON.\r
- * @param digit array with segment \r
+ * @param digit array with segment\r
* @retval None\r
*/\r
static void LCD_Conv_Char_Seg(uint8_t* c,bool point,bool column, uint8_t* digit)\r
{\r
uint16_t ch = 0 ;\r
uint8_t i,j;\r
- \r
+\r
switch (*c)\r
{\r
- case ' ' : \r
+ case ' ' :\r
ch = 0x00;\r
break;\r
- \r
+\r
case '*':\r
ch = star;\r
break;\r
- \r
+\r
case 'µ' :\r
ch = C_UMAP;\r
break;\r
- \r
+\r
case 'm' :\r
ch = C_mMap;\r
break;\r
- \r
+\r
case 'n' :\r
ch = C_nMap;\r
- break; \r
- \r
+ break;\r
+\r
case '-' :\r
ch = C_minus;\r
break;\r
- \r
+\r
case '/' :\r
ch = C_slatch;\r
- break; \r
- \r
+ break;\r
+\r
case '°' :\r
ch = C_percent_1;\r
- break; \r
+ break;\r
case '%' :\r
- ch = C_percent_2; \r
+ ch = C_percent_2;\r
break;\r
case 255 :\r
ch = C_full;\r
break ;\r
- \r
+\r
case '0':\r
case '1':\r
case '2':\r
case '6':\r
case '7':\r
case '8':\r
- case '9': \r
- ch = NumberMap[*c-0x30]; \r
+ case '9':\r
+ ch = NumberMap[*c-0x30];\r
break;\r
- \r
+\r
default:\r
/* The character c is one letter in upper case*/\r
if ( (*c < 0x5b) && (*c > 0x40) )\r
}\r
break;\r
}\r
- \r
+\r
/* Set the digital point can be displayed if the point is on */\r
if (point)\r
{\r
if (column)\r
{\r
ch |= 0x0020;\r
- } \r
+ }\r
\r
for (i = 12,j=0 ;j<4; i-=4,j++)\r
{\r
* This parameter can be: POINT_OFF or POINT_ON\r
* @param column: flag indicating if a column has to be add in front\r
* of displayed character.\r
- * This parameter can be: COLUMN_OFF or COLUMN_ON. \r
+ * This parameter can be: COLUMN_OFF or COLUMN_ON.\r
* @param position: position in the LCD of the caracter to write [0:7]\r
* @retval None\r
* @par Required preconditions: The LCD should be cleared before to start the\r
- * write operation. \r
+ * write operation.\r
*/\r
void LCD_GLASS_WriteChar(uint8_t* ch, bool point, bool column, uint8_t position)\r
{\r
uint8_t digit[4]; /* Digit frame buffer */\r
- \r
+\r
/* To convert displayed character in segment in array digit */\r
LCD_Conv_Char_Seg(ch,point,column,digit);\r
\r
- \r
+\r
switch (position)\r
{\r
/* Position 1 on LCD (Digit1)*/\r
LCD->RAM[LCD_RAMRegister_4] &= 0xcffffffc;\r
LCD->RAM[LCD_RAMRegister_6] &= 0xcffffffc;\r
\r
- LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 26 ) | (digit[0]& 0x03) ; // 1G 1B 1M 1E \r
- LCD->RAM[LCD_RAMRegister_2] |= ((digit[1]& 0x0c) << 26 ) | (digit[1]& 0x03) ; // 1F 1A 1C 1D \r
- LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x0c) << 26 ) | (digit[2]& 0x03) ; // 1Q 1K 1Col 1P \r
+ LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 26 ) | (digit[0]& 0x03) ; // 1G 1B 1M 1E\r
+ LCD->RAM[LCD_RAMRegister_2] |= ((digit[1]& 0x0c) << 26 ) | (digit[1]& 0x03) ; // 1F 1A 1C 1D\r
+ LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x0c) << 26 ) | (digit[2]& 0x03) ; // 1Q 1K 1Col 1P\r
LCD->RAM[LCD_RAMRegister_6] |= ((digit[3]& 0x0c) << 26 ) | (digit[3]& 0x03) ; // 1H 1J 1DP 1N\r
\r
break;\r
- \r
+\r
/* Position 2 on LCD (Digit2)*/\r
case 2:\r
LCD->RAM[LCD_RAMRegister_0] &= 0xf3ffff03;\r
- LCD->RAM[LCD_RAMRegister_2] &= 0xf3ffff03; \r
+ LCD->RAM[LCD_RAMRegister_2] &= 0xf3ffff03;\r
LCD->RAM[LCD_RAMRegister_4] &= 0xf3ffff03;\r
LCD->RAM[LCD_RAMRegister_6] &= 0xf3ffff03;\r
- \r
- LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 24 )|((digit[0]& 0x02) << 6 )|((digit[0]& 0x01) << 2 ) ; // 2G 2B 2M 2E \r
+\r
+ LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 24 )|((digit[0]& 0x02) << 6 )|((digit[0]& 0x01) << 2 ) ; // 2G 2B 2M 2E\r
LCD->RAM[LCD_RAMRegister_2] |= ((digit[1]& 0x0c) << 24 )|((digit[1]& 0x02) << 6 )|((digit[1]& 0x01) << 2 ) ; // 2F 2A 2C 2D\r
LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x0c) << 24 )|((digit[2]& 0x02) << 6 )|((digit[2]& 0x01) << 2 ) ; // 2Q 2K 2Col 2P\r
LCD->RAM[LCD_RAMRegister_6] |= ((digit[3]& 0x0c) << 24 )|((digit[3]& 0x02) << 6 )|((digit[3]& 0x01) << 2 ) ; // 2H 2J 2DP 2N\r
- \r
+\r
break;\r
- \r
+\r
/* Position 3 on LCD (Digit3)*/\r
case 3:\r
LCD->RAM[LCD_RAMRegister_0] &= 0xfcfffcff;\r
LCD->RAM[LCD_RAMRegister_4] &= 0xfcfffcff;\r
LCD->RAM[LCD_RAMRegister_6] &= 0xfcfffcff;\r
\r
- LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 22 ) | ((digit[0]& 0x03) << 8 ) ; // 3G 3B 3M 3E \r
+ LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 22 ) | ((digit[0]& 0x03) << 8 ) ; // 3G 3B 3M 3E\r
LCD->RAM[LCD_RAMRegister_2] |= ((digit[1]& 0x0c) << 22 ) | ((digit[1]& 0x03) << 8 ) ; // 3F 3A 3C 3D\r
LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x0c) << 22 ) | ((digit[2]& 0x03) << 8 ) ; // 3Q 3K 3Col 3P\r
LCD->RAM[LCD_RAMRegister_6] |= ((digit[3]& 0x0c) << 22 ) | ((digit[3]& 0x03) << 8 ) ; // 3H 3J 3DP 3N\r
- \r
+\r
break;\r
- \r
+\r
/* Position 4 on LCD (Digit4)*/\r
case 4:\r
LCD->RAM[LCD_RAMRegister_0] &= 0xffcff3ff;\r
LCD->RAM[LCD_RAMRegister_2] &= 0xffcff3ff;\r
LCD->RAM[LCD_RAMRegister_4] &= 0xffcff3ff;\r
LCD->RAM[LCD_RAMRegister_6] &= 0xffcff3ff;\r
- \r
- LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 18 ) | ((digit[0]& 0x03) << 10 ) ; // 4G 4B 4M 4E \r
+\r
+ LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 18 ) | ((digit[0]& 0x03) << 10 ) ; // 4G 4B 4M 4E\r
LCD->RAM[LCD_RAMRegister_2] |= ((digit[1]& 0x0c) << 18 ) | ((digit[1]& 0x03) << 10 ) ; // 4F 4A 4C 4D\r
LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x0c) << 18 ) | ((digit[2]& 0x03) << 10 ) ; // 4Q 4K 4Col 4P\r
LCD->RAM[LCD_RAMRegister_6] |= ((digit[3]& 0x0c) << 18 ) | ((digit[3]& 0x03) << 10 ) ; // 4H 4J 4DP 4N\r
- \r
+\r
break;\r
- \r
+\r
/* Position 5 on LCD (Digit5)*/\r
case 5:\r
LCD->RAM[LCD_RAMRegister_0] &= 0xfff3cfff;\r
LCD->RAM[LCD_RAMRegister_4] &= 0xfff3efff;\r
LCD->RAM[LCD_RAMRegister_6] &= 0xfff3efff;\r
\r
- LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 16 ) | ((digit[0]& 0x03) << 12 ) ; // 5G 5B 5M 5E \r
+ LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 16 ) | ((digit[0]& 0x03) << 12 ) ; // 5G 5B 5M 5E\r
LCD->RAM[LCD_RAMRegister_2] |= ((digit[1]& 0x0c) << 16 ) | ((digit[1]& 0x03) << 12 ) ; // 5F 5A 5C 5D\r
- LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x0c) << 16 ) | ((digit[2]& 0x01) << 12 ) ; // 5Q 5K 5P \r
+ LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x0c) << 16 ) | ((digit[2]& 0x01) << 12 ) ; // 5Q 5K 5P\r
LCD->RAM[LCD_RAMRegister_6] |= ((digit[3]& 0x0c) << 16 ) | ((digit[3]& 0x01) << 12 ) ; // 5H 5J 5N\r
- \r
+\r
break;\r
- \r
+\r
/* Position 6 on LCD (Digit6)*/\r
case 6:\r
LCD->RAM[LCD_RAMRegister_0] &= 0xfffc3fff;\r
LCD->RAM[LCD_RAMRegister_4] &= 0xfffc3fff;\r
LCD->RAM[LCD_RAMRegister_6] &= 0xfffc3fff;\r
\r
- LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x04) << 15 ) | ((digit[0]& 0x08) << 13 ) | ((digit[0]& 0x03) << 14 ) ; // 6B 6G 6M 6E \r
+ LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x04) << 15 ) | ((digit[0]& 0x08) << 13 ) | ((digit[0]& 0x03) << 14 ) ; // 6B 6G 6M 6E\r
LCD->RAM[LCD_RAMRegister_2] |= ((digit[1]& 0x04) << 15 ) | ((digit[1]& 0x08) << 13 ) | ((digit[1]& 0x03) << 14 ) ; // 6A 6F 6C 6D\r
- LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x04) << 15 ) | ((digit[2]& 0x08) << 13 ) | ((digit[2]& 0x01) << 14 ) ; // 6K 6Q 6P \r
+ LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x04) << 15 ) | ((digit[2]& 0x08) << 13 ) | ((digit[2]& 0x01) << 14 ) ; // 6K 6Q 6P\r
LCD->RAM[LCD_RAMRegister_6] |= ((digit[3]& 0x04) << 15 ) | ((digit[3]& 0x08) << 13 ) | ((digit[3]& 0x01) << 14 ) ; // 6J 6H 6N\r
- \r
+\r
break;\r
- \r
+\r
default:\r
break;\r
}\r
{\r
uint8_t i = 0x01;\r
\r
- /* wait for LCD Ready */ \r
+ /* wait for LCD Ready */\r
while( LCD_GetFlagStatus (LCD_FLAG_UDR) != RESET) ;\r
- \r
+\r
/* Send the string character by character on lCD */\r
while ((*ptr != 0) & (i < 8))\r
{\r
uint8_t i = 0x01;\r
uint8_t char_tmp;\r
\r
- /* TO wait LCD Ready */ \r
+ /* TO wait LCD Ready */\r
while( LCD_GetFlagStatus (LCD_FLAG_UDR) != RESET) ;\r
- \r
+\r
/* Send the string character by character on lCD */\r
while ((*ptr != 0) & (i < 8))\r
- { \r
+ {\r
char_tmp = (*ptr) & 0x00ff;\r
- \r
+\r
switch ((*ptr) & 0xf000)\r
{\r
case DOT:\r
LCD_GLASS_WriteChar(&char_tmp, POINT_OFF, COLUMN_ON, i);\r
break;\r
default:\r
- LCD_GLASS_WriteChar(&char_tmp, POINT_OFF, COLUMN_OFF, i); \r
+ LCD_GLASS_WriteChar(&char_tmp, POINT_OFF, COLUMN_OFF, i);\r
break;\r
}/* Point on the next character */\r
ptr++;\r
- \r
+\r
/* Increment the character counter */\r
i++;\r
}\r
void LCD_GLASS_Clear(void)\r
{\r
uint32_t counter = 0;\r
- \r
- /* TO wait LCD Ready */ \r
+\r
+ /* TO wait LCD Ready */\r
while( LCD_GetFlagStatus (LCD_FLAG_UDR) != RESET) ;\r
- \r
+\r
for (counter = LCD_RAMRegister_0; counter <= LCD_RAMRegister_15; counter++)\r
{\r
LCD->RAM[counter] = 0;\r
\r
/* Update the LCD display */\r
LCD_UpdateDisplayRequest();\r
- \r
+\r
}\r
\r
/**\r
* @param ptr: Pointer to string to display on the LCD Glass.\r
* @param nScroll: Specifies how many time the message will be scrolled\r
* @param ScrollSpeed : Speciifes the speed of the scroll, low value gives\r
- * higher speed \r
+ * higher speed\r
* @retval None\r
* @par Required preconditions: The LCD should be cleared before to start the\r
* write operation.\r
uint8_t* ptr1;\r
uint8_t str[7]="";\r
uint8_t Str_size;\r
- \r
+\r
if (ptr == 0) return;\r
\r
/* To calculate end of string */\r
for (ptr1=ptr,Str_size = 0 ; *ptr1 != 0; Str_size++,ptr1++) ;\r
- \r
+\r
ptr1 = ptr;\r
- \r
+\r
LCD_GLASS_DisplayString(ptr);\r
- Delay(ScrollSpeed);\r
- \r
+ //Delay(ScrollSpeed);\r
+\r
/* To shift the string for scrolling display*/\r
for (Repetition=0; Repetition<nScroll; Repetition++)\r
{\r
*(str+5) =* (ptr1+((Char_Nb+6)%Str_size));\r
LCD_GLASS_Clear();\r
LCD_GLASS_DisplayString(str);\r
- \r
+\r
/* user button pressed stop the scrolling sentence */\r
if (KeyPressed)\r
- return; \r
- Delay(ScrollSpeed);\r
- } \r
+ return;\r
+ //Delay(ScrollSpeed);\r
+ }\r
}\r
\r
}\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file icc_measure.c\r
- * @author Microcontroller Division\r
- * @version V1.0.3\r
- * @date May-2013\r
- * @brief Current measurements\r
- ******************************************************************************\r
- * @copy\r
- *\r
- * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
- * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
- * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
- * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
- * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
- * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
- *\r
- * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>\r
- */\r
- \r
-/* Includes ------------------------------------------------------------------*/\r
-#include "misc.h"\r
-#include "stm32l1xx.h"\r
-#include "stm32l1xx_adc.h"\r
-#include "stm32l1xx_lcd.h"\r
-#include "stm32l1xx_rcc.h"\r
-#include "stm32l1xx_rtc.h"\r
-#include "stm32l1xx_pwr.h"\r
-#include "stm32l1xx_gpio.h"\r
-#include "discover_board.h"\r
-#include "icc_measure.h"\r
-#include "discover_functions.h"\r
-#include "stm32l_discovery_lcd.h"\r
-#include "stm32l1xx_conf.h"\r
-\r
-/* Current measurment in RAM for Run mode and LPOWER run mode */\r
-#define TESTINRAM 1\r
-\r
-extern bool UserButton; /* Indicate if GPIO PA1 is used for user button instead of wake up signal */\r
-volatile bool Idd_WakeUP; /* Indicate Wake UP setted in IT handler */\r
-\r
-/* Variables used for save GPIO configuration */\r
-uint32_t GPIOA_MODER, GPIOB_MODER, GPIOC_MODER,GPIOD_MODER,GPIOE_MODER ,GPIOE_MODER,GPIOH_MODER;\r
-uint32_t GPIOA_PUPDR, GPIOB_PUPDR , GPIOC_PUPDR, GPIOD_PUPDR,GPIOE_PUPDR,GPIOH_PUPDR;\r
-\r
-/**\r
- * @brief Function used to Configure the GPIO in low consumption\r
- * @caller ADC_Icc_Test\r
- * @param None\r
- * @retval None\r
- */\r
-void GPIO_LowPower_Config(void)\r
-{\r
- GPIO_InitTypeDef GPIO_InitStructure;\r
-\r
- /* store GPIO configuration before lowpower switch */\r
- GPIOA_MODER = GPIOA->MODER;\r
- GPIOB_MODER = GPIOB->MODER;\r
- GPIOC_MODER = GPIOC->MODER;\r
- GPIOD_MODER = GPIOD->MODER;\r
- GPIOE_MODER = GPIOE->MODER;\r
- GPIOH_MODER = GPIOH->MODER;\r
- GPIOA_PUPDR = GPIOA->PUPDR;\r
- GPIOB_PUPDR = GPIOB->PUPDR;\r
- GPIOC_PUPDR = GPIOC->PUPDR;\r
- GPIOD_PUPDR = GPIOD->PUPDR;\r
- GPIOE_PUPDR = GPIOE->PUPDR;\r
- GPIOH_PUPDR = GPIOH->PUPDR;\r
- \r
- /* Configure all GPIO port pins in Analog input mode (trigger OFF) */\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;\r
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_400KHz;\r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;\r
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;\r
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;\r
-\r
- \r
- GPIOD->MODER = 0xFFFFFFFF;\r
- GPIOE->MODER = 0xFFFFFFFF;\r
- GPIOH->MODER = 0xFFFFFFFF;\r
- \r
- /* all GPIOA */\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_6| GPIO_Pin_7 \\r
- | GPIO_Pin_13 | GPIO_Pin_14|GPIO_Pin_5 | GPIO_Pin_8 |GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 |GPIO_Pin_15 ;\r
-\r
- GPIO_Init(GPIOA, &GPIO_InitStructure); \r
-\r
- /* All GPIOC except PC13 which is used for mesurement */\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4| GPIO_Pin_5 |GPIO_Pin_6| GPIO_Pin_7| GPIO_Pin_8 \\r
- | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_14 | GPIO_Pin_15 ;\r
- GPIO_Init(GPIOC, &GPIO_InitStructure); \r
-\r
- /* all GPIOB except PB6 and PB7 used for LED*/\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4| GPIO_Pin_5 | GPIO_Pin_8 \\r
- | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 |GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15 ;\r
- GPIO_Init(GPIOB, &GPIO_InitStructure);\r
- \r
- \r
- GPIO_LOW(GPIOB,GPIO_Pin_6);\r
- GPIO_LOW(GPIOB,GPIO_Pin_7);\r
-}\r
-\r
-/**\r
- * @brief To restore register values for GPIO.\r
- * @caller ADC_Icc_Test\r
- * @param None\r
- * @retval None\r
- */\r
-void Restore_GPIO_Config(void)\r
-{\r
- GPIOA->MODER = GPIOA_MODER;\r
- GPIOB->MODER = GPIOB_MODER;\r
- GPIOC->MODER = GPIOC_MODER;\r
- GPIOD->MODER = GPIOD_MODER;\r
- GPIOE->MODER = GPIOE_MODER;\r
- GPIOH->MODER = GPIOH_MODER;\r
-\r
- GPIOA->PUPDR = GPIOA_PUPDR;\r
- GPIOB->PUPDR = GPIOB_PUPDR;\r
- GPIOC->PUPDR = GPIOC_PUPDR;\r
- GPIOD->PUPDR = GPIOD_PUPDR;\r
- GPIOE->PUPDR = GPIOE_PUPDR;\r
- GPIOH->PUPDR = GPIOH_PUPDR;\r
-}\r
-\r
-\r
-/**\r
- * @brief Configures the clock system\r
- * @param None\r
- * @retval None\r
- */\r
-void Config_Systick()\r
-{\r
- RCC_ClocksTypeDef RCC_Clocks;\r
- RCC_GetClocksFreq(&RCC_Clocks);\r
- SysTick_Config(RCC_Clocks.HCLK_Frequency / 2000);\r
-}\r
-\r
-/**\r
- * @brief Configures the clock system in low frequency\r
- * @param None\r
- * @retval None\r
- */\r
-void Config_Systick_50ms()\r
-{\r
- RCC_ClocksTypeDef RCC_Clocks;\r
- RCC_GetClocksFreq(&RCC_Clocks);\r
- SysTick_Config(RCC_Clocks.HCLK_Frequency / 2);\r
-}\r
-\r
-/**\r
- * @brief To select MSI as System clock source \r
- * @caller ADC_Icc_Test\r
- * @param Frequence, DIV by 2 ot not , With or without RTC\r
- * @retval None\r
- */\r
-void SetHSICLKToMSI(uint32_t freq,bool div2,bool With_RTC)\r
-{\r
- \r
- /* RCC system reset */\r
- RCC_DeInit();\r
-\r
- /* Flash no latency*/\r
- FLASH_SetLatency(FLASH_Latency_0);\r
- \r
- /* Disable Prefetch Buffer */\r
- FLASH_PrefetchBufferCmd(DISABLE);\r
-\r
- /* Disable 64-bit access */\r
- FLASH_ReadAccess64Cmd(DISABLE);\r
- \r
- /* Disable FLASH during SLeep */\r
- FLASH_SLEEPPowerDownCmd(ENABLE);\r
- \r
- /* Enable the PWR APB1 Clock */\r
- RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);\r
-\r
- /* Select the Voltage Range 3 (1.2V) */\r
- PWR_VoltageScalingConfig(PWR_VoltageScaling_Range3);\r
-\r
- /* Wait Until the Voltage Regulator is ready */\r
- while (PWR_GetFlagStatus(PWR_FLAG_VOS) != RESET);\r
-\r
- /* Configure the MSI frequency */\r
- RCC_MSIRangeConfig(freq);\r
- \r
- /* Select MSI as system clock source */\r
- RCC_SYSCLKConfig(RCC_SYSCLKSource_MSI);\r
-\r
- /* Wait until MSI is used as system clock source */\r
- while (RCC_GetSYSCLKSource() != 0x00);\r
-\r
- if (div2)\r
- {\r
- RCC_HCLKConfig(RCC_SYSCLK_Div2); \r
- }\r
-\r
- RCC_HSICmd(DISABLE);\r
-\r
- /* Disable HSE clock */\r
- RCC_HSEConfig(RCC_HSE_OFF);\r
-\r
- /* Disable LSE clock */\r
- if (! With_RTC)\r
- RCC_LSEConfig(RCC_LSE_OFF);\r
-\r
- /* Disable LSI clock */\r
- RCC_LSICmd(DISABLE); \r
-\r
-}\r
-\r
-/**\r
- * @brief To select HSI as System clock source \r
- * @caller ADC_Icc_Test\r
- * @param None\r
- * @retval None\r
- */\r
-void SetHSICLK(void)\r
-{\r
- /* Enable HSI Clock */\r
- RCC_HSICmd(ENABLE);\r
- \r
- /*!< Wait till HSI is ready */\r
- while (RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET);\r
- \r
- /* Enable 64-bit access */\r
- FLASH_ReadAccess64Cmd(ENABLE);\r
- \r
- /* Enable Prefetch Buffer */\r
- FLASH_PrefetchBufferCmd(ENABLE);\r
- \r
- /* Flash 1 wait state */\r
- FLASH_SetLatency(FLASH_Latency_1);\r
- \r
- RCC_SYSCLKConfig(RCC_SYSCLKSource_HSI);\r
- \r
- while (RCC_GetSYSCLKSource() != 0x04);\r
- \r
- RCC_HCLKConfig(RCC_SYSCLK_Div1); \r
- /* PCLK2 = HCLK */\r
- RCC_PCLK2Config(RCC_HCLK_Div1);\r
-\r
- /* PCLK1 = HCLK */\r
- RCC_PCLK1Config(RCC_HCLK_Div1); \r
- \r
-}\r
-\r
-\r
-/**\r
- * @brief ADC initialization (ADC_Channel_4)\r
- * @caller main and ADC_Icc_Test\r
- * @param None\r
- * @retval None\r
- */ \r
-void ADC_Icc_Init(void)\r
-{\r
- ADC_InitTypeDef ADC_InitStructure;\r
-\r
-/* Enable ADC clock */\r
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);\r
-\r
-/* de-initialize ADC */\r
- ADC_DeInit(ADC1);\r
-\r
-/* ADC configured as follow:\r
- - NbrOfChannel = 1 - ADC_Channel_4\r
- - Mode = Single ConversionMode(ContinuousConvMode disabled)\r
- - Resolution = 12Bits\r
- - Prescaler = /1\r
- - sampling time 192 */\r
-\r
- /* ADC Configuration */\r
- ADC_StructInit(&ADC_InitStructure);\r
- ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;\r
- ADC_InitStructure.ADC_ScanConvMode = ENABLE;\r
- ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;\r
- ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;\r
- ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;\r
- ADC_InitStructure.ADC_NbrOfConversion = 1;\r
- ADC_Init(ADC1, &ADC_InitStructure);\r
-\r
- /* ADC1 regular channel4 configuration */\r
- ADC_RegularChannelConfig(ADC1, ADC_Channel_4, 1, ADC_SampleTime_192Cycles);\r
- ADC_DelaySelectionConfig(ADC1, ADC_DelayLength_Freeze);\r
-\r
- ADC_PowerDownCmd(ADC1, ADC_PowerDown_Idle_Delay, ENABLE);\r
- \r
- /* Enable ADC1 */\r
- ADC_Cmd(ADC1, ENABLE);\r
- \r
- /* Wait until ADC1 ON status */\r
- while (ADC_GetFlagStatus(ADC1, ADC_FLAG_ADONS) == RESET);\r
-}\r
-\r
-/**\r
- * @brief To return the supply measurmeent\r
- * @caller several functions\r
- * @param None\r
- * @retval ADC value\r
- */ \r
-uint16_t ADC_Supply(void)\r
-{\r
- uint8_t i;\r
- uint16_t res;\r
-\r
- /* Initializes ADC */\r
- ADC_Icc_Init();\r
- \r
- ADC_TempSensorVrefintCmd(ENABLE);\r
-\r
- /* ADC1 regular channel 17 for VREF configuration */\r
- ADC_RegularChannelConfig(ADC1, ADC_Channel_17, 1, ADC_SampleTime_192Cycles);\r
- \r
- /* initialize result */\r
- res = 0;\r
- for(i=4; i>0; i--)\r
- {\r
- /* start ADC convertion by software */\r
- ADC_SoftwareStartConv(ADC1);\r
-\r
- /* wait until end-of-covertion */\r
- while( ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == 0 );\r
- /* read ADC convertion result */\r
- res += ADC_GetConversionValue(ADC1);\r
- }\r
- \r
- /* de-initialize ADC */\r
- ADC_TempSensorVrefintCmd(DISABLE);\r
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, DISABLE);\r
- \r
- return (res>>2);\r
-}\r
-\r
-/**\r
- * @brief To confgure RCC for current measurmeent\r
- * @caller ADC_Icc_Test\r
- * @param Structure address for save the RCC configuration\r
- * @retval None\r
- */\r
-void Config_RCC(RCC_TypeDef *sav_RCC)\r
-{\r
- /* Save the RCC configuration registers */\r
- sav_RCC->AHBENR = RCC->AHBENR;\r
- sav_RCC->APB1ENR = RCC->APB1ENR;\r
- sav_RCC->APB2ENR = RCC->APB2ENR;\r
- sav_RCC->AHBLPENR = RCC->AHBLPENR;\r
- sav_RCC->APB1LPENR = RCC->APB1LPENR;\r
- sav_RCC->APB2LPENR = RCC->APB2LPENR;\r
- \r
- /* Set low power configuration */\r
- RCC->AHBENR = 0x05; // Ports A and C enable\r
- RCC->AHBLPENR = 0x05; \r
- RCC->APB1ENR = RCC_APB1ENR_PWREN; // PWR management enable \r
- RCC->APB2ENR = 0;\r
- \r
-}\r
-\r
-/**\r
- * @brief Current measurement\r
- * @caller main and ADC_Icc_Test\r
- * @param None\r
- * @retval ADC conversion value\r
- */\r
-uint16_t Current_Measurement (void)\r
-{\r
- uint16_t res,i;\r
-\r
- /* re-start ADC chanel 24 for Current measurement */\r
- ADC_Icc_Init(); \r
-\r
- /* initialize result */\r
- res = 0;\r
-\r
- for(i=4; i>0; i--)\r
- {\r
- /* start ADC convertion by software */\r
- ADC_SoftwareStartConv(ADC1);\r
- \r
- /* wait until end-of-covertion */\r
- while( ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == 0 );\r
- \r
- /* read ADC convertion result */\r
- res += ADC_GetConversionValue(ADC1);\r
- }\r
- \r
- return (res>>2);\r
-}\r
-\r
-/**\r
- * @brief Current measurement in different MCU modes:\r
- * RUN/SLEEP/LowPower/STANDBY with/without RTC\r
- * @caller main and ADC_Icc_Test\r
- * @param MCU state\r
- * @retval ADC value.\r
- */\r
-uint16_t ADC_Icc_Test(uint8_t Mcu_State)\r
-{\r
- GPIO_InitTypeDef GPIO_InitStructure;\r
- uint16_t adc_measure;\r
- uint32_t i;\r
- RCC_TypeDef SavRCC;\r
- /* Reset UserButton State */\r
- UserButton = FALSE;\r
- /* Start counter */\r
- GPIO_HIGH(CTN_GPIO_PORT,CTN_CNTEN_GPIO_PIN);\r
- /* Disable the RTC Wakeup Interrupt */\r
- RTC_ITConfig(RTC_IT_WUT, DISABLE);\r
- /* Disable LCD */\r
- LCD_Cmd(DISABLE);\r
- /* wait until LCD disable */\r
- while (LCD_GetFlagStatus(LCD_FLAG_ENS) == SET);\r
- /*Reset Idd-WakeUP flag*/\r
- Idd_WakeUP = FALSE;\r
- /* Set IO in lowpower configuration*/\r
- GPIO_LowPower_Config(); \r
- /*Disable fast wakeUp*/\r
- PWR_FastWakeUpCmd(DISABLE);\r
- \r
-/* Test MCU state for configuration */\r
- switch (Mcu_State)\r
- {\r
- /* Run mode : Measurement Measurement performed with MSI 4 MHz without RTC*/ \r
- case MCU_RUN:\r
- /* switch on MSI clock */\r
- SetHSICLKToMSI(RCC_MSIRange_6,NoDIV2,NoRTC) ; \r
- /* shitch on MSI clock */\r
- Config_RCC(&SavRCC); \r
- SysTick->CTRL = 0; \r
- RCC->APB1ENR = 0;\r
-\r
- /* To run nops during measurement:\r
- it's the best case for low current */ \r
-\r
- for (i=0;i<0xffff;i++) {\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- }\r
- \r
- break;\r
-\r
- /* SLEEP mode : Measurement performed with MSI 4 MHz without RTC in WFI mode*/\r
- case MCU_SLEEP:\r
- \r
- SetHSICLKToMSI(RCC_MSIRange_6,NoDIV2,NoRTC) ; \r
- Config_RCC(&SavRCC); \r
- Config_Systick_50ms();\r
- Delay(1);\r
-\r
- /* Request Wait For Interrupt */\r
- PWR_EnterSleepMode(PWR_Regulator_ON,PWR_SLEEPEntry_WFI); \r
- \r
- break; \r
-\r
- /* RUN LOW POWER mode : Measurement performed with MSI 32 Khz without RTC */\r
- case MCU_LP_RUN:\r
- \r
- /* Disable PVD */\r
- PWR_PVDCmd(DISABLE);\r
-\r
- /* Enable The ultra Low Power Mode */\r
- PWR_UltraLowPowerCmd(ENABLE); \r
-\r
- /* Save the RCC configuration registers */\r
- Config_RCC(&SavRCC); \r
- \r
- /* Stop the sys tick in order to avoid IT */\r
- SysTick->CTRL = 0; \r
- \r
-#ifdef TESTINRAM \r
- SetHSICLKToMSI(RCC_MSIRange_0,DIV2,NoRTC) ; \r
- \r
- PWR_EnterLowPowerRunMode(ENABLE);\r
- while(PWR_GetFlagStatus(PWR_FLAG_REGLP) == RESET) ; \r
-\r
- disableGlobalInterrupts();\r
- EnterLPRUNModeRAM();\r
- enableGlobalInterrupts(); \r
-#else \r
- /* Swith in MSI 32KHz */\r
- SetHSICLKToMSI(RCC_MSIRange_64KHz,DIV2,NoRTC) ; \r
- \r
- PWR_EnterLowPowerRunMode(ENABLE);\r
- while(PWR_GetFlagStatus(PWR_FLAG_REGLP) == RESET) ; \r
- \r
- /* Launch the counter */\r
- GPIO_LOW(CTN_GPIO_PORT,CTN_CNTEN_GPIO_PIN); \r
- \r
- /* To run the nop during measurement:\r
- it's the best case for low current\r
- until counter reach detected by IT --> Idd_WakeUP */\r
- do{\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP(); \r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP(); \r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP(); \r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP(); \r
- } while (Idd_WakeUP == FALSE ); \r
-#endif \r
- \r
- PWR_EnterLowPowerRunMode(DISABLE);\r
- while(PWR_GetFlagStatus(PWR_FLAG_REGLP) != RESET) ; \r
- \r
- break; \r
- \r
- /* SLEEP LOW POWER mode\r
- Measurement done to MSI 32 Khz without RTC\r
- */ \r
- case MCU_LP_SLEEP:\r
- \r
- /* Disable PVD */\r
- PWR_PVDCmd(DISABLE); \r
- \r
- /* Enable Ultra low power mode */\r
- PWR_UltraLowPowerCmd(ENABLE);\r
-\r
- \r
- /* To save the RCC configuration registers */\r
- Config_RCC(&SavRCC); \r
- \r
- /* To stop the sys tick for avoid IT */\r
- SysTick->CTRL = 0; \r
- \r
- /* Swith in MSI 32KHz */\r
- SetHSICLKToMSI(RCC_MSIRange_0,DIV2,NoRTC) ;\r
-\r
-#ifdef TESTINRAM\r
- disableGlobalInterrupts();\r
- EnterLPSLEEPModeRAM();\r
- enableGlobalInterrupts();\r
-#else \r
- /* Falling edge for start counter */ \r
- GPIO_LOW(CTN_GPIO_PORT,CTN_CNTEN_GPIO_PIN);\r
-\r
- /* Request Wait For Interrupt */ \r
- PWR_EnterSleepMode(PWR_Regulator_LowPower,PWR_SLEEPEntry_WFI);\r
-#endif \r
- break; \r
- \r
- /* STOP modes\r
- Measurement done to MSI 32 Khz without or with RTC\r
- */ \r
- case MCU_STOP_NoRTC:\r
- case MCU_STOP_RTC:\r
-\r
- /* Disable PVD */\r
- PWR_PVDCmd(DISABLE);\r
- \r
- /* Enable Ultra low power mode */\r
- PWR_UltraLowPowerCmd(ENABLE); \r
- \r
- /* To save the RCC configuration registers */\r
- Config_RCC(&SavRCC); \r
-\r
- /* To stop the sys tick for avoid IT */\r
- SysTick->CTRL = 0; \r
- \r
- /* Swith in MSI 32KHz */\r
- if( Mcu_State == MCU_STOP_NoRTC )\r
- SetHSICLKToMSI(RCC_MSIRange_0,DIV2,NoRTC) ;\r
- else\r
- SetHSICLKToMSI(RCC_MSIRange_0,DIV2,WITHRTC) ; \r
-\r
- /* Falling edge for start counter */ \r
- GPIO_LOW(CTN_GPIO_PORT,CTN_CNTEN_GPIO_PIN);\r
- \r
- /* Request Wait For Interrupt */ \r
- PWR_EnterSTOPMode(PWR_Regulator_LowPower,PWR_STOPEntry_WFI); \r
-\r
- break; \r
- \r
- /* Standby mode without RTC\r
- Measurement done to MSI 32 Khz without RTC\r
- */\r
- case MCU_STBY:\r
- \r
- /* Disable PVD */\r
- PWR_PVDCmd(DISABLE);\r
- \r
- /* Enable Ultra low power mode */\r
- PWR_UltraLowPowerCmd(ENABLE);\r
- \r
- RTC_OutputTypeConfig(RTC_OutputType_PushPull);\r
- RTC_OutputConfig(RTC_Output_WakeUp,RTC_OutputPolarity_High); \r
- \r
- /* To configure PC13 WakeUP output */\r
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 ;\r
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;\r
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;\r
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_400KHz; \r
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;\r
- GPIO_Init( GPIOC, &GPIO_InitStructure); \r
- \r
- GPIO_PinAFConfig(GPIOC, GPIO_PinSource13,GPIO_AF_RTC_AF1) ;\r
- Config_RCC(&SavRCC); \r
- \r
- SysTick->CTRL = 0; \r
- \r
- /* Swith in MSI 32KHz */\r
- SetHSICLKToMSI(RCC_MSIRange_0,DIV2,NoRTC) ; \r
- \r
- PWR_WakeUpPinCmd(PWR_WakeUpPin_1,ENABLE);\r
- \r
- PWR_UltraLowPowerCmd(ENABLE); \r
- \r
- PWR_EnterSTANDBYMode();\r
- /* Stop here WakeUp EXIT on RESET */\r
- \r
- break;\r
- }\r
- \r
- SetHSICLK(); \r
-\r
- Config_Systick(); \r
- RCC->AHBENR = SavRCC.AHBENR; \r
- \r
- PWR_VoltageScalingConfig(PWR_VoltageScaling_Range1);\r
- /* Wait Until the Voltage Regulator is ready */\r
- while (PWR_GetFlagStatus(PWR_FLAG_VOS) != RESET) ;\r
-\r
- /* Read ADC for current measurmeent */\r
- adc_measure = Current_Measurement();\r
- \r
- /* ICC_CNT_EN Hi */\r
- GPIO_HIGH(CTN_GPIO_PORT,CTN_CNTEN_GPIO_PIN);\r
- UserButton = TRUE;\r
-\r
- /* To restore RCC registers */\r
- RCC->APB1ENR = SavRCC.APB1ENR;\r
- RCC->APB2ENR = SavRCC.APB2ENR; \r
- RCC->AHBLPENR = SavRCC.AHBLPENR; \r
- RCC->APB1LPENR = SavRCC.APB1LPENR;\r
- RCC->APB2LPENR = SavRCC.APB2LPENR;\r
- \r
- /* Need to reinit RCC for LCD*/\r
- RCC_Configuration();\r
-\r
- PWR_EnterLowPowerRunMode(DISABLE);\r
- \r
- /* Disable Ultra low power mode */\r
- PWR_UltraLowPowerCmd(DISABLE);\r
- \r
- /* Disable FLASH during SLeep LP */\r
- FLASH_SLEEPPowerDownCmd(DISABLE);\r
- \r
- Restore_GPIO_Config(); \r
- \r
- /* Clear Wake Up flag */\r
- PWR_ClearFlag(PWR_FLAG_WU);\r
- \r
- /* Enable PVD */\r
- PWR_PVDCmd(ENABLE);\r
-\r
- LCD_GLASS_Init();\r
- \r
- return (adc_measure);\r
-}\r
-\r
-\r
-\r
-/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file icc_measure_Ram.c\r
- * @author Microcontroller Division\r
- * @version V1.0.3\r
- * @date May-2013\r
- * @brief Ram functions used for ICC current measurments\r
- ******************************************************************************\r
- * @copy\r
- *\r
- * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
- * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
- * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
- * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
- * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
- * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
- *\r
- * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>\r
- */\r
- \r
-/* Includes ------------------------------------------------------------------*/\r
-#include "misc.h"\r
-#include "stm32l1xx.h"\r
-#include "stm32l1xx_adc.h"\r
-#include "stm32l1xx_lcd.h"\r
-#include "stm32l1xx_rcc.h"\r
-#include "stm32l1xx_rtc.h"\r
-#include "stm32l1xx_pwr.h"\r
-#include "stm32l1xx_gpio.h"\r
-#include "discover_board.h"\r
-#include "icc_measure.h"\r
-#include "discover_functions.h"\r
-#include "stm32l1xx_conf.h"\r
-\r
-#define CR_DS_MASK ((uint32_t)0xFFFFFFFC)\r
-\r
-\r
-#if (defined ( __CC_ARM ))\r
- #define __RAMFUNC void \r
-#elif (defined (__ICCARM__))\r
- #define __RAMFUNC __ramfunc void\r
-#elif defined ( __GNUC__ )\r
-#define __RAMFUNC void __attribute__((section(".data")))\r
-#endif\r
-/**\r
- * @brief Enable or disable the power down mode during RUN mode .\r
- * @param NewState: new state of the power down mode during RUN mode.\r
- * This parameter can be: ENABLE or DISABLE.\r
- * @retval None\r
- */\r
-__RAMFUNC RAM_FLASH_RUNPowerDownCmd(FunctionalState NewState)\r
-{\r
-\r
- if (NewState != DISABLE)\r
- {\r
- /* Unlock the RUN_PD bit */\r
- FLASH->PDKEYR = FLASH_PDKEY1;\r
- FLASH->PDKEYR = FLASH_PDKEY2;\r
-\r
- /* Set the RUN_PD bit in FLASH_ACR register to put Flash in power down mode */\r
- FLASH->ACR |= (uint32_t)FLASH_ACR_RUN_PD;\r
- }\r
- else\r
- {\r
- /* Clear the RUN_PD bit in FLASH_ACR register to put Flash in idle mode */\r
- FLASH->ACR &= (uint32_t)(~(uint32_t)FLASH_ACR_RUN_PD);\r
- }\r
-\r
-}\r
-\r
-/**\r
- * @brief Enters/Exits the Low Power Run mode.\r
- * @param NewState: new state of the Low Power Run mode.\r
- * This parameter can be: ENABLE or DISABLE.\r
- * @retval None\r
- */\r
-__RAMFUNC RAM_PWR_LowPowerRunModeCmd(FunctionalState NewState)\r
-{\r
-\r
- if (NewState != DISABLE)\r
- {\r
- PWR->CR |= PWR_CR_LPSDSR;\r
- PWR->CR |= PWR_CR_LPRUN;\r
- }\r
- else\r
- {\r
- PWR->CR &= (uint32_t)~((uint32_t)PWR_CR_LPRUN);\r
- PWR->CR &= (uint32_t)~((uint32_t)PWR_CR_LPSDSR);\r
- }\r
-}\r
-\r
-/**\r
- * @brief Function in RAM for Low Power RUN current measurment\r
- * @caller ADC_Icc_Test\r
- * @param None\r
- * @retval None\r
- */\r
-__RAMFUNC EnterLPRUNModeRAM(void)\r
-{\r
- \r
- RAM_FLASH_RUNPowerDownCmd(ENABLE);\r
- RAM_PWR_LowPowerRunModeCmd(ENABLE);\r
- \r
- /* The application Run with delay */\r
- GPIO_LOW(CTN_GPIO_PORT,CTN_CNTEN_GPIO_PIN);\r
- \r
- do{\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- __NOP(); __NOP(); __NOP(); __NOP();\r
- } while((USERBUTTON_GPIO_PORT->IDR & USERBUTTON_GPIO_PIN) == 0);\r
- \r
- \r
- RAM_FLASH_RUNPowerDownCmd(DISABLE);\r
- RAM_PWR_LowPowerRunModeCmd(DISABLE);\r
-}\r
-\r
-/**\r
- * @brief Function in RAM for Low Power Sleep current measurment \r
- * @caller ADC_Icc_Test\r
- * @param None\r
- * @retval None\r
- */\r
-__RAMFUNC EnterLPSLEEPModeRAM(void)\r
-{\r
- uint32_t tmpreg = 0;\r
- \r
- RAM_FLASH_RUNPowerDownCmd(ENABLE);\r
- RAM_PWR_LowPowerRunModeCmd(ENABLE);\r
- \r
- /* The application Run with delay */\r
- GPIO_LOW(CTN_GPIO_PORT,CTN_CNTEN_GPIO_PIN);\r
-\r
- /* Select the regulator state in Sleep mode ---------------------------------*/\r
- tmpreg = PWR->CR;\r
-\r
- /* Clear PDDS and LPDSR bits */\r
- tmpreg &= CR_DS_MASK;\r
- \r
- /* Set LPDSR bit according to PWR_Regulator value */\r
- tmpreg |= PWR_Regulator_LowPower;\r
- \r
- /* Store the new value */\r
- PWR->CR = tmpreg;\r
- \r
- /* Clear SLEEPDEEP bit of Cortex System Control Register */\r
- SCB->SCR &= (uint32_t)~((uint32_t)SCB_SCR_SLEEPDEEP);\r
-\r
- /* Request Wait For Event */\r
- __WFE();\r
- \r
- RAM_FLASH_RUNPowerDownCmd(DISABLE);\r
- RAM_PWR_LowPowerRunModeCmd(DISABLE);\r
-}\r
-\r
-/**\r
- * @brief Function in RAM for Sleep current measurment \r
- * @caller ADC_Icc_Test\r
- * @param None\r
- * @retval None\r
- */\r
-\r
-__RAMFUNC EnterSLEEPModeRAM(void)\r
-{\r
- uint32_t tmpreg = 0;\r
- \r
- RAM_FLASH_RUNPowerDownCmd(ENABLE);\r
- RAM_PWR_LowPowerRunModeCmd(ENABLE);\r
- \r
- /* Select the regulator state in Sleep mode ---------------------------------*/\r
- tmpreg = PWR->CR;\r
-\r
- /* Clear PDDS and LPDSR bits */\r
- tmpreg &= CR_DS_MASK;\r
- \r
- /* Set LPDSR bit according to PWR_Regulator value */\r
- tmpreg |= PWR_Regulator_LowPower;\r
- \r
- /* Store the new value */\r
- PWR->CR = tmpreg;\r
- \r
- /* Clear SLEEPDEEP bit of Cortex System Control Register */\r
- SCB->SCR &= (uint32_t)~((uint32_t)SCB_SCR_SLEEPDEEP);\r
-\r
- \r
- /* Request Wait For Event */\r
- __WFE();\r
- \r
- RAM_FLASH_RUNPowerDownCmd(DISABLE);\r
- RAM_PWR_LowPowerRunModeCmd(DISABLE);\r
-}\r
-\r
-\r
-\r
-/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/\r
\r
/* Set configCREATE_LOW_POWER_DEMO to one to run the simple blinky low power\r
demo, or 0 to run the more comprehensive test and demo application. */\r
-#define configCREATE_LOW_POWER_DEMO 1\r
+#define configCREATE_LOW_POWER_DEMO 0\r
\r
/* A few settings are dependent on the configCREATE_LOW_POWER_DEMO setting. */\r
#if configCREATE_LOW_POWER_DEMO == 1\r
+++ /dev/null
- /**\r
- ******************************************************************************\r
- * @file icc_measure.h\r
- * @author Microcontroller Division\r
- * @version V1.0.3\r
- * @date May-2013\r
- * @brief Current measurements defines\r
- ******************************************************************************\r
- * @copy\r
- *\r
- * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
- * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
- * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
- * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
- * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
- * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
- *\r
- * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __ICC_MEASURE_H\r
-#define __ICC_MEASURE_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-\r
-\r
-/* Private define ------------------------------------------------------------*/\r
-#define MCU_RUN 0\r
-#define MCU_SLEEP 1\r
-#define MCU_LP_RUN 2\r
-#define MCU_LP_SLEEP 3\r
-#define MCU_STOP_RTC 4\r
-#define MCU_STOP_NoRTC 5\r
-#define MCU_STBY 6\r
-\r
-#define NoRTC FALSE\r
-#define WITHRTC !NoRTC\r
-#define NoDIV2 FALSE\r
-#define DIV2 !NoDIV2\r
-\r
-/* Exported constants --------------------------------------------------------*/\r
-/* Exported macro ------------------------------------------------------------*/\r
-/* Exported functions ------------------------------------------------------- */\r
-uint16_t ADC_Supply(void);\r
-void ADC_Icc_Init(void);\r
-uint16_t ADC_Icc_Test(uint8_t Mcu_State);\r
-void GPIO_LowPower_Config(void);\r
-void STOP_Init(void);\r
-void STBY_Init(void);\r
-uint16_t Current_Measurement(void);\r
-void EnterLPSLEEPModeRAM(void);\r
-void SetHSICLKToMSI(uint32_t ,bool ,bool );\r
-void EnterLPRUNModeRAM(void);\r
-#endif /* __ICC_MEASURE_H*/\r
-\r
-/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file Project/STM32L1xx_StdPeriph_Template/main.h\r
- * @author MCD Application Team\r
- * @version V1.0.3\r
- * @date May-2013\r
- * @brief Header for main.c module\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
- * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
- * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
- * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
- * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
- * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
- *\r
- * <h2><center>© COPYRIGHT 2010 STMicroelectronics</center></h2>\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __MAIN_H\r
-#define __MAIN_H\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "stm32l1xx.h"\r
-#include "discover_board.h"\r
-#include "stm32l_discovery_lcd.h"\r
-#include <stdio.h>\r
-\r
-/* Touch sensing driver headers */\r
-#include "tsl.h"\r
-#include "tsl_user.h"\r
-\r
-/* discovery board and specific drivers headers*/\r
-#include "discover_board.h"\r
-#include "icc_measure.h"\r
-#include "stm32l_discovery_lcd.h"\r
-\r
-\r
-/* Exported types ------------------------------------------------------------*/\r
-/* Exported constants --------------------------------------------------------*/\r
-/* Exported macro ------------------------------------------------------------*/\r
-/* Exported functions ------------------------------------------------------- */\r
-\r
-void Delay(__IO uint32_t nTime);\r
-\r
-#endif /* __MAIN_H */\r
-\r
-/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file STM32L152_Ex06_Linear_DISC\inc\tsl_conf_stm32l1xx.h\r
- * @author MCD Application Team\r
- * @version V1.0.3\r
- * @date May-2013\r
- * @brief Acquisition parameters for STM32L1xx products.\r
- * @note This file must be copied in the application project and values\r
- * changed for the application.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_CONF_STM32L1xx_H\r
-#define __TSL_CONF_STM32L1xx_H\r
-\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-//+++++++++++++++++++++++++++ COMMON PARAMETERS ++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
-/** @defgroup Common_Parameters Common Parameters\r
- * @{ */\r
-\r
-//==============================================================================\r
-// Number of elements\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Number_Of_Elements 01 - Number of elements\r
- * @{ */\r
-\r
-/** Total number of channels in application (range=1..255)\r
-*/\r
-#define TSLPRM_TOTAL_CHANNELS (3)\r
-\r
-/** Total number of banks in application (range=1..255)\r
-*/\r
-#define TSLPRM_TOTAL_BANKS (1)\r
-\r
-/** Total number of "Extended" TouchKeys in application (range=0..255)\r
-*/\r
-#define TSLPRM_TOTAL_TOUCHKEYS (0)\r
-\r
-/** Total number of "Basic" TouchKeys in application (range=0..255)\r
-*/\r
-#define TSLPRM_TOTAL_TOUCHKEYS_B (0)\r
-\r
-/** Total number of "Extended" Linear and Rotary sensors in application (range=0..255)\r
- - Count also the 1-channel linear sensor used as TouchKey\r
-*/\r
-#define TSLPRM_TOTAL_LINROTS (1)\r
-\r
-/** Total number of "Basic" Linear and Rotary sensors in application (range=0..255)\r
- - Count also the 1-channel linear sensor used as TouchKey\r
-*/\r
-#define TSLPRM_TOTAL_LINROTS_B (0)\r
-\r
-/** Total number of sensors/objects in application (range=1..255)\r
- - Count all TouchKeys, Linear and Rotary sensors\r
-*/\r
-#define TSLPRM_TOTAL_OBJECTS (1)\r
-\r
-/** @} Common_Parameters_Number_Of_Elements */\r
-\r
-//==============================================================================\r
-// Optional features\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Options 02 - Optional features\r
- * @{ */\r
-\r
-/** Record the last measure (0=No, 1=Yes)\r
- - If No the measure is recalculated using the Reference and Delta\r
-*/\r
-#define TSLPRM_USE_MEAS (1)\r
-\r
-/** Zone management usage (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_ZONE (0)\r
-\r
-/** Proximity detection usage (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_PROX (0)\r
-\r
-/** Use the Timer tick callback (0=No, 1=Yes)\r
- - When equal to 1, the function TSL_CallBack_TimerTick must be defined in\r
- the application code. It is called for each timer interruption.\r
-*/\r
-#define TSLPRM_USE_TIMER_CALLBACK (0)\r
-\r
-/** Acquisition interrupt mode (0=No, 1=Yes)\r
- - If No the TS interrupt is not used.\r
- - If Yes the TS interrupt is used.\r
-*/\r
-#define TSLPRM_USE_ACQ_INTERRUPT (0)\r
-\r
-/** @} Common_Parameters_Options */\r
-\r
-//==============================================================================\r
-// Acquisition limits\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Acquisition_Limits 03 - Acquisition limits\r
- * @{ */\r
-\r
-/** Minimum acquisition measurement (range=0..65535)\r
- - This is the minimum acceptable value for the acquisition measure.\r
- - The acquisition will be in error if the measure is below this value.\r
-*/\r
-#define TSLPRM_ACQ_MIN (50)\r
-\r
-/** Maximum acquisition measurement (range=0..65535)\r
- - This is the maximum acceptable value for the acquisition measure.\r
- - The acquisition will be in error if the measure is above this value.\r
-*/\r
-#define TSLPRM_ACQ_MAX (4000)\r
-\r
-/** @} Common_Parameters_Acquisition_Limits */\r
-\r
-//==============================================================================\r
-// Calibration\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Calibration 04 - Calibration\r
- * @{ */\r
-\r
-/** Number of calibration samples (range=4, 8, 16)\r
- - Low value = faster calibration but less precision.\r
- - High value = slower calibration but more precision.\r
-*/\r
-#define TSLPRM_CALIB_SAMPLES (8)\r
-\r
-/** Delay in measurement samples before starting the calibration (range=0..40)\r
- - This is usefull if a noise filter is used.\r
- - Write 0 to disable the delay.\r
-*/\r
-#define TSLPRM_CALIB_DELAY (10)\r
-\r
-/** @} Common_Parameters_Calibration */\r
-\r
-//==============================================================================\r
-// Thresholds for TouchKey sensors\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_TouchKey_Thresholds 05 - Thresholds for TouchKey sensors\r
- * @{ */\r
-\r
-/** TouchKeys Proximity state input threshold (range=0..255)\r
- - Enter Proximity state if delta is above\r
-*/\r
-#define TSLPRM_TKEY_PROX_IN_TH (20)\r
-\r
-/** TouchKeys Proximity state output threshold (range=0..255)\r
- - Exit Proximity state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_PROX_OUT_TH (15)\r
-\r
-/** TouchKeys Detect state input threshold (range=0..255)\r
- - Enter Detect state if delta is above\r
-*/\r
-#define TSLPRM_TKEY_DETECT_IN_TH (30)\r
-\r
-/** TouchKeys Detect state output threshold (range=0..255)\r
- - Exit Detect state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_DETECT_OUT_TH (25)\r
-\r
-/** TouchKeys re-Calibration threshold (range=0..255)\r
- - @warning The value is inverted in the sensor state machine\r
- - Enter Calibration state if delta is below\r
-*/\r
-#define TSLPRM_TKEY_CALIB_TH (30)\r
-\r
-/** TouchKey, Linear and Rotary sensors thresholds coefficient (range=0..4)\r
- This multiplier coefficient is applied on Detect thresholds only.\r
- - 0: feature disabled\r
- - 1: thresholds x 2\r
- - 2: thresholds x 4\r
- - 3: thresholds x 8\r
- - 4: thresholds x 16\r
-*/\r
-#define TSLPRM_COEFF_TH (0)\r
-\r
-/** @} Common_Parameters_TouchKey_Thresholds */\r
-\r
-//==============================================================================\r
-// Thresholds for Linear and Rotary sensors\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Thresholds 06 - Thresholds for Linear and Rotary sensors\r
- * @{ */\r
-\r
-/** Linear/Rotary Proximity state input threshold (range=0..255)\r
- - Enter Proximity state if delta is above\r
-*/\r
-#define TSLPRM_LINROT_PROX_IN_TH (30)\r
-\r
-/** Linear/Rotary Proximity state output threshold (range=0..255)\r
- - Exit Proximity state if delta is below\r
-*/\r
-#define TSLPRM_LINROT_PROX_OUT_TH (20)\r
-\r
-/** Linear/Rotary Detect state input threshold (range=0..255)\r
- - Enter Detect state if delta is above\r
-*/\r
-#define TSLPRM_LINROT_DETECT_IN_TH (50)\r
-\r
-/** Linear/Rotary Detect state output threshold (range=0..255)\r
- - Exit Detect state if delta is below\r
-*/\r
-#define TSLPRM_LINROT_DETECT_OUT_TH (40)\r
-\r
-/** Linear/Rotary re-Calibration threshold (range=0..255)\r
- - @warning The value is inverted in the sensor state machine\r
- - Enter Calibration state if delta is below\r
- - A low absolute value will result in a higher sensitivity and thus some spurious\r
- recalibration may be issued.\r
-*/\r
-#define TSLPRM_LINROT_CALIB_TH (50)\r
-\r
-/** Linear/Rotary Delta normalization (0=No, 1=Yes)\r
- - When this parameter is set, a coefficient is applied on all Delta of all sensors\r
- in order to normalize them and to improve the position calculation.\r
- - These coefficients must be defined in a constant table in the application (see Library examples).\r
- - The MSB is the coefficient integer part, the LSB is the coefficient real part.\r
- - Examples:\r
- - To apply a factor 1.10:\r
- 0x01 to the MSB\r
- 0x1A to the LSB (0.10 x 256 = 25.6 -> rounded to 26 = 0x1A)\r
- - To apply a factor 0.90:\r
- 0x00 to the MSB\r
- 0xE6 to the LSB (0.90 x 256 = 230.4 -> rounded to 230 = 0xE6)\r
- - To apply no factor:\r
- 0x01 to the MSB\r
- 0x00 to the LSB\r
-*/\r
-#define TSLPRM_LINROT_USE_NORMDELTA (1)\r
-\r
-/** @} Common_Parameters_LinRot_Thresholds */\r
-\r
-//==============================================================================\r
-// Linear/Rotary sensors used\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Used 07 - Linear/Rotary sensors used\r
- * @{ */\r
-\r
-/** Select which Linear and Rotary sensors you use in your application.\r
- - 0 = Not Used\r
- - 1 = Used\r
-\r
- LIN = Linear sensor\r
- ROT = Rotary sensor\r
- M = Mono electrodes design\r
- H = Half-ended electrodes design\r
- D = Dual electrodes design\r
-*/\r
-#define TSLPRM_USE_3CH_LIN_M (0)\r
-#define TSLPRM_USE_3CH_LIN_H (1)\r
-#define TSLPRM_USE_3CH_ROT_M (0)\r
-\r
-#define TSLPRM_USE_4CH_LIN_M (0)\r
-#define TSLPRM_USE_4CH_LIN_H (0)\r
-#define TSLPRM_USE_4CH_ROT_M (0)\r
-\r
-#define TSLPRM_USE_5CH_LIN_M (0)\r
-#define TSLPRM_USE_5CH_LIN_H (0)\r
-#define TSLPRM_USE_5CH_ROT_M (0)\r
-#define TSLPRM_USE_5CH_ROT_D (0)\r
-\r
-#define TSLPRM_USE_6CH_LIN_M (0)\r
-#define TSLPRM_USE_6CH_LIN_H (0)\r
-#define TSLPRM_USE_6CH_ROT_M (0)\r
-\r
-/** @} Common_Parameters_LinRot_used */\r
-\r
-//==============================================================================\r
-// Linear/Rotary sensors position\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_LinRot_Position 08 - Linear/Rotary sensors position\r
- * @{ */\r
-\r
-/** Position resolution in number of bits (range=1..8)\r
- - A Low value will result in a low resolution and will be less subject to noise.\r
- - A High value will result in a high resolution and will be more subject to noise.\r
-*/\r
-#define TSLPRM_LINROT_RESOLUTION (7)\r
-\r
-/** Direction change threshold in position unit (range=0..255)\r
- - Defines the default threshold used during the change direction process.\r
- - A Low value will result in a faster direction change.\r
- - A High value will result in a slower direction change.\r
-*/\r
-#define TSLPRM_LINROT_DIR_CHG_POS (10)\r
-\r
-/** Direction change debounce (range=0..63)\r
- - Defines the default integrator counter used during the change direction process.\r
- - This counter is decremented when the same change in the position is detected and the direction will\r
- change after this counter reaches zero.\r
- - A Low value will result in a faster direction change.\r
- - A High value will result in a slower direction change.\r
-*/\r
-#define TSLPRM_LINROT_DIR_CHG_DEB (1)\r
-\r
-/** @} Common_Parameters_LinRot_Position */\r
-\r
-//==============================================================================\r
-// Debounce counters\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Debounce 09 - Debounce counters\r
- * @{ */\r
-\r
-/** Proximity state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the Proximity detection but with less noise filtering.\r
- - A High value will result in improving the system noise immunity but will increase the system response time.\r
-*/\r
-#define TSLPRM_DEBOUNCE_PROX (3)\r
-\r
-/** Detect state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the detection but with less noise filtering.\r
- - A High value will result in improving the system noise immunity but will increase the system response time.\r
-*/\r
-#define TSLPRM_DEBOUNCE_DETECT (3)\r
-\r
-/** Release state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the end-detection but with less noise filtering.\r
- - A High value will result in a lower sensitivity during the end-detection but with more noise filtering.\r
-*/\r
-#define TSLPRM_DEBOUNCE_RELEASE (3)\r
-\r
-/** Re-calibration state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity during the recalibration but with less noise filtering.\r
- - A High value will result in a lower sensitivity during the recalibration but with more noise filtering.\r
-*/\r
-#define TSLPRM_DEBOUNCE_CALIB (3)\r
-\r
-/** Error state debounce in samples unit (range=0..63)\r
- - A Low value will result in a higher sensitivity to enter in error state.\r
- - A High value will result in a lower sensitivity to enter in error state.\r
-*/\r
-#define TSLPRM_DEBOUNCE_ERROR (3)\r
-\r
-/** @} Common_Parameters_Debounce */\r
-\r
-//==============================================================================\r
-// Environment Change System (ECS)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_ECS 10 - ECS\r
- * @{ */\r
-\r
-/** Environment Change System Slow K factor (range=0..255)\r
- - The higher value is K, the faster is the response time.\r
-*/\r
-#define TSLPRM_ECS_K_SLOW (10)\r
-\r
-/** Environment Change System Fast K factor (range=0..255)\r
- - The higher value is K, the faster is the response time.\r
-*/\r
-#define TSLPRM_ECS_K_FAST (20)\r
-\r
-/** Environment Change System delay in msec (range=0..5000)\r
- - The ECS will be started after this delay and when all sensors are in Release state.\r
-*/\r
-#define TSLPRM_ECS_DELAY (500)\r
-\r
-/** @} Common_Parameters_ECS */\r
-\r
-//==============================================================================\r
-// Detection Time Out (DTO)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_DTO 11 - DTO\r
- * @{ */\r
-\r
-/** Detection Time Out delay in seconds (range=0..63)\r
- - Value 0: DTO processing not compiled in the code (to gain size if not used).\r
- - Value 1: Default time out infinite.\r
- - Value between 2 and 63: Default time out between value n-1 and n.\r
- - Examples:\r
- - With a DTO equal to 2, the time out is between 1s and 2s.\r
- - With a DTO equal to 63, the time out is between 62s and 63s.\r
-\r
-@note The DTO can be changed in run-time by the application only if the\r
- default value is between 1 and 63.\r
-*/\r
-#define TSLPRM_DTO (10)\r
-\r
-/** @} Common_Parameters_DTO */\r
-\r
-//==============================================================================\r
-// Detection Exclusion System (DXS)\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_DXS 12 - DXS\r
- * @{ */\r
-\r
-/** Detection Exclusion System (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_DXS (0)\r
-\r
-/** @} Common_Parameters_DXS */\r
-\r
-//==============================================================================\r
-// Miscellaneous parameters\r
-//==============================================================================\r
-\r
-/** @defgroup Common_Parameters_Misc 13 - Miscellaneous\r
- * @{ */\r
-\r
-/** Timing tick frequency in Hz (range=125, 250, 500, 1000, 2000)\r
- - Result to a timing interrupt respectively every 8ms, 4ms, 2ms, 1ms, 0.5ms\r
-*/\r
-#define TSLPRM_TICK_FREQ (2000)\r
-\r
-/** @} Common_Parameters_Misc */\r
-\r
-/** @} Common_Parameters */\r
-\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++ MCU PARAMETERS ++++++++++++++++++++++++++++++++\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-\r
-/** @defgroup STM32L1xx_Parameters STM32L1xx Parameters\r
- * @{ */\r
-\r
-/** @defgroup STM32L1xx_Parameters_Misc 01 - Miscellaneous\r
- * @{ */\r
-\r
-/** Shield with a channel (0=No, 1=Yes)\r
-*/\r
-#define TSLPRM_USE_SHIELD (0)\r
-\r
-/** IOs default mode when no on-going acquisition (range=0..1)\r
- - 0: Output push-pull low\r
- - 1: Input floating\r
-*/\r
-#define TSLPRM_IODEF (0)\r
-\r
-/** Master timer prescaler for HW acquisition only (range=0..65535)\r
- - Divide the timer input clock by this value plus one\r
-*/\r
-#define TSLPRM_TIM_PRESCALER (0)\r
-\r
-/** Master timer reload value for HW acquisition only (range=4..65534, even number)\r
- - Set the auto-reload value for the center aligned counter\r
-*/\r
-#define TSLPRM_TIM_RELOAD (64)\r
-\r
-/** IT disabling for IO protection for SW acquisition only (range=0..1)\r
- - 0: IO not protected\r
- - 1: IO protected\r
-*/\r
-#define TSLPRM_PROTECT_IO_ACCESS (1)\r
-\r
-/** Which GPIO will be used for SW acquisition only (range=0..1)\r
- - 0: Not used\r
- - 1: Used\r
-*/\r
-#define TSLPRM_USE_GPIOA (1)\r
-#define TSLPRM_USE_GPIOB (1)\r
-#define TSLPRM_USE_GPIOC (1)\r
-#define TSLPRM_USE_GPIOF (0)\r
-#define TSLPRM_USE_GPIOG (0)\r
-\r
-/** @} STM32L1xx_Parameters_Misc */\r
-\r
-/** @} STM32L1xx_Parameters */\r
-\r
-// DO NOT REMOVE !!!\r
-#include "tsl_check_config.h"\r
-\r
-#endif /* __TSL_CONF_STM32L1xx_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file STM32L152_Ex06_Linear_DISC\inc\tsl_user.h\r
- * @author MCD Application Team\r
- * @version V1.0.3\r
- * @date May-2013\r
- * @brief Touch-Sensing user configuration and api file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software \r
- * distributed under the License is distributed on an "AS IS" BASIS, \r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */\r
-\r
-/* Define to prevent recursive inclusion -------------------------------------*/\r
-#ifndef __TSL_USER_H\r
-#define __TSL_USER_H\r
-\r
-#include "tsl.h"\r
-\r
-// LEDs definition on STM32L152B-DISC board\r
-// PB7 = LED_GREEN\r
-#define LED_GREEN_TOGGLE {GPIOB->ODR ^= (1<<7);}\r
-#define LED_GREEN_OFF {GPIOB->ODR &= ~(1<<7);}\r
-#define LED_GREEN_ON {GPIOB->ODR |= (1<<7);}\r
-// PB6 = LED_BLUE\r
-#define LED_BLUE_TOGGLE {GPIOB->ODR ^= (1<<6);}\r
-#define LED_BLUE_OFF {GPIOB->ODR &= ~(1<<6);}\r
-#define LED_BLUE_ON {GPIOB->ODR |= (1<<6);}\r
-\r
-//==============================================================================\r
-// IOs definition\r
-//==============================================================================\r
-\r
-// Channel IOs definition\r
-#define CHANNEL_0_SRC ((uint32_t)(GR2))\r
-#define CHANNEL_0_DEST (0)\r
-#define CHANNEL_0_SAMPLE_CONFIG TSL_GROUP2_IO2\r
-#define CHANNEL_0_CHANNEL_CONFIG TSL_GROUP2_IO1\r
-\r
-#define CHANNEL_1_SRC ((uint32_t)(GR9))\r
-#define CHANNEL_1_DEST (1)\r
-#define CHANNEL_1_SAMPLE_CONFIG TSL_GROUP9_IO2\r
-#define CHANNEL_1_CHANNEL_CONFIG TSL_GROUP9_IO1\r
-\r
-#define CHANNEL_2_SRC ((uint32_t)(GR3))\r
-#define CHANNEL_2_DEST (2)\r
-#define CHANNEL_2_SAMPLE_CONFIG TSL_GROUP3_IO2\r
-#define CHANNEL_2_CHANNEL_CONFIG TSL_GROUP3_IO1\r
-\r
-// Banks definition\r
-#define BANK_0_NBCHANNELS (3)\r
-#define BANK_0_INDEX (0) // Index of 1st channel used\r
-#define BANK_0_SHIELD_SAMPLE (0)\r
-#define BANK_0_SHIELD_CHANNEL (0)\r
-\r
-// User Parameters\r
-extern TSL_ObjectGroup_T MyObjGroup;\r
-extern CONST TSL_Object_T MyObjects[];\r
-extern CONST TSL_Bank_T MyBanks[];\r
-extern CONST TSL_LinRot_T MyLinRots[];\r
-\r
-void MyLinRots_ErrorStateProcess(void);\r
-void MyLinRots_OffStateProcess(void);\r
-\r
-void TSL_user_Init(void);\r
-TSL_Status_enum_T TSL_user_Action(void);\r
-void ProcessSensors(void);\r
-void ProcessSensorsButtons(void);\r
-\r
-\r
-#endif /* __TSL_USER_H */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
#include "stm32l1xx_rtc.h"\r
#include "discover_board.h"\r
#include "stm32l_discovery_lcd.h"\r
-#include "tsl.h"\r
\r
\r
extern volatile bool KeyPressed;\r
+++ /dev/null
-/**\r
- ******************************************************************************\r
- * @file STM32L152_Ex06_Linear_DISC\src\tsl_user.c \r
- * @author MCD Application Team\r
- * @version V1.0.3\r
- * @date May-2013\r
- * @brief Touch-Sensing user configuration and api file.\r
- ******************************************************************************\r
- * @attention\r
- *\r
- * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>\r
- *\r
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
- * You may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at:\r
- *\r
- * http://www.st.com/software_license_agreement_liberty_v2\r
- *\r
- * Unless required by applicable law or agreed to in writing, software \r
- * distributed under the License is distributed on an "AS IS" BASIS, \r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- ******************************************************************************\r
- */ \r
-\r
-#include "tsl_user.h"\r
-#include "stm32l_discovery_lcd.h"\r
-#include "discover_functions.h"\r
-\r
-// PB6 = LED_GREEN\r
-// #define LED_GREEN_TOGGLE {GPIOB->ODR ^= (1<<7);}\r
-// #define LED_GREEN_OFF {GPIOB->BSRRL = (1<<7);}\r
-// #define LED_GREEN_ON {GPIOB->BSRRH = (1<<7);}\r
-\r
-// PB7 = LED_BLUE\r
-// #define LED_BLUE_TOGGLE {GPIOB->ODR ^= (1<<6);}\r
-// #define LED_BLUE_OFF {GPIOB->BSRRL = (1<<6);}\r
-// #define LED_BLUE_ON {GPIOB->BSRRH = (1<<6);}\r
-\r
-\r
-unsigned char Slider_Position[7];\r
-extern uint8_t t_bar[2];\r
-\r
-//==============================================================================\r
-// Channels\r
-//==============================================================================\r
-\r
-// Channel Source and Configuration: Always placed in ROM\r
-const TSL_ChannelSrc_T MyChannels_Src[TSLPRM_TOTAL_CHANNELS] = {\r
- { CHANNEL_0_SRC, CHANNEL_0_SAMPLE_CONFIG, CHANNEL_0_CHANNEL_CONFIG },\r
- { CHANNEL_1_SRC, CHANNEL_1_SAMPLE_CONFIG, CHANNEL_1_CHANNEL_CONFIG },\r
- { CHANNEL_2_SRC, CHANNEL_2_SAMPLE_CONFIG, CHANNEL_2_CHANNEL_CONFIG }\r
-};\r
-\r
-// Channel Destination: Always placed in ROM\r
-const TSL_ChannelDest_T MyChannels_Dest[TSLPRM_TOTAL_CHANNELS] = {\r
- { CHANNEL_0_DEST },\r
- { CHANNEL_1_DEST },\r
- { CHANNEL_2_DEST }\r
-};\r
-\r
-// Channel Data: Always placed in RAM\r
-TSL_ChannelData_T MyChannels_Data[TSLPRM_TOTAL_CHANNELS];\r
-\r
-//------\r
-// Banks\r
-//------\r
-\r
-// Always placed in ROM\r
-CONST TSL_Bank_T MyBanks[TSLPRM_TOTAL_BANKS] = {\r
- {&MyChannels_Src[0], &MyChannels_Dest[0], MyChannels_Data, BANK_0_NBCHANNELS, BANK_0_SHIELD_SAMPLE, BANK_0_SHIELD_CHANNEL} \r
-};\r
-\r
-\r
-//==============================================================================\r
-// Linear and Rotary sensors\r
-//==============================================================================\r
-\r
-// Data (RAM)\r
-TSL_LinRotData_T MyLinRots_Data[TSLPRM_TOTAL_LINROTS];\r
-\r
-// Parameters (RAM)\r
-TSL_LinRotParam_T MyLinRots_Param[TSLPRM_TOTAL_LINROTS];\r
-\r
-\r
-// State Machine (ROM)\r
-\r
-\r
-CONST TSL_State_T MyLinRots_StateMachine[] =\r
-{\r
- // Calibration states\r
- /* 0 */ { TSL_STATEMASK_CALIB, TSL_linrot_CalibrationStateProcess },\r
- /* 1 */ { TSL_STATEMASK_DEB_CALIB, TSL_linrot_DebCalibrationStateProcess },\r
- // Release states \r
- /* 2 */ { TSL_STATEMASK_RELEASE, TSL_linrot_ReleaseStateProcess },\r
-#if TSLPRM_USE_PROX > 0\r
- /* 3 */ { TSL_STATEMASK_DEB_RELEASE_PROX, TSL_linrot_DebReleaseProxStateProcess },\r
-#else\r
- /* 3 */ { TSL_STATEMASK_DEB_RELEASE_PROX, 0 },\r
-#endif\r
- /* 4 */ { TSL_STATEMASK_DEB_RELEASE_DETECT, TSL_linrot_DebReleaseDetectStateProcess },\r
- /* 5 */ { TSL_STATEMASK_DEB_RELEASE_TOUCH, TSL_linrot_DebReleaseTouchStateProcess },\r
-#if TSLPRM_USE_PROX > 0\r
- // Proximity states\r
- /* 6 */ { TSL_STATEMASK_PROX, TSL_linrot_ProxStateProcess },\r
- /* 7 */ { TSL_STATEMASK_DEB_PROX, TSL_linrot_DebProxStateProcess },\r
- /* 8 */ { TSL_STATEMASK_DEB_PROX_DETECT, TSL_linrot_DebProxDetectStateProcess },\r
- /* 9 */ { TSL_STATEMASK_DEB_PROX_TOUCH, TSL_linrot_DebProxTouchStateProcess },\r
-#else\r
- /* 6 */ { TSL_STATEMASK_PROX, 0 },\r
- /* 7 */ { TSL_STATEMASK_DEB_PROX, 0 },\r
- /* 8 */ { TSL_STATEMASK_DEB_PROX_DETECT, 0 },\r
- /* 9 */ { TSL_STATEMASK_DEB_PROX_TOUCH, 0 },\r
-#endif\r
- // Detect states\r
- /* 10 */ { TSL_STATEMASK_DETECT, TSL_linrot_DetectStateProcess },\r
- /* 11 */ { TSL_STATEMASK_DEB_DETECT, TSL_linrot_DebDetectStateProcess },\r
- // Touch state\r
- /* 12 */ { TSL_STATEMASK_TOUCH, TSL_linrot_TouchStateProcess },\r
- // Error states\r
- /* 13 */ { TSL_STATEMASK_ERROR, MyLinRots_ErrorStateProcess },\r
- /* 14 */ { TSL_STATEMASK_DEB_ERROR_CALIB, TSL_linrot_DebErrorStateProcess },\r
- /* 15 */ { TSL_STATEMASK_DEB_ERROR_RELEASE, TSL_linrot_DebErrorStateProcess },\r
- /* 16 */ { TSL_STATEMASK_DEB_ERROR_PROX, TSL_linrot_DebErrorStateProcess },\r
- /* 17 */ { TSL_STATEMASK_DEB_ERROR_DETECT, TSL_linrot_DebErrorStateProcess },\r
- /* 18 */ { TSL_STATEMASK_DEB_ERROR_TOUCH, TSL_linrot_DebErrorStateProcess },\r
- // Other states\r
- /* 19 */ { TSL_STATEMASK_OFF, MyLinRots_OffStateProcess }\r
-};\r
-\r
-// Methods for "extended" type (ROM)\r
-CONST TSL_LinRotMethods_T MyLinRots_Methods =\r
-{\r
- TSL_linrot_Init,\r
- TSL_linrot_Process,\r
- TSL_linrot_CalcPos\r
-};\r
-\r
-// Delta Normalization Process\r
-// The MSB is the integer part, the LSB is the real part\r
-// Examples:\r
-// - To apply a factor 1.10:\r
-// 0x01 to the MSB\r
-// 0x1A to the LSB (0.10 x 256 = 25.6 -> rounded to 26 = 0x1A)\r
-// - To apply a factor 0.90:\r
-// 0x00 to the MSB\r
-// 0xE6 to the LSB (0.90 x 256 = 230.4 -> rounded to 230 = 0xE6)\r
-CONST uint16_t MyLinRot_DeltaCoeff[3] = {0x0200, 0x0100, 0x0300};\r
-\r
-// LinRots list (ROM)\r
-CONST TSL_LinRot_T MyLinRots[TSLPRM_TOTAL_LINROTS] =\r
-{\r
- {&MyLinRots_Data[0], &MyLinRots_Param[0], &MyChannels_Data[CHANNEL_0_DEST],\r
- 3, // Number of channels\r
- MyLinRot_DeltaCoeff,\r
- (TSL_tsignPosition_T *)TSL_POSOFF_3CH_LIN_H,\r
- TSL_SCTCOMP_3CH_LIN_H,\r
- TSL_POSCORR_3CH_LIN_H, \r
- MyLinRots_StateMachine,\r
- &MyLinRots_Methods}\r
-};\r
-\r
-//----------------\r
-// Generic Objects\r
-//----------------\r
-\r
-// List (ROM)\r
-CONST TSL_Object_T MyObjects[TSLPRM_TOTAL_OBJECTS] =\r
-{\r
- { TSL_OBJ_LINEAR, (TSL_LinRot_T *)&MyLinRots[0] }\r
-};\r
-\r
-// Group (RAM)\r
-TSL_ObjectGroup_T MyObjGroup =\r
-{\r
- &MyObjects[0], // First object\r
- TSLPRM_TOTAL_OBJECTS, // Number of objects\r
- 0x00, // State mask reset value\r
- TSL_STATE_NOT_CHANGED // Current state\r
-};\r
-\r
-//-------------------------------------------\r
-// TSL Common Parameters placed in RAM or ROM\r
-// --> external declaration in tsl_conf.h\r
-//-------------------------------------------\r
-\r
-TSL_Params_T TSL_Params =\r
-{\r
- TSLPRM_ACQ_MIN,\r
- TSLPRM_ACQ_MAX,\r
- TSLPRM_CALIB_SAMPLES,\r
- TSLPRM_DTO,\r
-#if TSLPRM_TOTAL_TKEYS > 0 \r
- MyTKeys_StateMachine, // Default state machine for TKeys\r
- &MyTKeys_Methods, // Default methods for TKeys\r
-#endif\r
-#if TSLPRM_TOTAL_LNRTS > 0\r
- MyLinRots_StateMachine, // Default state machine for LinRots\r
- &MyLinRots_Methods // Default methods for LinRots\r
-#endif\r
-};\r
-\r
-\r
-/* Private functions prototype -----------------------------------------------*/\r
-\r
-void TSL_user_InitGPIOs(void);\r
-void TSL_user_SetThresholds(void);\r
-\r
-/* Global variables ----------------------------------------------------------*/\r
-\r
-TSL_tTick_ms_T ECS_last_tick; // Hold the last time value for ECS\r
-uint32_t process_sensor; // asserted when there is no ECS => a finger is on the linear sensor\r
-\r
-\r
-/**\r
- * @brief Initialize the STMTouch Driver\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_user_Init(void)\r
-{\r
-#if TSLPRM_USE_SHIELD == 0\r
- TSL_user_InitGPIOs();\r
-#endif\r
-\r
- TSL_obj_GroupInit(&MyObjGroup); // Init Objects\r
- \r
- TSL_Init(MyBanks); // Init timing and acquisition modules\r
- \r
- TSL_user_SetThresholds(); // Init thresholds for each object individually\r
-}\r
-\r
-\r
-/**\r
- * @brief Execute STMTouch Driver main State machine\r
- * @param None\r
- * @retval status Return TSL_STATUS_OK if the acquisition is done\r
- */\r
-TSL_Status_enum_T TSL_user_Action(void)\r
-{\r
- static uint8_t idx_bank=0;\r
- static uint8_t ConfigDone=0;\r
- TSL_Status_enum_T status;\r
- \r
- if(!ConfigDone)\r
- {\r
- // Configure Bank\r
- TSL_acq_BankConfig(idx_bank);\r
- \r
- // Start Bank acquisition\r
- TSL_acq_BankStartAcq();\r
- \r
- // Set flag\r
- ConfigDone=1;\r
- }\r
- \r
- // Check Bank End of Acquisition\r
- if (TSL_acq_BankWaitEOC() == TSL_STATUS_OK)\r
- {\r
- // Get Bank Result\r
- TSL_acq_BankGetResult(idx_bank, 0, 0);\r
- ConfigDone=0;\r
- idx_bank++;\r
- }\r
- \r
-\r
- if(idx_bank == TSLPRM_TOTAL_BANKS)\r
- {\r
- idx_bank=0;\r
- \r
- // Process Objects\r
- TSL_obj_GroupProcess(&MyObjGroup);\r
- \r
- // DxS processing\r
- // Warning: TSLPRM_USE_DXS must be set !!!\r
- TSL_dxs_FirstObj(&MyObjGroup);\r
-\r
- // ECS every 100ms\r
- if (TSL_tim_CheckDelay_ms(100, &ECS_last_tick) == TSL_STATUS_OK)\r
- {\r
- LED_BLUE_TOGGLE;\r
- if (TSL_ecs_Process(&MyObjGroup) == TSL_STATUS_OK)\r
- {\r
- LED_GREEN_ON;\r
- process_sensor = 0;\r
- }\r
- else\r
- {\r
- LED_GREEN_OFF;\r
- process_sensor = 1;\r
- }\r
- }\r
-\r
- \r
- status = TSL_STATUS_OK; // All banks have been acquired and sensors processed\r
- \r
- }\r
- else\r
- {\r
- status = TSL_STATUS_BUSY;\r
- }\r
- \r
- return status;\r
-}\r
-\r
-\r
-/**\r
- * @brief Manage the activity on sensors when touched/released (example)\r
- * @param None\r
- * @retval None\r
- */\r
-void ProcessSensors(void)\r
-{\r
- uint16_t Max_Value = 256/(9-TSLPRM_LINROT_RESOLUTION);\r
-\r
- uint16_t Message[6]; \r
- uint32_t percent_value;\r
- Message[0] = ' ';\r
- Message[1] = ' ';\r
- Message[2] = ' ';\r
- /*Add "%" in message*/ \r
- Message[3] = '°' ;\r
- Message[4] = '/' ;\r
- Message[5] = '%' ;\r
-\r
- if (!process_sensor) \r
- {\r
- /*Display message*/\r
- LCD_GLASS_DisplayStrDeci(Message); \r
- return;\r
- }\r
- \r
- /* get Slider position and convert it in percent*/\r
- percent_value = MyLinRots[0].p_Data->Position ;\r
- percent_value *= 10000;\r
- percent_value /= Max_Value;\r
- /*Convert percent value in char and store it in message*/ \r
- convert_into_char(percent_value,Message);\r
- /*Add "%" in message*/ \r
- Message[3] = '°' ;\r
- Message[4] = '/' ;\r
- Message[5] = '%' ;\r
- /*Display message*/\r
- LCD_GLASS_DisplayStrDeci(Message); \r
- \r
-}\r
-\r
-/**\r
- * @brief Manage the activity on sensors when touched/released (example)\r
- * @param None\r
- * @retval None\r
- */\r
-void ProcessSensorsButtons(void)\r
-{\r
- uint8_t Message[6]; \r
- \r
- /* Prepare Message to display*/\r
- Message[0] = ' ';\r
- Message[1] = '0';\r
- Message[2] = '0';\r
- Message[3] = '0';\r
- Message[4] = '0';\r
- Message[5] = ' ';\r
-\r
- if (process_sensor) \r
- {\r
- \r
- #ifdef STM32L1XX_MDP // for medium density plus device\r
- if( MyLinRots[0].p_Data->Position > 118 )\r
- Message[4] = 255; \r
- else if( MyLinRots[0].p_Data->Position > 80 ) \r
- Message[3] = 255; \r
- else if( MyLinRots[0].p_Data->Position > 5 ) \r
- Message[2] = 255; \r
- else \r
- Message[1] = 255; \r
- #else // for medium density device\r
- if( MyLinRots[0].p_Data->Position < 127 )\r
- {\r
- if( MyLinRots[0].p_Data->Position > 110 )\r
- Message[4] = 255; \r
- else if( MyLinRots[0].p_Data->Position > 80 ) \r
- Message[3] = 255; \r
- else if( MyLinRots[0].p_Data->Position > 5 ) \r
- Message[2] = 255; \r
- else \r
- Message[1] = 255; \r
- }\r
- #endif \r
-\r
- }\r
- LCD_GLASS_DisplayString(Message);\r
- \r
-}\r
-\r
-\r
-\r
-/**\r
- * @brief Initializes the TouchSensing GPIOs.\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_user_InitGPIOs(void)\r
-{\r
- // Configure the Shield IO (PX.y) to ground when not used.\r
-\r
-\r
-}\r
-\r
-\r
-/**\r
- * @brief Set thresholds for each object (optional).\r
- * @param None\r
- * @retval None\r
- */\r
-void TSL_user_SetThresholds(void)\r
-{\r
- // Example: Decrease the Detect thresholds for the TKEY 0\r
- //MyTKeys_Param[0].DetectInTh -= 10;\r
- //MyTKeys_Param[0].DetectOutTh -= 10;\r
- \r
-}\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r