aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2013-08-12 16:27:06 +0200
committerDean Camera <dean@fourwalledcubicle.com>2013-08-12 16:27:06 +0200
commita4a6958524adab55b5306df7c9a5de70b359dfa1 (patch)
tree49861865ae15ea44db7066141580671492af6da7
parent5558b2f221e4bbbb4f6d20a72908ad62c1a5941b (diff)
downloadlufa-a4a6958524adab55b5306df7c9a5de70b359dfa1.tar.gz
lufa-a4a6958524adab55b5306df7c9a5de70b359dfa1.tar.bz2
lufa-a4a6958524adab55b5306df7c9a5de70b359dfa1.zip
Fix broken USART SPI driver for the AVR8 architecture.
-rw-r--r--LUFA/DoxygenPages/ChangeLog.txt1
-rw-r--r--LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h8
2 files changed, 5 insertions, 4 deletions
diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt
index 3dce7a33b..673cb7d93 100644
--- a/LUFA/DoxygenPages/ChangeLog.txt
+++ b/LUFA/DoxygenPages/ChangeLog.txt
@@ -40,6 +40,7 @@
* - Fixed Pipe_GetBoundEndpointAddress() returning invalid endpoint directions on AVR8 architecture devices (thanks to decerri)
* under some circumstances
* - Fixed incorrect USB device state set when a suspended LUFA device is woken while addressed but not configured (thanks to Balaji Krishnan)
+ * - Fixed broken USART SPI driver for the AVR8 architecture due to incorrect initialization
* - Library Applications:
* - Added handler for SCSI_CMD_START_STOP_UNIT in demos using the Mass Storage class, to prevent ejection errors on *nix systems due to an
* unknown SCSI command
diff --git a/LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h b/LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h
index f12aa77f7..e449a8f5e 100644
--- a/LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h
+++ b/LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h
@@ -133,13 +133,13 @@
static inline void SerialSPI_Init(const uint8_t SPIOptions,
const uint32_t BaudRate)
{
- UBRR1 = SERIAL_SPI_UBBRVAL(BaudRate);
+ DDRD |= ((1 << 3) | (1 << 5));
+ PORTD |= (1 << 2);
UCSR1C = ((1 << UMSEL11) | (1 << UMSEL10) | SPIOptions);
UCSR1B = ((1 << TXEN1) | (1 << RXEN1));
- DDRD |= (1 << 3);
- PORTD |= (1 << 2);
+ UBRR1 = SERIAL_SPI_UBBRVAL(BaudRate);
}
/** Turns off the USART driver, disabling and returning used hardware to their default configuration. */
@@ -151,7 +151,7 @@
UBRR1 = 0;
- DDRD &= ~(1 << 3);
+ DDRD &= ~((1 << 3) | (1 << 5));
PORTD &= ~(1 << 2);
}