#ifndef REMOTE_CONTROL_h
#define REMOTE_CONTROL_h

/* Includes ----------------------------------------------------------------- */
#include <cmsis_os2.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;

//乐迪
typedef struct
{
  int16_t ch[4];
  int16_t sw[8]; 

} LD_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,LD_raw_t *LD_raw);

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

#endif