2025-12-24 09:54:51 +08:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2006-2018, RT-Thread Development Team
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*
|
|
|
|
|
* Change Logs:
|
|
|
|
|
* Date Author Notes
|
|
|
|
|
* 2019-03-05 whj4674672 first version
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
|
#include <rtdevice.h>
|
|
|
|
|
#include <board.h>
|
|
|
|
|
|
|
|
|
|
/* defined the LED0 pin: PB1 */
|
|
|
|
|
#define LED0_PIN GET_PIN(C, 13)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
|
{
|
|
|
|
|
int count = 1;
|
|
|
|
|
/* set LED0 pin mode to output */
|
|
|
|
|
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
|
2025-12-30 15:44:41 +08:00
|
|
|
rt_pin_mode(GET_PIN(D, 0), PIN_MODE_OUTPUT);
|
2025-12-24 09:54:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
while (count++)
|
|
|
|
|
{
|
|
|
|
|
rt_pin_write(LED0_PIN, PIN_HIGH);
|
|
|
|
|
rt_thread_mdelay(100);
|
|
|
|
|
rt_pin_write(LED0_PIN, PIN_LOW);
|
|
|
|
|
rt_thread_mdelay(100);
|
|
|
|
|
// rt_kprintf("Hello RT-Thread!\n");
|
|
|
|
|
}
|
|
|
|
|
return RT_EOK;
|
|
|
|
|
}
|
2025-12-30 15:44:41 +08:00
|
|
|
static inline int dwt_init(void)
|
|
|
|
|
{
|
|
|
|
|
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
|
|
|
|
|
DWT->CYCCNT = 0;
|
|
|
|
|
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
INIT_APP_EXPORT(dwt_init);
|
2025-12-24 09:54:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|