summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2020-05-13 08:23:55 -0700
committerScott Shawcroft <scott@tannewt.org>2020-05-13 08:23:55 -0700
commit7546d47f777636962fa0119224f52496ab64181f (patch)
tree6628db8926179284db3857cb2dcc492e5300750c
parent2efe17bcb76197137287ae4a984b4481ab77be15 (diff)
parent82fdced180da8b6730753caae93ac6b9c9fcdaae (diff)
Merge remote-tracking branch 'adafruit/master' into improve_verification
-rw-r--r--locale/ID.po7
-rw-r--r--locale/circuitpython.pot7
-rw-r--r--locale/de_DE.po7
-rw-r--r--locale/en_US.po7
-rw-r--r--locale/en_x_pirate.po7
-rw-r--r--locale/es.po7
-rw-r--r--locale/fil.po7
-rw-r--r--locale/fr.po7
-rw-r--r--locale/it_IT.po7
-rw-r--r--locale/ko.po7
-rw-r--r--locale/pl.po7
-rw-r--r--locale/pt_BR.po7
-rw-r--r--locale/sv.po7
-rw-r--r--locale/zh_Latn_pinyin.po7
-rw-r--r--ports/atmel-samd/boards/catwan_usbstick/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk1
-rw-r--r--ports/atmel-samd/boards/pyruler/mpconfigboard.mk4
-rw-r--r--ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk1
-rw-r--r--ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk1
-rw-r--r--ports/atmel-samd/common-hal/countio/Counter.c83
-rw-r--r--ports/atmel-samd/common-hal/countio/Counter.h19
-rw-r--r--ports/atmel-samd/common-hal/countio/__init__.c1
-rw-r--r--ports/atmel-samd/eic_handler.c7
-rw-r--r--ports/atmel-samd/eic_handler.h1
-rw-r--r--ports/cxd56/mpconfigport.mk2
-rw-r--r--ports/litex/mpconfigport.mk2
-rw-r--r--ports/mimxrt10xx/mpconfigport.mk2
-rw-r--r--ports/nrf/mpconfigport.mk2
-rw-r--r--ports/stm/mpconfigport.mk3
-rw-r--r--py/circuitpy_defns.mk5
-rw-r--r--py/circuitpy_mpconfig.h8
-rw-r--r--py/circuitpy_mpconfig.mk3
-rw-r--r--shared-bindings/countio/Counter.c151
-rw-r--r--shared-bindings/countio/Counter.h18
-rw-r--r--shared-bindings/countio/__init__.c48
-rw-r--r--shared-bindings/countio/__init__.h9
36 files changed, 452 insertions, 19 deletions
diff --git a/locale/ID.po b/locale/ID.po
index 21239c4d6..e4420f046 100644
--- a/locale/ID.po
+++ b/locale/ID.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-05-12 12:24-0700\n"
+"POT-Creation-Date: 2020-05-12 14:37+1000\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"
@@ -254,6 +254,7 @@ msgstr ""
msgid "3-arg pow() not supported"
msgstr ""
+#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr "Sebuah channel hardware interrupt sedang digunakan"
@@ -1248,6 +1249,10 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr "Pin tidak mempunya kemampuan untuk ADC (Analog Digital Converter)"
+#: ports/atmel-samd/common-hal/countio/Counter.c
+msgid "Pin must support hardware interrupts"
+msgstr ""
+
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "Pin number already reserved by EXTI"
msgstr ""
diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot
index 741f45f25..d1f497805 100644
--- a/locale/circuitpython.pot
+++ b/locale/circuitpython.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-05-12 12:24-0700\n"
+"POT-Creation-Date: 2020-05-12 14:37+1000\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"
@@ -253,6 +253,7 @@ msgstr ""
msgid "3-arg pow() not supported"
msgstr ""
+#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr ""
@@ -1236,6 +1237,10 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr ""
+#: ports/atmel-samd/common-hal/countio/Counter.c
+msgid "Pin must support hardware interrupts"
+msgstr ""
+
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "Pin number already reserved by EXTI"
msgstr ""
diff --git a/locale/de_DE.po b/locale/de_DE.po
index 67b6ea8b5..797c095b8 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-05-12 12:24-0700\n"
+"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"PO-Revision-Date: 2020-04-30 17:01+0000\n"
"Last-Translator: Jeff Epler <jepler@gmail.com>\n"
"Language-Team: German <https://later.unpythonic.net/projects/circuitpython/"
@@ -262,6 +262,7 @@ msgstr "0.0 zu einer komplexen Potenz"
msgid "3-arg pow() not supported"
msgstr "3-arg pow() wird nicht unterstützt"
+#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr "Ein Hardware Interrupt Kanal wird schon benutzt"
@@ -1258,6 +1259,10 @@ msgstr "Zugang verweigert"
msgid "Pin does not have ADC capabilities"
msgstr "Pin hat keine ADC Funktionalität"
+#: ports/atmel-samd/common-hal/countio/Counter.c
+msgid "Pin must support hardware interrupts"
+msgstr ""
+
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "Pin number already reserved by EXTI"
msgstr ""
diff --git a/locale/en_US.po b/locale/en_US.po
index 5408767de..d18ea1808 100644
--- a/locale/en_US.po
+++ b/locale/en_US.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-05-12 12:24-0700\n"
+"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -253,6 +253,7 @@ msgstr ""
msgid "3-arg pow() not supported"
msgstr ""
+#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr ""
@@ -1236,6 +1237,10 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr ""
+#: ports/atmel-samd/common-hal/countio/Counter.c
+msgid "Pin must support hardware interrupts"
+msgstr ""
+
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "Pin number already reserved by EXTI"
msgstr ""
diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po
index d6c4c7ba5..6515beaf9 100644
--- a/locale/en_x_pirate.po
+++ b/locale/en_x_pirate.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-05-12 12:24-0700\n"
+"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"PO-Revision-Date: 2020-03-30 22:11+0000\n"
"Last-Translator: Tannewt <devnull@unpythonic.net>\n"
"Language-Team: English <https://later.unpythonic.net/projects/circuitpython/"
@@ -260,6 +260,7 @@ msgstr ""
msgid "3-arg pow() not supported"
msgstr ""
+#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr "Avast! A hardware interrupt channel be used already"
@@ -1245,6 +1246,10 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr "Belay that! Th' Pin be not ADC capable"
+#: ports/atmel-samd/common-hal/countio/Counter.c
+msgid "Pin must support hardware interrupts"
+msgstr ""
+
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "Pin number already reserved by EXTI"
msgstr ""
diff --git a/locale/es.po b/locale/es.po
index 5ccd3dd9c..12ecb0c18 100644
--- a/locale/es.po
+++ b/locale/es.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-05-12 12:24-0700\n"
+"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -255,6 +255,7 @@ msgstr "0.0 a una potencia compleja"
msgid "3-arg pow() not supported"
msgstr "pow() con 3 argumentos no soportado"
+#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr "El canal EXTINT ya está siendo utilizado"
@@ -1250,6 +1251,10 @@ msgstr "Permiso denegado"
msgid "Pin does not have ADC capabilities"
msgstr "Pin no tiene capacidad ADC"
+#: ports/atmel-samd/common-hal/countio/Counter.c
+msgid "Pin must support hardware interrupts"
+msgstr ""
+
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "Pin number already reserved by EXTI"
msgstr ""
diff --git a/locale/fil.po b/locale/fil.po
index fc7adb9dd..2dd773eef 100644
--- a/locale/fil.po
+++ b/locale/fil.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-05-12 12:24-0700\n"
+"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@@ -256,6 +256,7 @@ msgstr "0.0 para sa complex power"
msgid "3-arg pow() not supported"
msgstr "3-arg pow() hindi suportado"
+#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr "Isang channel ng hardware interrupt ay ginagamit na"
@@ -1256,6 +1257,10 @@ msgstr "Walang pahintulot"
msgid "Pin does not have ADC capabilities"
msgstr "Ang pin ay walang kakayahan sa ADC"
+#: ports/atmel-samd/common-hal/countio/Counter.c
+msgid "Pin must support hardware interrupts"
+msgstr ""
+
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "Pin number already reserved by EXTI"
msgstr ""
diff --git a/locale/fr.po b/locale/fr.po
index 39e56c6cc..b87e0cd21 100644
--- a/locale/fr.po
+++ b/locale/fr.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-05-12 12:24-0700\n"
+"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"PO-Revision-Date: 2020-05-05 20:24+0000\n"
"Last-Translator: Jeff Epler <jepler@gmail.com>\n"
"Language-Team: French <https://later.unpythonic.net/projects/circuitpython/"
@@ -264,6 +264,7 @@ msgstr "0.0 à une puissance complexe"
msgid "3-arg pow() not supported"
msgstr "pow() non supporté avec 3 arguments"
+#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr "Un canal d'interruptions matérielles est déjà utilisé"
@@ -1277,6 +1278,10 @@ msgstr "Permission refusée"
msgid "Pin does not have ADC capabilities"
msgstr "La broche ne peut être utilisée pour l'ADC"
+#: ports/atmel-samd/common-hal/countio/Counter.c
+msgid "Pin must support hardware interrupts"
+msgstr ""
+
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "Pin number already reserved by EXTI"
msgstr ""
diff --git a/locale/it_IT.po b/locale/it_IT.po
index 983f25c59..61de76f54 100644
--- a/locale/it_IT.po
+++ b/locale/it_IT.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-05-12 12:24-0700\n"
+"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@@ -255,6 +255,7 @@ msgstr "0.0 elevato alla potenza di un numero complesso"
msgid "3-arg pow() not supported"
msgstr "pow() con tre argmomenti non supportata"
+#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr "Un canale di interrupt hardware è già in uso"
@@ -1265,6 +1266,10 @@ msgstr "Permesso negato"
msgid "Pin does not have ADC capabilities"
msgstr "Il pin non ha capacità di ADC"
+#: ports/atmel-samd/common-hal/countio/Counter.c
+msgid "Pin must support hardware interrupts"
+msgstr ""
+
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "Pin number already reserved by EXTI"
msgstr ""
diff --git a/locale/ko.po b/locale/ko.po
index 5e2515b83..e6e386b30 100644
--- a/locale/ko.po
+++ b/locale/ko.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-05-12 12:24-0700\n"
+"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"PO-Revision-Date: 2019-05-06 14:22-0700\n"
"Last-Translator: \n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -255,6 +255,7 @@ msgstr ""
msgid "3-arg pow() not supported"
msgstr ""
+#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr ""
@@ -1240,6 +1241,10 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr ""
+#: ports/atmel-samd/common-hal/countio/Counter.c
+msgid "Pin must support hardware interrupts"
+msgstr ""
+
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "Pin number already reserved by EXTI"
msgstr ""
diff --git a/locale/pl.po b/locale/pl.po
index 350dab995..962c09005 100644
--- a/locale/pl.po
+++ b/locale/pl.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-05-12 12:24-0700\n"
+"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n"
@@ -254,6 +254,7 @@ msgstr "0.0 do potęgi zespolonej"
msgid "3-arg pow() not supported"
msgstr "3-argumentowy pow() jest niewspierany"
+#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr "Kanał przerwań sprzętowych w użyciu"
@@ -1241,6 +1242,10 @@ msgstr "Odmowa dostępu"
msgid "Pin does not have ADC capabilities"
msgstr "Nóżka nie obsługuje ADC"
+#: ports/atmel-samd/common-hal/countio/Counter.c
+msgid "Pin must support hardware interrupts"
+msgstr ""
+
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "Pin number already reserved by EXTI"
msgstr ""
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index ffca8aa91..e18355fa3 100644
--- a/locale/pt_BR.po
+++ b/locale/pt_BR.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-05-12 12:24-0700\n"
+"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -255,6 +255,7 @@ msgstr ""
msgid "3-arg pow() not supported"
msgstr ""
+#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr "Um canal de interrupção de hardware já está em uso"
@@ -1251,6 +1252,10 @@ msgstr "Permissão negada"
msgid "Pin does not have ADC capabilities"
msgstr "O pino não tem recursos de ADC"
+#: ports/atmel-samd/common-hal/countio/Counter.c
+msgid "Pin must support hardware interrupts"
+msgstr ""
+
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "Pin number already reserved by EXTI"
msgstr ""
diff --git a/locale/sv.po b/locale/sv.po
index 1db16d756..493245dbf 100644
--- a/locale/sv.po
+++ b/locale/sv.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-05-12 12:24-0700\n"
+"POT-Creation-Date: 2020-05-12 14:37+1000\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"
@@ -253,6 +253,7 @@ msgstr ""
msgid "3-arg pow() not supported"
msgstr ""
+#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr ""
@@ -1236,6 +1237,10 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr ""
+#: ports/atmel-samd/common-hal/countio/Counter.c
+msgid "Pin must support hardware interrupts"
+msgstr ""
+
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "Pin number already reserved by EXTI"
msgstr ""
diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po
index e1c8d5e9d..9d0bd392d 100644
--- a/locale/zh_Latn_pinyin.po
+++ b/locale/zh_Latn_pinyin.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-05-12 12:24-0700\n"
+"POT-Creation-Date: 2020-05-12 14:37+1000\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@@ -260,6 +260,7 @@ msgstr "0.0 dào fùzá diànyuán"
msgid "3-arg pow() not supported"
msgstr "bù zhīchí 3-arg pow ()"
+#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr "Yìngjiàn zhōngduàn tōngdào yǐ zài shǐyòng zhōng"
@@ -1255,6 +1256,10 @@ msgstr "Quánxiàn bèi jùjué"
msgid "Pin does not have ADC capabilities"
msgstr "Pin méiyǒu ADC nénglì"
+#: ports/atmel-samd/common-hal/countio/Counter.c
+msgid "Pin must support hardware interrupts"
+msgstr ""
+
#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "Pin number already reserved by EXTI"
msgstr ""
diff --git a/ports/atmel-samd/boards/catwan_usbstick/mpconfigboard.mk b/ports/atmel-samd/boards/catwan_usbstick/mpconfigboard.mk
index 8724e0d4b..892a5371e 100644
--- a/ports/atmel-samd/boards/catwan_usbstick/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/catwan_usbstick/mpconfigboard.mk
@@ -9,3 +9,5 @@ CHIP_FAMILY = samd21
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
+CIRCUITPY_COUNTIO = 0
+CIRCUITPY_ROTARYIO = 0
diff --git a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk
index d848363a0..a8390fd97 100644
--- a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk
@@ -19,6 +19,7 @@ CIRCUITPY_GAMEPAD = 0
CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
+CIRCUITPY_COUNTIO = 0
CIRCUITPY_VECTORIO = 0
CFLAGS_INLINE_LIMIT = 55
diff --git a/ports/atmel-samd/boards/pyruler/mpconfigboard.mk b/ports/atmel-samd/boards/pyruler/mpconfigboard.mk
index b79940673..475d8b634 100644
--- a/ports/atmel-samd/boards/pyruler/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/pyruler/mpconfigboard.mk
@@ -9,10 +9,10 @@ CHIP_FAMILY = samd21
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
-
+CIRCUITPY_COUNTIO = 0
SUPEROPT_GC = 0
CFLAGS_BOARD = --param max-inline-insns-auto=15
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 35
-endif \ No newline at end of file
+endif
diff --git a/ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk b/ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk
index bd6c9c9ff..e56517b5c 100644
--- a/ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk
@@ -12,6 +12,7 @@ EXTERNAL_FLASH_DEVICES = W25Q32BV
LONGINT_IMPL = MPZ
CIRCUITPY_BITBANGIO = 0
+CIRCUITPY_COUNTIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0
diff --git a/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk b/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk
index c1dbf514d..9309fdce0 100644
--- a/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.mk
@@ -23,6 +23,7 @@ CIRCUITPY_TOUCHIO_USE_NATIVE=0
CIRCUITPY_TOUCHIO=0
CIRCUITPY_USB_MIDI=0
CIRCUITPY_RTC=0
+CIRCUITPY_COUNTIO=0
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
diff --git a/ports/atmel-samd/common-hal/countio/Counter.c b/ports/atmel-samd/common-hal/countio/Counter.c
new file mode 100644
index 000000000..db5b325b8
--- /dev/null
+++ b/ports/atmel-samd/common-hal/countio/Counter.c
@@ -0,0 +1,83 @@
+
+#include "common-hal/countio/Counter.h"
+
+#include "atmel_start_pins.h"
+
+#include "eic_handler.h"
+#include "samd/external_interrupts.h"
+#include "py/runtime.h"
+#include "supervisor/shared/translate.h"
+
+void common_hal_countio_counter_construct(countio_counter_obj_t* self,
+ const mcu_pin_obj_t* pin_a) {
+ if (!pin_a->has_extint) {
+ mp_raise_RuntimeError(translate("Pin must support hardware interrupts"));
+ }
+
+
+ if (eic_get_enable()) {
+ if (!eic_channel_free(pin_a->extint_channel)) {
+ mp_raise_RuntimeError(translate("A hardware interrupt channel is already in use"));
+ }
+ } else {
+ turn_on_external_interrupt_controller();
+ }
+
+ // These default settings apply when the EIC isn't yet enabled.
+ self->eic_channel_a = pin_a->extint_channel;
+
+ self->pin_a = pin_a->number;
+
+ gpio_set_pin_function(self->pin_a, GPIO_PIN_FUNCTION_A);
+ gpio_set_pin_pull_mode(self->pin_a, GPIO_PULL_UP);
+
+ set_eic_channel_data(self->eic_channel_a, (void*) self);
+
+ self->count = 0;
+
+
+ claim_pin(pin_a);
+
+
+ set_eic_handler(self->eic_channel_a, EIC_HANDLER_COUNTER);
+ turn_on_eic_channel(self->eic_channel_a, EIC_CONFIG_SENSE0_FALL_Val);
+
+}
+
+bool common_hal_countio_counter_deinited(countio_counter_obj_t* self) {
+ return self->pin_a == NO_PIN;
+}
+
+void common_hal_countio_counter_deinit(countio_counter_obj_t* self) {
+ if (common_hal_countio_counter_deinited(self)) {
+ return;
+ }
+
+ set_eic_handler(self->eic_channel_a, EIC_HANDLER_NO_INTERRUPT);
+ turn_off_eic_channel(self->eic_channel_a);
+
+
+ reset_pin_number(self->pin_a);
+ self->pin_a = NO_PIN;
+
+}
+
+mp_int_t common_hal_countio_counter_get_count(countio_counter_obj_t* self) {
+ return self->count;
+}
+
+void common_hal_countio_counter_set_count(countio_counter_obj_t* self,
+ mp_int_t new_count) {
+ self->count = new_count;
+}
+
+void common_hal_countio_counter_reset(countio_counter_obj_t* self){
+ self->count = 0;
+}
+
+void counter_interrupt_handler(uint8_t channel) {
+ countio_counter_obj_t* self = get_eic_channel_data(channel);
+
+ self->count += 1;
+
+}
diff --git a/ports/atmel-samd/common-hal/countio/Counter.h b/ports/atmel-samd/common-hal/countio/Counter.h
new file mode 100644
index 000000000..724c73415
--- /dev/null
+++ b/ports/atmel-samd/common-hal/countio/Counter.h
@@ -0,0 +1,19 @@
+
+#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_COUNTIO_COUNTER_H
+#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_COUNTIO_COUNTER_H
+
+#include "common-hal/microcontroller/Pin.h"
+
+#include "py/obj.h"
+
+typedef struct {
+ mp_obj_base_t base;
+ uint8_t pin_a;
+ uint8_t eic_channel_a:4;
+ mp_int_t count;
+} countio_counter_obj_t;
+
+
+void counter_interrupt_handler(uint8_t channel);
+
+#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_COUNTIO_COUNT_H
diff --git a/ports/atmel-samd/common-hal/countio/__init__.c b/ports/atmel-samd/common-hal/countio/__init__.c
new file mode 100644
index 000000000..b95b20d15
--- /dev/null
+++ b/ports/atmel-samd/common-hal/countio/__init__.c
@@ -0,0 +1 @@
+//No countio module functions
diff --git a/ports/atmel-samd/eic_handler.c b/ports/atmel-samd/eic_handler.c
index 30ecaa7ca..7f26bdefb 100644
--- a/ports/atmel-samd/eic_handler.c
+++ b/ports/atmel-samd/eic_handler.c
@@ -27,6 +27,7 @@
#include "common-hal/pulseio/PulseIn.h"
#include "common-hal/ps2io/Ps2.h"
#include "common-hal/rotaryio/IncrementalEncoder.h"
+#include "common-hal/countio/Counter.h"
#include "shared-bindings/microcontroller/__init__.h"
//#include "samd/external_interrupts.h"
#include "eic_handler.h"
@@ -59,6 +60,12 @@ void shared_eic_handler(uint8_t channel) {
break;
#endif
+#if CIRCUITPY_COUNTIO
+ case EIC_HANDLER_COUNTER:
+ counter_interrupt_handler(channel);
+ break;
+#endif
+
default:
break;
}
diff --git a/ports/atmel-samd/eic_handler.h b/ports/atmel-samd/eic_handler.h
index 71b0fce67..08da7ea34 100644
--- a/ports/atmel-samd/eic_handler.h
+++ b/ports/atmel-samd/eic_handler.h
@@ -30,6 +30,7 @@
#define EIC_HANDLER_PULSEIN 0x1
#define EIC_HANDLER_INCREMENTAL_ENCODER 0x2
#define EIC_HANDLER_PS2 0x3
+#define EIC_HANDLER_COUNTER 0x04
void set_eic_handler(uint8_t channel, uint8_t eic_handler);
void shared_eic_handler(uint8_t channel);
diff --git a/ports/cxd56/mpconfigport.mk b/ports/cxd56/mpconfigport.mk
index ad3d0e72d..8aeae1de5 100644
--- a/ports/cxd56/mpconfigport.mk
+++ b/ports/cxd56/mpconfigport.mk
@@ -18,5 +18,5 @@ CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_NVM = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_FREQUENCYIO = 0
-
+CIRCUITPY_COUNTIO = 0
INTERNAL_LIBM = 1
diff --git a/ports/litex/mpconfigport.mk b/ports/litex/mpconfigport.mk
index 0a82f4161..004930ba7 100644
--- a/ports/litex/mpconfigport.mk
+++ b/ports/litex/mpconfigport.mk
@@ -25,7 +25,7 @@ CIRCUITPY_NVM = 0
CIRCUITPY_PULSEIO = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
-
+CIRCUITPY_COUNTIO = 0
# Enable USB support
CIRCUITPY_USB_HID = 1
CIRCUITPY_USB_MIDI = 1
diff --git a/ports/mimxrt10xx/mpconfigport.mk b/ports/mimxrt10xx/mpconfigport.mk
index 5881ac302..e9e554142 100644
--- a/ports/mimxrt10xx/mpconfigport.mk
+++ b/ports/mimxrt10xx/mpconfigport.mk
@@ -26,5 +26,5 @@ CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_NVM = 0
CIRCUITPY_ROTARYIO = 0
-
+CIRCUITPY_COUNTIO = 0
LONGINT_IMPL = MPZ
diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk
index 58ab44282..a9ad11bd4 100644
--- a/ports/nrf/mpconfigport.mk
+++ b/ports/nrf/mpconfigport.mk
@@ -36,6 +36,8 @@ CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_RGBMATRIX ?= 1
CIRCUITPY_FRAMEBUFFERIO ?= 1
+CIRCUITPY_COUNTIO = 0
+
# nRF52840-specific
ifeq ($(MCU_CHIP),nrf52840)
diff --git a/ports/stm/mpconfigport.mk b/ports/stm/mpconfigport.mk
index 06dace843..0c5247d95 100644
--- a/ports/stm/mpconfigport.mk
+++ b/ports/stm/mpconfigport.mk
@@ -13,6 +13,7 @@ ifeq ($(MCU_SERIES),F4)
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_ROTARYIO = 0
+ CIRCUITPY_COUNTIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0
@@ -30,6 +31,7 @@ ifeq ($(MCU_SERIES),H7)
CIRCUITPY_NVM = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_AUDIOIO = 0
+ CIRCUITPY_COUNTIO = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_FREQUENCYIO = 0
@@ -44,6 +46,7 @@ ifeq ($(MCU_SERIES),F7)
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_ROTARYIO = 0
+ CIRCUITPY_COUNTIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0
diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk
index 9913329c2..9e36f2e6a 100644
--- a/py/circuitpy_defns.mk
+++ b/py/circuitpy_defns.mk
@@ -139,6 +139,9 @@ endif
ifeq ($(CIRCUITPY_BUSIO),1)
SRC_PATTERNS += busio/% bitbangio/OneWire.%
endif
+ifeq ($(CIRCUITPY_COUNTIO),1)
+SRC_PATTERNS += countio/%
+endif
ifeq ($(CIRCUITPY_DIGITALIO),1)
SRC_PATTERNS += digitalio/%
endif
@@ -269,6 +272,8 @@ SRC_COMMON_HAL_ALL = \
busio/SPI.c \
busio/UART.c \
busio/__init__.c \
+ countio/Counter.c \
+ countio/__init__.c \
digitalio/DigitalInOut.c \
digitalio/__init__.c \
displayio/ParallelBus.c \
diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h
index a62ac11e9..6ea413216 100644
--- a/py/circuitpy_mpconfig.h
+++ b/py/circuitpy_mpconfig.h
@@ -321,6 +321,13 @@ extern const struct _mp_obj_module_t busio_module;
#define BUSIO_MODULE
#endif
+#if CIRCUITPY_COUNTIO
+extern const struct _mp_obj_module_t countio_module;
+#define COUNTIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_countio), (mp_obj_t)&countio_module },
+#else
+#define COUNTIO_MODULE
+#endif
+
#if CIRCUITPY_DIGITALIO
extern const struct _mp_obj_module_t digitalio_module;
#define DIGITALIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_digitalio), (mp_obj_t)&digitalio_module },
@@ -645,6 +652,7 @@ extern const struct _mp_obj_module_t ustack_module;
BLEIO_MODULE \
BOARD_MODULE \
BUSIO_MODULE \
+ COUNTIO_MODULE \
DIGITALIO_MODULE \
DISPLAYIO_MODULE \
FONTIO_MODULE \
diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk
index 046d91caa..0801540bc 100644
--- a/py/circuitpy_mpconfig.mk
+++ b/py/circuitpy_mpconfig.mk
@@ -88,6 +88,9 @@ CFLAGS += -DCIRCUITPY_BUSIO=$(CIRCUITPY_BUSIO)
CIRCUITPY_DIGITALIO ?= 1
CFLAGS += -DCIRCUITPY_DIGITALIO=$(CIRCUITPY_DIGITALIO)
+CIRCUITPY_COUNTIO ?= $(CIRCUITPY_FULL_BUILD)
+CFLAGS += -DCIRCUITPY_COUNTIO=$(CIRCUITPY_COUNTIO)
+
CIRCUITPY_DISPLAYIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_DISPLAYIO=$(CIRCUITPY_DISPLAYIO)
diff --git a/shared-bindings/countio/Counter.c b/shared-bindings/countio/Counter.c
new file mode 100644
index 000000000..d9d97f0ea
--- /dev/null
+++ b/shared-bindings/countio/Counter.c
@@ -0,0 +1,151 @@
+
+#include <stdint.h>
+
+#include "lib/utils/context_manager_helpers.h"
+#include "py/objproperty.h"
+#include "py/runtime.h"
+#include "py/runtime0.h"
+#include "shared-bindings/microcontroller/Pin.h"
+#include "shared-bindings/countio/Counter.h"
+#include "shared-bindings/util.h"
+
+//| .. currentmodule:: countio
+//|
+//| :class:`Counter` -- Track the count of falling edge transistions (pulses) on a given pin
+//| ========================================================================================
+//|
+//| Counter will keep track of the number of falling edge transistions (pulses) on a given pin
+//|
+//| .. class:: Counter(pin_a)
+//|
+//| Create a Counter object associated with the given pin. It tracks the number of
+//| falling pulses relative when the object is constructed.
+//|
+//| :param ~microcontroller.Pin pin_a: Pin to read pulses from.
+//|
+//|
+//| For example::
+//|
+//| import countio
+//| import time
+//| from board import *
+//|
+//| pin_counter = countio.Counter(board.D1)
+//| #reset the count after 100 counts
+//| while True:
+//| if pin_counter.count == 100:
+//| pin_counter.reset()
+//| print(pin_counter.count)
+//|
+STATIC mp_obj_t countio_counter_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ enum { ARG_pin_a };
+ static const mp_arg_t allowed_args[] = {
+ { MP_QSTR_pin_a, MP_ARG_REQUIRED | MP_ARG_OBJ }
+
+ };
+ mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
+ mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
+
+ const mcu_pin_obj_t* pin_a = validate_obj_is_free_pin(args[ARG_pin_a].u_obj);
+
+
+ countio_counter_obj_t *self = m_new_obj(countio_counter_obj_t);
+ self->base.type = &countio_counter_type;
+
+ common_hal_countio_counter_construct(self, pin_a);
+
+ return MP_OBJ_FROM_PTR(self);
+}
+
+//| .. method:: deinit()
+//|
+//| Deinitializes the Counter and releases any hardware resources for reuse.
+//|
+STATIC mp_obj_t countio_counter_deinit(mp_obj_t self_in) {
+ countio_counter_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ common_hal_countio_counter_deinit(self);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(countio_counter_deinit_obj, countio_counter_deinit);
+
+STATIC void check_for_deinit(countio_counter_obj_t *self) {
+ if (common_hal_countio_counter_deinited(self)) {
+ raise_deinited_error();
+ }
+}
+
+//| .. method:: __enter__()
+//|
+//| No-op used by Context Managers.
+//|
+// Provided by context manager helper.
+
+//| .. method:: __exit__()
+//|
+//| Automatically deinitializes the hardware when exiting a context. See
+//| :ref:`lifetime-and-contextmanagers` for more info.
+//|
+STATIC mp_obj_t countio_counter_obj___exit__(size_t n_args, const mp_obj_t *args) {
+ (void)n_args;
+ common_hal_countio_counter_deinit(args[0]);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(countio_counter___exit___obj, 4, 4, countio_counter_obj___exit__);
+
+
+//| .. attribute:: count
+//|
+//| The current count in terms of pulses.
+//|
+//|
+STATIC mp_obj_t countio_counter_obj_get_count(mp_obj_t self_in) {
+ countio_counter_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ check_for_deinit(self);
+
+ return mp_obj_new_int(common_hal_countio_counter_get_count(self));
+}
+MP_DEFINE_CONST_FUN_OBJ_1(countio_counter_get_count_obj, countio_counter_obj_get_count);
+
+STATIC mp_obj_t countio_counter_obj_set_count(mp_obj_t self_in, mp_obj_t new_count) {
+ countio_counter_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ check_for_deinit(self);
+
+ common_hal_countio_counter_set_count(self, mp_obj_get_int(new_count));
+ return mp_const_none;
+}
+MP_DEFINE_CONST_FUN_OBJ_2(countio_counter_set_count_obj, countio_counter_obj_set_count);
+
+const mp_obj_property_t countio_counter_count_obj = {
+ .base.type = &mp_type_property,
+ .proxy = {(mp_obj_t)&countio_counter_get_count_obj,
+ (mp_obj_t)&countio_counter_set_count_obj,
+ (mp_obj_t)&mp_const_none_obj},
+};
+
+STATIC mp_obj_t countio_counter_reset(mp_obj_t self_in){
+ countio_counter_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ check_for_deinit(self);
+ //set the position to zero for reset
+ common_hal_countio_counter_reset(self);
+ return mp_const_none;
+}
+
+
+MP_DEFINE_CONST_FUN_OBJ_1(countio_counter_reset_obj, countio_counter_reset);
+
+STATIC const mp_rom_map_elem_t countio_counter_locals_dict_table[] = {
+ // Methods
+ { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&countio_counter_deinit_obj) },
+ { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
+ { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&countio_counter___exit___obj) },
+ { MP_ROM_QSTR(MP_QSTR_count), MP_ROM_PTR(&countio_counter_count_obj) },
+ { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&countio_counter_reset_obj) },
+};
+STATIC MP_DEFINE_CONST_DICT(countio_counter_locals_dict, countio_counter_locals_dict_table);
+
+const mp_obj_type_t countio_counter_type = {
+ { &mp_type_type },
+ .name = MP_QSTR_Counter,
+ .make_new = countio_counter_make_new,
+ .locals_dict = (mp_obj_dict_t*)&countio_counter_locals_dict,
+};
diff --git a/shared-bindings/countio/Counter.h b/shared-bindings/countio/Counter.h
new file mode 100644
index 000000000..15adbbe2a
--- /dev/null
+++ b/shared-bindings/countio/Counter.h
@@ -0,0 +1,18 @@
+#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_COUNTIO_COUNTER_H
+#define MICROPY_INCLUDED_SHARED_BINDINGS_COUNTIO_COUNTER_H
+
+#include "common-hal/microcontroller/Pin.h"
+#include "common-hal/countio/Counter.h"
+
+extern const mp_obj_type_t countio_counter_type;
+
+extern void common_hal_countio_counter_construct(countio_counter_obj_t* self,
+ const mcu_pin_obj_t* pin_a);
+extern void common_hal_countio_counter_deinit(countio_counter_obj_t* self);
+extern bool common_hal_countio_counter_deinited(countio_counter_obj_t* self);
+extern mp_int_t common_hal_countio_counter_get_count(countio_counter_obj_t* self);
+extern void common_hal_countio_counter_set_count(countio_counter_obj_t* self,
+ mp_int_t new_count);
+extern void common_hal_countio_counter_reset(countio_counter_obj_t* self);
+
+#endif // MICROPY_INCLUDED_SHARED_BINDINGS_COUNTIO_COUNTER_H
diff --git a/shared-bindings/countio/__init__.c b/shared-bindings/countio/__init__.c
new file mode 100644
index 000000000..8929bf7ed
--- /dev/null
+++ b/shared-bindings/countio/__init__.c
@@ -0,0 +1,48 @@
+
+#include <stdint.h>
+
+#include "py/obj.h"
+#include "py/runtime.h"
+
+#include "shared-bindings/microcontroller/Pin.h"
+#include "shared-bindings/countio/__init__.h"
+#include "shared-bindings/countio/Counter.h"
+
+//| :mod:`countio` --- Support for edge counting
+//| ========================================================
+//|
+//| .. module:: countio
+//| :synopsis: Support for edge counting
+//| :platform: SAMD
+//|
+//| The `countio` module contains logic to read and count edge transistions
+//|
+//| Libraries
+//|
+//| .. toctree::
+//| :maxdepth: 3
+//|
+//| Counter
+//|
+
+//| .. warning:: This module is not available in some SAMD21 (aka M0) builds. See the
+//| :ref:`module-support-matrix` for more info.
+//|
+
+//| All classes change hardware state and should be deinitialized when they
+//| are no longer needed if the program continues after use. To do so, either
+//| call :py:meth:`!deinit` or use a context manager. See
+//| :ref:`lifetime-and-contextmanagers` for more info.
+//|
+
+STATIC const mp_rom_map_elem_t countio_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_countio) },
+ { MP_ROM_QSTR(MP_QSTR_Counter), MP_ROM_PTR(&countio_counter_type) },
+};
+
+STATIC MP_DEFINE_CONST_DICT(countio_module_globals, countio_module_globals_table);
+
+const mp_obj_module_t countio_module = {
+ .base = { &mp_type_module },
+ .globals = (mp_obj_dict_t*)&countio_module_globals,
+};
diff --git a/shared-bindings/countio/__init__.h b/shared-bindings/countio/__init__.h
new file mode 100644
index 000000000..35ae9f035
--- /dev/null
+++ b/shared-bindings/countio/__init__.h
@@ -0,0 +1,9 @@
+
+#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_COUNTIO___INIT___H
+#define MICROPY_INCLUDED_SHARED_BINDINGS_COUNTIO___INIT___H
+
+#include "py/obj.h"
+
+// Nothing now.
+
+#endif // MICROPY_INCLUDED_SHARED_BINDINGS_COUNTIO___INIT___H