3
3
//! See product specification, chapter 24.
4
4
5
5
#[ cfg( feature = "9160" ) ]
6
- use crate :: pac:: { Interrupt , TIMER0_NS as TIMER0 , TIMER1_NS as TIMER1 , TIMER2_NS as TIMER2 } ;
6
+ use crate :: pac:: {
7
+ timer0_ns:: RegisterBlock as RegBlock0 , Interrupt , TIMER0_NS as TIMER0 , TIMER1_NS as TIMER1 ,
8
+ TIMER2_NS as TIMER2 ,
9
+ } ;
7
10
8
11
#[ cfg( not( feature = "9160" ) ) ]
9
- use crate :: pac:: { Interrupt , TIMER0 , TIMER1 , TIMER2 } ;
12
+ use crate :: pac:: {
13
+ timer0:: RegisterBlock as RegBlock0 , timer3:: RegisterBlock as RegBlock3 , Interrupt , TIMER0 ,
14
+ TIMER1 , TIMER2 ,
15
+ } ;
10
16
11
17
use cast:: u32;
12
18
use embedded_hal:: {
@@ -20,8 +26,6 @@ use void::{unreachable, Void};
20
26
#[ cfg( any( feature = "52832" , feature = "52833" , feature = "52840" ) ) ]
21
27
use crate :: pac:: { TIMER3 , TIMER4 } ;
22
28
23
- use crate :: pac;
24
-
25
29
use core:: marker:: PhantomData ;
26
30
27
31
pub struct OneShot ;
@@ -238,7 +242,7 @@ pub trait Instance: sealed::Sealed {
238
242
/// This interrupt associated with this RTC instance.
239
243
const INTERRUPT : Interrupt ;
240
244
241
- fn as_timer0 ( & self ) -> & pac :: timer0 :: RegisterBlock ;
245
+ fn as_timer0 ( & self ) -> & RegBlock0 ;
242
246
243
247
fn timer_start < Time > ( & self , cycles : Time )
244
248
where
@@ -335,7 +339,7 @@ impl Instance for TIMER0 {
335
339
const INTERRUPT : Interrupt = Interrupt :: TIMER0 ;
336
340
337
341
#[ inline( always) ]
338
- fn as_timer0 ( & self ) -> & pac :: timer0 :: RegisterBlock {
342
+ fn as_timer0 ( & self ) -> & RegBlock0 {
339
343
self
340
344
}
341
345
}
@@ -344,7 +348,7 @@ impl Instance for TIMER1 {
344
348
const INTERRUPT : Interrupt = Interrupt :: TIMER1 ;
345
349
346
350
#[ inline( always) ]
347
- fn as_timer0 ( & self ) -> & pac :: timer0 :: RegisterBlock {
351
+ fn as_timer0 ( & self ) -> & RegBlock0 {
348
352
self
349
353
}
350
354
}
@@ -353,7 +357,7 @@ impl Instance for TIMER2 {
353
357
const INTERRUPT : Interrupt = Interrupt :: TIMER2 ;
354
358
355
359
#[ inline( always) ]
356
- fn as_timer0 ( & self ) -> & pac :: timer0 :: RegisterBlock {
360
+ fn as_timer0 ( & self ) -> & RegBlock0 {
357
361
self
358
362
}
359
363
}
@@ -363,9 +367,9 @@ impl Instance for TIMER3 {
363
367
const INTERRUPT : Interrupt = Interrupt :: TIMER3 ;
364
368
365
369
#[ inline( always) ]
366
- fn as_timer0 ( & self ) -> & pac :: timer0 :: RegisterBlock {
367
- let rb: & pac :: timer3 :: RegisterBlock = self ;
368
- let rb_ptr: * const pac :: timer3 :: RegisterBlock = rb;
370
+ fn as_timer0 ( & self ) -> & RegBlock0 {
371
+ let rb: & RegBlock3 = self ;
372
+ let rb_ptr: * const RegBlock3 = rb;
369
373
370
374
// SAFETY: TIMER0 and TIMER3 register layouts are identical, except
371
375
// that TIMER3 has 6 CC registers, while TIMER0 has 4. There is
@@ -379,9 +383,9 @@ impl Instance for TIMER4 {
379
383
const INTERRUPT : Interrupt = Interrupt :: TIMER4 ;
380
384
381
385
#[ inline( always) ]
382
- fn as_timer0 ( & self ) -> & pac :: timer0 :: RegisterBlock {
383
- let rb: & pac :: timer3 :: RegisterBlock = self ;
384
- let rb_ptr: * const pac :: timer3 :: RegisterBlock = rb;
386
+ fn as_timer0 ( & self ) -> & RegBlock0 {
387
+ let rb: & RegBlock3 = self ;
388
+ let rb_ptr: * const RegBlock3 = rb;
385
389
386
390
// SAFETY: TIMER0 and TIMER3 register layouts are identical, except
387
391
// that TIMER3 has 6 CC registers, while TIMER0 has 4. There is
0 commit comments