From 0be7187865a70f711390f92cd272f0c353a9fce9 Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Fri, 6 Dec 2024 21:16:20 -0800 Subject: [PATCH] copied over blink program from IDE developed program I wrote. --- src/main.c | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index 23fbcc0..83dc6ca 100644 --- a/src/main.c +++ b/src/main.c @@ -1,8 +1,44 @@ -#include "stdio.h" +#include "debug.h" -int main(int argc, char **argv) +/* Global typedef */ + +/* Global define */ + +/* Global Variable */ + +void GPIO_Toggle_INIT(void) { - printf("Hello!\n"); - return 0; + GPIO_InitTypeDef GPIO_InitStructure = {0}; + + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_Init(GPIOA, &GPIO_InitStructure); +} + +/** + * @fn main + * @brief Main program + * @return none + */ + +int main(void) +{ + u8 i = 0; + + NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); + SystemCoreClockUpdate(); + Delay_Init(); + //USART_Printf_Init(115200); + //printf("SystemClk:%d\r\n", SystemCoreClock); + //printf( "ChipID:%08x\r\n", DBGMCU_GetCHIPID() ); + //printf("GPIO Toggle TEST\r\n"); + GPIO_Toggle_INIT(); + + while(1) + { + Delay_Ms(250); + GPIO_WriteBit(GPIOA, GPIO_Pin_1, (i == 0) ? (i = Bit_SET) : (i = Bit_RESET)); + } } -