From 643c7e934a661dcb565d3e80f62f33c64c306756 Mon Sep 17 00:00:00 2001 From: Jacob Alexander Date: Sat, 19 Jul 2014 09:31:04 -0700 Subject: [PATCH] Removing unnecessary ifdefs --- Output/uartOut/output_com.c | 15 ++++----------- Output/usbMuxUart/output_com.c | 17 +++++------------ 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/Output/uartOut/output_com.c b/Output/uartOut/output_com.c index 16fd892..2f1762f 100644 --- a/Output/uartOut/output_com.c +++ b/Output/uartOut/output_com.c @@ -116,10 +116,7 @@ inline void Output_send(void) // Sets the device into firmware reload mode inline void Output_firmwareReload() { -#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) -#elif defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) uart_device_reload(); -#endif } @@ -133,10 +130,8 @@ inline unsigned int Output_availablechar() // USB Get Character from input buffer inline int Output_getchar() { -#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) -#elif defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) - return uart_serial_getchar(); -#endif + // XXX Make sure to check output_availablechar() first! Information is lost with the cast (error codes) (AVR) + return (int)uart_serial_getchar(); } @@ -151,6 +146,7 @@ inline int Output_putchar( char c ) inline int Output_putstr( char* str ) { #if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR + uint16_t count = 0; #elif defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) // ARM uint32_t count = 0; #endif @@ -165,10 +161,7 @@ inline int Output_putstr( char* str ) // Soft Chip Reset inline void Output_softReset() { -#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) -#elif defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) - SOFTWARE_RESET(); -#endif + usb_device_software_reset(); } diff --git a/Output/usbMuxUart/output_com.c b/Output/usbMuxUart/output_com.c index f08e088..80c7a4c 100644 --- a/Output/usbMuxUart/output_com.c +++ b/Output/usbMuxUart/output_com.c @@ -142,10 +142,7 @@ inline void Output_send(void) // Sets the device into firmware reload mode inline void Output_firmwareReload() { -#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) -#elif defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) uart_device_reload(); -#endif } @@ -159,20 +156,18 @@ inline unsigned int Output_availablechar() // USB Get Character from input buffer inline int Output_getchar() { -#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) -#elif defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) + // XXX Make sure to check output_availablechar() first! Information is lost with the cast (error codes) (AVR) if ( usb_serial_available() > 0 ) { - return usb_serial_getchar(); + return (int)usb_serial_getchar(); } if ( uart_serial_available() > 0 ) { - return uart_serial_getchar(); + return (int)uart_serial_getchar(); } return -1; -#endif } @@ -191,6 +186,7 @@ inline int Output_putchar( char c ) inline int Output_putstr( char* str ) { #if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR + uint16_t count = 0; #elif defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) // ARM uint32_t count = 0; #endif @@ -209,10 +205,7 @@ inline int Output_putstr( char* str ) // Soft Chip Reset inline void Output_softReset() { -#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) -#elif defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) - SOFTWARE_RESET(); -#endif + usb_device_software_reset(); } -- 2.39.5