File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
ports/esp32s2/common-hal/microcontroller Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 39
39
#include "supervisor/filesystem.h"
40
40
#include "supervisor/shared/safe_mode.h"
41
41
42
+ #include "freertos/FreeRTOS.h"
43
+
42
44
void common_hal_mcu_delay_us (uint32_t delay ) {
43
45
44
46
}
45
47
46
48
volatile uint32_t nesting_count = 0 ;
49
+ static portMUX_TYPE cp_mutex = portMUX_INITIALIZER_UNLOCKED ;
47
50
48
51
void common_hal_mcu_disable_interrupts (void ) {
52
+ if (nesting_count == 0 ) {
53
+ portENTER_CRITICAL (& cp_mutex );
54
+ }
49
55
nesting_count ++ ;
50
56
}
51
57
52
58
void common_hal_mcu_enable_interrupts (void ) {
53
59
if (nesting_count == 0 ) {
54
-
60
+ // Maybe log here because it's very bad.
55
61
}
56
62
nesting_count -- ;
57
63
if (nesting_count > 0 ) {
58
64
return ;
59
65
}
66
+ portEXIT_CRITICAL (& cp_mutex );
60
67
}
61
68
62
69
void common_hal_mcu_on_next_reset (mcu_runmode_t runmode ) {
You can’t perform that action at this time.
0 commit comments