初级会员
- 积分
- 185
- 金钱
- 185
- 注册时间
- 2020-5-21
- 在线时间
- 58 小时
|
1金钱
F407,用的Hal库。cubemx生成代码,闪LED正常。现想用RT-thread 3.1.5,闪LED, 但是led 只闪一次。修改代码如下:1. board.c
void SysTick_Handler(void)
{
rt_interrupt_enter();
HAL_IncTick();
rt_tick_increase();
rt_interrupt_leave();
}
void rt_hw_board_init(void)
{
extern void SystemClock_Config();
HAL_Init();
SystemClock_Config();
SystemCoreClockUpdate();
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / RT_TICK_PER_SECOND);
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
rt_system_heap_init(rt_heap_begin_get(), rt_heap_end_get());
#endif
}
2. main.c
static void led0_thread_entry(void* parameter)
{
while(1)
{
HAL_GPIO_TogglePin(GPIOF,GPIO_PIN_10);
rt_thread_delay(100);
}
}
int main(void)
{ rt_thread_init(&led0_thread, "led0", led0_thread_entry, RT_NULL, &rt_led0_thread_stack[0], sizeof(rt_led0_thread_stack), 3, 20);
rt_thread_startup(&led0_thread);
}
谢谢大家了!!!
|
|