micropython/extmod
robert-hh 501a6e7bf7
mimxrt: Implement a Quadrature Encoder and Counter class.
These classes are base on the Quadrature Encoder blocks
of the i.MXRT MCUs. The i.MXRT 102x has two encoders, the
other ones four. The i.MXRT 101x does not support this
function. It is implemented as two classes, Encoder and Counter.

The number of pins that can be uses as inputs is limited by
the MCU architecture and the board schematics. The Encoder
class supports:
- Defining the module
- Defining the input pins.
- Defining a pin for an index signal.
- Defining a pin for a Home signal.
- Defining an output pin showing the compare match signal.
- Setting the number of cycles per revolution.
- Setting the initial value for the position.
- Setting the counting direction.
- Setting a glitch filter.
- Setting the value counter as signed or unsigned integers.
- Defining callbacks for getting to a specific position,
  overrun and underrun (starting the next revolution). These
  callbacks can be hard interrupts to ensure short latency.

The encoder counts all phases of a cycle. The span
for the position is 2**32, for the revolution is 2**16. The
highest input frequency is CPU-Clock/24.

The Counter mode counts single pulses on input A of the Encoder.
The configuration support:

- Defining the module
- Defining the input pin.
- Defining the counting direction, either fixed or controlled
  by the level of an input pin.
- Defining a pin for an index signal.
- Defining an ouput pin showing th compare match signal.
- Setting the counter value.
- Setting the glitch filter.
- Returing the value counter as signed or unsigned integer.
- Defining a callback which is called at a certain value.

The counting range is 0 - 2**32-1 and a 16 bit overrun counter.
The highest input frequency is CPU-Clock/12.

Signed-off-by: robert-hh <robert@hammelrath.com>
2024-03-07 09:22:16 +01:00
..
asyncio extmod/asyncio: Make current_task raise exception when there is no task. 2024-02-28 15:48:51 +11:00
axtls-include all: Prune trailing whitespace. 2024-03-07 16:25:17 +11:00
btstack all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
lwip-include all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
mbedtls all: Update bindings, ports and tests for mbedtls v3.5.1. 2024-01-30 11:08:46 +11:00
nimble all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
extmod.cmake extmod/modvfs: Add new "vfs" module with mount/umount and Vfs classes. 2024-02-07 13:25:08 +11:00
extmod.mk extmod/modvfs: Add new "vfs" module with mount/umount and Vfs classes. 2024-02-07 13:25:08 +11:00
font_petme128_8x8.h extmod: Move font_petme128_8x8.h from ports/stm32 to extmod. 2022-05-05 13:30:40 +10:00
machine_adc.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
machine_adc_block.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
machine_bitstream.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
machine_i2c.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
machine_i2s.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
machine_mem.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
machine_pinbase.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
machine_pulse.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
machine_pwm.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
machine_signal.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
machine_spi.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
machine_timer.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
machine_uart.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
machine_wdt.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
misc.h extmod/os_dupterm: Let mp_os_dupterm_tx_strn() return num bytes written. 2023-12-22 10:26:52 +11:00
modasyncio.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modbinascii.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modbluetooth.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modbluetooth.h all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modbtree.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modcryptolib.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
moddeflate.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modframebuf.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modhashlib.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modheapq.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modjson.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modlwip.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modmachine.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modmachine.h mimxrt: Implement a Quadrature Encoder and Counter class. 2024-03-07 09:22:16 +01:00
modnetwork.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modnetwork.h extmod/modnetwork: Add deinit function to NIC protocol. 2023-12-06 17:32:00 +11:00
modonewire.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modos.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modplatform.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modplatform.h extmod/modplatform: Set MICROPY_PLATFORM_ARCH on riscv platforms. 2023-06-23 15:34:22 +10:00
modrandom.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modre.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modselect.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modsocket.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modtime.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modtime.h all: Rename *umodule*.h to remove the "u" prefix. 2023-06-08 17:54:14 +10:00
modtls_axtls.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modtls_mbedtls.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
moductypes.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modvfs.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modwebrepl.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modwebsocket.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
modwebsocket.h all: Rename *umodule*.h to remove the "u" prefix. 2023-06-08 17:54:14 +10:00
mpbthci.c extmod/modbluetooth: Refactor stack/hci/driver/port bindings. 2020-09-08 11:41:31 +10:00
mpbthci.h extmod/nimble: Add support for reading whole HCI UART packets. 2022-06-03 11:53:28 +10:00
network_cyw43.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
network_cyw43.h extmod: Add network-level class binding to cyw43 driver. 2019-06-03 16:47:35 +10:00
network_esp_hosted.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
network_lwip.c extmod/modnetwork: Allow more extensive port-specific customisation. 2023-03-01 01:26:44 +11:00
network_ninaw10.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
network_wiznet5k.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
os_dupterm.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
vfs.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
vfs.h py/builtin: Clean up and simplify import_stat and builtin_open config. 2022-05-25 13:04:45 +10:00
vfs_blockdev.c all: Reformat C and Python source code with tools/codeformat.py. 2020-02-28 10:33:03 +11:00
vfs_fat.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
vfs_fat.h extmod: Factor out block-device struct to make independent of fatfs. 2019-10-29 12:12:37 +11:00
vfs_fat_diskio.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
vfs_fat_file.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
vfs_lfs.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
vfs_lfs.h extmod: Add VFS littlefs bindings. 2019-10-29 14:17:29 +11:00
vfs_lfsx.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
vfs_lfsx_file.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
vfs_posix.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
vfs_posix.h extmod/vfs: Introduce a C-level VFS protocol, with fast import_stat. 2018-06-06 14:33:42 +10:00
vfs_posix_file.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
vfs_reader.c all: Remove the "STATIC" macro and just use "static" instead. 2024-03-07 14:20:42 +11:00
virtpin.c py/obj: Add accessors for type slots and use everywhere. 2022-09-19 19:06:07 +10:00
virtpin.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00