mirror of
https://github.com/esp-rs/esp-idf-hal.git
synced 2025-09-29 21:31:17 +00:00
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
This commit is contained in:
parent
719eea4777
commit
076390200a
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user