#ifndef LD_H
#define LD_H
#include "user_math.h"

#define SBUS_RX_BUF_NUM 50u

#define RC_FRAME_LENGTH 25u

#define RC_CH_VALUE_OFFSET  ((uint16_t)1024)

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

}__attribute__((packed)) RC_ctrl_t;


int map_int(int x, int in_min, int in_max, int out_min, int out_max)	;	

void remote_control_init(void);
static void sbus_to_rc(volatile const uint8_t *sbus_buf, RC_ctrl_t *rc_ctrl);
int map(int x, int in_min, int in_max, int out_min, int out_max);		






#endif

