#ifndef REMOTE_CONTROL_h
#define REMOTE_CONTROL_h

/* 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);

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

