Permit many sequences to be passed

Sequences are now passed in via the start method to avoid having to stop the PWM and restart it. Sequences continue to be constrained with the same lifetime of the Pwm object itself. The pwm_sequence example has been extended to illustrate multiple sequences being passed around.
This commit is contained in:
huntc
2022-01-23 16:21:34 +11:00
parent 6b0cb0609b
commit 7598b8a40f
3 changed files with 43 additions and 47 deletions

View File

@ -27,16 +27,10 @@ async fn main(_spawner: Spawner, p: Peripherals) {
config.refresh = 30;
let pwm = unwrap!(SequencePwm::new(
p.PWM0,
p.P0_13,
NoPin,
NoPin,
NoPin,
config,
&seq_values
p.PWM0, p.P0_13, NoPin, NoPin, NoPin, config,
));
let _ = pwm.start(SequenceMode::Times(1));
let _ = pwm.start(&seq_values, SequenceMode::Times(1));
// pwm.stop() deconfigures pins, and then the task_start_seq0 task cant work
// so its going to have to start running in order load the configuration