From 5ca747e312e70aa87b6056c15f6dae41c2f0f20c Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Thu, 30 Aug 2012 08:47:35 -0400 Subject: Changing setting of the UMSELn bits (for UART mode) and serial config values. Before, the UMSELn1 bit was being to set to 1, putting the UART into a reserved mode. Now, we only set the high (0x80) bit to 1 for the ATmega8, which is needed to access UCSRnC (whose i/o address is shared with UBRRH). Also, no longer bitwise-or the new config with the existing register value, because we're actually configuring all the settings in the register. (We're not using UCPOL, but it's supposed to be 0 in asynchronous mode.) --- cores/arduino/HardwareSerial.h | 48 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'cores/arduino/HardwareSerial.h') diff --git a/cores/arduino/HardwareSerial.h b/cores/arduino/HardwareSerial.h index dcbaebc..c2d0ce9 100644 --- a/cores/arduino/HardwareSerial.h +++ b/cores/arduino/HardwareSerial.h @@ -69,30 +69,30 @@ class HardwareSerial : public Stream }; // Define config for Serial.begin(baud, config); -#define SERIAL_5N1 0x80 -#define SERIAL_6N1 0x82 -#define SERIAL_7N1 0x84 -#define SERIAL_8N1 0x86 -#define SERIAL_5N2 0x88 -#define SERIAL_6N2 0x8A -#define SERIAL_7N2 0x8C -#define SERIAL_8N2 0x8E -#define SERIAL_5E1 0xA0 -#define SERIAL_6E1 0xA2 -#define SERIAL_7E1 0xA4 -#define SERIAL_8E1 0xA6 -#define SERIAL_5E2 0xA8 -#define SERIAL_6E2 0xAA -#define SERIAL_7E2 0xAC -#define SERIAL_8E2 0xAE -#define SERIAL_5O1 0xB0 -#define SERIAL_6O1 0xB2 -#define SERIAL_7O1 0xB4 -#define SERIAL_8O1 0xB6 -#define SERIAL_5O2 0xB8 -#define SERIAL_6O2 0xBA -#define SERIAL_7O2 0xBC -#define SERIAL_8O2 0xBE +#define SERIAL_5N1 0x00 +#define SERIAL_6N1 0x02 +#define SERIAL_7N1 0x04 +#define SERIAL_8N1 0x06 +#define SERIAL_5N2 0x08 +#define SERIAL_6N2 0x0A +#define SERIAL_7N2 0x0C +#define SERIAL_8N2 0x0E +#define SERIAL_5E1 0x20 +#define SERIAL_6E1 0x22 +#define SERIAL_7E1 0x24 +#define SERIAL_8E1 0x26 +#define SERIAL_5E2 0x28 +#define SERIAL_6E2 0x2A +#define SERIAL_7E2 0x2C +#define SERIAL_8E2 0x2E +#define SERIAL_5O1 0x30 +#define SERIAL_6O1 0x32 +#define SERIAL_7O1 0x34 +#define SERIAL_8O1 0x36 +#define SERIAL_5O2 0x38 +#define SERIAL_6O2 0x3A +#define SERIAL_7O2 0x3C +#define SERIAL_8O2 0x3E #if defined(UBRRH) || defined(UBRR0H) extern HardwareSerial Serial; -- cgit v1.2.3-18-g5258