Skip to content

Commit c27955c

Browse files
author
Henrik Alsér
committed
Consume task output pins
1 parent 9f22b12 commit c27955c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

examples/gpiote-demo/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const APP: () = {
5151
// PPI usage, channel 2 event triggers "task out" (toggle) on channel 1 (toggles led1)
5252
gpiote
5353
.channel1()
54-
.output_pin(&led1)
54+
.output_pin(led1)
5555
.task_out_polarity(TaskOutPolarity::Toggle)
5656
.init_high();
5757
gpiote.channel2().input_pin(&btn2).hi_to_lo(false);

nrf-hal-common/src/gpiote.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl<'a> GpioteChannel<'_> {
9898
}
9999
}
100100

101-
pub fn output_pin<P: GpioteOutputPin>(&'a self, pin: &'a P) -> GpioteTask<'a, P> {
101+
pub fn output_pin<P: GpioteOutputPin>(&'a self, pin: P) -> GpioteTask<'a, P> {
102102
GpioteTask {
103103
gpiote: &self.gpiote,
104104
pin: pin,
@@ -274,7 +274,7 @@ fn config_port_event_pin<P: GpioteInputPin>(pin: &P, sense: PortEventSense) {
274274

275275
pub struct GpioteTask<'a, P: GpioteOutputPin> {
276276
gpiote: &'a GPIOTE,
277-
pin: &'a P,
277+
pin: P,
278278
channel: usize,
279279
task_out_polarity: TaskOutPolarity,
280280
}
@@ -284,7 +284,7 @@ impl<'a, P: GpioteOutputPin> GpioteTask<'_, P> {
284284
config_channel_task_pin(
285285
self.gpiote,
286286
self.channel,
287-
self.pin,
287+
&self.pin,
288288
&self.task_out_polarity,
289289
Level::High,
290290
);
@@ -294,7 +294,7 @@ impl<'a, P: GpioteOutputPin> GpioteTask<'_, P> {
294294
config_channel_task_pin(
295295
self.gpiote,
296296
self.channel,
297-
self.pin,
297+
&self.pin,
298298
&self.task_out_polarity,
299299
Level::Low,
300300
);

0 commit comments

Comments
 (0)