#include "stm32f10x.h" //STM32
#include "matrix_key.h"
#include "usart.h"
// 此表为LED的字模 0 1 2 3 4 5 6 7 8 9 a b c d e f
unsigned char LED7Code[] = {~0x3F,~0x06,~0x5B,~0x4F,~0x66,~0x6D,~0x7D,~0x07,~0x7F,~0x6F,~0x77,~0x7C,~0x39,~0x5E,~0x79,~0x71};
int x;
int main(void){
RCC_Configuration(); //时钟设置
USART1_Init(115200); //串口初始化波特率
GPIO_Configuration55();//GPIO_Configuration44();
GPIO_Write(GPIOA, LED7Code[8]);//数码管全亮
while(1)
{
x=keyscan55();//扫描按键,返回按键值
//x=keyscan44();)
printf("%d ",x);//串口输出
if (x>=0)
{
GPIO_Write(GPIOA, LED7Code[x]); //显示按键值;
}
}
}
|
———————————————— 版权声明:本文为CSDN博主「Baal Austin」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/weixin_44529350/article/details/109163581