76 lines
2.2 KiB
C
76 lines
2.2 KiB
C
/**
|
|
****************************************************************************************************
|
|
* @file bsp_delay.c
|
|
* @author
|
|
* @version V1.0
|
|
* @date 2024-02-10
|
|
* @brief main
|
|
****************************************************************************************************
|
|
*/
|
|
|
|
/*app*********************************************************************************************/
|
|
#include "app_demo.h"
|
|
|
|
|
|
/*kit*********************************************************************************************/
|
|
#include "kit_debug.h"
|
|
|
|
/*bsp*********************************************************************************************/
|
|
#include "bsp_delay.h"
|
|
#include "bsp_led.h"
|
|
#include "bsp_task.h"
|
|
|
|
/*drv*********************************************************************************************/
|
|
#include "drv_sys.h"
|
|
#include "drv_usart.h"
|
|
|
|
/*uC/OS-III*********************************************************************************************/
|
|
#include "os.h"
|
|
|
|
OS_TCB StartTask1_TCB; /* 任务控制块 */
|
|
|
|
void poll_start_task1_init(void)
|
|
{
|
|
HAL_Init(); /* 初始化HAL库 */
|
|
sys_stm32_clock_init(336, 8, 2, 7); /* 设置时钟,168Mhz */
|
|
delay_init(168); /* 延时初始化 */
|
|
usart_init(115200); /* 串口初始化为115200 */
|
|
led_init(); /* 初始化LED */
|
|
}
|
|
|
|
void poll_start_task1_handler(uint32_t baseTime)
|
|
{
|
|
task1(baseTime);
|
|
}
|
|
|
|
void poll_start_task2_handler(uint32_t baseTime)
|
|
{
|
|
task2(baseTime);
|
|
}
|
|
|
|
|
|
// name,id,_prio,_period,_,_timeout,init_call,_ask_call,stack_size
|
|
TASK_STATIC_INIT_CCM(poll_start_task1, 1, 2, 500, 2000, poll_start_task1_init, poll_start_task1_handler, 400);
|
|
TASK_STATIC_INIT_CCM(poll_start_task2, 2, 5, 1000, 2000, NULL, poll_start_task2_handler, 400);
|
|
|
|
int main(void)
|
|
{
|
|
OS_ERR err;
|
|
// KIT_DEBUG_PRINTF("12323 \r\n");
|
|
/* 关闭所有中断 */
|
|
CPU_IntDis();
|
|
|
|
KIT_DEBUG_PRINTF("BMS start \r\n");
|
|
|
|
/* 初始化uC/OS-III */
|
|
OSInit(&err);
|
|
|
|
bsp_task_creat(&poll_start_task1,(uint8_t *)"poll_start_task1");
|
|
bsp_task_creat(&poll_start_task2,(uint8_t *)"poll_start_task2");
|
|
|
|
/* 开始任务调度 */
|
|
OSStart(&err);
|
|
}
|
|
|
|
|