#include "stm32f10x.h" // Device header
#include "led.h"
#include "key.h"
#include "OLED.h"
int main(void)
{
LED_GPIO_Config(); //初始化LED函数
Key_GPIO_Config(); //初始化key函数
OLED_Init(); //初始化OLED函数
int count=0; //定义一个变量
OLED_ShowNum(2,3,1,2);
while(1)
{
uint8_t KeyVal = Key_Scan(KEY1_GPIO_PORT,KEY1_GPIO_PIN);//查询按键状态
if(KeyVal==KEY_ON) //按键按下
{
count++;
OLED_ShowNum(2,3,count,2);//OLED显示
LED1_TOGGLE;//灯亮
}
}
}
记录学习stm32f103c8t6(标准库)过程