Skip to content

Commit

Permalink
Update comments to address feedback in Rahix#562
Browse files Browse the repository at this point in the history
  • Loading branch information
armandas committed Oct 5, 2024
1 parent 2db4a18 commit d4acdd6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions avr-hal-generic/src/usart_spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ macro_rules! add_usart_spi {
fn raw_setup(&mut self, settings: &$crate::spi::Settings) {
use $crate::hal::spi;

// Setup control registers
// We start by setting the UBBRn to 0
// UBRRn must be zero at the time the transmitter is enabled.
self.[<ubrr $n>].write(|w| unsafe {w.bits(0)});

// We have to translate the character size register into the 2 bits which are the MSB/LSB and the phase
Expand Down Expand Up @@ -84,13 +83,14 @@ macro_rules! add_usart_spi {
}
});

// Enable receiver and transmitter, and also the rec interrupt.
// Enable receiver and transmitter.
self.[<ucsr $n b>].write(|w| w
.[<txen $n>]().set_bit()
.[<rxen $n>]().set_bit()
);

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

0 comments on commit d4acdd6

Please sign in to comment.