diff options
Diffstat (limited to 'examples/nrf/src')
| -rw-r--r-- | examples/nrf/src/bin/pwm_sequence.rs | 2 | ||||
| -rw-r--r-- | examples/nrf/src/bin/pwm_sequence_ppi.rs | 2 |
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 |
