#ifndef RC_h #define RC_h /* Includes ----------------------------------------------------------------- */ #include #include "bsp_usart.h" #include "cmd.h" #include "user_math.h" #include "device.h" /* Exported constants ------------------------------------------------------- */ /* Exported macro ----------------------------------------------------------- */ /* Exported types ----------------------------------------------------------- */ typedef __packed struct { 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; //#define SBUS_RX_BUF_NUM 25u //#define RC_FRAME_LENGTH 18u typedef __packed struct { fp32 map_ch[4]; int16_t ch[4]; int16_t sw[8]; } RC_ctrl_t; int8_t RC_SBUS_Init(void ); static void RC_SBUS_RxCpltCallback(void) ; int8_t RC_SBUS_Restart(void) ; int8_t RC_SBUS_StartDmaRecv(void) ; bool RC_SBUS_WaitDmaCplt(uint32_t timeout) ; int8_t LD_ParseRaw( RC_ctrl_t *rc_ctrl); static bool DR16_DataCorrupted(const DR16_t *dr16) ; int8_t DR16_ParseRaw(DR16_t *dr16); int8_t RC_ParseRC( DR16_t *dr16, RC_ctrl_t *rc_ctrl, CMD_RC_t *rc) ; int8_t DR16_HandleOffline(const DR16_t *dr16, CMD_RC_t *rc) ; #endif