I wanted to know what the rationale is to default to the HSPI bus, when using the GxEPD2. I see I could easily adjust the Ctor and pass either the Bus-ID or Pins there, which could be passed to the SPI Init.
or alternatively, add an additional overload for init(), which would specify the BusID? If working with the BusId, it would somehow duplicate the code in the SPI::init(), so that might not be preferred.
Why
I do already have a SD card on HSPI and was running into troubles with my two cores on ESP32. Both cores might communicate on the HSPI at the same time, and I would prefer to separate the devices in hardware than having a mutex and making things more complex in the software.
I also saw the class spi_settings, which might have been introduced for a similar reason. Should the configuration of the SPI be there?
Yes, you can. Keep it simple was the design goal when I started GxEPD2.
But you can easily create your own GxEPD2_EPD class for your need.
See also extras/sw_spi/README.MD.
GxEPD is easier to adapt. You could create your own GxIO_SPI class.
Thanks @ZinggJM for your fast feedback and the link, I will have a look into that!
Hope no offence taken :). My request was not for to ask for justification, more on the thoughts process behind so find out how I would extend the library in the best possible way, so others might be able to profit from it too.
Use SPI instance to communicate instead of SPI so that a SPIClass with different bus Id can be passed in
Pass in additional PINs to both the Class and Driver and make sure the existing signatures remain intact.
Tested with and without additional parameters
No expectations here, just wanted to summarize and close this thread. If you have suggestions and remarks it would be appreciated for sure. Also I did not add a PR as I cannot provide the code for all display types because of lack of hardware to test.
Can we actually merge @michaelschnyder 's fork or the suggested code in the extras folder (GxEPD2/extras/sw_spi at master · ZinggJM/GxEPD2 · GitHub) into the main branch? I'm using a TTGO T-BEAM V1.1 board, the SPI pins are not exposed, so I have to define my own pins. I believe defining your own SPI pins will be a common use case in future.
I see that the main GxEPD2_EPD.cpp already started differentiating from the one that is provided in extras. In future this can become a maintenance pain / tech debt.