From 99f7ef7c673e02d559eb55d064f38a105393c8f6 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Sun, 1 Dec 2013 17:21:54 +0100 Subject: Centrally decide which hardware UARTS are available Before, this decision was made in few different places, based on sometimes different register defines. Now, HardwareSerial.h decides wich UARTS are available, defines USE_HWSERIALn macros and HardwareSerial.cpp simply checks these macros (together with some #ifs to decide which registers to use for UART 0). For consistency, USBAPI.h also defines a HAVE_CDCSERIAL macro when applicable. For supported targets, this should change any behaviour. For unsupported targets, the error messages might subtly change because some checks are moved or changed. Additionally, this moves the USBAPI.h include form HardareSerial.h into Arduino.h and raises an error when both CDC serial and UART0 are available (previously this would silently use UART0 instead of CDC, but there is not currently any Atmel chip available for which this would occur). --- cores/arduino/Arduino.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cores/arduino/Arduino.h') diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index 8502e44..a189777 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -200,6 +200,10 @@ extern const uint8_t PROGMEM digital_pin_to_timer_PGM[]; #include "WCharacter.h" #include "WString.h" #include "HardwareSerial.h" +#include "USBAPI.h" +#if defined(HAVE_HWSERIAL0) && defined(HAVE_CDCSERIAL) +#error "Targets with both UART0 and CDC serial not supported" +#endif uint16_t makeWord(uint16_t w); uint16_t makeWord(byte h, byte l); -- cgit v1.2.3-18-g5258