41 lines
983 B
C
41 lines
983 B
C
#include "debug.h"
|
|
|
|
void GPIO_LED_Init(void)
|
|
{
|
|
GPIO_InitTypeDef GPIO_InitStructure = {0};
|
|
|
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
|
|
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
|
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
|
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
|
|
SystemCoreClockUpdate();
|
|
Delay_Init();
|
|
|
|
#if (SDI_PRINT == SDI_PR_OPEN)
|
|
SDI_Printf_Enable();
|
|
#else
|
|
USART_Printf_Init(115200);
|
|
#endif
|
|
|
|
printf("SystemClk: %ld\r\n", SystemCoreClock);
|
|
printf("DeviceID: %08lx\r\n", DBGMCU_GetDEVID());
|
|
printf("ChipID: %08lx\r\n", DBGMCU_GetCHIPID());
|
|
|
|
GPIO_LED_Init();
|
|
|
|
while(1)
|
|
{
|
|
Delay_Ms(1000);
|
|
printf("On\r\n");
|
|
GPIO_WriteBit(GPIOA, GPIO_Pin_0, Bit_SET);
|
|
Delay_Ms(1000);
|
|
printf("Off\r\n");
|
|
GPIO_WriteBit(GPIOA, GPIO_Pin_0, Bit_RESET);
|
|
}
|
|
}
|