move_xrobot/User/device/ai.h

67 lines
1.6 KiB
C
Raw Normal View History

2025-01-14 10:35:04 +08:00
/*
AI
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ----------------------------------------------------------------- */
#include <cmsis_os2.h>
#include <stdbool.h>
#include <stdint.h>
#include "component\ahrs.h"
#include "component\cmd.h"
#include "component\user_math.h"
2025-03-04 17:20:57 +08:00
#include "component\filter.h"
2025-01-14 10:35:04 +08:00
#include "device\device.h"
#include "device\referee.h"
#include "protocol.h"
/* Exported constants ------------------------------------------------------- */
/* Exported macro ----------------------------------------------------------- */
/* Exported types ----------------------------------------------------------- */
typedef struct __packed {
uint8_t id;
Protocol_UpPackageReferee_t package;
} AI_UpPackageReferee_t;
typedef struct __packed {
uint8_t id;
Protocol_UpPackageMCU_t package;
} AI_UpPackageMCU_t;
typedef struct __packed {
osThreadId_t thread_alert;
Protocol_DownPackage_t form_host;
struct {
AI_UpPackageReferee_t ref;
AI_UpPackageMCU_t mcu;
} to_host;
CMD_AI_Status_t status;
2025-03-04 17:20:57 +08:00
bool ai_online;
2025-01-14 10:35:04 +08:00
} AI_t;
/* Exported functions prototypes -------------------------------------------- */
int8_t AI_Init(AI_t *ai);
int8_t AI_Restart(void);
int8_t AI_StartReceiving(AI_t *ai);
bool AI_WaitDmaCplt(void);
2025-03-04 17:20:57 +08:00
int8_t AI_ParseHost(AI_t *ai);
2025-01-14 10:35:04 +08:00
int8_t AI_HandleOffline(AI_t *ai, CMD_Host_t *cmd_host);
int8_t AI_PackMCU(AI_t *ai, const AHRS_Quaternion_t *quat);
int8_t AI_PackRef(AI_t *ai, const Referee_ForAI_t *ref);
int8_t AI_StartSend(AI_t *ai, bool option);
2025-03-04 17:20:57 +08:00
void AI_PackCmd(AI_t *ai, CMD_Host_t *cmd_host);
2025-01-14 10:35:04 +08:00
#ifdef __cplusplus
}
#endif