diff options
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();
+ }
+}
+
|