AP_Bootloader: fixed build with no uarts

This commit is contained in:
Andrew Tridgell 2018-06-25 16:08:51 +10:00
parent f71d2a7417
commit 0546ea69d1
2 changed files with 10 additions and 4 deletions

View File

@ -35,10 +35,6 @@ extern "C" {
struct boardinfo board_info;
#ifndef BOOTLOADER_BAUDRATE
#define BOOTLOADER_BAUDRATE 115200
#endif
int main(void)
{
init_uarts();

View File

@ -14,10 +14,16 @@
#include "mcu_f7.h"
static BaseChannel *uarts[] = { BOOTLOADER_DEV_LIST };
#if HAL_USE_SERIAL == TRUE
static SerialConfig sercfg;
#endif
static int8_t locked_uart = -1;
static uint8_t last_uart;
#ifndef BOOTLOADER_BAUDRATE
#define BOOTLOADER_BAUDRATE 115200
#endif
int16_t cin(unsigned timeout_ms)
{
uint8_t b = 0;
@ -328,6 +334,7 @@ void init_uarts(void)
usbConnectBus(serusbcfg.usbp);
#endif
#if HAL_USE_SERIAL == TRUE
sercfg.speed = BOOTLOADER_BAUDRATE;
for (uint8_t i=0; i<ARRAY_SIZE_SIMPLE(uarts); i++) {
@ -338,6 +345,7 @@ void init_uarts(void)
#endif
sdStart((SerialDriver *)uarts[i], &sercfg);
}
#endif
}
@ -352,8 +360,10 @@ void port_setbaud(uint32_t baudrate)
return;
}
#endif
#if HAL_USE_SERIAL == TRUE
memset(&sercfg, 0, sizeof(sercfg));
sercfg.speed = baudrate;
sdStart((SerialDriver *)uarts[last_uart], &sercfg);
#endif
}