aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f4/src/bin
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-07-28 17:18:22 -0500
committerxoviat <[email protected]>2023-07-28 17:18:22 -0500
commitc7c701b3e312c14ca00eabfa8b6d422cec869cbf (patch)
treedf9388eca3a45127eb36a670396d3a2c91517fa0 /examples/stm32f4/src/bin
parente495d606ec62ccfd72eaf9fc868455da217e2d5c (diff)
parentcc414e63d3b7aec7da07d9097cf8a78b5d55a73a (diff)
Merge branch 'main' of https://github.com/embassy-rs/embassy into hrtim
Diffstat (limited to 'examples/stm32f4/src/bin')
-rw-r--r--examples/stm32f4/src/bin/can.rs7
-rw-r--r--examples/stm32f4/src/bin/dac.rs2
-rw-r--r--examples/stm32f4/src/bin/pwm.rs4
-rw-r--r--examples/stm32f4/src/bin/pwm_complementary.rs6
4 files changed, 11 insertions, 8 deletions
diff --git a/examples/stm32f4/src/bin/can.rs b/examples/stm32f4/src/bin/can.rs
index 08bed88db..f84f74d30 100644
--- a/examples/stm32f4/src/bin/can.rs
+++ b/examples/stm32f4/src/bin/can.rs
@@ -40,10 +40,13 @@ async fn main(_spawner: Spawner) {
40 40
41 can.as_mut() 41 can.as_mut()
42 .modify_config() 42 .modify_config()
43 .set_bit_timing(0x001c0003) // http://www.bittiming.can-wiki.info/
44 .set_loopback(true) // Receive own frames 43 .set_loopback(true) // Receive own frames
45 .set_silent(true) 44 .set_silent(true)
46 .enable(); 45 .leave_disabled();
46
47 can.set_bitrate(1_000_000);
48
49 can.enable().await;
47 50
48 let mut i: u8 = 0; 51 let mut i: u8 = 0;
49 loop { 52 loop {
diff --git a/examples/stm32f4/src/bin/dac.rs b/examples/stm32f4/src/bin/dac.rs
index 3a6216712..aaedcfecc 100644
--- a/examples/stm32f4/src/bin/dac.rs
+++ b/examples/stm32f4/src/bin/dac.rs
@@ -14,11 +14,11 @@ async fn main(_spawner: Spawner) -> ! {
14 info!("Hello World, dude!"); 14 info!("Hello World, dude!");
15 15
16 let mut dac = DacCh1::new(p.DAC, NoDma, p.PA4); 16 let mut dac = DacCh1::new(p.DAC, NoDma, p.PA4);
17 unwrap!(dac.set_trigger_enable(false));
17 18
18 loop { 19 loop {
19 for v in 0..=255 { 20 for v in 0..=255 {
20 unwrap!(dac.set(Value::Bit8(to_sine_wave(v)))); 21 unwrap!(dac.set(Value::Bit8(to_sine_wave(v))));
21 dac.trigger();
22 } 22 }
23 } 23 }
24} 24}
diff --git a/examples/stm32f4/src/bin/pwm.rs b/examples/stm32f4/src/bin/pwm.rs
index 7c5902052..4f130c26b 100644
--- a/examples/stm32f4/src/bin/pwm.rs
+++ b/examples/stm32f4/src/bin/pwm.rs
@@ -4,9 +4,9 @@
4 4
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::pwm::simple_pwm::{PwmPin, SimplePwm};
8use embassy_stm32::pwm::Channel;
9use embassy_stm32::time::khz; 7use embassy_stm32::time::khz;
8use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm};
9use embassy_stm32::timer::Channel;
10use embassy_time::{Duration, Timer}; 10use embassy_time::{Duration, Timer};
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
diff --git a/examples/stm32f4/src/bin/pwm_complementary.rs b/examples/stm32f4/src/bin/pwm_complementary.rs
index a8a68ed6e..8cc2a4117 100644
--- a/examples/stm32f4/src/bin/pwm_complementary.rs
+++ b/examples/stm32f4/src/bin/pwm_complementary.rs
@@ -4,10 +4,10 @@
4 4
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::pwm::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin};
8use embassy_stm32::pwm::simple_pwm::PwmPin;
9use embassy_stm32::pwm::Channel;
10use embassy_stm32::time::khz; 7use embassy_stm32::time::khz;
8use embassy_stm32::timer::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin};
9use embassy_stm32::timer::simple_pwm::PwmPin;
10use embassy_stm32::timer::Channel;
11use embassy_time::{Duration, Timer}; 11use embassy_time::{Duration, Timer};
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13