Module atmega_hal::spi

source ·
Expand description

SPI

§Example

Complete example source code can be found in the repository atmega2560-spi-feedback.rs

let dp = atmega_hal::Peripherals::take().unwrap();
let pins = atmega_hal::pins!(dp);

let (mut spi, mut cs) = spi::Spi::new(
    dp.SPI,
    pins.pb1.into_output(),
    pins.pb2.into_output(),
    pins.pb3.into_pull_up_input(),
    pins.pb0.into_output(),
    spi::Settings::default(),
);

let data_out = b"Hello World!";
let mut data_in = [0u8; 12];

cs.set_low().unwrap();
spi.transfer(&mut data_in, data_out).unwrap();
cs.set_high().unwrap();

ufmt::uwriteln!(&mut serial, "data: {:?}", data_in).unwrap();

Structs§

Enums§

  • Order of data transmission, either MSB first or LSB first
  • Oscillator Clock Frequency division options.

Traits§

  • Internal trait for low-level SPI peripherals

Type Aliases§