Skip to content

Commit a9ff28d

Browse files
committed
Use get() instead of take()
1 parent 20a1cca commit a9ff28d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

nrf-hal-common/src/pwm.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ where
285285
/// Sets duty cycle (15 bit) for all PWM channels.
286286
/// Will replace any ongoing sequence playback.
287287
pub fn set_duty_on_common(&self, duty: u16) {
288-
let mut buffer = T::buffer().take();
288+
let mut buffer = T::buffer().get();
289289
buffer.copy_from_slice(&[duty.min(self.max_duty()) & 0x7FFF; 4][..]);
290290
T::buffer().set(buffer);
291291
self.one_shot();
@@ -301,7 +301,7 @@ where
301301
/// Sets inverted duty cycle (15 bit) for all PWM channels.
302302
/// Will replace any ongoing sequence playback.
303303
pub fn set_duty_off_common(&self, duty: u16) {
304-
let mut buffer = T::buffer().take();
304+
let mut buffer = T::buffer().get();
305305
buffer.copy_from_slice(&[duty.min(self.max_duty()) | 0x8000; 4][..]);
306306
T::buffer().set(buffer);
307307
self.one_shot();
@@ -329,7 +329,7 @@ where
329329
/// Sets duty cycle (15 bit) for a PWM group.
330330
/// Will replace any ongoing sequence playback.
331331
pub fn set_duty_on_group(&self, group: Group, duty: u16) {
332-
let mut buffer = T::buffer().take();
332+
let mut buffer = T::buffer().get();
333333
buffer[usize::from(group)] = duty.min(self.max_duty()) & 0x7FFF;
334334
T::buffer().set(buffer);
335335
self.one_shot();
@@ -345,7 +345,7 @@ where
345345
/// Sets inverted duty cycle (15 bit) for a PWM group.
346346
/// Will replace any ongoing sequence playback.
347347
pub fn set_duty_off_group(&self, group: Group, duty: u16) {
348-
let mut buffer = T::buffer().take();
348+
let mut buffer = T::buffer().get();
349349
buffer[usize::from(group)] = duty.min(self.max_duty()) | 0x8000;
350350
T::buffer().set(buffer);
351351
self.one_shot();
@@ -373,7 +373,7 @@ where
373373
/// Sets duty cycle (15 bit) for a PWM channel.
374374
/// Will replace any ongoing sequence playback and the other channels will return to their previously set value.
375375
pub fn set_duty_on(&self, channel: Channel, duty: u16) {
376-
let mut buffer = T::buffer().take();
376+
let mut buffer = T::buffer().get();
377377
buffer[usize::from(channel)] = duty.min(self.max_duty()) & 0x7FFF;
378378
T::buffer().set(buffer);
379379
self.one_shot();
@@ -386,7 +386,7 @@ where
386386
/// Sets inverted duty cycle (15 bit) for a PWM channel.
387387
/// Will replace any ongoing sequence playback and the other channels will return to their previously set value.
388388
pub fn set_duty_off(&self, channel: Channel, duty: u16) {
389-
let mut buffer = T::buffer().take();
389+
let mut buffer = T::buffer().get();
390390
buffer[usize::from(channel)] = duty.min(self.max_duty()) | 0x8000;
391391
T::buffer().set(buffer);
392392
self.one_shot();

0 commit comments

Comments
 (0)