X-Git-Url: http://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/9d18e10afb2439a6a9ba6978a799259746a837b7..9f4d9c8e095ee37b411008e81e6a12e7c20cb9c5:/project/commands/cmd_uart.c diff --git a/project/commands/cmd_uart.c b/project/commands/cmd_uart.c index 8e634f4..91081f7 100644 --- a/project/commands/cmd_uart.c +++ b/project/commands/cmd_uart.c @@ -78,9 +78,18 @@ void cmd_uart(uint8_t argc, char **argv) // Display the current baud rate #ifdef CFG_PRINTF_UART uart_pcb_t *pcb = uartGetPCB(); - printf("%d%s", pcb->baudrate, CFG_PRINTF_NEWLINE); + printf("%u%s", (unsigned int)(pcb->baudrate), CFG_PRINTF_NEWLINE); #else - printf("UART not initialised (using USBCDC)%s", CFG_PRINTF_NEWLINE); + // Try to get UART from EEPROM + uint32_t uartEEPROM = eepromReadU32(CFG_EEPROM_UART_SPEED); + if ((uartEEPROM < 9600) || (uartEEPROM > 115200)) + { + printf("UART not set in EEPROM%s", CFG_PRINTF_NEWLINE); + } + else + { + printf("%u%s", (unsigned int)uartEEPROM, CFG_PRINTF_NEWLINE); + } #endif } }