aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32l1
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-01-14 22:02:00 +0100
committerDario Nieuwenhuis <[email protected]>2022-01-19 17:59:55 +0100
commit58fc64722c65bbdc209ae0fd1700f03702bbcd08 (patch)
tree77f9412b47259cd4cf4170b0a257b371398d4f2c /examples/stm32l1
parent52e156b429417bde59d0ea67d11256866f1dcec9 (diff)
stm32/gpio: expose all functionality as inherent methods.
Diffstat (limited to 'examples/stm32l1')
-rw-r--r--examples/stm32l1/src/bin/blinky.rs5
-rw-r--r--examples/stm32l1/src/bin/spi.rs5
2 files changed, 4 insertions, 6 deletions
diff --git a/examples/stm32l1/src/bin/blinky.rs b/examples/stm32l1/src/bin/blinky.rs
index deabdddba..07c804e9f 100644
--- a/examples/stm32l1/src/bin/blinky.rs
+++ b/examples/stm32l1/src/bin/blinky.rs
@@ -9,7 +9,6 @@ use embassy::executor::Spawner;
9use embassy::time::{Duration, Timer}; 9use embassy::time::{Duration, Timer};
10use embassy_stm32::gpio::{Level, Output, Speed}; 10use embassy_stm32::gpio::{Level, Output, Speed};
11use embassy_stm32::Peripherals; 11use embassy_stm32::Peripherals;
12use embedded_hal::digital::v2::OutputPin;
13use example_common::*; 12use example_common::*;
14 13
15#[embassy::main] 14#[embassy::main]
@@ -20,11 +19,11 @@ async fn main(_spawner: Spawner, p: Peripherals) {
20 19
21 loop { 20 loop {
22 info!("high"); 21 info!("high");
23 unwrap!(led.set_high()); 22 led.set_high();
24 Timer::after(Duration::from_millis(1000)).await; 23 Timer::after(Duration::from_millis(1000)).await;
25 24
26 info!("low"); 25 info!("low");
27 unwrap!(led.set_low()); 26 led.set_low();
28 Timer::after(Duration::from_millis(1000)).await; 27 Timer::after(Duration::from_millis(1000)).await;
29 } 28 }
30} 29}
diff --git a/examples/stm32l1/src/bin/spi.rs b/examples/stm32l1/src/bin/spi.rs
index 3cfbe3fc4..9d1a2fc87 100644
--- a/examples/stm32l1/src/bin/spi.rs
+++ b/examples/stm32l1/src/bin/spi.rs
@@ -7,7 +7,6 @@ mod example_common;
7 7
8use embassy::executor::Spawner; 8use embassy::executor::Spawner;
9use embassy_stm32::gpio::{Level, Output, Speed}; 9use embassy_stm32::gpio::{Level, Output, Speed};
10use embedded_hal::digital::v2::OutputPin;
11use example_common::*; 10use example_common::*;
12 11
13use embassy_stm32::dma::NoDma; 12use embassy_stm32::dma::NoDma;
@@ -35,9 +34,9 @@ async fn main(_spawner: Spawner, p: Peripherals) {
35 34
36 loop { 35 loop {
37 let mut buf = [0x0Au8; 4]; 36 let mut buf = [0x0Au8; 4];
38 unwrap!(cs.set_low()); 37 cs.set_low();
39 unwrap!(spi.transfer(&mut buf)); 38 unwrap!(spi.transfer(&mut buf));
40 unwrap!(cs.set_high()); 39 cs.set_high();
41 info!("xfer {=[u8]:x}", buf); 40 info!("xfer {=[u8]:x}", buf);
42 } 41 }
43} 42}