summaryrefslogtreecommitdiff
path: root/bsp/wch/risc-v/yd-ch32v307vct6/applications/main.c
blob: 6c77b9d9f8028c112defc7fd17163be8a1e9a0c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * Copyright (c) 2006-2022, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2024-01-06     GSunwinder   first version
 *
 */

#include <rtthread.h>
#include <rtdevice.h>

#include "ch32v30x.h"
#include "board.h"

/*********************************************************************
 * @fn      main
 *
 * @brief   Main program.
 *
 * @return  none
 */

int main(void)
{
    rt_kprintf("SystemClk: %d Hz\r\n", SystemCoreClock);

    rt_pin_mode(LED_BLUE, PIN_MODE_OUTPUT);
    rt_pin_mode(LED_RED,  PIN_MODE_OUTPUT);

    while (1)
    {
        rt_pin_write(LED_RED,  PIN_LOW);
        rt_pin_write(LED_BLUE, PIN_HIGH);
        rt_thread_mdelay(1000);
        rt_pin_write(LED_RED,  PIN_HIGH);
        rt_pin_write(LED_BLUE, PIN_LOW);
        rt_thread_mdelay(1000);
    }
}