#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

7 unstable releases (3 breaking)

0.6.0 Jan 21, 2025
0.5.1 Dec 5, 2024
0.4.1 Nov 15, 2024
0.4.0 Oct 29, 2024
0.3.0 Sep 30, 2024

#12 in #gpio-pin

Download history 3/week @ 2024-10-22 156/week @ 2024-10-29 23/week @ 2024-11-05 121/week @ 2024-11-12 20/week @ 2024-11-19 53/week @ 2024-11-26 253/week @ 2024-12-03 84/week @ 2024-12-10 21/week @ 2024-12-17 10/week @ 2024-12-24 5/week @ 2024-12-31 17/week @ 2025-01-07 1/week @ 2025-01-14 104/week @ 2025-01-21 3/week @ 2025-01-28 38/week @ 2025-02-04

152 downloads per month
Used in cu-rp-balancebot

Apache-2.0

1.5MB
226 lines

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

~16–28MB
~383K SLoC