Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(beepy): add a mediocre i2c_puppet driver #155

Merged
merged 12 commits into from
Jul 14, 2023
Merged

feat(beepy): add a mediocre i2c_puppet driver #155

merged 12 commits into from
Jul 14, 2023

Conversation

hawkw
Copy link
Contributor

@hawkw hawkw commented Jul 13, 2023

Depends on #154.

This branch adds a simple driver for the i2c_puppet firmware on the
Beepy RP2040. It allows controlling the status LED and reading
keypresses.

Key input can be read by sending a message to the driver service to
subscribe to keypresses. The driver task tracks a list of subscriptions
(channels) and broadcasts each keystroke to all subscribers. In
addition, the status LED and backlight can be controlled by sending
messages to the driver task.

The keyboard driver is in a new mnemos-beepy crate in platforms that
contains drivers for the Beepy hardware that are implemented using
cross-platform driver service definitions. Right now, this is just the
i2c_puppet driver, which is implemented against the kernel's
cross-platform I2cService interface. However, in the future, if we can
write a generic driver interface for SPI in the kernel crate, we could
move the SHARP display driver into mnemos-beepy as well.

Currently, the way the keyboard is implemented is pretty bad: we poll
the keyboard for new keystrokes periodically, as long as at least one
task is subscribed. This is wildly inefficient and we should instead
have the i2c_puppet send us an interrupt when new keystrokes are
ready. However, this will require code for configuring the D1 to
actually generate interrupts on GPIO pins, which we haven't written yet.
I'll add this in a later branch and rewrite the keyboard driver to use
that.

Keyboard input isn't actually wired up to anything yet --- we just run a
task that logs all keypresses. A subsequent branch will actually make
the forth shell handle keyboard input.

@hawkw hawkw requested a review from jamesmunns July 13, 2023 17:35
Base automatically changed from eliza/more-fixedvec to main July 13, 2023 17:39
Copy link
Contributor

@jamesmunns jamesmunns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nits, overall looks good! Looking forward to playing with it :D

platforms/allwinner-d1/boards/Cargo.toml Show resolved Hide resolved
platforms/allwinner-d1/core/src/drivers/twi.rs Outdated Show resolved Hide resolved
platforms/beepy/src/i2c_puppet.rs Outdated Show resolved Hide resolved
@hawkw hawkw merged commit 4276780 into main Jul 14, 2023
3 checks passed
@hawkw hawkw deleted the eliza/keydoarb branch July 14, 2023 00:24
@hawkw hawkw mentioned this pull request Jul 16, 2023
12 tasks
@jamesmunns jamesmunns added platform: D1 Specific to the Allwinner D1 hardware platform area: drivers Related to driver implementation for hardware devices. labels Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: drivers Related to driver implementation for hardware devices. platform: D1 Specific to the Allwinner D1 hardware platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants