mirror of
https://github.com/esp-rs/esp-idf-hal.git
synced 2025-09-30 22:01:23 +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
|
//! SPI loopback test
|
||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! SCLK GPIO6
|
//! SCLK GPIO6
|
||||||
//! MISO GPIO2
|
//! SDI GPIO2
|
||||||
//! MOSI GPIO7
|
//! SDO GPIO7
|
||||||
//! CS GPIO10
|
//! CS GPIO10
|
||||||
//!
|
//!
|
||||||
//! Depending on your target and the board you are using you have to change the pins.
|
//! Depending on your target and the board you are using you have to change the pins.
|
||||||
//!
|
//!
|
||||||
//! This example transfers data via SPI.
|
//! 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::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@ -27,8 +27,8 @@ fn main() -> anyhow::Result<()> {
|
|||||||
let spi = peripherals.spi2;
|
let spi = peripherals.spi2;
|
||||||
|
|
||||||
let sclk = peripherals.pins.gpio6;
|
let sclk = peripherals.pins.gpio6;
|
||||||
let miso = peripherals.pins.gpio2;
|
let serial_in = peripherals.pins.gpio2; //SDI
|
||||||
let mosi = peripherals.pins.gpio7;
|
let serial_out = peripherals.pins.gpio7; //SDO
|
||||||
let cs = peripherals.pins.gpio10;
|
let cs = peripherals.pins.gpio10;
|
||||||
|
|
||||||
println!("Starting SPI loopback test");
|
println!("Starting SPI loopback test");
|
||||||
@ -37,8 +37,8 @@ fn main() -> anyhow::Result<()> {
|
|||||||
spi,
|
spi,
|
||||||
spi::Pins {
|
spi::Pins {
|
||||||
sclk,
|
sclk,
|
||||||
sdo: miso,
|
sdo: serial_out,
|
||||||
sdi: Some(mosi),
|
sdi: Some(serial_in),
|
||||||
cs: Some(cs),
|
cs: Some(cs),
|
||||||
},
|
},
|
||||||
config,
|
config,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user