From ea907b91f4feb6acff1329f903c99cf03f8bb893 Mon Sep 17 00:00:00 2001 From: bernie Date: Tue, 19 Oct 2004 07:52:35 +0000 Subject: [PATCH] Reset parity bits before overwriting them (Fixed by batt in kseries). git-svn-id: https://src.develer.com/svnoss/bertos/trunk@238 38d2e660-2303-0410-9eaa-f027e97ec537 --- drv/ser_avr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drv/ser_avr.c b/drv/ser_avr.c index 452e16b3..78a3058d 100755 --- a/drv/ser_avr.c +++ b/drv/ser_avr.c @@ -38,6 +38,9 @@ /*#* *#* $Log$ + *#* Revision 1.17 2004/10/19 07:52:35 bernie + *#* Reset parity bits before overwriting them (Fixed by batt in project_ks). + *#* *#* Revision 1.16 2004/10/03 18:45:48 bernie *#* Convert to new-style config macros; Allow compiling with a C++ compiler (mostly). *#* @@ -372,7 +375,7 @@ static void uart0_setbaudrate(UNUSED(struct SerialHardware *, _hw), unsigned lon static void uart0_setparity(UNUSED(struct SerialHardware *, _hw), int parity) { #if !CPU_AVR_ATMEGA103 - UCSR0C |= (parity) << UPM0; + UCSR0C = (UCSR0C & ~(BV(UPM1) | BV(UPM0))) | ((parity) << UPM0); #endif } @@ -420,7 +423,7 @@ static void uart1_setbaudrate(UNUSED(struct SerialHardware *, _hw), unsigned lon static void uart1_setparity(UNUSED(struct SerialHardware *, _hw), int parity) { - UCSR1C |= (parity) << UPM0; + UCSR1C = (UCSR1C & ~(BV(UPM1) | BV(UPM0))) | ((parity) << UPM0); } #endif // AVR_HAS_UART1 -- 2.25.1