File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
TARGET_ARM_SSG/TARGET_BEETLE
TARGET_NXP/TARGET_LPC176X Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ void us_ticker_set_interrupt(timestamp_t timestamp) {
99
99
/* Check if the event was in the past */
100
100
if (delta <= 0 ) {
101
101
/* This event was in the past */
102
- Timer_SetInterrupt ( TIMER0 , 0 );
102
+ NVIC_SetPendingIRQ ( Timer_GetIRQn ( TIMER0 ) );
103
103
return ;
104
104
}
105
105
Original file line number Diff line number Diff line change @@ -49,10 +49,17 @@ uint32_t us_ticker_read() {
49
49
}
50
50
51
51
void us_ticker_set_interrupt (timestamp_t timestamp ) {
52
- // set match value
53
- US_TICKER_TIMER -> MR0 = (uint32_t )timestamp ;
54
- // enable match interrupt
55
- US_TICKER_TIMER -> MCR |= 1 ;
52
+ int current_time = us_ticker_read ();
53
+ int delta = (int )(timestamp - current_time );
54
+ if (delta <= 0 ) {
55
+ NVIC_SetPendingIRQ (US_TICKER_TIMER_IRQn );
56
+ } else {
57
+ // set match value
58
+ US_TICKER_TIMER -> MR0 = (uint32_t )timestamp ;
59
+ // enable match interrupt
60
+ US_TICKER_TIMER -> MCR |= 1 ;
61
+ }
62
+
56
63
}
57
64
58
65
void us_ticker_disable_interrupt (void ) {
You can’t perform that action at this time.
0 commit comments