#middleware #raspberry-pi #copper #real-time #gpio-pin

cu-rp-encoder

This is a driver for the Raspberry Pi to decode a directional encoder from GPIOs

6 releases

0.5.1 Dec 5, 2024
0.5.0 Dec 2, 2024
0.4.1 Nov 15, 2024
0.4.0 Oct 29, 2024
0.3.0 Sep 30, 2024

#14 in #gpio-pin

Download history 151/week @ 2024-09-25 42/week @ 2024-10-02 195/week @ 2024-10-09 29/week @ 2024-10-16 98/week @ 2024-10-23 66/week @ 2024-10-30 18/week @ 2024-11-06 125/week @ 2024-11-13 15/week @ 2024-11-20 109/week @ 2024-11-27 226/week @ 2024-12-04 59/week @ 2024-12-11 17/week @ 2024-12-18 10/week @ 2024-12-25

368 downloads per month
Used in cu-rp-balancebot

Apache-2.0

1.5MB
2K SLoC

Raspberry Pi based encoder driver for Copper

This driver is for the Raspberry Pi based encoder driver for Copper.

Compatibility

Any encoder with a base clock + a direction trigger.

Usage

Add the driver like any other source in Copper:

    tasks: [
        (
            id: "src",
            type: "cu_rp_encoder::Encoder",
            params: {
                pin_clt: 17,
                pin_dat: 18,
            },
        ),
    ]

The pin_clt is the pin for the clock signal and the pin_dat is the pin for the direction signal.

When you connect this driver to the rest of the system you need to use the cu_rp_encoder::EncoderMsg message type.

    cnx: [
        (src: "src",  dst: "dst",   msg: "cu_rp_encoder::EncoderMsg"),
    ],

It has been tested with a Hall effect encoder like this one:

The encoder

Dependencies

~10–22MB
~327K SLoC