diff options
Diffstat (limited to 'examples/stm32f4/src/bin')
| -rw-r--r-- | examples/stm32f4/src/bin/can.rs | 7 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/dac.rs | 2 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/pwm.rs | 4 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/pwm_complementary.rs | 6 |
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 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_stm32::pwm::simple_pwm::{PwmPin, SimplePwm}; | ||
| 8 | use embassy_stm32::pwm::Channel; | ||
| 9 | use embassy_stm32::time::khz; | 7 | use embassy_stm32::time::khz; |
| 8 | use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; | ||
| 9 | use embassy_stm32::timer::Channel; | ||
| 10 | use embassy_time::{Duration, Timer}; | 10 | use embassy_time::{Duration, Timer}; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {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 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_stm32::pwm::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin}; | ||
| 8 | use embassy_stm32::pwm::simple_pwm::PwmPin; | ||
| 9 | use embassy_stm32::pwm::Channel; | ||
| 10 | use embassy_stm32::time::khz; | 7 | use embassy_stm32::time::khz; |
| 8 | use embassy_stm32::timer::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin}; | ||
| 9 | use embassy_stm32::timer::simple_pwm::PwmPin; | ||
| 10 | use embassy_stm32::timer::Channel; | ||
| 11 | use embassy_time::{Duration, Timer}; | 11 | use embassy_time::{Duration, Timer}; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
