53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
#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;
|
||
int aaaa=146;
|
||
|
||
extern int speedm;
|
||
|
||
void FunctionBall(void *argument)
|
||
{
|
||
(void)argument; /* 未使用argument,消除警告 */
|
||
|
||
const uint32_t delay_tick = osKernelGetTickFreq() / TASK_FREQ_BALL;
|
||
|
||
// osDelay(6000);//等待极致控制板启动
|
||
// XiaomiWait_init(1,&hcan2); //小米电机初始化
|
||
|
||
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(); // 控制球的动作
|
||
|
||
// HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_SET); // 确保气缸爪子闭合
|
||
// HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_SET); // 确保下气缸关闭
|
||
|
||
// ball.xiaomi.position = aaaa;
|
||
// CAN_XiaoMi(1,&ball.xiaomi,&hcan2);
|
||
|
||
tick += delay_tick; /* 计算下一个唤醒时刻 */
|
||
osDelayUntil(tick);
|
||
|
||
}
|
||
}
|