Skip to content

Commit

Permalink
split master/slave spi structures
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed Apr 20, 2023
1 parent 557b7f2 commit 1178ec4
Show file tree
Hide file tree
Showing 5 changed files with 379 additions and 196 deletions.
7 changes: 4 additions & 3 deletions examples/rtic-spi-slave-dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod app {
pac::{DMA1, SPI3},
prelude::*,
rcc::RccExt,
spi::{Rx, Spi, Tx},
spi::{Rx, SpiSlave, Tx},
};
use panic_semihosting as _;
use systick_monotonic::*;
Expand Down Expand Up @@ -56,7 +56,7 @@ mod app {

let rcc = device_peripherals.RCC;
let rcc = rcc.constrain();
let clocks = rcc.cfgr.sysclk(100.MHz()).pclk1(36.MHz()).freeze();
let _clocks = rcc.cfgr.sysclk(100.MHz()).pclk1(36.MHz()).freeze();

let mono = Systick::new(core.SYST, 100_000_000);

Expand All @@ -77,7 +77,8 @@ mod app {
phase: Phase::CaptureOnFirstTransition,
};

let spi3 = Spi::new_slave(spi, (sck, miso, mosi), mode, 8_000_000.Hz(), &clocks);
let mut spi3 = SpiSlave::new(spi, (sck, miso, mosi, None), mode);
spi3.set_internal_nss(false);

let (tx, rx) = spi3.use_dma().txrx();

Expand Down
4 changes: 0 additions & 4 deletions src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ pub use embedded_hal::adc::OneShot as _embedded_hal_adc_OneShot;
pub use embedded_hal::blocking::delay::DelayMs as _embedded_hal_blocking_delay_DelayMs;
pub use embedded_hal::blocking::delay::DelayUs as _embedded_hal_blocking_delay_DelayUs;
pub use embedded_hal::blocking::serial::Write as _embedded_hal_blocking_serial_Write;
pub use embedded_hal::blocking::spi::{
Transfer as _embedded_hal_blocking_spi_Transfer, Write as _embedded_hal_blocking_spi_Write,
};
pub use embedded_hal::serial::Read as _embedded_hal_serial_Read;
pub use embedded_hal::serial::Write as _embedded_hal_serial_Write;
pub use embedded_hal::spi::FullDuplex as _embedded_hal_spi_FullDuplex;
pub use embedded_hal::Capture as _embedded_hal_Capture;
pub use embedded_hal::Pwm as _embedded_hal_Pwm;
pub use embedded_hal::Qei as _embedded_hal_Qei;
Expand Down
Loading

0 comments on commit 1178ec4

Please sign in to comment.