@@ -24,48 +24,56 @@ SOFTWARE.
24
24
volatile uint32_t ap3_stimer_overflows = 0x00 ;
25
25
uint64_t ticks = 0 ;
26
26
27
- void _fill_ticks ( void ){
27
+ void _fill_ticks (void )
28
+ {
28
29
ticks = ap3_stimer_overflows;
29
30
ticks <<= 32 ;
30
31
ticks |= (am_hal_stimer_counter_get () & 0xFFFFFFFF );
31
32
}
32
33
33
- unsigned long micros ( void ){
34
+ unsigned long micros (void )
35
+ {
34
36
_fill_ticks ();
35
- return (uint32_t )(ticks/ AP3_STIMER_FREQ_MHZ);
37
+ return (uint32_t )(ticks / AP3_STIMER_FREQ_MHZ);
36
38
}
37
39
38
- unsigned long millis ( void ){
40
+ unsigned long millis (void )
41
+ {
39
42
_fill_ticks ();
40
- return (uint32_t )(ticks/ AP3_STIMER_FREQ_KHZ);
43
+ return (uint32_t )(ticks / AP3_STIMER_FREQ_KHZ);
41
44
}
42
45
43
- unsigned long seconds ( void ){
46
+ unsigned long secs (void )
47
+ {
44
48
_fill_ticks ();
45
- return (uint32_t )(ticks/ AP3_STIMER_FREQ_HZ);
49
+ return (uint32_t )(ticks / AP3_STIMER_FREQ_HZ);
46
50
}
47
51
48
- unsigned long systicks ( void ){
52
+ unsigned long systicks (void )
53
+ {
49
54
return am_hal_stimer_counter_get ();
50
55
}
51
56
52
- unsigned long sysoverflows ( void ){
57
+ unsigned long sysoverflows (void )
58
+ {
53
59
return ap3_stimer_overflows;
54
60
}
55
61
56
- void delay (uint32_t ms){
62
+ void delay (uint32_t ms)
63
+ {
57
64
am_util_delay_ms (ms);
58
65
}
59
66
60
- void delayMicroseconds (uint32_t us){
67
+ void delayMicroseconds (uint32_t us)
68
+ {
61
69
am_util_delay_us (us);
62
70
}
63
71
64
- extern " C" void am_stimer_isr (void ){
65
- am_hal_stimer_int_clear (AM_HAL_STIMER_INT_OVERFLOW);
66
- ap3_stimer_overflows += 1 ;
67
- // At the fastest rate (3MHz) the 64 bits of the stimer
68
- // along with this overflow counter can keep track of
69
- // the time for ~ 195,000 years without wrapping to 0
72
+ extern " C" void am_stimer_isr (void )
73
+ {
74
+ am_hal_stimer_int_clear (AM_HAL_STIMER_INT_OVERFLOW);
75
+ ap3_stimer_overflows += 1 ;
76
+ // At the fastest rate (3MHz) the 64 bits of the stimer
77
+ // along with this overflow counter can keep track of
78
+ // the time for ~ 195,000 years without wrapping to 0
70
79
}
71
-
0 commit comments