aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Rosenthal <[email protected]>2021-11-10 19:43:47 -0700
committerJacob Rosenthal <[email protected]>2021-11-10 19:43:47 -0700
commit407e5d06e09c18a9956fcc4de42deaaaedd35912 (patch)
treeb026725fc717584295dbf248539fbc82f4008911
parent613e88f1d2dad3c8f5ea2471bb5b714e180a5ede (diff)
more comments
-rw-r--r--embassy-nrf/src/pwm.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/embassy-nrf/src/pwm.rs b/embassy-nrf/src/pwm.rs
index 8c4a5daea..5063c9457 100644
--- a/embassy-nrf/src/pwm.rs
+++ b/embassy-nrf/src/pwm.rs
@@ -11,7 +11,8 @@ use crate::interrupt::Interrupt;
11use crate::pac; 11use crate::pac;
12use crate::util::slice_in_ram_or; 12use crate::util::slice_in_ram_or;
13 13
14/// Interface to the PWM peripheral 14/// SimplePwm is the traditional pwm interface you're probably used to, allowing
15/// to simply set a duty cycle across up to four channels.
15pub struct SimplePwm<'d, T: Instance> { 16pub struct SimplePwm<'d, T: Instance> {
16 phantom: PhantomData<&'d mut T>, 17 phantom: PhantomData<&'d mut T>,
17 duty: [u16; 4], 18 duty: [u16; 4],
@@ -21,6 +22,8 @@ pub struct SimplePwm<'d, T: Instance> {
21 ch3: Option<AnyPin>, 22 ch3: Option<AnyPin>,
22} 23}
23 24
25/// SequencePwm allows you to offloader the updating of a sequence of duty
26/// cycles to up to four channels, as well as repeat that sequence n times.
24pub struct SequencePwm<'d, T: Instance> { 27pub struct SequencePwm<'d, T: Instance> {
25 phantom: PhantomData<&'d mut T>, 28 phantom: PhantomData<&'d mut T>,
26 ch0: Option<AnyPin>, 29 ch0: Option<AnyPin>,
@@ -42,7 +45,7 @@ pub enum Error {
42} 45}
43 46
44impl<'d, T: Instance> SequencePwm<'d, T> { 47impl<'d, T: Instance> SequencePwm<'d, T> {
45 /// Creates the interface to a PWM Sequence interface. 48 /// Creates the interface to a `SequencePwm`.
46 /// 49 ///
47 /// Must be started by calling `start` 50 /// Must be started by calling `start`
48 /// 51 ///
@@ -329,7 +332,7 @@ pub enum CounterMode {
329} 332}
330 333
331impl<'d, T: Instance> SimplePwm<'d, T> { 334impl<'d, T: Instance> SimplePwm<'d, T> {
332 /// Creates the interface to a PWM instance. 335 /// Creates the interface to a `SimplePwm`
333 /// 336 ///
334 /// Defaults the freq to 1Mhz, max_duty 1000, duty 0, up mode, and pins low. 337 /// Defaults the freq to 1Mhz, max_duty 1000, duty 0, up mode, and pins low.
335 /// Must be started by calling `set_duty` 338 /// Must be started by calling `set_duty`