aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Rosenthal <[email protected]>2021-11-01 13:16:24 -0700
committerJacob Rosenthal <[email protected]>2021-11-01 13:16:24 -0700
commit74e7f4a22717a73f735caa97589c9603091016e6 (patch)
tree948dc7a493910394e9de07180b2fa08257dec367
parentf2cfbe42629c74fd53f709ad7187d00b21d7030a (diff)
comments
-rw-r--r--embassy-nrf/src/pwm.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/embassy-nrf/src/pwm.rs b/embassy-nrf/src/pwm.rs
index 3594e6afd..947cd873b 100644
--- a/embassy-nrf/src/pwm.rs
+++ b/embassy-nrf/src/pwm.rs
@@ -66,7 +66,7 @@ pub enum SequenceMode {
66pub struct SequenceConfig<'a> { 66pub struct SequenceConfig<'a> {
67 /// Selects up mode or up-and-down mode for the counter 67 /// Selects up mode or up-and-down mode for the counter
68 pub counter_mode: CounterMode, 68 pub counter_mode: CounterMode,
69 // Top value to be compared against buffer values 69 /// Top value to be compared against buffer values
70 pub top: u16, 70 pub top: u16,
71 /// Configuration for PWM_CLK 71 /// Configuration for PWM_CLK
72 pub prescaler: Prescaler, 72 pub prescaler: Prescaler,
@@ -170,7 +170,7 @@ impl<'d, T: Instance> Pwm<'d, T> {
170 } 170 }
171 } 171 }
172 172
173 /// Returns a configured pwm that has had start called on it 173 /// Play a `SequenceConfig` sequence instead of a stable `set_duty` output
174 pub fn play_sequence(&self, config: SequenceConfig) -> Result<(), Error> { 174 pub fn play_sequence(&self, config: SequenceConfig) -> Result<(), Error> {
175 slice_in_ram_or(config.sequence, Error::DMABufferNotInDataMemory)?; 175 slice_in_ram_or(config.sequence, Error::DMABufferNotInDataMemory)?;
176 176
@@ -233,6 +233,7 @@ impl<'d, T: Instance> Pwm<'d, T> {
233 233
234 r.loop_.write(|w| unsafe { w.cnt().bits(times) }); 234 r.loop_.write(|w| unsafe { w.cnt().bits(times) });
235 235
236 // we can subtract 1 by starting at seq1 instead of seq0
236 if odd { 237 if odd {
237 // tasks_seqstart doesnt exist in all svds so write its bit instead 238 // tasks_seqstart doesnt exist in all svds so write its bit instead
238 r.tasks_seqstart[1].write(|w| unsafe { w.bits(0x01) }); 239 r.tasks_seqstart[1].write(|w| unsafe { w.bits(0x01) });