36 lines
871 B
C++
36 lines
871 B
C++
#include "ballTask.hpp"
|
||
#include "TopDefine.h"
|
||
#include "FreeRTOS.h"
|
||
#include "userTask.h"
|
||
#include <cmsis_os2.h>
|
||
#include "ball.hpp"
|
||
#include "remote_control.h"
|
||
extern RC_ctrl_t rc_ctrl;
|
||
Ball ball;
|
||
int abc=0;
|
||
int c30=0;
|
||
int speed1=500;
|
||
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.ballHadling(); // 处理摩擦轮转动
|
||
ball.Spin(speedm);
|
||
ball.Send_control();
|
||
|
||
tick += delay_tick; /* 计算下一个唤醒时刻 */
|
||
osDelayUntil(tick);
|
||
}
|
||
}
|