Wykres commitów

6 Commity (aaf109f88d58870ff05037822a9c1eed4390a5ef)

Autor SHA1 Wiadomość Data
robert-hh aaf109f88d
mimxrt/machine_encoder.c: Replace "STATIC" with "static".
That's only required for new files.

Signed-off-by: robert-hh <robert@hammelrath.com>
2024-03-07 14:04:59 +01:00
robert-hh 445e1f003d
mimxrt: Adapt for the changed pin file creation of PR 12211.
Signed-off-by: robert-hh <robert@hammelrath.com>
2024-03-07 14:04:59 +01:00
robert-hh f7232e96b9
mimxrt: Support Encoder/Counter for the MIMXRT117x family.
Signed-off-by: robert-hh <robert@hammelrath.com>
2024-03-07 14:04:57 +01:00
robert-hh 65d4b26c9f
mimxrt: Adapt for PR8813 - Optimise mp_obj_type_t storage.
Signed-off-by: robert-hh <robert@hammelrath.com>
2024-03-07 14:03:36 +01:00
robert-hh 29af65455b
mimxrt: Add settings for MIMXRT1015.
The MIMXRT1015 MCU has only one encoder/counter unit.

Signed-off-by: robert-hh <robert@hammelrath.com>
2024-03-07 09:22:20 +01:00
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