1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 01:35:41 +03:00

allow controlling external XOR gate connected to PB2 (BOOT1) to invert USART2_RX signal on F1. Currently used by sbus driver.

This commit is contained in:
dongie 2014-06-11 12:52:03 +09:00
parent e35c92b0da
commit 84729747b0
6 changed files with 57 additions and 5 deletions

View file

@ -1,3 +1,8 @@
/*
* This file is part of baseflight
* Licensed under GPL V3 or modified DCL - see https://github.com/multiwii/baseflight/blob/master/README.md
*/
#include "board.h"
#include "mw.h"
@ -22,6 +27,12 @@ void sbusInit(rcReadRawDataPtr *callback)
int b;
for (b = 0; b < SBUS_MAX_CHANNEL; b++)
sbusChannelData[b] = 2 * (mcfg.midrc - SBUS_OFFSET);
// Configure hardware inverter on PB2. If not available, this has no effect.
if (mcfg.serial2_rx_inverted) {
INV_ON;
} else {
INV_OFF;
}
core.rcvrport = uartOpen(USART2, sbusDataReceive, 100000, (portMode_t)(MODE_RX | MODE_SBUS));
if (callback)
*callback = sbusReadRawRC;