Module attiny_hal::spi
source · Expand description
SPI
§Example
For full source code, please refer to the ATmega SPI example:
atmega2560-spi-feedback.rs
let dp = attiny_hal::Peripherals::take().unwrap();
let pins = attiny_hal::pins!(dp);
let (mut spi, mut cs) = spi::Spi::new(
dp.SPI,
pins.pa4.into_output(),
pins.pa6.into_output(),
pins.pa5.into_pull_up_input(),
pins.pa3.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§
- Wrapper for the CS pin
- Settings to pass to Spi.
- Behavior for a SPI interface.
Enums§
- Order of data transmission, either MSB first or LSB first
- Oscillator Clock Frequency division options.
Traits§
- Internal trait for low-level SPI peripherals