Skip to content

Commit dfedea1

Browse files
belovictormatthijskooijman
authored andcommitted
Use a more portable way to enable and disable interrupts
Previously, the AVR-specific cli() and sei() were used, now the generic noInterrupts() and interrupts() provided by Arduino are used.
1 parent 03ec06b commit dfedea1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/hal/hal.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,13 @@ u1_t hal_checkTimer (u4_t time) {
164164
static uint8_t irqlevel = 0;
165165

166166
void hal_disableIRQs () {
167-
cli();
167+
noInterrupts();
168168
irqlevel++;
169169
}
170170

171171
void hal_enableIRQs () {
172172
if(--irqlevel == 0) {
173-
sei();
173+
interrupts();
174174

175175
// Instead of using proper interrupts (which are a bit tricky
176176
// and/or not available on all pins on AVR), just poll the pin

0 commit comments

Comments
 (0)