diff options
author | Paul Selkirk <paul@psgd.org> | 2017-10-17 00:27:11 -0400 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2017-10-17 00:27:11 -0400 |
commit | 03b14b4cd4a214a92e3968ff33a13c2086896864 (patch) | |
tree | 4b391205211d55a0cba4750682784f5d1799fb44 /projects/bootloader/bootloader.c | |
parent | 5af4a915edf3e77705fa2625081200b61f8dda26 (diff) |
Overhaul UART API
MGMT is the default UART, and no one should have to explicitly refer to
the UART unless they need USER (hsm.c:hal_serial_send_char).
The default UART is now exposed in the header file, so that the
default-using functions can be macros, which saves a few bytes in code
space, and a few microseconds in function call overhead.
Diffstat (limited to 'projects/bootloader/bootloader.c')
-rw-r--r-- | projects/bootloader/bootloader.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/projects/bootloader/bootloader.c b/projects/bootloader/bootloader.c index ead87d0..c62df12 100644 --- a/projects/bootloader/bootloader.c +++ b/projects/bootloader/bootloader.c @@ -84,7 +84,7 @@ int should_dfu() for (i = 0; i < 50; i++) { HAL_Delay(100); led_toggle(LED_BLUE); - if (uart_recv_char2(STM_UART_MGMT, &rx, 0) == HAL_OK) { + if (uart_recv_char(&rx, 0) == HAL_OK) { if (rx == 13) return 1; } } @@ -100,7 +100,7 @@ int main(void) stm_init(); - uart_send_string2(STM_UART_MGMT, (char *) "\r\n\r\nThis is the bootloader speaking..."); + uart_send_string("\r\n\r\nThis is the bootloader speaking..."); if (should_dfu()) { led_off(LED_BLUE); @@ -110,9 +110,9 @@ int main(void) */ led_off(LED_BLUE); led_on(LED_RED); - uart_send_string2(STM_UART_MGMT, (char *) "dfu_receive_firmware failed: "); - uart_send_number2(STM_UART_MGMT, status, 3, 16); - uart_send_string2(STM_UART_MGMT, (char *) "\r\n\r\nRebooting in three seconds\r\n"); + uart_send_string("dfu_receive_firmware failed: "); + uart_send_hex(status, 2); + uart_send_string("\r\n\r\nRebooting in three seconds\r\n"); HAL_Delay(3000); HAL_NVIC_SystemReset(); while (1) {}; @@ -124,7 +124,7 @@ int main(void) */ *dfu_control = HARDWARE_EARLY_DFU_JUMP; - uart_send_string2(STM_UART_MGMT, (char *) "loading firmware\r\n\r\n"); + uart_send_string("loading firmware\r\n\r\n"); /* De-initialize hardware by rebooting */ HAL_NVIC_SystemReset(); |