8000 rp2/mpconfigport: Allow MICROPY_PY_THREAD to be disabled by a board. · pimoroni/micropython@efa54c2 · GitHub
[go: up one dir, main page]

Skip to content

Commit efa54c2

Browse files
committed
rp2/mpconfigport: Allow MICROPY_PY_THREAD to be disabled by a board.
Signed-off-by: Damien George <damien@micropython.org>
1 parent a70367e commit efa54c2

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

ports/rp2/mpconfigport.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@
8989
// Fine control over Python builtins, classes, modules, etc
9090
#define MICROPY_PY_BUILTINS_HELP_TEXT rp2_help_text
9191
#define MICROPY_PY_SYS_PLATFORM "rp2"
92+
#ifndef MICROPY_PY_THREAD
9293
#define MICROPY_PY_THREAD (1)
9394
#define MICROPY_PY_THREAD_GIL (0)
9495
#define MICROPY_THREAD_YIELD() mp_handle_pending(true)
96+
#endif
9597

9698
// Extended modules
9799
#define MICROPY_EPOCH_IS_1970 (1)

ports/rp2/mphalport.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@
3737
#define MICROPY_HW_USB_CDC_TX_TIMEOUT (500)
3838

3939
// Entering a critical section.
40+
#if MICROPY_PY_THREAD
4041
#define MICROPY_BEGIN_ATOMIC_SECTION() mp_thread_begin_atomic_section()
4142
#define MICROPY_END_ATOMIC_SECTION(state) mp_thread_end_atomic_section(state)
43+
#else
44+
#define MICROPY_BEGIN_ATOMIC_SECTION() save_and_disable_interrupts()
45+
#define MICROPY_END_ATOMIC_SECTION(state) restore_interrupts(state)
46+
#endif
4247

4348
#define MICROPY_PY_PENDSV_ENTER pendsv_suspend()
4449
#define MICROPY_PY_PENDSV_EXIT pendsv_resume()

0 commit comments

Comments
 (0)
0