当前位置:网站首页>STM32 key light
STM32 key light
2022-07-04 00:08:00 【Flamingo39】
STM32 Key development
The basic principle of key scanning
Key signal recognition
Generally speaking , One end of the two pins of the key is pulled up to the high level through the resistance , The other end is grounded . stay There is no key press When , The input pin is high , When There are buttons to press , The input pin is low . By repeatedly reading the signal of the key input pin , Then identify the high and low level to judge whether there is a key trigger .
Why shake
The low level of the input pin of the key does not mean that the key must be pressed , Maybe it's a jamming signal , therefore , It needs to be processed by de dithering , Filter these interference signals , So as to obtain the real key trigger signal .
How to shake
After detecting the low level of the key input pin for the first time , A little delay , Read the pin again , If it is still low , It is confirmed as the key trigger signal ; otherwise , Judged as interference signal , Not to deal with .
GPIO Input level reading HAL Library function
GPIO_PinState HAL_GPIO_ReadPin( GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
Parameters 1:GPIOx, Port number , Such as :GPIOB,GPIOF.
Parameters 2:GPIO_Pin, Pin number , Such as :GPIO_PIN_9,GPIO_PIN_12.
Return value :GPIO_PinState, The level state of the pin .
Application, for example, : Judge PC13 Input signal of pin , If high , Will PB9 Pin controlled LED The switch state of the lamp is switched .
if(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_13) == GPIO_PIN_SET)
{
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_9);
}

边栏推荐
- AI Challenger 2018 text mining competition related solutions and code summary
- Qtcharts notes (V) scatter diagram qscatterseries
- Powerful blog summary
- Private project practice sharing populate joint query in mongoose makes the template unable to render - solve the error message: syntaxerror: unexpected token r in JSON at
- 炒股開戶傭金優惠怎麼才能獲得,網上開戶安全嗎
- BBS forum recommendation
- Live app source code, jump to links outside the station or jump to pages inside the platform
- Briefly understand the operation mode of developing NFT platform
- Kubedl hostnetwork: accelerating the efficiency of distributed training communication
- [complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!
猜你喜欢

Selenium check box

Vscode regular match replace console log(.*)
![[PHP basics] cookie basics, application case code and attack and defense](/img/7c/551b79fd5dd8a411de85c800c3a034.jpg)
[PHP basics] cookie basics, application case code and attack and defense
![[Happy Valentine's day]](/img/d9/9280398eb64907a567df6eea772adb.jpg)
[Happy Valentine's day] "I still like you very much, like sin ² a+cos ² A consistent "(white code in the attached table)
![[NLP] text classification still stays at Bert? Duality is too strong than learning framework](/img/49/1ff6025bdb0445e5638c1451e0b267.jpg)
[NLP] text classification still stays at Bert? Duality is too strong than learning framework

Private project practice sharing populate joint query in mongoose makes the template unable to render - solve the error message: syntaxerror: unexpected token r in JSON at

EPF: a fuzzy testing framework for network protocols based on evolution, protocol awareness and coverage guidance

Briefly understand the operation mode of developing NFT platform

Iclr2022: how does AI recognize "things I haven't seen"?

Analysis on the scale of China's smart health industry and prediction report on the investment trend of the 14th five year plan 2022-2028 Edition
随机推荐
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
Analysis: misunderstanding of choosing WMS warehouse management system
What does redis do? Redis often practices grammar every day
Research Report on the scale prediction of China's municipal engineering industry and the prospect of the 14th five year plan 2022-2028
Social network analysis -social network analysis
Fluent learning (4) listview
Investment demand and income forecast report of China's building ceramics industry, 2022-2028
[PHP basics] cookie basics, application case code and attack and defense
2020.2.14
Yyds dry goods inventory three JS source code interpretation - getobjectbyproperty method
D25:sequence search (sequence search, translation + problem solving)
Test the influence of influent swacth on the electromagnetic coil of quartz meter
Selenium library 4.5.0 keyword explanation (4)
It is forbidden to splice SQL in code
IO flow principle and classification
1214 print diamond
Les sociétés de valeurs mobilières dont la Commission d'ouverture d'un compte d'actions est la plus faible ont ce que tout le monde recommande.
网上的低佣金链接安全吗?招商证券怎么开户?
Sword finger offer day 4 (Sword finger offer 03. duplicate numbers in the array, sword finger offer 53 - I. find the number I in the sorted array, and the missing numbers in sword finger offer 53 - ii
P3371 [template] single source shortest path (weakened version)