55 lines
927 B
C
55 lines
927 B
C
|
|
#include "sys.h"
|
|||
|
|
#include "usart.h"
|
|||
|
|
#include "delay.h"
|
|||
|
|
#include "led.h"
|
|||
|
|
#include "key.h"
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
|
|||
|
|
|
|||
|
|
//STM32H7<48><37><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>-HAL<41>⺯<EFBFBD><E2BAAF><EFBFBD>汾
|
|||
|
|
//DevEBox <20><>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD>
|
|||
|
|
//<2F>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>̣<EFBFBD>mcudev.taobao.com
|
|||
|
|
//<2F>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>̣<EFBFBD>shop389957290.taobao.com
|
|||
|
|
|
|||
|
|
u8 key;
|
|||
|
|
u8 LED2_sta = 0;
|
|||
|
|
|
|||
|
|
int main(void)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
Cache_Enable(); //<2F><><EFBFBD><EFBFBD>L1-Cache
|
|||
|
|
HAL_Init(); //<2F><>ʼ<EFBFBD><CABC>HAL<41><4C>
|
|||
|
|
Stm32_Clock_Init(160,5,2,4); //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>,400Mhz
|
|||
|
|
delay_init(400); //<2F><>ʱ<EFBFBD><CAB1>ʼ<EFBFBD><CABC>
|
|||
|
|
uart_init(115200); //<2F><><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
|
LED_Init(); //<2F><>ʼ<EFBFBD><CABC>LEDʱ<44><CAB1>
|
|||
|
|
KEY_Init(); //<2F><>ʼ<EFBFBD><CABC><EFBFBD>밴<EFBFBD><EBB0B4><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD>ӿ<EFBFBD>
|
|||
|
|
LED2(0); //<2F>ȵ<EFBFBD><C8B5><EFBFBD>LED2
|
|||
|
|
while(1)
|
|||
|
|
{
|
|||
|
|
key=KEY_Scan(0); //<2F>õ<EFBFBD><C3B5><EFBFBD>ֵ
|
|||
|
|
|
|||
|
|
if(key)
|
|||
|
|
{
|
|||
|
|
switch(key)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
case KEY1_PRES: //<2F><><EFBFBD><EFBFBD>LED2<44><32><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
LED2_sta=0;
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case KEY2_PRES: //<2F><><EFBFBD><EFBFBD>LED2<44><32>ת
|
|||
|
|
LED2_sta=!LED2_sta;
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
LED2(LED2_sta); //<2F><><EFBFBD><EFBFBD>LED1״̬
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
delay_ms(10);
|
|||
|
|
}
|
|||
|
|
}
|