summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2019-08-22 14:03:52 -0700
committerGitHub <noreply@github.com>2019-08-22 14:03:52 -0700
commit1d973a08038148ce20aaa43863721df6328318b7 (patch)
treea1c11233deacc8777395009072dba6de8d60df5a /shared-bindings
parent18f441ae3519899fbdff5afc2d2e47a94cb36a73 (diff)
parent7cc15e56c831e302db2c61ac4fb4f8bc9b1bfe8f (diff)
Merge pull request #2071 from dhalbert/shared-module-touchio
make nrf touchio be generic: now available for SAMD51 too
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/touchio/TouchIn.c3
-rw-r--r--shared-bindings/touchio/TouchIn.h5
2 files changed, 7 insertions, 1 deletions
diff --git a/shared-bindings/touchio/TouchIn.c b/shared-bindings/touchio/TouchIn.c
index 78fceef41..33d369c74 100644
--- a/shared-bindings/touchio/TouchIn.c
+++ b/shared-bindings/touchio/TouchIn.c
@@ -68,10 +68,11 @@ STATIC mp_obj_t touchio_touchin_make_new(const mp_obj_type_t *type,
// 1st argument is the pin
mp_obj_t pin_obj = args[0];
assert_pin(pin_obj, false);
+ const mcu_pin_obj_t *pin = MP_OBJ_TO_PTR(pin_obj);
+ assert_pin_free(pin);
touchio_touchin_obj_t *self = m_new_obj(touchio_touchin_obj_t);
self->base.type = &touchio_touchin_type;
- const mcu_pin_obj_t *pin = MP_OBJ_TO_PTR(pin_obj);
common_hal_touchio_touchin_construct(self, pin);
return (mp_obj_t) self;
diff --git a/shared-bindings/touchio/TouchIn.h b/shared-bindings/touchio/TouchIn.h
index 2e5c51607..e04e79c0b 100644
--- a/shared-bindings/touchio/TouchIn.h
+++ b/shared-bindings/touchio/TouchIn.h
@@ -28,7 +28,12 @@
#define MICROPY_INCLUDED_SHARED_BINDINGS_TOUCHIO_TOUCHIN_H
#include "common-hal/microcontroller/Pin.h"
+
+#if CIRCUITPY_TOUCHIO_USE_NATIVE
#include "common-hal/touchio/TouchIn.h"
+#else
+#include "shared-module/touchio/TouchIn.h"
+#endif
extern const mp_obj_type_t touchio_touchin_type;