Merge branch 'master' of git://github.com/microbuilder/LPC1343CodeBase
[hackover2013-badge-firmware.git] / project / commands / cmd_uart.c
index 8e634f4..490626b 100644 (file)
@@ -43,7 +43,7 @@
 #include "project/commands.h"       // Generic helper functions
 
 #ifdef CFG_I2CEEPROM
-  #include "drivers/eeprom/eeprom.h"
+  #include "drivers/storage/eeprom/eeprom.h"
   #include "core/uart/uart.h"
 
 /**************************************************************************/
@@ -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
   }
 }
This page took 0.023174 seconds and 4 git commands to generate.