/********************************** (C) COPYRIGHT ******************************* * File Name : main.c * Author : WCH * Version : V1.0.0 * Date : 2022/08/08 * Description : Main program body. * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd. * SPDX-License-Identifier: Apache-2.0 *******************************************************************************/ #include "debug.h" /* Global define */ /* Global Variable */ /********************************************************************* * @fn GPIO_Toggle_INIT * * @brief Initializes GPIOD.4 * * @return none */ void GPIO_LED_Init(void) { GPIO_InitTypeDef GPIO_InitStructure = {0}; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); } /********************************************************************* * @fn main * * @brief Main program. * * @return none */ int main(void) { NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); 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(GPIOD, GPIO_Pin_4, Bit_SET); Delay_Ms(1000); printf("Off\r\n"); GPIO_WriteBit(GPIOD, GPIO_Pin_4, Bit_RESET); } }