Skip to content

Commit 8c4ca6f

Browse files
committed
Update comments to address feedback in Rahix#562
1 parent 97312b0 commit 8c4ca6f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

avr-hal-generic/src/usart_spi.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ macro_rules! add_usart_spi {
5555
fn raw_setup(&mut self, settings: &$crate::spi::Settings) {
5656
use $crate::hal::spi;
5757

58+
// UBRRn must be zero at the time the transmitter is enabled.
59+
self.[<ubrr $n>].write(|w| unsafe {w.bits(0)});
60+
5861
// We have to translate the character size register into the 2 bits which are the MSB/LSB and the phase
5962
// 5 Bit Char = MSB and 1st
6063
// 6 Bit Char = MSB and 2nd
@@ -80,13 +83,14 @@ macro_rules! add_usart_spi {
8083
}
8184
});
8285

83-
// Enable receiver and transmitter, and also the rec interrupt.
86+
// Enable receiver and transmitter.
8487
self.[<ucsr $n b>].write(|w| w
8588
.[<txen $n>]().set_bit()
8689
.[<rxen $n>]().set_bit()
8790
);
8891

8992
// Set the clock divider for SPI clock.
93+
// This must be done after the transmitter is enabled.
9094
self.[<ubrr $n>].write(|w| {
9195
match settings.clock {
9296
$crate::spi::SerialClockRate::OscfOver2 => w.bits(0),

0 commit comments

Comments
 (0)