extmod/modmachine: Add MICROPY_PY_MACHINE_PIN_BASE option.
And use it in qemu-arm, unix and windows ports to enable PinBase. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
30a63a204d
commit
e68aa40d2a
|
@ -24,10 +24,10 @@
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "py/mpconfig.h"
|
|
||||||
#if MICROPY_PY_MACHINE
|
|
||||||
|
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
|
||||||
|
#if MICROPY_PY_MACHINE_PIN_BASE
|
||||||
|
|
||||||
#include "extmod/modmachine.h"
|
#include "extmod/modmachine.h"
|
||||||
#include "extmod/virtpin.h"
|
#include "extmod/virtpin.h"
|
||||||
|
|
||||||
|
@ -84,4 +84,4 @@ MP_DEFINE_CONST_OBJ_TYPE(
|
||||||
protocol, &pinbase_pin_p
|
protocol, &pinbase_pin_p
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif // MICROPY_PY_MACHINE
|
#endif // MICROPY_PY_MACHINE_PIN_BASE
|
||||||
|
|
|
@ -81,7 +81,10 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_time_pulse_us), MP_ROM_PTR(&machine_time_pulse_us_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_time_pulse_us), MP_ROM_PTR(&machine_time_pulse_us_obj) },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Class for Signal.
|
// Classes for PinBase and Signal.
|
||||||
|
#if MICROPY_PY_MACHINE_PIN_BASE
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_PinBase), MP_ROM_PTR(&machine_pinbase_type) },
|
||||||
|
#endif
|
||||||
{ MP_ROM_QSTR(MP_QSTR_Signal), MP_ROM_PTR(&machine_signal_type) },
|
{ MP_ROM_QSTR(MP_QSTR_Signal), MP_ROM_PTR(&machine_signal_type) },
|
||||||
|
|
||||||
// Classes for software bus protocols.
|
// Classes for software bus protocols.
|
||||||
|
|
|
@ -27,9 +27,6 @@
|
||||||
// This file is never compiled standalone, it's included directly from
|
// This file is never compiled standalone, it's included directly from
|
||||||
// extmod/modmachine.c via MICROPY_PY_MACHINE_INCLUDEFILE.
|
// extmod/modmachine.c via MICROPY_PY_MACHINE_INCLUDEFILE.
|
||||||
|
|
||||||
#define MICROPY_PY_MACHINE_EXTRA_GLOBALS \
|
|
||||||
{ MP_ROM_QSTR(MP_QSTR_PinBase), MP_ROM_PTR(&machine_pinbase_type) }, \
|
|
||||||
|
|
||||||
// This variable is needed for machine.soft_reset(), but the variable is otherwise unused.
|
// This variable is needed for machine.soft_reset(), but the variable is otherwise unused.
|
||||||
int pyexec_system_exit = 0;
|
int pyexec_system_exit = 0;
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#define MICROPY_PY_HASHLIB (1)
|
#define MICROPY_PY_HASHLIB (1)
|
||||||
#define MICROPY_PY_MACHINE (1)
|
#define MICROPY_PY_MACHINE (1)
|
||||||
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/qemu-arm/modmachine.c"
|
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/qemu-arm/modmachine.c"
|
||||||
|
#define MICROPY_PY_MACHINE_PIN_BASE (1)
|
||||||
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
|
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
|
||||||
#define MICROPY_USE_INTERNAL_PRINTF (1)
|
#define MICROPY_USE_INTERNAL_PRINTF (1)
|
||||||
#define MICROPY_VFS (1)
|
#define MICROPY_VFS (1)
|
||||||
|
|
|
@ -36,9 +36,6 @@
|
||||||
#define MICROPY_PAGE_MASK (MICROPY_PAGE_SIZE - 1)
|
#define MICROPY_PAGE_MASK (MICROPY_PAGE_SIZE - 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MICROPY_PY_MACHINE_EXTRA_GLOBALS \
|
|
||||||
{ MP_ROM_QSTR(MP_QSTR_PinBase), MP_ROM_PTR(&machine_pinbase_type) }, \
|
|
||||||
|
|
||||||
// This variable is needed for machine.soft_reset(), but the variable is otherwise unused.
|
// This variable is needed for machine.soft_reset(), but the variable is otherwise unused.
|
||||||
int pyexec_system_exit = 0;
|
int pyexec_system_exit = 0;
|
||||||
|
|
||||||
|
|
|
@ -116,3 +116,4 @@
|
||||||
// Enable the "machine" module, mostly for machine.mem*.
|
// Enable the "machine" module, mostly for machine.mem*.
|
||||||
#define MICROPY_PY_MACHINE (1)
|
#define MICROPY_PY_MACHINE (1)
|
||||||
#define MICROPY_PY_MACHINE_PULSE (1)
|
#define MICROPY_PY_MACHINE_PULSE (1)
|
||||||
|
#define MICROPY_PY_MACHINE_PIN_BASE (1)
|
||||||
|
|
|
@ -156,6 +156,7 @@
|
||||||
#define MICROPY_PY_MACHINE (1)
|
#define MICROPY_PY_MACHINE (1)
|
||||||
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/unix/modmachine.c"
|
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/unix/modmachine.c"
|
||||||
#define MICROPY_PY_MACHINE_PULSE (1)
|
#define MICROPY_PY_MACHINE_PULSE (1)
|
||||||
|
#define MICROPY_PY_MACHINE_PIN_BASE (1)
|
||||||
#define MICROPY_MACHINE_MEM_GET_READ_ADDR mod_machine_mem_get_addr
|
#define MICROPY_MACHINE_MEM_GET_READ_ADDR mod_machine_mem_get_addr
|
||||||
#define MICROPY_MACHINE_MEM_GET_WRITE_ADDR mod_machine_mem_get_addr
|
#define MICROPY_MACHINE_MEM_GET_WRITE_ADDR mod_machine_mem_get_addr
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue