Closed bugadani closed 4 years ago
Well, embedded-graphics really doesn't have any control over the display, that'd be something the display driver has to implement. But it the display-interface drivers should have a release
function which gives the pins back.
I guess if you know what you're doing you could make the pins the floating before going to sleep and setting them back up into the correct mode after waking up.
Patches to implement release
on the D-I drivers would be very welcome.
embedded-graphics really doesn't have any control over the display
Right.
I have found a workaround but I'll think about how to implement this in the coming days. Thanks!
This is a bit of a mess since some pins/interfaces are owned by the DI and some are owned by the driver and it differs by type (e.g. DI::spi vs DI::i2c etc.)
I think the most straightforward solution would be for each DI to have a deconstructor, possibly forced by the trait (not sure how viable this is since each DI has a different list of things to return).
As for the drivers they would need to deconstruct into DI + anything extra so to get the full primitives list you'd do (as a SPI DI + RST in driver example):
let (di, rst) = driver.release();
let (spi, dc) = di.release();
I've just release v0.4.1
of the ST7789 driver with a release
function returning the DI and RST pin like described above.
I think the most straightforward solution would be for each DI to have a deconstructor, possibly forced by the trait (not sure how viable this is since each DI has a different list of things to return).
I don't see any way to turn that into a trait but I fully agree with the assessment.
Also released new patch versions of the included DI impls with the new release()
method.
We could enforce this by way of associated type as described here: https://users.rust-lang.org/t/trait-enforced-deconstruction/42768
Not sure if it's worth doing tho since it complicates the traits.
You mean as proposed by #6? ;)
I don't see any benefit of this as there's no internal use of the Deconstructable
trait.
Hi!
On my board I need to be able to coerce the D/C and CS pins to a low or floating state before entering shutdown mode. It would be nice to have some means to do this, either by deconstructing the interface and getting back the pins, or having some sort of power state control built in that is able to power down the display somehow.
I guess this is a request that basically needs to bubble up to ~embedded-graphics~ the (in my case) SSD1306 driver as well...
Edit well I found a workaround, when the SSD1306 driver will get a release based on this library, sending the display on command will allow me to work around my "issue".