Only index into the configurable baud rate list when needed.

This commit is contained in:
Dominic Clifton 2015-03-03 17:30:35 +00:00
parent dca984ff88
commit a156d915f4
10 changed files with 11 additions and 13 deletions

View File

@ -62,7 +62,7 @@
#ifdef BLACKBOX
#define BLACKBOX_BAUDRATE BAUD_115200
#define BLACKBOX_BAUDRATE 115200
#define BLACKBOX_INITIAL_PORT_MODE MODE_TX
// How many bytes should we transmit per loop iteration?

View File

@ -236,7 +236,7 @@ serialPort_t *openSerialPort(
serialPortIdentifier_e identifier,
serialPortFunction_e function,
serialReceiveCallbackPtr callback,
baudRate_e baudRateIndex,
uint32_t baudRate,
portMode_t mode,
serialInversion_e inversion)
{
@ -248,8 +248,6 @@ serialPort_t *openSerialPort(
serialPort_t *serialPort = NULL;
uint32_t baudRate = baudRates[baudRateIndex];
switch(identifier) {
#ifdef USE_VCP
case SERIAL_PORT_USB_VCP:

View File

@ -110,7 +110,7 @@ serialPort_t *openSerialPort(
serialPortIdentifier_e identifier,
serialPortFunction_e function,
serialReceiveCallbackPtr callback,
baudRate_e baudrate,
uint32_t baudrate,
portMode_t mode,
serialInversion_e inversion
);

View File

@ -602,7 +602,7 @@ void mspAllocateSerialPorts(serialConfig_t *serialConfig)
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) {
resetMspPort(mspPort, serialPort, FOR_GENERAL_MSP);
portIndex++;

View File

@ -43,7 +43,7 @@
#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_mask;

View File

@ -64,7 +64,7 @@
static serialPort_t *frskyPort = NULL;
static serialPortConfig_t *portConfig;
#define FRSKY_BAUDRATE BAUD_9600
#define FRSKY_BAUDRATE 9600
#define FRSKY_INITIAL_PORT_MODE MODE_TX
static telemetryConfig_t *telemetryConfig;

View File

@ -100,7 +100,7 @@ static uint8_t hottMsgCrc;
#define HOTT_CRC_SIZE (sizeof(hottMsgCrc))
#define HOTT_BAUDRATE BAUD_19200
#define HOTT_BAUDRATE 19200
#define HOTT_INITIAL_PORT_MODE MODE_RX
static serialPort_t *hottPort = NULL;

View File

@ -100,7 +100,7 @@ void configureMSPTelemetryPort(void)
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) {
return;

View File

@ -133,7 +133,7 @@ const uint16_t frSkyDataIdTable[] = {
};
#define __USE_C99_MATH // for roundf()
#define SMARTPORT_BAUD BAUD_57600
#define SMARTPORT_BAUD 57600
#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_NOT_CONNECTED_TIMEOUT_MS 7000

View File

@ -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(functionMask);
UNUSED(baudRateIndex);
UNUSED(baudRate);
UNUSED(callback);
UNUSED(mode);
UNUSED(inversion);