Skip to content

encoder-only setup questions #38

@erichiggins

Description

@erichiggins

Hello! Love this project, thank you for all the work you have done so far!

Trying to use a Pico, an SSD1309, and encoder-only mode on my own project, hitting a few obstacles that I could use some help with. The display portion all works, but I can't seem to get the encoder and encoder push button to work as expected.

  1. Can you clarify why the Encoder class uses x and y input arguments? Most rotary encoders seem to have CLK and DT pins -- it's not clear to me how this translates.
  2. Looking through the various 'setup_examples' that are supplied, a couple of them claim to use an encoder (judging by the filename), but do they? Looking through the code for each, it's not clear to me that any of them use anything other than buttons.

For context, here's my hardware_setup.py

from machine import Pin, SPI, freq
import gc

from drivers.ssd1309.ssd1309 import SSD1309_SPI as SSD
freq(250_000_000)  # RP2 overclock
# Create and export an SSD instance
spi = SPI(0, baudrate=10_000_000, sck=Pin(18), mosi=Pin(19))
gc.collect()  # Precaution before instantiating framebuf
ssd = SSD(128, 64, spi, dc=Pin(16), cs=Pin(17), res=Pin(20))

import sys
print(sys.implementation.version)
from gui.primitives.encoder import Encoder
from gui.core.ugui import Display

enc_clk = Pin(12, Pin.IN, Pin.PULL_UP)
enc_dt = Pin(13, Pin.IN, Pin.PULL_UP)
enc_btn = Pin(10, Pin.IN, Pin.PULL_UP)


display = Display(ssd, nxt=enc_clk, sel=enc_btn, prev=enc_dt, incr=False, encoder=4)

Happy to supply the driver I wrote for the SSD1309 if needed. I can confirm that works as expected. I'll be happy to contribute it for others to use, as well as my own hardware setup example.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions