Fix arduino 1.8.13 warnings

This commit is contained in:
Alex Voinea 2022-02-04 15:53:12 +01:00
parent 60aa996ba7
commit 58867f6c06
2 changed files with 8 additions and 5 deletions

View File

@ -30,7 +30,7 @@ uint8_t selectedSerialPort = 0;
// this is so I can support Attiny series and any other chip without a UART
#if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
#if UART_PRESENT(SERIAL_PORT)
#ifdef HAS_UART
ring_buffer rx_buffer = { { 0 }, 0, 0 };
#endif

View File

@ -28,9 +28,12 @@
#endif
// The presence of the UBRRH register is used to detect a UART.
#define UART_PRESENT(port) ((port == 0 && (defined(UBRRH) || defined(UBRR0H))) || \
(port == 1 && defined(UBRR1H)) || (port == 2 && defined(UBRR2H)) || \
#if ((port == 0 && (defined(UBRRH) || defined(UBRR0H))) || \
(port == 1 && defined(UBRR1H)) || \
(port == 2 && defined(UBRR2H)) || \
(port == 3 && defined(UBRR3H)))
#define HAS_UART
#endif
// These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor
// requires two levels of indirection to expand macro values properly)
@ -82,7 +85,7 @@ struct ring_buffer
int tail;
};
#if UART_PRESENT(SERIAL_PORT)
#ifdef HAS_UART
extern ring_buffer rx_buffer;
#endif