From 7d7389cac55952fcb794d2632747a8adc1e119ee Mon Sep 17 00:00:00 2001 From: Dien-Nhung Nguyen-Phu Date: Wed, 15 May 2024 12:43:35 +0700 Subject: init blink project generated project from EVT --- src/main.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/main.c (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..f504d29 --- /dev/null +++ b/src/main.c @@ -0,0 +1,30 @@ +#include "CH58x_common.h" +#include "CH58x_sys.h" + +void led_init(void) +{ + GPIOA_SetBits(GPIO_Pin_10); + GPIOA_ResetBits(GPIO_Pin_12); + GPIOA_ModeCfg(GPIO_Pin_10, GPIO_ModeOut_PP_5mA); + GPIOA_ModeCfg(GPIO_Pin_12, GPIO_ModeOut_PP_5mA); +} + +void led_toggle(void) +{ + GPIOA_InverseBits(GPIO_Pin_10); + GPIOA_InverseBits(GPIO_Pin_12); +} + +int main() +{ + SetSysClock(CLK_SOURCE_PLL_60MHz); + + led_init(); + + while(1) + { + mDelaymS(100); + led_toggle(); + } +} + -- cgit v1.2.3