diff options
| author | Jacob Rosenthal <[email protected]> | 2021-11-03 18:15:42 -0700 |
|---|---|---|
| committer | Jacob Rosenthal <[email protected]> | 2021-11-03 18:15:42 -0700 |
| commit | 82695c8f653cb1479ca00efaf4c2bcda65e49ff7 (patch) | |
| tree | 5bbdaf19bc35eef55489bf678f57cad768a0da02 | |
| parent | 44375b427c20273d91845e5e012e669d8a2e1cc0 (diff) | |
make both news configure registers in same order
| -rw-r--r-- | embassy-nrf/src/pwm.rs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/embassy-nrf/src/pwm.rs b/embassy-nrf/src/pwm.rs index 8c26adacc..4f60e30be 100644 --- a/embassy-nrf/src/pwm.rs +++ b/embassy-nrf/src/pwm.rs | |||
| @@ -118,17 +118,6 @@ impl<'d, T: Instance> PwmSeq<'d, T> { | |||
| 118 | 118 | ||
| 119 | // Enable | 119 | // Enable |
| 120 | r.enable.write(|w| w.enable().enabled()); | 120 | r.enable.write(|w| w.enable().enabled()); |
| 121 | r.mode | ||
| 122 | .write(|w| unsafe { w.bits(config.counter_mode as u32) }); | ||
| 123 | r.prescaler | ||
| 124 | .write(|w| w.prescaler().bits(config.prescaler as u8)); | ||
| 125 | r.countertop | ||
| 126 | .write(|w| unsafe { w.countertop().bits(config.top) }); | ||
| 127 | |||
| 128 | r.decoder.write(|w| { | ||
| 129 | w.load().bits(config.sequence_load as u8); | ||
| 130 | w.mode().refresh_count() | ||
| 131 | }); | ||
| 132 | 121 | ||
| 133 | r.seq0 | 122 | r.seq0 |
| 134 | .ptr | 123 | .ptr |
| @@ -152,6 +141,18 @@ impl<'d, T: Instance> PwmSeq<'d, T> { | |||
| 152 | .enddelay | 141 | .enddelay |
| 153 | .write(|w| unsafe { w.bits(config.end_delay) }); | 142 | .write(|w| unsafe { w.bits(config.end_delay) }); |
| 154 | 143 | ||
| 144 | r.decoder.write(|w| { | ||
| 145 | w.load().bits(config.sequence_load as u8); | ||
| 146 | w.mode().refresh_count() | ||
| 147 | }); | ||
| 148 | |||
| 149 | r.mode | ||
| 150 | .write(|w| unsafe { w.bits(config.counter_mode as u32) }); | ||
| 151 | r.prescaler | ||
| 152 | .write(|w| w.prescaler().bits(config.prescaler as u8)); | ||
| 153 | r.countertop | ||
| 154 | .write(|w| unsafe { w.countertop().bits(config.top) }); | ||
| 155 | |||
| 155 | Ok(Self { | 156 | Ok(Self { |
| 156 | phantom: PhantomData, | 157 | phantom: PhantomData, |
| 157 | }) | 158 | }) |
