From: gitknilch Date: Sun, 20 Feb 2011 12:03:41 +0000 (+0100) Subject: more tx disabling. X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/fnordlicht-mini/commitdiff_plain/a73d0f32629447c5eb40fcfc9d1e4fcd8437aae7?ds=sidebyside more tx disabling. --- diff --git a/firmware/fnordlicht-firmware/remote.c b/firmware/fnordlicht-firmware/remote.c index fcaf672..dcef098 100644 --- a/firmware/fnordlicht-firmware/remote.c +++ b/firmware/fnordlicht-firmware/remote.c @@ -430,10 +430,15 @@ void parse_config_startup(struct remote_msg_config_startup_t *msg) storage_save_config(); } +#if UART_TX_ENABLED static void wait_for_uart(void) { while (fifo_fill((fifo_t *)&global_uart.tx) != 0 || !uart_send_complete()); } +#else +/* no need to wait for me */ +#define wait_for_uart() +#endif void parse_bootloader(struct remote_msg_bootloader_t *msg) { diff --git a/firmware/fnordlicht-firmware/uart.h b/firmware/fnordlicht-firmware/uart.h index ceeb4f0..8db8f3f 100644 --- a/firmware/fnordlicht-firmware/uart.h +++ b/firmware/fnordlicht-firmware/uart.h @@ -38,7 +38,9 @@ /* structs */ struct global_uart_t { fifo_t rx; +#if UART_TX_ENABLED fifo_t tx; +#endif }; /* global variables */ @@ -48,10 +50,15 @@ extern volatile struct global_uart_t global_uart; void uart_init(void); void uart_putc(uint8_t data); +#if UART_TX_ENABLED static inline bool uart_send_complete(void) { return _BV(_UDRE_UART0) & _UCSRA_UART0; } +#else +/* we're never incomplete, never. */ +#define uart_send_complete() 1 +#endif #endif