Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d190e21

Browse files
Ayush1325DhruvaG2000
authored andcommitted
Implement interrupts and noInterrupts
- Using irq_lock and irq_unlock zephyr apis. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
1 parent 3227e1a commit d190e21

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

‎cores/arduino/Arduino.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ enum analogPins { DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user),
9797

9898
#endif
9999

100+
void interrupts(void);
101+
void noInterrupts(void);
102+
100103
#include <variant.h>
101104
#ifdef __cplusplus
102105
#include <zephyrPrint.h>

‎cores/arduino/zephyrCommon.cpp‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,22 @@ size_t analog_pin_index(pin_size_t pinNumber) {
175175

176176
#endif //CONFIG_ADC
177177

178+
static unsigned int irq_key;
179+
static bool interrupts_disabled = false;
180+
181+
void interrupts(void) {
182+
if (interrupts_disabled) {
183+
irq_unlock(irq_key);
184+
interrupts_disabled = false;
185+
}
186+
}
187+
188+
void noInterrupts(void) {
189+
if (!interrupts_disabled) {
190+
irq_key = irq_lock();
191+
interrupts_disabled = true;
192+
}
193+
}
178194
}
179195

180196
void yield(void) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /