Skip to content

Split HW traits to support different configurations#4

Merged
MorganR merged 3 commits into
mainfrom
hw
Sep 26, 2025
Merged

Split HW traits to support different configurations#4
MorganR merged 3 commits into
mainfrom
hw

Conversation

@MorganR

@MorganR MorganR commented Sep 7, 2025

Copy link
Copy Markdown
Owner

This makes writing the drivers a little annoying, as they have to specify that HW::Error implements From<X::Error> for all the relevant hardware types X. But, this nuisance is limited to the driver implementations, and doesn't spill over to users of the library.

To keep the boilerplate to a minimum, the type definitions put minimal constraints on their generic types (e.g. Epd2In9 expects a HW and STATE of any type). Each each trait implementation then request just the minimal set of constraints it cares about.

For example, the Reset implementation just requires the hardware constraints HW: ResetHw + DelayHw + ErrorHw and HW::Error: From<<HW::Reset as embedded_hal::digital::ErrorType>::Error>.

To support both displays with different "busy" pin states, and different wiring configurations of the existing displays, the BusyHw trait now also requires a busy_when() function.

@MorganR MorganR merged commit 4faae13 into main Sep 26, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant