Some more doco

This commit is contained in:
huntc 2022-01-30 16:26:09 +11:00
parent 1c67bd4643
commit 986295998a
2 changed files with 5 additions and 2 deletions

View File

@ -381,6 +381,7 @@ impl<'a, T: Instance> Drop for SequencePwm<'a, T> {
} }
} }
/// Configuration for the PWM as a whole.
#[non_exhaustive] #[non_exhaustive]
pub struct Config { pub struct Config {
/// Selects up mode or up-and-down mode for the counter /// Selects up mode or up-and-down mode for the counter
@ -404,6 +405,7 @@ impl Default for Config {
} }
} }
/// Configuration per sequence
#[non_exhaustive] #[non_exhaustive]
#[derive(Clone)] #[derive(Clone)]
pub struct SequenceConfig { pub struct SequenceConfig {
@ -422,6 +424,7 @@ impl Default for SequenceConfig {
} }
} }
/// A composition of a sequence buffer and its configuration.
#[non_exhaustive] #[non_exhaustive]
pub struct Sequence<'d> { pub struct Sequence<'d> {
/// The words comprising the sequence. Must not exceed 32767 words. /// The words comprising the sequence. Must not exceed 32767 words.

View File

@ -32,7 +32,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
let _ = pwm.start( let _ = pwm.start(
Sequence::new(&mut seq_words_1, seq_config.clone()), Sequence::new(&mut seq_words_1, seq_config.clone()),
None, None,
SequenceMode::Infinite, SequenceMode::Times(1),
); );
info!("pwm started!"); info!("pwm started!");
@ -43,7 +43,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
let _ = pwm.start( let _ = pwm.start(
Sequence::new(&mut seq_words_2, seq_config), Sequence::new(&mut seq_words_2, seq_config),
None, None,
SequenceMode::Infinite, SequenceMode::Times(1),
); );
// we can abort a sequence if we need to before its complete with pwm.stop() // we can abort a sequence if we need to before its complete with pwm.stop()