aboutsummaryrefslogtreecommitdiff
path: root/examples/nrf/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-01-25 06:46:37 +0000
committerGitHub <[email protected]>2022-01-25 06:46:37 +0000
commita950266a7501c5534ebd7c477d42d29ac25cf472 (patch)
treed548c46ba46a285bc3bc8555ed3f0875648922ef /examples/nrf/src
parent0549a9dbaac8726e5d37d87f8f14b8524915c8c9 (diff)
parentc9f29534d6f3fd5bcf2cee09e70667373a8dc179 (diff)
Merge #590
590: Stop PWM before assigning the new sequence r=huntc a=huntc I had introduced a small bug in my last PR where I assigned the sequence before stopping the PWM. I now stop the PWM before doing that now. Also, corrected a math comment. Co-authored-by: huntc <[email protected]>
Diffstat (limited to 'examples/nrf/src')
-rw-r--r--examples/nrf/src/bin/pwm_sequence.rs2
-rw-r--r--examples/nrf/src/bin/pwm_sequence_ppi.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/examples/nrf/src/bin/pwm_sequence.rs b/examples/nrf/src/bin/pwm_sequence.rs
index 561bc1dd1..56c865d1c 100644
--- a/examples/nrf/src/bin/pwm_sequence.rs
+++ b/examples/nrf/src/bin/pwm_sequence.rs
@@ -18,7 +18,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
18 18
19 let mut config = SequenceConfig::default(); 19 let mut config = SequenceConfig::default();
20 config.prescaler = Prescaler::Div128; 20 config.prescaler = Prescaler::Div128;
21 // 1 period is 1000 * (128/16mhz = 0.000008s = 0.008ms) = 8ms 21 // 1 period is 1000 * (128/16mhz = 0.000008s = 0.008ms) = 8us
22 // but say we want to hold the value for 5000ms 22 // but say we want to hold the value for 5000ms
23 // so we want to repeat our value as many times as necessary until 5000ms passes 23 // so we want to repeat our value as many times as necessary until 5000ms passes
24 // want 5000/8 = 625 periods total to occur, so 624 (we get the one period for free remember) 24 // want 5000/8 = 625 periods total to occur, so 624 (we get the one period for free remember)
diff --git a/examples/nrf/src/bin/pwm_sequence_ppi.rs b/examples/nrf/src/bin/pwm_sequence_ppi.rs
index 213ef5ed7..f03c5716a 100644
--- a/examples/nrf/src/bin/pwm_sequence_ppi.rs
+++ b/examples/nrf/src/bin/pwm_sequence_ppi.rs
@@ -20,7 +20,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
20 20
21 let mut config = SequenceConfig::default(); 21 let mut config = SequenceConfig::default();
22 config.prescaler = Prescaler::Div128; 22 config.prescaler = Prescaler::Div128;
23 // 1 period is 1000 * (128/16mhz = 0.000008s = 0.008ms) = 8ms 23 // 1 period is 1000 * (128/16mhz = 0.000008s = 0.008ms) = 8us
24 // but say we want to hold the value for 250ms 250ms/8 = 31.25 periods 24 // but say we want to hold the value for 250ms 250ms/8 = 31.25 periods
25 // so round to 31 - 1 (we get the one period for free remember) 25 // so round to 31 - 1 (we get the one period for free remember)
26 // thus our sequence takes 5 * 250ms or 1.25 seconds 26 // thus our sequence takes 5 * 250ms or 1.25 seconds