diff options
| author | Dien-Nhung Nguyen-Phu <kein@kienlab.com> | 2024-05-15 12:43:35 +0700 |
|---|---|---|
| committer | Dien-Nhung Nguyen-Phu <kein@kienlab.com> | 2024-06-03 11:33:00 +0700 |
| commit | 7d7389cac55952fcb794d2632747a8adc1e119ee (patch) | |
| tree | 3a444aff2c9cc739b0f1b10d35af400c53ff9c6c /src | |
| parent | 93877fd60df56ff8d621546e0398aa2d86d991a1 (diff) | |
init blink project
generated project from EVT
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.c | 30 |
1 files changed, 30 insertions, 0 deletions
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();
+ }
+}
+
|