aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCameron <[email protected]>2023-07-05 09:20:56 +0200
committerCameron <[email protected]>2023-07-05 09:20:56 +0200
commit2c5146f19fad4344222dee916687b750896a7487 (patch)
treeaee363ba745a7b605e3c79292d07aa5d7bd09324
parent93caf97a04d1383ddeb11cff51b3ca34107a45c8 (diff)
Fixed Lifetimes in Events & Tasks
-rw-r--r--embassy-nrf/src/ppi/mod.rs4
-rw-r--r--embassy-nrf/src/ppi/ppi.rs4
-rw-r--r--embassy-nrf/src/timer.rs12
3 files changed, 10 insertions, 10 deletions
diff --git a/embassy-nrf/src/ppi/mod.rs b/embassy-nrf/src/ppi/mod.rs
index 9092529ac..c2bc0f580 100644
--- a/embassy-nrf/src/ppi/mod.rs
+++ b/embassy-nrf/src/ppi/mod.rs
@@ -96,7 +96,7 @@ impl<'d, G: Group> PpiGroup<'d, G> {
96 /// Get a reference to the "enable all" task. 96 /// Get a reference to the "enable all" task.
97 /// 97 ///
98 /// When triggered, it will enable all the channels in this group. 98 /// When triggered, it will enable all the channels in this group.
99 pub fn task_enable_all(&self) -> Task { 99 pub fn task_enable_all<'s: 'd>(&'d self) -> Task<'s> {
100 let n = self.g.number(); 100 let n = self.g.number();
101 Task::from_reg(&regs().tasks_chg[n].en) 101 Task::from_reg(&regs().tasks_chg[n].en)
102 } 102 }
@@ -104,7 +104,7 @@ impl<'d, G: Group> PpiGroup<'d, G> {
104 /// Get a reference to the "disable all" task. 104 /// Get a reference to the "disable all" task.
105 /// 105 ///
106 /// When triggered, it will disable all the channels in this group. 106 /// When triggered, it will disable all the channels in this group.
107 pub fn task_disable_all(&self) -> Task { 107 pub fn task_disable_all<'s: 'd>(&self) -> Task<'s> {
108 let n = self.g.number(); 108 let n = self.g.number();
109 Task::from_reg(&regs().tasks_chg[n].dis) 109 Task::from_reg(&regs().tasks_chg[n].dis)
110 } 110 }
diff --git a/embassy-nrf/src/ppi/ppi.rs b/embassy-nrf/src/ppi/ppi.rs
index 6e8a669d3..d0a70b85d 100644
--- a/embassy-nrf/src/ppi/ppi.rs
+++ b/embassy-nrf/src/ppi/ppi.rs
@@ -34,7 +34,7 @@ impl<'d, C: StaticChannel> Ppi<'d, C, 0, 1> {
34 34
35impl<'d, C: ConfigurableChannel> Ppi<'d, C, 1, 1> { 35impl<'d, C: ConfigurableChannel> Ppi<'d, C, 1, 1> {
36 /// Configure PPI channel to trigger `task` on `event`. 36 /// Configure PPI channel to trigger `task` on `event`.
37 pub fn new_one_to_one(ch: impl Peripheral<P = C> + 'd, event: Event, task: Task) -> Self { 37 pub fn new_one_to_one(ch: impl Peripheral<P = C> + 'd, event: Event<'d>, task: Task<'d>) -> Self {
38 into_ref!(ch); 38 into_ref!(ch);
39 39
40 let r = regs(); 40 let r = regs();
@@ -49,7 +49,7 @@ impl<'d, C: ConfigurableChannel> Ppi<'d, C, 1, 1> {
49#[cfg(not(feature = "nrf51"))] // Not for nrf51 because of the fork task 49#[cfg(not(feature = "nrf51"))] // Not for nrf51 because of the fork task
50impl<'d, C: ConfigurableChannel> Ppi<'d, C, 1, 2> { 50impl<'d, C: ConfigurableChannel> Ppi<'d, C, 1, 2> {
51 /// Configure PPI channel to trigger both `task1` and `task2` on `event`. 51 /// Configure PPI channel to trigger both `task1` and `task2` on `event`.
52 pub fn new_one_to_two(ch: impl Peripheral<P = C> + 'd, event: Event, task1: Task, task2: Task) -> Self { 52 pub fn new_one_to_two(ch: impl Peripheral<P = C> + 'd, event: Event<'d>, task1: Task<'d>, task2: Task<'d>) -> Self {
53 into_ref!(ch); 53 into_ref!(ch);
54 54
55 let r = regs(); 55 let r = regs();
diff --git a/embassy-nrf/src/timer.rs b/embassy-nrf/src/timer.rs
index dc3757856..fed576c35 100644
--- a/embassy-nrf/src/timer.rs
+++ b/embassy-nrf/src/timer.rs
@@ -168,21 +168,21 @@ impl<'d, T: Instance> Timer<'d, T> {
168 /// Returns the START task, for use with PPI. 168 /// Returns the START task, for use with PPI.
169 /// 169 ///
170 /// When triggered, this task starts the timer. 170 /// When triggered, this task starts the timer.
171 pub fn task_start(&self) -> Task { 171 pub fn task_start<'s: 'd>(&self) -> Task<'s> {
172 Task::from_reg(&T::regs().tasks_start) 172 Task::from_reg(&T::regs().tasks_start)
173 } 173 }
174 174
175 /// Returns the STOP task, for use with PPI. 175 /// Returns the STOP task, for use with PPI.
176 /// 176 ///
177 /// When triggered, this task stops the timer. 177 /// When triggered, this task stops the timer.
178 pub fn task_stop(&self) -> Task { 178 pub fn task_stop<'s: 'd>(&self) -> Task<'s> {
179 Task::from_reg(&T::regs().tasks_stop) 179 Task::from_reg(&T::regs().tasks_stop)
180 } 180 }
181 181
182 /// Returns the CLEAR task, for use with PPI. 182 /// Returns the CLEAR task, for use with PPI.
183 /// 183 ///
184 /// When triggered, this task resets the timer's counter to 0. 184 /// When triggered, this task resets the timer's counter to 0.
185 pub fn task_clear(&self) -> Task { 185 pub fn task_clear<'s: 'd>(&self) -> Task<'s> {
186 Task::from_reg(&T::regs().tasks_clear) 186 Task::from_reg(&T::regs().tasks_clear)
187 } 187 }
188 188
@@ -190,7 +190,7 @@ impl<'d, T: Instance> Timer<'d, T> {
190 /// 190 ///
191 /// When triggered, this task increments the timer's counter by 1. 191 /// When triggered, this task increments the timer's counter by 1.
192 /// Only works in counter mode. 192 /// Only works in counter mode.
193 pub fn task_count(&self) -> Task { 193 pub fn task_count<'s: 'd>(&self) -> Task<'s> {
194 Task::from_reg(&T::regs().tasks_count) 194 Task::from_reg(&T::regs().tasks_count)
195 } 195 }
196 196
@@ -258,14 +258,14 @@ impl<'d, T: Instance> Cc<'d, T> {
258 /// Returns this CC register's CAPTURE task, for use with PPI. 258 /// Returns this CC register's CAPTURE task, for use with PPI.
259 /// 259 ///
260 /// When triggered, this task will capture the current value of the timer's counter in this register. 260 /// When triggered, this task will capture the current value of the timer's counter in this register.
261 pub fn task_capture(&self) -> Task { 261 pub fn task_capture<'s: 'd>(&self) -> Task<'s> {
262 Task::from_reg(&T::regs().tasks_capture) 262 Task::from_reg(&T::regs().tasks_capture)
263 } 263 }
264 264
265 /// Returns this CC register's COMPARE event, for use with PPI. 265 /// Returns this CC register's COMPARE event, for use with PPI.
266 /// 266 ///
267 /// This event will fire when the timer's counter reaches the value in this CC register. 267 /// This event will fire when the timer's counter reaches the value in this CC register.
268 pub fn event_compare(&self) -> Event { 268 pub fn event_compare<'s: 'd>(&self) -> Event<'s> {
269 Event::from_reg(&T::regs().events_compare[self.n]) 269 Event::from_reg(&T::regs().events_compare[self.n])
270 } 270 }
271 271