R1_up/User/task/ballTask.cpp
2025-06-18 15:09:35 +08:00

42 lines
882 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "ballTask.hpp"
#include "TopDefine.h"
#include "FreeRTOS.h"
#include "userTask.h"
#include <cmsis_os2.h>
#include "ball.hpp"
#include "remote_control.h"
#include "vofa.h"
extern RC_ctrl_t rc_ctrl;
Ball ball;
//float vofa[8];
//检查光电
int abc=0;
extern int speedm;
void FunctionBall(void *argument)
{
(void)argument; /* 未使用argument消除警告 */
const uint32_t delay_tick = osKernelGetTickFreq() / TASK_FREQ_BALL;
uint32_t tick = osKernelGetTickCount();
while(1)
{
#ifdef DEBUG
task_struct.stack_water_mark.ball = osThreadGetStackSpace(osThreadGetId());
#endif
abc=HAL_GPIO_ReadPin(up_ball_GPIO_Port, up_ball_Pin);
ball.rc_mode(); // 遥控器模式
ball.ball_control(); // 控制球的动作
tick += delay_tick; /* 计算下一个唤醒时刻 */
osDelayUntil(tick);
}
}