@@ -18,9 +18,6 @@ extern crate alloc;
18
18
use alloc:: boxed:: Box ;
19
19
use alloc:: sync:: Arc ;
20
20
21
- use embedded_svc:: sys_time:: SystemTime ;
22
- use embedded_svc:: timer:: { self , asynch, ErrorType , OnceTimer , PeriodicTimer , Timer , TimerService } ;
23
-
24
21
use esp_idf_hal:: task:: asynch:: Notification ;
25
22
26
23
use crate :: sys:: * ;
@@ -135,32 +132,6 @@ impl<'a> RawHandle for EspTimer<'a> {
135
132
}
136
133
}
137
134
138
- impl < ' a > ErrorType for EspTimer < ' a > {
139
- type Error = EspError ;
140
- }
141
-
142
- impl < ' a > timer:: Timer for EspTimer < ' a > {
143
- fn is_scheduled ( & self ) -> Result < bool , Self :: Error > {
144
- EspTimer :: is_scheduled ( self )
145
- }
146
-
147
- fn cancel ( & mut self ) -> Result < bool , Self :: Error > {
148
- EspTimer :: cancel ( self )
149
- }
150
- }
151
-
152
- impl < ' a > OnceTimer for EspTimer < ' a > {
153
- fn after ( & mut self , duration : Duration ) -> Result < ( ) , Self :: Error > {
154
- EspTimer :: after ( self , duration)
155
- }
156
- }
157
-
158
- impl < ' a > PeriodicTimer for EspTimer < ' a > {
159
- fn every ( & mut self , duration : Duration ) -> Result < ( ) , Self :: Error > {
160
- EspTimer :: every ( self , duration)
161
- }
162
- }
163
-
164
135
pub struct EspAsyncTimer {
165
136
timer : EspTimer < ' static > ,
166
137
notification : Arc < Notification > ,
@@ -192,30 +163,6 @@ impl EspAsyncTimer {
192
163
}
193
164
}
194
165
195
- impl ErrorType for EspAsyncTimer {
196
- type Error = EspError ;
197
- }
198
-
199
- impl asynch:: OnceTimer for EspAsyncTimer {
200
- async fn after ( & mut self , duration : Duration ) -> Result < ( ) , Self :: Error > {
201
- EspAsyncTimer :: after ( self , duration) . await
202
- }
203
- }
204
-
205
- impl asynch:: PeriodicTimer for EspAsyncTimer {
206
- type Clock < ' a > = & ' a mut Self where Self : ' a ;
207
-
208
- fn every ( & mut self , duration : Duration ) -> Result < Self :: Clock < ' _ > , Self :: Error > {
209
- EspAsyncTimer :: every ( self , duration)
210
- }
211
- }
212
-
213
- impl < ' a > asynch:: Clock for & ' a mut EspAsyncTimer {
214
- async fn tick ( & mut self ) {
215
- EspAsyncTimer :: tick ( self ) . await
216
- }
217
- }
218
-
219
166
impl embedded_hal_async:: delay:: DelayNs for EspAsyncTimer {
220
167
async fn delay_ns ( & mut self , ns : u32 ) {
221
168
EspAsyncTimer :: after ( self , Duration :: from_micros ( ns as _ ) )
@@ -369,47 +316,6 @@ where
369
316
}
370
317
}
371
318
372
- impl < T > ErrorType for EspTimerService < T >
373
- where
374
- T : EspTimerServiceType ,
375
- {
376
- type Error = EspError ;
377
- }
378
-
379
- impl < T > TimerService for EspTimerService < T >
380
- where
381
- T : EspTimerServiceType ,
382
- {
383
- type Timer < ' a > = EspTimer < ' static > where Self : ' a ;
384
-
385
- fn timer < F > ( & self , callback : F ) -> Result < Self :: Timer < ' _ > , Self :: Error >
386
- where
387
- F : FnMut ( ) + Send + ' static ,
388
- {
389
- EspTimerService :: timer ( self , callback)
390
- }
391
- }
392
-
393
- impl < T > SystemTime for EspTimerService < T >
394
- where
395
- T : EspTimerServiceType ,
396
- {
397
- fn now ( & self ) -> Duration {
398
- EspTimerService :: now ( self )
399
- }
400
- }
401
-
402
- impl < T > asynch:: TimerService for EspTimerService < T >
403
- where
404
- T : EspTimerServiceType ,
405
- {
406
- type Timer < ' a > = EspAsyncTimer where Self : ' a ;
407
-
408
- async fn timer ( & self ) -> Result < Self :: Timer < ' _ > , Self :: Error > {
409
- EspTimerService :: timer_async ( self )
410
- }
411
- }
412
-
413
319
#[ cfg( esp_idf_esp_timer_supports_isr_dispatch_method) ]
414
320
mod isr {
415
321
use crate :: sys:: EspError ;
0 commit comments