Only index into the configurable baud rate list when needed.
This commit is contained in:
parent
dca984ff88
commit
a156d915f4
|
@ -62,7 +62,7 @@
|
||||||
|
|
||||||
#ifdef BLACKBOX
|
#ifdef BLACKBOX
|
||||||
|
|
||||||
#define BLACKBOX_BAUDRATE BAUD_115200
|
#define BLACKBOX_BAUDRATE 115200
|
||||||
#define BLACKBOX_INITIAL_PORT_MODE MODE_TX
|
#define BLACKBOX_INITIAL_PORT_MODE MODE_TX
|
||||||
|
|
||||||
// How many bytes should we transmit per loop iteration?
|
// How many bytes should we transmit per loop iteration?
|
||||||
|
|
|
@ -236,7 +236,7 @@ serialPort_t *openSerialPort(
|
||||||
serialPortIdentifier_e identifier,
|
serialPortIdentifier_e identifier,
|
||||||
serialPortFunction_e function,
|
serialPortFunction_e function,
|
||||||
serialReceiveCallbackPtr callback,
|
serialReceiveCallbackPtr callback,
|
||||||
baudRate_e baudRateIndex,
|
uint32_t baudRate,
|
||||||
portMode_t mode,
|
portMode_t mode,
|
||||||
serialInversion_e inversion)
|
serialInversion_e inversion)
|
||||||
{
|
{
|
||||||
|
@ -248,8 +248,6 @@ serialPort_t *openSerialPort(
|
||||||
|
|
||||||
serialPort_t *serialPort = NULL;
|
serialPort_t *serialPort = NULL;
|
||||||
|
|
||||||
uint32_t baudRate = baudRates[baudRateIndex];
|
|
||||||
|
|
||||||
switch(identifier) {
|
switch(identifier) {
|
||||||
#ifdef USE_VCP
|
#ifdef USE_VCP
|
||||||
case SERIAL_PORT_USB_VCP:
|
case SERIAL_PORT_USB_VCP:
|
||||||
|
|
|
@ -110,7 +110,7 @@ serialPort_t *openSerialPort(
|
||||||
serialPortIdentifier_e identifier,
|
serialPortIdentifier_e identifier,
|
||||||
serialPortFunction_e function,
|
serialPortFunction_e function,
|
||||||
serialReceiveCallbackPtr callback,
|
serialReceiveCallbackPtr callback,
|
||||||
baudRate_e baudrate,
|
uint32_t baudrate,
|
||||||
portMode_t mode,
|
portMode_t mode,
|
||||||
serialInversion_e inversion
|
serialInversion_e inversion
|
||||||
);
|
);
|
||||||
|
|
|
@ -602,7 +602,7 @@ void mspAllocateSerialPorts(serialConfig_t *serialConfig)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
serialPort = openSerialPort(portConfig->identifier, FUNCTION_MSP, NULL, portConfig->msp_baudrateIndex, MODE_RXTX, SERIAL_NOT_INVERTED);
|
serialPort = openSerialPort(portConfig->identifier, FUNCTION_MSP, NULL, baudRates[portConfig->msp_baudrateIndex], MODE_RXTX, SERIAL_NOT_INVERTED);
|
||||||
if (serialPort) {
|
if (serialPort) {
|
||||||
resetMspPort(mspPort, serialPort, FOR_GENERAL_MSP);
|
resetMspPort(mspPort, serialPort, FOR_GENERAL_MSP);
|
||||||
portIndex++;
|
portIndex++;
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
#define SPEK_FRAME_SIZE 16
|
#define SPEK_FRAME_SIZE 16
|
||||||
|
|
||||||
#define SPEKTRUM_BAUDRATE BAUD_115200
|
#define SPEKTRUM_BAUDRATE 115200
|
||||||
|
|
||||||
static uint8_t spek_chan_shift;
|
static uint8_t spek_chan_shift;
|
||||||
static uint8_t spek_chan_mask;
|
static uint8_t spek_chan_mask;
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
static serialPort_t *frskyPort = NULL;
|
static serialPort_t *frskyPort = NULL;
|
||||||
static serialPortConfig_t *portConfig;
|
static serialPortConfig_t *portConfig;
|
||||||
|
|
||||||
#define FRSKY_BAUDRATE BAUD_9600
|
#define FRSKY_BAUDRATE 9600
|
||||||
#define FRSKY_INITIAL_PORT_MODE MODE_TX
|
#define FRSKY_INITIAL_PORT_MODE MODE_TX
|
||||||
|
|
||||||
static telemetryConfig_t *telemetryConfig;
|
static telemetryConfig_t *telemetryConfig;
|
||||||
|
|
|
@ -100,7 +100,7 @@ static uint8_t hottMsgCrc;
|
||||||
|
|
||||||
#define HOTT_CRC_SIZE (sizeof(hottMsgCrc))
|
#define HOTT_CRC_SIZE (sizeof(hottMsgCrc))
|
||||||
|
|
||||||
#define HOTT_BAUDRATE BAUD_19200
|
#define HOTT_BAUDRATE 19200
|
||||||
#define HOTT_INITIAL_PORT_MODE MODE_RX
|
#define HOTT_INITIAL_PORT_MODE MODE_RX
|
||||||
|
|
||||||
static serialPort_t *hottPort = NULL;
|
static serialPort_t *hottPort = NULL;
|
||||||
|
|
|
@ -100,7 +100,7 @@ void configureMSPTelemetryPort(void)
|
||||||
baudRateIndex = BAUD_19200;
|
baudRateIndex = BAUD_19200;
|
||||||
}
|
}
|
||||||
|
|
||||||
mspTelemetryPort = openSerialPort(portConfig->identifier, FUNCTION_MSP_TELEMETRY, NULL, baudRateIndex, MSP_TELEMETRY_INITIAL_PORT_MODE, SERIAL_NOT_INVERTED);
|
mspTelemetryPort = openSerialPort(portConfig->identifier, FUNCTION_MSP_TELEMETRY, NULL, baudRates[baudRateIndex], MSP_TELEMETRY_INITIAL_PORT_MODE, SERIAL_NOT_INVERTED);
|
||||||
|
|
||||||
if (!mspTelemetryPort) {
|
if (!mspTelemetryPort) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -133,7 +133,7 @@ const uint16_t frSkyDataIdTable[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define __USE_C99_MATH // for roundf()
|
#define __USE_C99_MATH // for roundf()
|
||||||
#define SMARTPORT_BAUD BAUD_57600
|
#define SMARTPORT_BAUD 57600
|
||||||
#define SMARTPORT_UART_MODE MODE_BIDIR
|
#define SMARTPORT_UART_MODE MODE_BIDIR
|
||||||
#define SMARTPORT_SERVICE_DELAY_MS 5 // telemetry requests comes in at roughly 12 ms intervals, keep this under that
|
#define SMARTPORT_SERVICE_DELAY_MS 5 // telemetry requests comes in at roughly 12 ms intervals, keep this under that
|
||||||
#define SMARTPORT_NOT_CONNECTED_TIMEOUT_MS 7000
|
#define SMARTPORT_NOT_CONNECTED_TIMEOUT_MS 7000
|
||||||
|
|
|
@ -187,10 +187,10 @@ void serialSetMode(serialPort_t *instance, portMode_t mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
serialPort_t *openSerialPort(serialPortIdentifier_e identifier, serialPortFunction_e functionMask, serialReceiveCallbackPtr callback, baudRate_e baudRateIndex, portMode_t mode, serialInversion_e inversion) {
|
serialPort_t *openSerialPort(serialPortIdentifier_e identifier, serialPortFunction_e functionMask, serialReceiveCallbackPtr callback, uint32_t baudRate, portMode_t mode, serialInversion_e inversion) {
|
||||||
UNUSED(identifier);
|
UNUSED(identifier);
|
||||||
UNUSED(functionMask);
|
UNUSED(functionMask);
|
||||||
UNUSED(baudRateIndex);
|
UNUSED(baudRate);
|
||||||
UNUSED(callback);
|
UNUSED(callback);
|
||||||
UNUSED(mode);
|
UNUSED(mode);
|
||||||
UNUSED(inversion);
|
UNUSED(inversion);
|
||||||
|
|
Loading…
Reference in New Issue