aboutsummaryrefslogtreecommitdiff
path: root/examples/nrf/src/bin/pwm.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/nrf/src/bin/pwm.rs')
-rw-r--r--examples/nrf/src/bin/pwm.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/nrf/src/bin/pwm.rs b/examples/nrf/src/bin/pwm.rs
index c8a083294..dca40fd58 100644
--- a/examples/nrf/src/bin/pwm.rs
+++ b/examples/nrf/src/bin/pwm.rs
@@ -6,7 +6,6 @@ use defmt::*;
6use embassy_executor::executor::Spawner; 6use embassy_executor::executor::Spawner;
7use embassy_executor::time::{Duration, Timer}; 7use embassy_executor::time::{Duration, Timer};
8use embassy_nrf::pwm::{Prescaler, SimplePwm}; 8use embassy_nrf::pwm::{Prescaler, SimplePwm};
9use embassy_nrf::Peripherals;
10use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
11 10
12// for i in range(1024): print(int((math.sin(i/512*math.pi)*0.4+0.5)**2*32767), ', ', end='') 11// for i in range(1024): print(int((math.sin(i/512*math.pi)*0.4+0.5)**2*32767), ', ', end='')
@@ -71,7 +70,8 @@ static DUTY: [u16; 1024] = [
71]; 70];
72 71
73#[embassy_executor::main] 72#[embassy_executor::main]
74async fn main(_spawner: Spawner, p: Peripherals) { 73async fn main(_spawner: Spawner) {
74 let p = embassy_nrf::init(Default::default());
75 let mut pwm = SimplePwm::new_4ch(p.PWM0, p.P0_13, p.P0_14, p.P0_16, p.P0_15); 75 let mut pwm = SimplePwm::new_4ch(p.PWM0, p.P0_13, p.P0_14, p.P0_16, p.P0_15);
76 pwm.set_prescaler(Prescaler::Div1); 76 pwm.set_prescaler(Prescaler::Div1);
77 pwm.set_max_duty(32767); 77 pwm.set_max_duty(32767);