2026rc_r1/User/device/remote_control.h
2026-03-17 04:38:02 +08:00

71 lines
1.6 KiB
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.

#ifndef REMOTE_CONTROL_h
#define REMOTE_CONTROL_h
/*
***********使用这个代码需要将MRobot生成的DR16代码注释掉因为DR16结构体是同一个*************
***********但是你的Dr16串口是从MR直接加过来的**************
*/
/* Includes ----------------------------------------------------------------- */
#include <cmsis_os2.h>
#include "module/cmd.h"
#include "component/user_math.h"
#include "device/device.h"
/* Exported constants ------------------------------------------------------- */
/* Exported macro ----------------------------------------------------------- */
/* Exported types ----------------------------------------------------------- */
//大疆
typedef struct __packed {
uint16_t ch_r_x : 11;
uint16_t ch_r_y : 11;
uint16_t ch_l_x : 11;
uint16_t ch_l_y : 11;
uint8_t sw_r : 2;
uint8_t sw_l : 2;
int16_t x;
int16_t y;
int16_t z;
uint8_t press_l;
uint8_t press_r;
uint16_t key;
uint16_t res;
} DR16_Data_t;
typedef struct {
DR16_Data_t data;
} DR16_t;
//乐迪
typedef struct
{
float ch[4];
int16_t sw[8];
} LD_raw_t;
typedef struct
{
float ch[4];
int16_t sw[8];
} ET16s_raw_t;
/* Exported functions prototypes -------------------------------------------- */
int8_t REMOTE_Restart(void);
int8_t REMOTE_Init(void);
int8_t REMOTE_StartDmaRecv(void);
bool REMOTE_WaitDmaCplt(uint32_t timeout);
int8_t REMOTE_ParseRC(DR16_t *dr16, CMD_RC_t *rc,ET16s_raw_t *ET16s,LD_raw_t *LD);
int8_t DR16_HandleOffline(const DR16_t *dr16, CMD_RC_t *rc);
int8_t LD_HandleOffline(const LD_raw_t *LD, CMD_RC_t *rc);
int8_t ET16s_HandleOffline(const ET16s_raw_t *ET16s, CMD_RC_t *rc);
#endif