1859 views|1 replies

137

Posts

0

Resources
The OP
 

[Ateli Development Board AT32F421 Review] + Buttons are coming [Copy link]

 This post was last edited by Xidian Zhong Lingyuxiu on 2021-4-21 23:39

As you can see, it may be written simply. In fact, it is indeed very simple .

Please read the program and slowly understand it. This is for those who have some basic knowledge, so please don't watch it.

Buttons, don’t think they are just buttons. In industrial control, most sensors also use button functions. High and low level conversion outputs are button inputs for MCU.

The button code still uses the original STM32F030C8T6 template.

Button initialization code:

#if KEY1_EN

/* Enable the key port clock */
RCC_AHBPeriphClockCmd( KEY1_GPIO_CLK, ENABLE );
/* Configure the KEY pin as input */
GPIO_StructInit( &GPIO_InitStructure );

//Select the key pin
GPIO_InitStructure.GPIO_Pins = KEY1_GPIO_PIN;
// Set the key pin
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; // Set input
GPIO_InitStructure.GPIO_Pull = GPIO_Pull_NOPULL; // Pull down // GPIO_PuPd_NOPULL GPIO_PuPd_DOWN
GPIO_InitStructure.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz;
// Use the structure to initialize the key
GPIO_Init( KEY1_GPIO_PORT, &GPIO_InitStructure );
#endif

Finally, upload the button source code. A button test function is made in the main function.

按键1.jpg (121.57 KB, downloads: 0)

按键定义

按键定义

按键3.jpg (87 KB, downloads: 0)

按键使能及采集

按键使能及采集

02_KEY.7z

3 MB, downloads: 5

This post is from Domestic Chip Exchange

Latest reply

Come on, thank you for sharing, looking forward to the follow-up!   Details Published on 2021-4-22 17:17
 
 

7422

Posts

2

Resources
2
 

Come on, thank you for sharing, looking forward to the follow-up!

This post is from Domestic Chip Exchange
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list