bs_bcu_app/main/main.c

84 lines
2.6 KiB
C
Raw Normal View History

2024-11-07 17:24:19 +08:00
/**
****************************************************************************************************
* @file bsp_delay.c
* @author
* @version V1.0
* @date 2024-02-10
* @brief main
****************************************************************************************************
*/
/*app*********************************************************************************************/
2024-11-11 11:45:58 +08:00
//#include "app_demo.h"
2024-11-07 17:24:19 +08:00
/*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)
{
2024-11-11 17:18:25 +08:00
HAL_Init(); /* 初始化HAL库 */
2024-11-07 17:24:19 +08:00
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)
{
2024-11-12 19:03:56 +08:00
/* */
/* can_init(CAN_SJW_1TQ, CAN_BS2_8TQ, CAN_BS1_9TQ, 4, CAN_MODE_LOOPBACK); /* CAN初始化, 回环模式, 波特率500Kbps */
/* */
/* */
/* */
/* */
/* */
/* */
2024-11-07 17:24:19 +08:00
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);
}