diff options
| author | huntc <[email protected]> | 2022-01-30 16:26:09 +1100 |
|---|---|---|
| committer | huntc <[email protected]> | 2022-01-30 16:26:09 +1100 |
| commit | 986295998a3fa8c665364d7b4a5fc009d186dee9 (patch) | |
| tree | cfa78102dbdb488f3662215ea9d8ed5cb5b0df7b | |
| parent | 1c67bd46433734d9280e976da33975cf5beb773e (diff) | |
Some more doco
| -rw-r--r-- | embassy-nrf/src/pwm.rs | 3 | ||||
| -rw-r--r-- | examples/nrf/src/bin/pwm_sequence.rs | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/embassy-nrf/src/pwm.rs b/embassy-nrf/src/pwm.rs index 94dfdeda6..a4bc94765 100644 --- a/embassy-nrf/src/pwm.rs +++ b/embassy-nrf/src/pwm.rs | |||
| @@ -381,6 +381,7 @@ impl<'a, T: Instance> Drop for SequencePwm<'a, T> { | |||
| 381 | } | 381 | } |
| 382 | } | 382 | } |
| 383 | 383 | ||
| 384 | /// Configuration for the PWM as a whole. | ||
| 384 | #[non_exhaustive] | 385 | #[non_exhaustive] |
| 385 | pub struct Config { | 386 | pub struct Config { |
| 386 | /// Selects up mode or up-and-down mode for the counter | 387 | /// Selects up mode or up-and-down mode for the counter |
| @@ -404,6 +405,7 @@ impl Default for Config { | |||
| 404 | } | 405 | } |
| 405 | } | 406 | } |
| 406 | 407 | ||
| 408 | /// Configuration per sequence | ||
| 407 | #[non_exhaustive] | 409 | #[non_exhaustive] |
| 408 | #[derive(Clone)] | 410 | #[derive(Clone)] |
| 409 | pub struct SequenceConfig { | 411 | pub struct SequenceConfig { |
| @@ -422,6 +424,7 @@ impl Default for SequenceConfig { | |||
| 422 | } | 424 | } |
| 423 | } | 425 | } |
| 424 | 426 | ||
| 427 | /// A composition of a sequence buffer and its configuration. | ||
| 425 | #[non_exhaustive] | 428 | #[non_exhaustive] |
| 426 | pub struct Sequence<'d> { | 429 | pub struct Sequence<'d> { |
| 427 | /// The words comprising the sequence. Must not exceed 32767 words. | 430 | /// The words comprising the sequence. Must not exceed 32767 words. |
diff --git a/examples/nrf/src/bin/pwm_sequence.rs b/examples/nrf/src/bin/pwm_sequence.rs index 6fb861e8f..d3ddf558c 100644 --- a/examples/nrf/src/bin/pwm_sequence.rs +++ b/examples/nrf/src/bin/pwm_sequence.rs | |||
| @@ -32,7 +32,7 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 32 | let _ = pwm.start( | 32 | let _ = pwm.start( |
| 33 | Sequence::new(&mut seq_words_1, seq_config.clone()), | 33 | Sequence::new(&mut seq_words_1, seq_config.clone()), |
| 34 | None, | 34 | None, |
| 35 | SequenceMode::Infinite, | 35 | SequenceMode::Times(1), |
| 36 | ); | 36 | ); |
| 37 | 37 | ||
| 38 | info!("pwm started!"); | 38 | info!("pwm started!"); |
| @@ -43,7 +43,7 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 43 | let _ = pwm.start( | 43 | let _ = pwm.start( |
| 44 | Sequence::new(&mut seq_words_2, seq_config), | 44 | Sequence::new(&mut seq_words_2, seq_config), |
| 45 | None, | 45 | None, |
| 46 | SequenceMode::Infinite, | 46 | SequenceMode::Times(1), |
| 47 | ); | 47 | ); |
| 48 | 48 | ||
| 49 | // we can abort a sequence if we need to before its complete with pwm.stop() | 49 | // we can abort a sequence if we need to before its complete with pwm.stop() |
