R2_UP/User/device/remote_control.h
2025-03-12 10:46:02 +08:00

43 lines
1.2 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
****************************(C) COPYRIGHT 2016 DJI****************************
* @file remote_control.c/h
* @brief 遥控器处理遥控器是通过类似SBUS的协议传输利用DMA传输方式节约CPU
* 资源利用串口空闲中断来拉起处理函数同时提供一些掉线重启DMA串口
* 的方式保证热插拔的稳定性。
* @note
* @history
* Version Date Author Modification
* V1.0.0 Dec-26-2018 RM 1. 完成
*
@verbatim
==============================================================================
==============================================================================
@endverbatim
****************************(C) COPYRIGHT 2016 DJI****************************
*/
#ifndef REMOTE_CONTROL_H
#define REMOTE_CONTROL_H
#include "struct_typedef.h"
#include "bsp_rc.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;
extern 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