Skip to content

Commit

Permalink
spi: port set_format changes to rp235x
Browse files Browse the repository at this point in the history
  • Loading branch information
jannic committed Oct 12, 2024
1 parent 0e945d5 commit 982dbb1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rp235x-hal/src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ impl<S: State, D: SpiDevice, P: ValidSpiPinout<D>, const DS: u8> Spi<S, D, P, DS
(freq_in / (prescale as u32 * (1 + postdiv as u32))).Hz()
}

/// Set format and datasize
pub fn set_format(&mut self, data_bits: u8, frame_format: FrameFormat) {
/// Set format
pub fn set_format(&mut self, frame_format: FrameFormat) {
self.device.sspcr0().modify(|_, w| unsafe {
w.dss().bits(data_bits - 1).frf().bits(match &frame_format {
w.dss().bits(DS - 1).frf().bits(match &frame_format {
FrameFormat::MotorolaSpi(_) => 0x00,
FrameFormat::TexasInstrumentsSynchronousSerial => 0x01,
FrameFormat::NationalSemiconductorMicrowire => 0x10,
Expand Down Expand Up @@ -335,7 +335,7 @@ impl<D: SpiDevice, P: ValidSpiPinout<D>, const DS: u8> Spi<Disabled, D, P, DS> {
self.device.reset_bring_up(resets);

self.set_baudrate(peri_frequency, baudrate);
self.set_format(DS, frame_format);
self.set_format(frame_format);
self.set_slave(slave);
// Always enable DREQ signals -- harmless if DMA is not listening
self.device
Expand Down

0 comments on commit 982dbb1

Please sign in to comment.