rt-thread-official/bsp/cvitek/cv18xx_risc-v/applications/main.c

48 lines
991 B
C
Raw Normal View History

2023-06-30 00:05:55 +08:00
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023/06/25 flyingcys first version
*/
#include <rtthread.h>
#include <stdio.h>
#include <drivers/dev_pin.h>
#if defined(BOARD_TYPE_MILKV_DUO256M) || defined(BOARD_TYPE_MILKV_DUO256M_SPINOR)
#define LED_PIN "E02" /* Onboard LED pins */
#elif defined(BOARD_TYPE_MILKV_DUO) || defined(BOARD_TYPE_MILKV_DUO_SPINOR)
#define LED_PIN "C24" /* Onboard LED pins */
#endif
2023-06-30 00:05:55 +08:00
int main(void)
{
#ifdef RT_USING_SMART
2023-06-30 00:05:55 +08:00
rt_kprintf("Hello RT-Smart!\n");
#else
rt_kprintf("Hello RISC-V!\n");
#endif
/* LED pin: C24 */
rt_uint16_t led = rt_pin_get(LED_PIN);
/* set LED pin mode to output */
rt_pin_mode(led, PIN_MODE_OUTPUT);
while (1)
{
rt_pin_write(led, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(led, PIN_LOW);
rt_thread_mdelay(500);
}
2023-06-30 00:05:55 +08:00
return 0;
}