The touch detects that a key is pressed and the calling process is: TSL_Action -> TSL_SCKEY_P1_Acquisition() -> TSL_IO_Acquisition() -> TSL_SCKey_Process() -> TSL_SCKey_DetectedTreatment(), where TSL_Action() and TSL_SCKey_Process() have other state changes and processing.
The TSL_IO_Acquisition() function is a charge and discharge time detection function. The most important variables should be the charge and discharge time and the number of times it is detected that the value exceeds the preset range. They will be used outside the function, namely FinalMeasurementValue and RejectionCounter.
void TSL_IO_SW_Burst_Wait_Vil(void)//Only view the contents of IAR compiler
{
#if defined(_COSMIC_)
......
#elif defined(_IAR_)
__asm("ld a, S:AcquisitionBitMask"); //Put AcquisitionBitMask into a
__asm("ldw x, S:sTouchIO"); // Put sTouchIO into x Load word (16 bits)
__asm("incw x"); //Add a word
// Loop = 1 + 1 + 2 + 2 + 2 cycles = 8 cycles
__asm("WaitForVil:");
// To be sure that the loop last 8 cycles the first instruction must be a 1-byte instruction
// This is to be sure it is fully fetched in 1 cycle. The second instruction must be shorter than 4 bytes.
// If this not the case, the code must be aligned.
__asm("bcp a, (x)"); // 1 cycles logical comparison
__asm("jreq ??EndWaitForVil"); //Jump to EndWaitForVil
__asm("ldw y, TIMACQ_CNTR"); // 2 cycles; hw counter also used for timeout ...
__asm("cpw y, #0x0E00"); // 2 cycles; Timeout compare word value comparison
__asm("jrult ??WaitForVil");
__asm("EndWaitForVil:");
#else //_RAISONANCE_
......
#endif
}
The general meaning of this function is to detect the level of the corresponding pin until the same level or timeout jumps out. The value of the TIMACQ_CNTR counter should be loaded in FinalMeasurementValue (I don’t know if it is correct, please correct me)
Previous article:stm8l wake-up operation encountered a problem
Next article:Detailed explanation of STM8S touch button firmware library
Recommended ReadingLatest update time:2024-11-16 13:33
- Popular Resources
- Popular amplifiers
- STM8 C language programming (1) - basic program and startup code analysis
- Description of the BLDC back-EMF sampling method based on the STM8 official library
- Simulation and Modeling of Chemical Sensors Volume 5 Electro-Optical Sensors Part 1 Photocopy
- STM32 MCU project example: Smart watch design based on TouchGFX (8) Associating the underlying driver with the UI
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [Project source code] [Modelsim FAQ] vsim-3033 Instantiation of 'xxxx' failed
- micropython update: 2020.12
- Collaborative SI-PI-EMI Simulation of Chip-Package-System (CPS)
- [Sipeed LicheeRV 86 Panel Review] The board is not responding
- Use stm32l452 to drive hts221 and stts751 routine
- [National Technology N32WB452 Review] + Basic Function Usage
- Will demand for SiC FETs increase in the future?
- Problems with pressure maintenance of testing machine
- Testing a battery-powered product with a 26K resistor between the battery pads (no battery is soldered at this time!),...
- When TMS320F28377D runs CLA, it shows that Cla1Task2 does not contain frame information