File tree Expand file tree Collapse file tree
ports/esp32s2/common-hal/microcontroller Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3939#include "supervisor/filesystem.h"
4040#include "supervisor/shared/safe_mode.h"
4141
42+ #include "freertos/FreeRTOS.h"
43+
4244void common_hal_mcu_delay_us (uint32_t delay ) {
4345
4446}
4547
4648volatile uint32_t nesting_count = 0 ;
49+ static portMUX_TYPE cp_mutex = portMUX_INITIALIZER_UNLOCKED ;
4750
4851void common_hal_mcu_disable_interrupts (void ) {
52+ if (nesting_count == 0 ) {
53+ portENTER_CRITICAL (& cp_mutex );
54+ }
4955 nesting_count ++ ;
5056}
5157
5258void common_hal_mcu_enable_interrupts (void ) {
5359 if (nesting_count == 0 ) {
54-
60+ // Maybe log here because it's very bad.
5561 }
5662 nesting_count -- ;
5763 if (nesting_count > 0 ) {
5864 return ;
5965 }
66+ portEXIT_CRITICAL (& cp_mutex );
6067}
6168
6269void common_hal_mcu_on_next_reset (mcu_runmode_t runmode ) {
You can’t perform that action at this time.
0 commit comments