/**
 * 初始化任务
*/
#include "TopDefine.h"
#include "userTask.h"
#include "nuc.h"

/*********************/
/**
 * \brief 初始化
 *
 * \param argument 未使用
 */
void initFunction(void *argument) 
{
    (void)argument; /* 未使用argument，消除警告 */

    osKernelLock();
    /* 创建任务 */
	task_struct.thread.shoot	=
        osThreadNew(FunctionShoot, NULL, &attr_shoot);
    task_struct.thread.can =
        osThreadNew(FunctionCan, NULL, &attr_can);
   task_struct.thread.ball =
       osThreadNew(FunctionBall, NULL, &attr_ball);   
    task_struct.thread.nuc =
        osThreadNew(Function_nuc, NULL, &attr_nuc);     
    /* 创建消息队列 */
    // task_struct.msgq.msg =
    //     osMessageQueueNew(2u, sizeof(CAN_CapOutput_t), NULL);
    task_struct.msgq.nuc =
        osMessageQueueNew(2u, sizeof(NUC_t), NULL);

    /*创建事件组*/
    task_struct.events.eventReceive = osEventFlagsNew(&attr_event);
    
    osKernelUnlock();
    osThreadTerminate(osThreadGetId()); /* 结束自身 */
}
