mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 07:15:18 +03:00
Fixed serial RX to be able to use TX pin on any F4 target.
This commit is contained in:
parent
edbadf4285
commit
d466af8a44
10 changed files with 50 additions and 9 deletions
|
@ -565,6 +565,9 @@ const clivalue_t valueTable[] = {
|
||||||
#ifdef SERIAL_RX
|
#ifdef SERIAL_RX
|
||||||
{ "serialrx_provider", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &rxConfig()->serialrx_provider, .config.lookup = { TABLE_SERIAL_RX } },
|
{ "serialrx_provider", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &rxConfig()->serialrx_provider, .config.lookup = { TABLE_SERIAL_RX } },
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef STM32F4
|
||||||
|
{ "serialrx_halfduplex", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &rxConfig()->halfDuplex, .config.lookup = { TABLE_OFF_ON } },
|
||||||
|
#endif
|
||||||
|
|
||||||
{ "sbus_inversion", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &rxConfig()->sbus_inversion, .config.lookup = { TABLE_OFF_ON } },
|
{ "sbus_inversion", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &rxConfig()->sbus_inversion, .config.lookup = { TABLE_OFF_ON } },
|
||||||
|
|
||||||
|
|
|
@ -856,6 +856,7 @@ void createDefaultConfig(master_t *config)
|
||||||
#else
|
#else
|
||||||
config->rxConfig.serialrx_provider = 0;
|
config->rxConfig.serialrx_provider = 0;
|
||||||
#endif
|
#endif
|
||||||
|
config->rxConfig.halfDuplex = 0;
|
||||||
config->rxConfig.rx_spi_protocol = RX_SPI_DEFAULT_PROTOCOL;
|
config->rxConfig.rx_spi_protocol = RX_SPI_DEFAULT_PROTOCOL;
|
||||||
config->rxConfig.sbus_inversion = 1;
|
config->rxConfig.sbus_inversion = 1;
|
||||||
config->rxConfig.spektrum_sat_bind = 0;
|
config->rxConfig.spektrum_sat_bind = 0;
|
||||||
|
|
|
@ -236,7 +236,13 @@ bool crsfRxInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
serialPort = openSerialPort(portConfig->identifier, FUNCTION_RX_SERIAL, crsfDataReceive, CRSF_BAUDRATE, CRSF_PORT_MODE, CRSF_PORT_OPTIONS);
|
serialPort = openSerialPort(portConfig->identifier,
|
||||||
|
FUNCTION_RX_SERIAL,
|
||||||
|
crsfDataReceive,
|
||||||
|
CRSF_BAUDRATE,
|
||||||
|
CRSF_PORT_MODE,
|
||||||
|
CRSF_PORT_OPTIONS | (rxConfig->halfDuplex ? SERIAL_BIDIR : 0)
|
||||||
|
);
|
||||||
|
|
||||||
return serialPort != NULL;
|
return serialPort != NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,13 @@ bool ibusInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig)
|
||||||
bool portShared = false;
|
bool portShared = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
serialPort_t *ibusPort = openSerialPort(portConfig->identifier, FUNCTION_RX_SERIAL, ibusDataReceive, IBUS_BAUDRATE, portShared ? MODE_RXTX : MODE_RX, SERIAL_NOT_INVERTED);
|
serialPort_t *ibusPort = openSerialPort(portConfig->identifier,
|
||||||
|
FUNCTION_RX_SERIAL,
|
||||||
|
ibusDataReceive,
|
||||||
|
IBUS_BAUDRATE,
|
||||||
|
portShared ? MODE_RXTX : MODE_RX,
|
||||||
|
SERIAL_NOT_INVERTED | (rxConfig->halfDuplex ? SERIAL_BIDIR : 0)
|
||||||
|
);
|
||||||
|
|
||||||
#ifdef TELEMETRY
|
#ifdef TELEMETRY
|
||||||
if (portShared) {
|
if (portShared) {
|
||||||
|
|
|
@ -604,7 +604,13 @@ bool jetiExBusInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfi
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
jetiExBusPort = openSerialPort(portConfig->identifier, FUNCTION_RX_SERIAL, jetiExBusDataReceive, JETIEXBUS_BAUDRATE, MODE_RXTX, JETIEXBUS_OPTIONS );
|
jetiExBusPort = openSerialPort(portConfig->identifier,
|
||||||
|
FUNCTION_RX_SERIAL,
|
||||||
|
jetiExBusDataReceive,
|
||||||
|
JETIEXBUS_BAUDRATE,
|
||||||
|
MODE_RXTX,
|
||||||
|
JETIEXBUS_OPTIONS | (rxConfig->halfDuplex ? SERIAL_BIDIR : 0)
|
||||||
|
);
|
||||||
serialSetMode(jetiExBusPort, MODE_RX);
|
serialSetMode(jetiExBusPort, MODE_RX);
|
||||||
return jetiExBusPort != NULL;
|
return jetiExBusPort != NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,8 @@ typedef struct rxConfig_s {
|
||||||
uint8_t rcmap[MAX_MAPPABLE_RX_INPUTS]; // mapping of radio channels to internal RPYTA+ order
|
uint8_t rcmap[MAX_MAPPABLE_RX_INPUTS]; // mapping of radio channels to internal RPYTA+ order
|
||||||
uint8_t serialrx_provider; // type of UART-based receiver (0 = spek 10, 1 = spek 11, 2 = sbus). Must be enabled by FEATURE_RX_SERIAL first.
|
uint8_t serialrx_provider; // type of UART-based receiver (0 = spek 10, 1 = spek 11, 2 = sbus). Must be enabled by FEATURE_RX_SERIAL first.
|
||||||
uint8_t sbus_inversion; // default sbus (Futaba, FrSKY) is inverted. Support for uninverted OpenLRS (and modified FrSKY) receivers.
|
uint8_t sbus_inversion; // default sbus (Futaba, FrSKY) is inverted. Support for uninverted OpenLRS (and modified FrSKY) receivers.
|
||||||
uint8_t rx_spi_protocol; // type of nrf24 protocol (0 = v202 250kbps). Must be enabled by FEATURE_RX_NRF24 first.
|
uint8_t halfDuplex; // allow rx to operate in half duplex mode on F4, ignored for F1 and F3.
|
||||||
|
uint8_t rx_spi_protocol; // type of nrf24 protocol (0 = v202 250kbps). Must be enabled by FEATURE_RX_NRF24 first.
|
||||||
uint32_t rx_spi_id;
|
uint32_t rx_spi_id;
|
||||||
uint8_t rx_spi_rf_channel_count;
|
uint8_t rx_spi_rf_channel_count;
|
||||||
uint8_t spektrum_sat_bind; // number of bind pulses for Spektrum satellite receivers
|
uint8_t spektrum_sat_bind; // number of bind pulses for Spektrum satellite receivers
|
||||||
|
|
|
@ -248,8 +248,13 @@ bool sbusInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig)
|
||||||
bool portShared = false;
|
bool portShared = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
portOptions_t options = (rxConfig->sbus_inversion) ? (SBUS_PORT_OPTIONS | SERIAL_INVERTED) : SBUS_PORT_OPTIONS;
|
serialPort_t *sBusPort = openSerialPort(portConfig->identifier,
|
||||||
serialPort_t *sBusPort = openSerialPort(portConfig->identifier, FUNCTION_RX_SERIAL, sbusDataReceive, SBUS_BAUDRATE, portShared ? MODE_RXTX : MODE_RX, options);
|
FUNCTION_RX_SERIAL,
|
||||||
|
sbusDataReceive,
|
||||||
|
SBUS_BAUDRATE,
|
||||||
|
portShared ? MODE_RXTX : MODE_RX,
|
||||||
|
SBUS_PORT_OPTIONS | (rxConfig->sbus_inversion ? SERIAL_INVERTED : 0) | (rxConfig->halfDuplex ? SERIAL_BIDIR : 0)
|
||||||
|
);
|
||||||
|
|
||||||
#ifdef TELEMETRY
|
#ifdef TELEMETRY
|
||||||
if (portShared) {
|
if (portShared) {
|
||||||
|
|
|
@ -303,7 +303,8 @@ bool spektrumInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig
|
||||||
spektrumDataReceive,
|
spektrumDataReceive,
|
||||||
SPEKTRUM_BAUDRATE,
|
SPEKTRUM_BAUDRATE,
|
||||||
portShared || srxlEnabled ? MODE_RXTX : MODE_RX,
|
portShared || srxlEnabled ? MODE_RXTX : MODE_RX,
|
||||||
SERIAL_NOT_INVERTED | (srxlEnabled ? SERIAL_BIDIR : 0));
|
SERIAL_NOT_INVERTED | ((srxlEnabled || rxConfig->halfDuplex) ? SERIAL_BIDIR : 0)
|
||||||
|
);
|
||||||
|
|
||||||
#ifdef TELEMETRY
|
#ifdef TELEMETRY
|
||||||
if (portShared) {
|
if (portShared) {
|
||||||
|
|
|
@ -179,7 +179,13 @@ bool sumdInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig)
|
||||||
bool portShared = false;
|
bool portShared = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
serialPort_t *sumdPort = openSerialPort(portConfig->identifier, FUNCTION_RX_SERIAL, sumdDataReceive, SUMD_BAUDRATE, portShared ? MODE_RXTX : MODE_RX, SERIAL_NOT_INVERTED);
|
serialPort_t *sumdPort = openSerialPort(portConfig->identifier,
|
||||||
|
FUNCTION_RX_SERIAL,
|
||||||
|
sumdDataReceive,
|
||||||
|
SUMD_BAUDRATE,
|
||||||
|
portShared ? MODE_RXTX : MODE_RX,
|
||||||
|
SERIAL_NOT_INVERTED | (rxConfig->halfDuplex ? SERIAL_BIDIR : 0)
|
||||||
|
);
|
||||||
|
|
||||||
#ifdef TELEMETRY
|
#ifdef TELEMETRY
|
||||||
if (portShared) {
|
if (portShared) {
|
||||||
|
|
|
@ -329,7 +329,13 @@ bool xBusInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig)
|
||||||
bool portShared = false;
|
bool portShared = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
serialPort_t *xBusPort = openSerialPort(portConfig->identifier, FUNCTION_RX_SERIAL, xBusDataReceive, baudRate, portShared ? MODE_RXTX : MODE_RX, SERIAL_NOT_INVERTED);
|
serialPort_t *xBusPort = openSerialPort(portConfig->identifier,
|
||||||
|
FUNCTION_RX_SERIAL,
|
||||||
|
xBusDataReceive,
|
||||||
|
baudRate,
|
||||||
|
portShared ? MODE_RXTX : MODE_RX,
|
||||||
|
SERIAL_NOT_INVERTED | (rxConfig->halfDuplex ? SERIAL_BIDIR : 0)
|
||||||
|
);
|
||||||
|
|
||||||
#ifdef TELEMETRY
|
#ifdef TELEMETRY
|
||||||
if (portShared) {
|
if (portShared) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue