Merge pull request #2071 from dhalbert/shared-module-touchio

make nrf touchio be generic: now available for SAMD51 too
crypto-aes
Scott Shawcroft 3 years ago committed by GitHub
commit 1d973a0803
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-21 14:18-0400\n"
"POT-Creation-Date: 2019-08-22 15:20-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -980,6 +980,10 @@ msgstr ""
msgid "No hardware support on pin"
msgstr "Tidak ada dukungan hardware untuk pin"
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
#: py/moduerrno.c
msgid "No space left on device"
msgstr ""
@ -1329,9 +1333,6 @@ msgid "Unsupported pull value."
msgstr ""
#: ports/nrf/common-hal/bleio/Characteristic.c
msgid "Value length required fixed length"
msgstr ""
#: ports/nrf/common-hal/bleio/Descriptor.c
msgid "Value length != required fixed length"
msgstr ""

@ -8,8 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-21 14:18-0400\n"
"POT-Creation-Date: 2019-08-19 10:22-0400\n"
"POT-Creation-Date: 2019-08-22 15:20-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -966,6 +965,10 @@ msgstr ""
msgid "No hardware support on pin"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
#: py/moduerrno.c
msgid "No space left on device"
msgstr ""
@ -1306,9 +1309,6 @@ msgid "Unsupported pull value."
msgstr ""
#: ports/nrf/common-hal/bleio/Characteristic.c
msgid "Value length required fixed length"
msgstr ""
#: ports/nrf/common-hal/bleio/Descriptor.c
msgid "Value length != required fixed length"
msgstr ""

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-21 14:18-0400\n"
"POT-Creation-Date: 2019-08-22 15:20-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Pascal Deneaux\n"
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
@ -978,6 +978,10 @@ msgstr ""
msgid "No hardware support on pin"
msgstr "Keine Hardwareunterstützung an diesem Pin"
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
#: py/moduerrno.c
msgid "No space left on device"
msgstr "Kein Speicherplatz auf Gerät"
@ -1336,9 +1340,6 @@ msgid "Unsupported pull value."
msgstr "Nicht unterstützter Pull-Wert"
#: ports/nrf/common-hal/bleio/Characteristic.c
msgid "Value length required fixed length"
msgstr ""
#: ports/nrf/common-hal/bleio/Descriptor.c
msgid "Value length != required fixed length"
msgstr ""

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-21 14:18-0400\n"
"POT-Creation-Date: 2019-08-22 15:20-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -965,6 +965,10 @@ msgstr ""
msgid "No hardware support on pin"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
#: py/moduerrno.c
msgid "No space left on device"
msgstr ""
@ -1305,9 +1309,6 @@ msgid "Unsupported pull value."
msgstr ""
#: ports/nrf/common-hal/bleio/Characteristic.c
msgid "Value length required fixed length"
msgstr ""
#: ports/nrf/common-hal/bleio/Descriptor.c
msgid "Value length != required fixed length"
msgstr ""

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-21 14:18-0400\n"
"POT-Creation-Date: 2019-08-22 15:20-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: @sommersoft, @MrCertainly\n"
@ -969,6 +969,10 @@ msgstr ""
msgid "No hardware support on pin"
msgstr ""
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
#: py/moduerrno.c
msgid "No space left on device"
msgstr ""
@ -1309,9 +1313,6 @@ msgid "Unsupported pull value."
msgstr ""
#: ports/nrf/common-hal/bleio/Characteristic.c
msgid "Value length required fixed length"
msgstr ""
#: ports/nrf/common-hal/bleio/Descriptor.c
msgid "Value length != required fixed length"
msgstr ""

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-21 14:18-0400\n"
"POT-Creation-Date: 2019-08-22 15:20-0400\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -334,11 +334,6 @@ msgstr "El brillo no se puede ajustar"
msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Tamaño de buffer incorrecto. Debe ser de %d bytes."
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
#: shared-bindings/displayio/Display.c
msgid "Buffer is not a bytearray."
msgstr ""
@ -347,6 +342,11 @@ msgstr ""
msgid "Buffer is too small"
msgstr ""
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
msgstr "Buffer debe ser de longitud 1 como minimo"
@ -980,6 +980,10 @@ msgstr "Sin soporte de hardware en el pin clk"
msgid "No hardware support on pin"
msgstr "Sin soporte de hardware en pin"
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
#: py/moduerrno.c
msgid "No space left on device"
msgstr "No queda espacio en el dispositivo"
@ -1346,9 +1350,6 @@ msgid "Unsupported pull value."
msgstr "valor pull no soportado."
#: ports/nrf/common-hal/bleio/Characteristic.c
msgid "Value length required fixed length"
msgstr ""
#: ports/nrf/common-hal/bleio/Descriptor.c
msgid "Value length != required fixed length"
msgstr ""

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-21 14:18-0400\n"
"POT-Creation-Date: 2019-08-22 15:20-0400\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@ -989,6 +989,10 @@ msgstr ""
msgid "No hardware support on pin"
msgstr "Walang support sa hardware ang pin"
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
#: py/moduerrno.c
msgid "No space left on device"
msgstr ""
@ -1350,9 +1354,6 @@ msgid "Unsupported pull value."
msgstr "Hindi suportado ang pull value."
#: ports/nrf/common-hal/bleio/Characteristic.c
msgid "Value length required fixed length"
msgstr ""
#: ports/nrf/common-hal/bleio/Descriptor.c
msgid "Value length != required fixed length"
msgstr ""

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-21 14:18-0400\n"
"POT-Creation-Date: 2019-08-22 15:20-0400\n"
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@ -998,6 +998,10 @@ msgstr ""
msgid "No hardware support on pin"
msgstr "Pas de support matériel pour cette broche"
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
#: py/moduerrno.c
msgid "No space left on device"
msgstr "Il n'y a plus d'espace libre sur le périphérique"
@ -1375,9 +1379,6 @@ msgid "Unsupported pull value."
msgstr "Valeur de tirage 'pull' non supportée."
#: ports/nrf/common-hal/bleio/Characteristic.c
msgid "Value length required fixed length"
msgstr ""
#: ports/nrf/common-hal/bleio/Descriptor.c
msgid "Value length != required fixed length"
msgstr ""

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-21 14:18-0400\n"
"POT-Creation-Date: 2019-08-22 15:20-0400\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@ -988,6 +988,10 @@ msgstr ""
msgid "No hardware support on pin"
msgstr "Nessun supporto hardware sul pin"
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
#: py/moduerrno.c
msgid "No space left on device"
msgstr "Non che spazio sul dispositivo"
@ -1349,9 +1353,6 @@ msgid "Unsupported pull value."
msgstr "Valore di pull non supportato."
#: ports/nrf/common-hal/bleio/Characteristic.c
msgid "Value length required fixed length"
msgstr ""
#: ports/nrf/common-hal/bleio/Descriptor.c
msgid "Value length != required fixed length"
msgstr ""

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-21 14:18-0400\n"
"POT-Creation-Date: 2019-08-22 15:20-0400\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n"
@ -975,6 +975,10 @@ msgstr ""
msgid "No hardware support on pin"
msgstr "Brak sprzętowej obsługi na nóżce"
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
#: py/moduerrno.c
msgid "No space left on device"
msgstr "Brak miejsca"
@ -1325,9 +1329,6 @@ msgid "Unsupported pull value."
msgstr "Zła wartość podciągnięcia."
#: ports/nrf/common-hal/bleio/Characteristic.c
msgid "Value length required fixed length"
msgstr ""
#: ports/nrf/common-hal/bleio/Descriptor.c
msgid "Value length != required fixed length"
msgstr ""

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-21 14:18-0400\n"
"POT-Creation-Date: 2019-08-22 15:20-0400\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -980,6 +980,10 @@ msgstr "Sem suporte de hardware no pino de clock"
msgid "No hardware support on pin"
msgstr "Nenhum suporte de hardware no pino"
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
#: py/moduerrno.c
msgid "No space left on device"
msgstr ""
@ -1326,9 +1330,6 @@ msgid "Unsupported pull value."
msgstr ""
#: ports/nrf/common-hal/bleio/Characteristic.c
msgid "Value length required fixed length"
msgstr ""
#: ports/nrf/common-hal/bleio/Descriptor.c
msgid "Value length != required fixed length"
msgstr ""

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-21 14:18-0400\n"
"POT-Creation-Date: 2019-08-22 15:20-0400\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@ -975,6 +975,10 @@ msgstr ""
msgid "No hardware support on pin"
msgstr "Méiyǒu zài yǐn jiǎo shàng de yìngjiàn zhīchí"
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
msgstr ""
#: py/moduerrno.c
msgid "No space left on device"
msgstr "Shèbèi shàng méiyǒu kònggé"
@ -1332,9 +1336,6 @@ msgid "Unsupported pull value."
msgstr "Bù zhīchí de lādòng zhí."
#: ports/nrf/common-hal/bleio/Characteristic.c
msgid "Value length required fixed length"
msgstr ""
#: ports/nrf/common-hal/bleio/Descriptor.c
msgid "Value length != required fixed length"
msgstr ""

@ -14,5 +14,3 @@ LONGINT_IMPL = MPZ
# No I2S on SAMD51G
CIRCUITPY_AUDIOBUSIO = 0
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0

@ -14,5 +14,3 @@ EXTERNAL_FLASH_DEVICES = "W25Q128JV_PM"
CIRCUITPY_PS2IO = 1
# No I2S on SAMD51G.
CIRCUITPY_AUDIOBUSIO = 0
# No touch on SAMD51 yet.
CIRCUITPY_TOUCHIO = 0

@ -15,5 +15,3 @@ LONGINT_IMPL = MPZ
CIRCUITPY_NETWORK = 1
MICROPY_PY_WIZNET5K = 5500
CIRCUITPY_PS2IO = 1
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0

@ -15,5 +15,3 @@ LONGINT_IMPL = MPZ
CIRCUITPY_NETWORK = 1
MICROPY_PY_WIZNET5K = 5500
CIRCUITPY_PS2IO = 1
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0

@ -13,5 +13,3 @@ EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
LONGINT_IMPL = MPZ
CIRCUITPY_PS2IO = 1
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0

@ -15,5 +15,3 @@ LONGINT_IMPL = MPZ
CIRCUITPY_PS2IO = 1
# No I2S on SAMD51G
CIRCUITPY_AUDIOBUSIO = 0
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0

@ -11,8 +11,6 @@ QSPI_FLASH_FILESYSTEM = 0
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
# Not needed.
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_DISPLAYIO = 0

@ -15,5 +15,3 @@ LONGINT_IMPL = MPZ
CIRCUITPY_NETWORK = 1
MICROPY_PY_WIZNET5K = 5500
CIRCUITPY_PS2IO = 1
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0

@ -15,5 +15,3 @@ LONGINT_IMPL = MPZ
CIRCUITPY_NETWORK = 1
MICROPY_PY_WIZNET5K = 5500
CIRCUITPY_PS2IO = 1
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0

@ -15,5 +15,3 @@ LONGINT_IMPL = MPZ
CIRCUITPY_PS2IO = 1
# No I2S on SAMD51G
CIRCUITPY_AUDIOBUSIO = 0
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0

@ -17,7 +17,5 @@ CIRCUITPY_DISPLAYIO = 1
CIRCUITPY_GAMEPAD = 1
CIRCUITPY_GAMEPADSHIFT = 1
CIRCUITPY_STAGE = 1
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pybadge

@ -17,7 +17,5 @@ CIRCUITPY_DISPLAYIO = 1
CIRCUITPY_GAMEPAD = 1
CIRCUITPY_GAMEPADSHIFT = 1
CIRCUITPY_STAGE = 1
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pybadge

@ -17,7 +17,5 @@ CIRCUITPY_DISPLAYIO = 1
CIRCUITPY_GAMEPAD = 1
CIRCUITPY_GAMEPADSHIFT = 1
CIRCUITPY_STAGE = 1
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pygamer

@ -17,7 +17,5 @@ CIRCUITPY_DISPLAYIO = 1
CIRCUITPY_GAMEPAD = 1
CIRCUITPY_GAMEPADSHIFT = 1
CIRCUITPY_STAGE = 1
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pybadge

@ -11,6 +11,3 @@ QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
LONGINT_IMPL = MPZ
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0

@ -11,6 +11,3 @@ QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
LONGINT_IMPL = MPZ
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0

@ -17,8 +17,6 @@ LONGINT_IMPL = MPZ
CIRCUITPY_PS2IO = 1
# No I2S on SAMD51G
CIRCUITPY_AUDIOBUSIO = 0
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
# Make room for more stuff
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_FREQUENCYIO = 0
@ -28,4 +26,3 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
#FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_INA219
#FROZEN_MPY_DIRS += $(TOP)/frozen/RoboticsMasters_CircuitPython_MPU9250

@ -9,6 +9,3 @@ CHIP_FAMILY = samd51
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0

@ -15,5 +15,3 @@ LONGINT_IMPL = MPZ
CIRCUITPY_PS2IO = 1
# No I2S on SAMD51G
CIRCUITPY_AUDIOBUSIO = 0
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0

@ -34,9 +34,10 @@
#include "shared-bindings/touchio/TouchIn.h"
#include "supervisor/shared/translate.h"
// Native touchio only exists for SAMD21
#ifdef SAMD21
#include "hpl/pm/hpl_pm_base.h"
#endif
#include "samd/clocks.h"
#include "samd/pins.h"
@ -65,7 +66,6 @@ void common_hal_touchio_touchin_construct(touchio_touchin_obj_t* self,
claim_pin(pin);
// Turn on the PTC if its not in use. We won't turn it off until reset.
#ifdef SAMD21
if ((( Ptc *) PTC)->CTRLA.bit.ENABLE == 0) {
// We run the PTC at 8mhz so divide the 48mhz clock by 6.
uint8_t gclk = find_free_gclk(6);
@ -94,7 +94,6 @@ void common_hal_touchio_touchin_construct(touchio_touchin_obj_t* self,
// but for touches using fruit or other objects, the difference is much less.
self->threshold = get_raw_reading(self) + 100;
#endif
}
bool common_hal_touchio_touchin_deinited(touchio_touchin_obj_t* self) {
@ -139,3 +138,5 @@ uint16_t common_hal_touchio_touchin_get_threshold(touchio_touchin_obj_t *self) {
void common_hal_touchio_touchin_set_threshold(touchio_touchin_obj_t *self, uint16_t new_threshold) {
self->threshold = new_threshold;
}
#endif // SAMD21

@ -27,6 +27,9 @@
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_TOUCHIO_TOUCHIN_H
#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_TOUCHIO_TOUCHIN_H
// Native touchio only exists for SAMD21
#ifdef SAMD21
#include "common-hal/microcontroller/Pin.h"
#include "samd21_ptc_component.h"
@ -42,4 +45,6 @@ typedef struct {
void touchin_reset(void);
#endif // SAMD21
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_TOUCHIO_TOUCHIN_H

@ -18,11 +18,13 @@ endif
ifeq ($(CHIP_FAMILY),samd21)
# frequencyio not yet verified as working on SAMD21.
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_TOUCHIO_USE_NATIVE = 1
endif
# Put samd51-only choices here.
ifeq ($(CHIP_FAMILY),samd51)
CIRCUITPY_SAMD = 1
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
endif
INTERNAL_LIBM = 1

@ -54,7 +54,11 @@
#include "common-hal/pulseio/PWMOut.h"
#include "common-hal/ps2io/Ps2.h"
#include "common-hal/rtc/RTC.h"
#if CIRCUITPY_TOUCHIO_USE_NATIVE
#include "common-hal/touchio/TouchIn.h"
#endif
#include "samd/cache.h"
#include "samd/clocks.h"
#include "samd/events.h"
@ -211,7 +215,7 @@ void reset_port(void) {
//pdmin_reset();
#endif
#if CIRCUITPY_TOUCHIO
#if CIRCUITPY_TOUCHIO && CIRCUITPY_TOUCHIO_USE_NATIVE
touchin_reset();
#endif
eic_reset();

@ -217,9 +217,8 @@ ifeq ($(CIRCUITPY_PEW),1)
SRC_PATTERNS += _pew/%
endif
# All possible sources are listed here, and are filtered by SRC_PATTERNS.
SRC_COMMON_HAL = \
$(filter $(SRC_PATTERNS), \
# All possible sources are listed here, and are filtered by SRC_PATTERNS in SRC_COMMON_HAL
SRC_COMMON_HAL_ALL = \
analogio/AnalogIn.c \
analogio/AnalogOut.c \
analogio/__init__.c \
@ -272,10 +271,9 @@ $(filter $(SRC_PATTERNS), \
rtc/__init__.c \
supervisor/Runtime.c \
supervisor/__init__.c \
time/__init__.c \
touchio/TouchIn.c \
touchio/__init__.c \
)
time/__init__.c
SRC_COMMON_HAL = $(filter $(SRC_PATTERNS), $(SRC_COMMON_HAL_ALL))
# These don't have corresponding files in each port but are still located in
# shared-bindings to make it clear what the contents of the modules are.
@ -298,9 +296,7 @@ SRC_BINDINGS_ENUMS += \
help.c \
util.c
# All possible sources are listed here, and are filtered by SRC_PATTERNS.
SRC_SHARED_MODULE = \
$(filter $(SRC_PATTERNS), \
SRC_SHARED_MODULE_ALL = \
_pixelbuf/PixelBuf.c \
_pixelbuf/__init__.c \
_stage/Layer.c \
@ -349,8 +345,23 @@ $(filter $(SRC_PATTERNS), \
uheap/__init__.c \
ustack/__init__.c \
_pew/__init__.c \
_pew/PewPew.c \
)
_pew/PewPew.c
# All possible sources are listed here, and are filtered by SRC_PATTERNS.
SRC_SHARED_MODULE = $(filter $(SRC_PATTERNS), $(SRC_SHARED_MODULE_ALL))
# Use the native touchio if requested. This flag is set conditionally in, say, mpconfigport.h.
# The presence of common-hal/touchio/* # does not imply it's available for all chips in a port,
# so there is an explicit flag. For example, SAMD21 touchio is native, but SAMD51 is not.
ifeq ($(CIRCUITPY_TOUCHIO_USE_NATIVE),1)
SRC_COMMON_HAL_ALL += \
touchio/TouchIn.c \
touchio/__init__.c
else
SRC_SHARED_MODULE_ALL += \
touchio/TouchIn.c \
touchio/__init__.c
endif
ifeq ($(INTERNAL_LIBM),1)
SRC_LIBM = \

@ -45,10 +45,10 @@ endif
# Use for for early stage or highly restricted ports
ifndef CIRCUITPY_DEFAULT_BUILD
ifeq ($(CIRCUITPY_MINIMAL_BUILD),1)
CIRCUITPY_FULL_BUILD = 0
CIRCUITPY_DEFAULT_BUILD = 0
CIRCUITPY_FULL_BUILD = 0
CIRCUITPY_DEFAULT_BUILD = 0
else
CIRCUITPY_DEFAULT_BUILD = 1
CIRCUITPY_DEFAULT_BUILD = 1
endif
endif
@ -241,6 +241,12 @@ CIRCUITPY_TIME = $(CIRCUITPY_DEFAULT_BUILD)
endif
CFLAGS += -DCIRCUITPY_TIME=$(CIRCUITPY_TIME)
# touchio might be native or generic. See circuitpy_defns.mk.
ifndef CIRCUITPY_TOUCHIO_USE_NATIVE
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
endif
CFLAGS += -DCIRCUITPY_TOUCHIO_USE_NATIVE=$(CIRCUITPY_TOUCHIO_USE_NATIVE)
ifndef CIRCUITPY_TOUCHIO
CIRCUITPY_TOUCHIO = $(CIRCUITPY_DEFAULT_BUILD)
endif

@ -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;

@ -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;

@ -28,15 +28,9 @@
#include <string.h>
#include <stdio.h>
#include "py/nlr.h"
#include "py/mperrno.h"
#include "py/runtime.h"
#include "py/binary.h"
#include "py/mphal.h"
#include "shared-bindings/touchio/TouchIn.h"
#include "supervisor/shared/translate.h"
#include "nrf.h"
// This is a capacitive touch sensing routine using a single digital
// pin. The pin should be connected to the sensing pad, and to ground
@ -57,15 +51,14 @@ static uint16_t get_raw_reading(touchio_touchin_obj_t *self) {
for (uint16_t i = 0; i < N_SAMPLES; i++) {
// set pad to digital output high for 10us to charge it
nrf_gpio_cfg_output(self->pin->number);
nrf_gpio_pin_set(self->pin->number);
common_hal_digitalio_digitalinout_switch_to_output(self->digitalinout, true, DRIVE_MODE_PUSH_PULL);
mp_hal_delay_us(10);
// set pad back to an input and take some samples
nrf_gpio_cfg_input(self->pin->number, NRF_GPIO_PIN_NOPULL);
common_hal_digitalio_digitalinout_switch_to_input(self->digitalinout, PULL_NONE);
while(nrf_gpio_pin_read(self->pin->number)) {
while(common_hal_digitalio_digitalinout_get_value(self->digitalinout)) {
if (ticks >= TIMEOUT_TICKS) return TIMEOUT_TICKS;
ticks++;
}
@ -73,16 +66,22 @@ static uint16_t get_raw_reading(touchio_touchin_obj_t *self) {
return ticks;
}
void common_hal_touchio_touchin_construct(touchio_touchin_obj_t* self,
const mcu_pin_obj_t *pin) {
self->pin = pin;
void common_hal_touchio_touchin_construct(touchio_touchin_obj_t* self, const mcu_pin_obj_t *pin) {
claim_pin(pin);
self->digitalinout = m_new_obj(digitalio_digitalinout_obj_t);
self->digitalinout->base.type = &digitalio_digitalinout_type;
common_hal_digitalio_digitalinout_construct(self->digitalinout, pin);
self->threshold = get_raw_reading(self) * 1.05 + 100;
uint16_t raw_reading = get_raw_reading(self);
if (raw_reading == TIMEOUT_TICKS) {
mp_raise_ValueError(translate("No pulldown on pin; 1Mohm recommended"));
}
self->threshold = raw_reading * 1.05 + 100;
}
bool common_hal_touchio_touchin_deinited(touchio_touchin_obj_t* self) {
return self->pin == NULL;
return self->digitalinout == MP_OBJ_NULL;
}
void common_hal_touchio_touchin_deinit(touchio_touchin_obj_t* self) {
@ -90,8 +89,8 @@ void common_hal_touchio_touchin_deinit(touchio_touchin_obj_t* self) {
return;
}
reset_pin_number(self->pin->number);
self->pin = NULL;
common_hal_digitalio_digitalinout_deinit(self->digitalinout);
self->digitalinout = MP_OBJ_NULL;
}
void touchin_reset() {

@ -25,19 +25,20 @@
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_TOUCHIO_TOUCHIN_H
#define MICROPY_INCLUDED_NRF_COMMON_HAL_TOUCHIO_TOUCHIN_H
#ifndef MICROPY_INCLUDED_SHARED_MODULE_TOUCHIO_TOUCHIN_H
#define MICROPY_INCLUDED_SHARED_MODULE_TOUCHIO_TOUCHIN_H
#include "common-hal/microcontroller/Pin.h"
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "py/obj.h"
typedef struct {
mp_obj_base_t base;
const mcu_pin_obj_t *pin;
digitalio_digitalinout_obj_t *digitalinout;
uint16_t threshold;
} touchio_touchin_obj_t;
void touchin_reset(void);
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_TOUCHIO_TOUCHIN_H
#endif // MICROPY_INCLUDED_SHARED_MODULE_TOUCHIO_TOUCHIN_H
Loading…
Cancel
Save