#ifndef REMOTE_CONTROL_H
#define REMOTE_CONTROL_H
#ifdef __cplusplus
extern "C"{
#endif
#define FREERTOS 1
#if FREERTOS == 0
#include "struct_typedef.h"

#define SBUS_RX_BUF_NUM 50u

#define RC_FRAME_LENGTH 25u

typedef  struct
{
	int16_t ch[4];
  int16_t sw[8]; 

}__attribute__((packed)) RC_ctrl_t;

extern void remote_control_init(void);
static void sbus_to_rc(volatile const uint8_t *sbus_buf, RC_ctrl_t *rc_ctrl);
#else
/* Includes ----------------------------------------------------------------- */
#include "device.h"
#include <cmsis_os2.h>
#include "FreeRTOS.h"
#include <stdbool.h>
#include "uart_it.h"
#include "TopDefine.h"

typedef  struct {
  int16_t ch[4];
  int16_t sw[8]; 
} RC_data_t;

typedef  struct {
  RC_data_t RC_data;
  uint8_t   sbus_rx_buffer[2][25u];
  int8_t   Error_count;
  uint8_t   Error_flag;
  DMA_Buffer_t  dma_buffer;
}RC_mess_t;

/* Exported functions prototypes -------------------------------------------- */
int8_t RC_init(void);
int8_t RC_rx_analysis(void);
uint32_t RC_WaitNew(void);
RC_data_t* get_rc_data(void);
#endif
#ifdef __cplusplus
}
#endif
#endif
