Skip to content

Commit dd134e4

Browse files
committed
extmod/modmachine: Add MICROPY_PY_MACHINE_MEMX configuration option.
Enabled by default. Signed-off-by: Damien George <[email protected]>
1 parent 23ccbcf commit dd134e4

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

extmod/machine_mem.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "py/runtime.h"
2828
#include "extmod/modmachine.h"
2929

30-
#if MICROPY_PY_MACHINE
30+
#if MICROPY_PY_MACHINE_MEMX
3131

3232
// If you wish to override the functions for mapping the machine_mem read/write
3333
// address, then add a #define for MICROPY_MACHINE_MEM_GET_READ_ADDR and/or
@@ -113,4 +113,4 @@ const machine_mem_obj_t machine_mem8_obj = {{&machine_mem_type}, 1};
113113
const machine_mem_obj_t machine_mem16_obj = {{&machine_mem_type}, 2};
114114
const machine_mem_obj_t machine_mem32_obj = {{&machine_mem_type}, 4};
115115

116-
#endif // MICROPY_PY_MACHINE
116+
#endif // MICROPY_PY_MACHINE_MEMX

extmod/modmachine.c

+2
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,11 @@ static const mp_rom_map_elem_t machine_module_globals_table[] = {
138138
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_machine) },
139139

140140
// Memory access objects.
141+
#if MICROPY_PY_MACHINE_MEMX
141142
{ MP_ROM_QSTR(MP_QSTR_mem8), MP_ROM_PTR(&machine_mem8_obj) },
142143
{ MP_ROM_QSTR(MP_QSTR_mem16), MP_ROM_PTR(&machine_mem16_obj) },
143144
{ MP_ROM_QSTR(MP_QSTR_mem32), MP_ROM_PTR(&machine_mem32_obj) },
145+
#endif
144146

145147
// Miscellaneous functions.
146148
#if MICROPY_PY_MACHINE_BARE_METAL_FUNCS

py/mpconfig.h

+5
Original file line numberDiff line numberDiff line change
@@ -1702,6 +1702,11 @@ typedef double mp_float_t;
17021702
#define MICROPY_PY_MACHINE_PULSE (0)
17031703
#endif
17041704

1705+
// Whether to provide the "machine.mem8/16/32" objects
1706+
#ifndef MICROPY_PY_MACHINE_MEMX
1707+
#define MICROPY_PY_MACHINE_MEMX (MICROPY_PY_MACHINE)
1708+
#endif
1709+
17051710
// Whether to provide the "machine.Signal" class
17061711
#ifndef MICROPY_PY_MACHINE_SIGNAL
17071712
#define MICROPY_PY_MACHINE_SIGNAL (MICROPY_PY_MACHINE)

0 commit comments

Comments
 (0)