Skip to content

Commit 2259834

Browse files
authored
[LPC15XX] Modified μs_ticker to use critical API
Replaced __disable_irq() and __enable_irq() with core_util_critical_section_enter() and core_util_critical_section_exit().
1 parent d5f0985 commit 2259834

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hal/targets/hal/TARGET_NXP/TARGET_LPC15XX/us_ticker.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <stddef.h>
1717
#include "us_ticker_api.h"
1818
#include "PeripheralNames.h"
19+
#include "critical.h"
1920

2021
#define US_TICKER_TIMER_IRQn SCT3_IRQn
2122

@@ -61,11 +62,11 @@ uint32_t us_ticker_read() {
6162

6263
void us_ticker_set_interrupt(timestamp_t timestamp) {
6364
// Set SCT3 match register 0 (critical section)
64-
__disable_irq();
65+
core_util_critical_section_enter();
6566
LPC_SCT3->CTRL |= (1 << 2);
6667
LPC_SCT3->MATCH0 = (uint32_t)timestamp;
6768
LPC_SCT3->CTRL &= ~(1 << 2);
68-
__enable_irq();
69+
core_util_critical_section_exit();
6970

7071
// Enable interrupt on SCT3 event 0
7172
LPC_SCT3->EVEN = (1 << 0);

0 commit comments

Comments
 (0)