vroland / epdiy

EPDiy is a driver board for affordable e-Paper (or E-ink) displays.
https://vroland.github.io/epdiy-hardware/
GNU Lesser General Public License v3.0
1.25k stars 178 forks source link

Make it possible to set the display type at runtime #250

Closed mickeprag closed 10 months ago

mickeprag commented 1 year ago

The goal is to be able to support different displays at runtime. I have a use case where one firmware should support more than one display.

This change is a non breaking and backwards compatible addition. It will still be able to select a fixed display using menuconfig. If no display is selected the code must call epd_set_display() before epd_init(), similar to selecting the board at runtime.

martinberlin commented 1 year ago

This looks great to me for current version. Only issue is that as you've already seen @vroland started already with a similar idea in s3_lcd branch. Which I suppose will be the next V7 version of Epdiy PCB. Now I'm not really sure how this will be planned in order to support old versions. But it will be nice for him also to review this PR since maybe it can take more months to see the light. Thanks a lot Micke for your always thoughtful contributions to this project

mickeprag commented 1 year ago

Yes, this is why I opened this PR now. Feels not good that we both are trying to solve the same thing twice. Instead we should try to merge mine and @vroland work to find a solution he is also fine with.

vroland commented 1 year ago

@mickeprag Thanks for starting on this! I know that working on the v7 branch quietly right now is not optimal, maybe I should open a draft PR to at least make it more visible. Would you mind if I just cherry-pick your changes and integrate them into this branch? I'll change the display configuration a bit to also include bus width and bus speed for v7, but already having all the places in the draw functions changed is quite convenient :) lut.c will need some care to make sure the lookup functions still optimize well if the width is not known compile-time, but that is possible with some annotations I added on the v7 branch.

mickeprag commented 1 year ago

Sure, that sounds like a good idea!

I'll change the display configuration a bit to also include bus width and bus speed for v7

Sounds good!

martinberlin commented 10 months ago

Great as I can see now this is already done in latest updates in V7 pull request #251 Micke can you take a look and confirm so we close here? This is the way that we instantiate the display now:

  epd_init(&epd_board_v6, &ED060XC3, EPD_LUT_64K);
  // Set VCOM for boards that allow to set this in software (in mV).
  // This will print an error if unsupported. In this case,
  // set VCOM using the hardware potentiometer and delete this line.
  epd_set_vcom(1560);
  hl = epd_hl_init(WAVEFORM);
mickeprag commented 10 months ago

This is a breaking change but it is ok with me.