Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of TUKS-COURSE-TIMER by
stm32l4xx_hal_tsc.c File Reference
This file provides firmware functions to manage the following functionalities of the Touch Sensing Controller (TSC) peripheral: + Initialization and De-initialization + Channel IOs, Shield IOs and Sampling IOs configuration + Start and Stop an acquisition + Read acquisition result + Interrupts and flags management. More...
Go to the source code of this file.
Functions | |
static uint32_t | TSC_extract_groups (uint32_t iomask) |
Utility function used to set the acquired groups mask. | |
HAL_StatusTypeDef | HAL_TSC_Init (TSC_HandleTypeDef *htsc) |
Initialize the TSC peripheral according to the specified parameters in the TSC_InitTypeDef structure and initialize the associated handle. | |
HAL_StatusTypeDef | HAL_TSC_DeInit (TSC_HandleTypeDef *htsc) |
Deinitialize the TSC peripheral registers to their default reset values. | |
__weak void | HAL_TSC_MspInit (TSC_HandleTypeDef *htsc) |
Initialize the TSC MSP. | |
__weak void | HAL_TSC_MspDeInit (TSC_HandleTypeDef *htsc) |
DeInitialize the TSC MSP. | |
HAL_StatusTypeDef | HAL_TSC_Start (TSC_HandleTypeDef *htsc) |
Start the acquisition. | |
HAL_StatusTypeDef | HAL_TSC_Start_IT (TSC_HandleTypeDef *htsc) |
Start the acquisition in interrupt mode. | |
HAL_StatusTypeDef | HAL_TSC_Stop (TSC_HandleTypeDef *htsc) |
Stop the acquisition previously launched in polling mode. | |
HAL_StatusTypeDef | HAL_TSC_Stop_IT (TSC_HandleTypeDef *htsc) |
Stop the acquisition previously launched in interrupt mode. | |
HAL_StatusTypeDef | HAL_TSC_PollForAcquisition (TSC_HandleTypeDef *htsc) |
Start acquisition and wait until completion. | |
TSC_GroupStatusTypeDef | HAL_TSC_GroupGetStatus (TSC_HandleTypeDef *htsc, uint32_t gx_index) |
Get the acquisition status for a group. | |
uint32_t | HAL_TSC_GroupGetValue (TSC_HandleTypeDef *htsc, uint32_t gx_index) |
Get the acquisition measure for a group. | |
HAL_StatusTypeDef | HAL_TSC_IOConfig (TSC_HandleTypeDef *htsc, TSC_IOConfigTypeDef *config) |
Configure TSC IOs. | |
HAL_StatusTypeDef | HAL_TSC_IODischarge (TSC_HandleTypeDef *htsc, uint32_t choice) |
Discharge TSC IOs. | |
HAL_TSC_StateTypeDef | HAL_TSC_GetState (TSC_HandleTypeDef *htsc) |
Return the TSC handle state. | |
void | HAL_TSC_IRQHandler (TSC_HandleTypeDef *htsc) |
Handle TSC interrupt request. | |
__weak void | HAL_TSC_ConvCpltCallback (TSC_HandleTypeDef *htsc) |
Acquisition completed callback in non-blocking mode. | |
__weak void | HAL_TSC_ErrorCallback (TSC_HandleTypeDef *htsc) |
Error callback in non-blocking mode. |
Detailed Description
This file provides firmware functions to manage the following functionalities of the Touch Sensing Controller (TSC) peripheral: + Initialization and De-initialization + Channel IOs, Shield IOs and Sampling IOs configuration + Start and Stop an acquisition + Read acquisition result + Interrupts and flags management.
- Version:
- V1.5.1
- Date:
- 31-May-2016
================================================================================ ##### TSC specific features ##### ================================================================================ [..] (#) Proven and robust surface charge transfer acquisition principle (#) Supports up to 3 capacitive sensing channels per group (#) Capacitive sensing channels can be acquired in parallel offering a very good response time (#) Spread spectrum feature to improve system robustness in noisy environments (#) Full hardware management of the charge transfer acquisition sequence (#) Programmable charge transfer frequency (#) Programmable sampling capacitor I/O pin (#) Programmable channel I/O pin (#) Programmable max count value to avoid long acquisition when a channel is faulty (#) Dedicated end of acquisition and max count error flags with interrupt capability (#) One sampling capacitor for up to 3 capacitive sensing channels to reduce the system components (#) Compatible with proximity, touchkey, linear and rotary touch sensor implementation ##### How to use this driver ##### ================================================================================ [..] (#) Enable the TSC interface clock using __HAL_RCC_TSC_CLK_ENABLE() macro. (#) GPIO pins configuration (++) Enable the clock for the TSC GPIOs using __HAL_RCC_GPIOx_CLK_ENABLE() macro. (++) Configure the TSC pins used as sampling IOs in alternate function output Open-Drain mode, and TSC pins used as channel/shield IOs in alternate function output Push-Pull mode using HAL_GPIO_Init() function. (#) Interrupts configuration (++) Configure the NVIC (if the interrupt model is used) using HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ() and function. (#) TSC configuration (++) Configure all TSC parameters and used TSC IOs using HAL_TSC_Init() function. [..] TSC peripheral alternate functions are mapped on AF9. *** Acquisition sequence *** =================================== [..] (+) Discharge all IOs using HAL_TSC_IODischarge() function. (+) Wait a certain time allowing a good discharge of all capacitors. This delay depends of the sampling capacitor and electrodes design. (+) Select the channel IOs to be acquired using HAL_TSC_IOConfig() function. (+) Launch the acquisition using either HAL_TSC_Start() or HAL_TSC_Start_IT() function. If the synchronized mode is selected, the acquisition will start as soon as the signal is received on the synchro pin. (+) Wait the end of acquisition using either HAL_TSC_PollForAcquisition() or HAL_TSC_GetState() function or using WFI instruction for example. (+) Check the group acquisition status using HAL_TSC_GroupGetStatus() function. (+) Read the acquisition value using HAL_TSC_GroupGetValue() function.
Table 1. IOs for the STM32L4xx devices +--------------------------------+ | IOs | TSC functions | |--------------|-----------------| | PB12 (AF) | TSC_G1_IO1 | | PB13 (AF) | TSC_G1_IO2 | | PB14 (AF) | TSC_G1_IO3 | | PB15 (AF) | TSC_G1_IO4 | |--------------|-----------------| | PB4 (AF) | TSC_G2_IO1 | | PB5 (AF) | TSC_G2_IO2 | | PB6 (AF) | TSC_G2_IO3 | | PB7 (AF) | TSC_G2_IO4 | |--------------|-----------------| | PA15 (AF) | TSC_G3_IO1 | | PC10 (AF) | TSC_G3_IO2 | | PC11 (AF) | TSC_G3_IO3 | | PC12 (AF) | TSC_G3_IO4 | |--------------|-----------------| | PC6 (AF) | TSC_G4_IO1 | | PC7 (AF) | TSC_G4_IO2 | | PC8 (AF) | TSC_G4_IO3 | | PC9 (AF) | TSC_G4_IO4 | |--------------|-----------------| | PE10 (AF) | TSC_G5_IO1 | | PE11 (AF) | TSC_G5_IO2 | | PE12 (AF) | TSC_G5_IO3 | | PE13 (AF) | TSC_G5_IO4 | |--------------|-----------------| | PD10 (AF) | TSC_G6_IO1 | | PD11 (AF) | TSC_G6_IO2 | | PD12 (AF) | TSC_G6_IO3 | | PD13 (AF) | TSC_G6_IO4 | |--------------|-----------------| | PE2 (AF) | TSC_G7_IO1 | | PE3 (AF) | TSC_G7_IO2 | | PE4 (AF) | TSC_G7_IO3 | | PE5 (AF) | TSC_G7_IO4 | |--------------|-----------------| | PF14 (AF) | TSC_G8_IO1 | | PF15 (AF) | TSC_G8_IO2 | | PG0 (AF) | TSC_G8_IO3 | | PG1 (AF) | TSC_G8_IO4 | |--------------|-----------------| | PB10 (AF) | TSC_SYNC | | PD2 (AF) | | +--------------------------------+
- Attention:
© COPYRIGHT(c) 2016 STMicroelectronics
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file stm32l4xx_hal_tsc.c.
Generated on Tue Jul 12 2022 17:38:52 by
