STM32F103RC
STM32 Cube IDE
大一时买的,当时是50元左右,很便宜,安卓上位机为FHDFPV
我买的型号波特率约为18464,
实测帧头为102,帧尾为153,前四个数为左右遥感对应的通道,
第五个数为类似开关的通道
上左两个图标是拍照和录像,中间的为右摇杆输出限制,有30%、60%、100%可选,右二为打开控制UI,右三为手机陀螺仪控制,选择后可使用手机陀螺仪控制右摇杆。
测试程序
串口部分见STM32 串口DMA接收 Openmv / K210 整数、小数字符串数据 (基于HAL库)
FHDFPV.c
/*
* FHDFPV.c
*
* Created on: Apr 27, 2021
* Author: Royic
*/
#include "../BSP/UART_DMA/UART_DMA.h"
int16_t FHDFPV_Ch[5] = {0};
uint8_t FHDFPV_Timeout_Count = 0;
void FHDFPV_UART_DMA_Read(uint32_t Len)
{
extern uint8_t RxBuffer[];
if(RxBuffer[0] == 102 && RxBuffer[7] == 153 && Len == 8)
{
FHDFPV_Timeout_Count = 0;
FHDFPV_Ch[0] = (int16_t)RxBuffer[1] - 128;
FHDFPV_Ch[1] = (int16_t)RxBuffer[2] - 128;
FHDFPV_Ch[2] = (int16_t)RxBuffer[3] - 128;
FHDFPV_Ch[3] = (int16_t)RxBuffer[4] - 128;
if(RxBuffer[5]==64)
FHDFPV_Ch[4] = -1;
else if(RxBuffer[5]==80)
FHDFPV_Ch[4] = 1;
}
}
FHDFPV.h
/*
* FHDFPV.h
*
* Created on: Apr 27, 2021
* Author: Royic
*/
#ifndef FHDFPV_FHDFPV_H_
#define FHDFPV_FHDFPV_H_
#define FHDFPV_Huart huart1 //波特率18475
extern UART_HandleTypeDef FHDFPV_Huart;
extern int16_t FHDFPV_Ch[];
extern uint8_t FHDFPV_Timeout_Count;
void FHDFPV_UART_DMA_Read(uint32_t Len);
#endif /* FHDFPV_FHDFPV_H_ */
应用效果