From 076390200a10c61d19edeead7c9dda93c264d860 Mon Sep 17 00:00:00 2001 From: Brendan Horan Date: Mon, 16 May 2022 22:22:58 +0930 Subject: [PATCH] Fix SPI loopback exmaple -- mixed up SDI and SDO (#72) * Fix SPI loopback exmaple Fix SDI and SDO been mixed up in example Update to new names * change SPI println back to orignal * run cargo fmt --- examples/spi_loopback.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/spi_loopback.rs b/examples/spi_loopback.rs index 842c73155..245ad5912 100644 --- a/examples/spi_loopback.rs +++ b/examples/spi_loopback.rs @@ -1,15 +1,15 @@ //! SPI loopback test //! //! Folowing pins are used: -//! SCLK GPIO6 -//! MISO GPIO2 -//! MOSI GPIO7 -//! CS GPIO10 +//! SCLK GPIO6 +//! SDI GPIO2 +//! SDO GPIO7 +//! CS GPIO10 //! //! Depending on your target and the board you are using you have to change the pins. //! //! This example transfers data via SPI. -//! Connect MISO and MOSI pins to see the outgoing data is read as incoming data. +//! Connect SDI and SDO pins to see the outgoing data is read as incoming data. use std::thread; use std::time::Duration; @@ -27,8 +27,8 @@ fn main() -> anyhow::Result<()> { let spi = peripherals.spi2; let sclk = peripherals.pins.gpio6; - let miso = peripherals.pins.gpio2; - let mosi = peripherals.pins.gpio7; + let serial_in = peripherals.pins.gpio2; //SDI + let serial_out = peripherals.pins.gpio7; //SDO let cs = peripherals.pins.gpio10; println!("Starting SPI loopback test"); @@ -37,8 +37,8 @@ fn main() -> anyhow::Result<()> { spi, spi::Pins { sclk, - sdo: miso, - sdi: Some(mosi), + sdo: serial_out, + sdi: Some(serial_in), cs: Some(cs), }, config,