summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
Diffstat (limited to 'py')
-rw-r--r--py/mphal.h9
-rw-r--r--py/py.mk1
2 files changed, 10 insertions, 0 deletions
diff --git a/py/mphal.h b/py/mphal.h
index 6215ab065e..aacd02ebd8 100644
--- a/py/mphal.h
+++ b/py/mphal.h
@@ -66,4 +66,13 @@ mp_uint_t mp_hal_ticks_ms(void);
mp_uint_t mp_hal_ticks_us(void);
#endif
+// If port HAL didn't define its own pin API, use generic
+// "virtual pin" API from the core.
+#ifndef mp_hal_pin_obj_t
+#define mp_hal_pin_obj_t mp_obj_t
+#define mp_hal_get_pin_obj(pin) (pin)
+#define mp_hal_pin_read(pin) mp_virtual_pin_read(pin)
+#define mp_hal_pin_write(pin, v) mp_virtual_pin_write(pin, v)
+#endif
+
#endif // __MICROPY_INCLUDED_PY_MPHAL_H__
diff --git a/py/py.mk b/py/py.mk
index cdccb1cbb8..aa992da722 100644
--- a/py/py.mk
+++ b/py/py.mk
@@ -174,6 +174,7 @@ PY_O_BASENAME = \
../extmod/moduheapq.o \
../extmod/moduhashlib.o \
../extmod/modubinascii.o \
+ ../extmod/virtpin.o \
../extmod/machine_mem.o \
../extmod/machine_i2c.o \
../extmod/modussl.o \