99526cc047
feat: move MRS demo source to bsp and libraries folder feat: update Sconscript feat: modify SConstruct in the bsp feat: use the rtconfig.py of gd32vf103v-eval bsp to modify feat: use the MRS's rtconfig.h temoporarily feat: update Kconfig files feat: use the MRS's .ld and rename as link.lds feat: add ch32v1 porting folder perf: remove board/system_ch32v10x.c fix: define SOC_ARM_SERIES_CH32V103 in rtconfig.h fix: add some neccessary macros in rtconfig.h perf: use the menuconfig to generate rtconfig.h feat: add readme.md fix: correct the bad encode in main.c fix: include board.h in main.c perf: check and update README.md perf: remove ch32f10x_port_cn.md feat: ignore the standard libraries's CI checking feat: add sdk_dist.py fix: correct some style errors again perf: simply the board/kconfig fix: format ch32v103r-evt fix: format drvs and libcpu
74 lines
1.6 KiB
C
74 lines
1.6 KiB
C
/*
|
|
* Copyright (c) 2006-2022, RT-Thread Development Team
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* Change Logs:
|
|
* Date Author Notes
|
|
* 2020-04-03 WCH first version
|
|
* 2022-04-05 Blta modify some formats
|
|
*/
|
|
#include <rtthread.h>
|
|
#include <board.h>
|
|
|
|
|
|
/* Global typedef */
|
|
|
|
/* Global define */
|
|
|
|
/* LED0(PA1) usd pin device */
|
|
#define LED0_PIN 15
|
|
|
|
/* Global Variable */
|
|
|
|
/* LED1 initialization */
|
|
void LED1_BLINK_INIT(void)
|
|
{
|
|
GPIO_InitTypeDef GPIO_InitStructure = {0};
|
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
|
|
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
|
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
|
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
|
}
|
|
|
|
/* main thread */
|
|
int main(void)
|
|
{
|
|
rt_kprintf("\r\n MCU: CH32V103C8T6\r\n");
|
|
rt_kprintf(" SysClk: %dHz\r\n", SystemCoreClock);
|
|
rt_kprintf(" www.wch.cn\r\n");
|
|
LED1_BLINK_INIT();
|
|
|
|
GPIO_ResetBits(GPIOA, GPIO_Pin_0);
|
|
while(1)
|
|
{
|
|
GPIO_SetBits(GPIOA, GPIO_Pin_0);
|
|
rt_thread_mdelay(500);
|
|
|
|
GPIO_ResetBits(GPIOA, GPIO_Pin_0);
|
|
rt_thread_mdelay(500);
|
|
}
|
|
}
|
|
|
|
/* led cmd */
|
|
int led(void)
|
|
{
|
|
rt_uint8_t count;
|
|
|
|
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
|
|
|
|
for(count = 0; count < 10; count++)
|
|
{
|
|
rt_pin_write(LED0_PIN, PIN_LOW);
|
|
rt_kprintf("led on, count : %d\r\n", count);
|
|
rt_thread_mdelay(500);
|
|
|
|
rt_pin_write(LED0_PIN, PIN_HIGH);
|
|
rt_kprintf("led off\r\n");
|
|
rt_thread_mdelay(500);
|
|
}
|
|
return 0;
|
|
}
|
|
MSH_CMD_EXPORT(led, RT - Thread first led sample by using I / O driver);
|