Closed itsmevjnk closed 1 year ago
Only certain platforms, such as the ESP32, allow multiple SPI buses. This library is generic. No specific platform support is provided. Hardware SPI must also be available.
We need the following two functions
bool init(SPIClass* spi = &SPI); // use specific spi
bool init(); // use Hardware spi
We will not accept your PR. Once the two functions are complete, you can create a new PR.
The SPI object that is referenced in the function I modified is the default hardware SPI object for Arduino, and as such, it is still generic. Also, since it's an optional parameter, the library will still be compatible with older code. For reference, Adafruit also does something like that for their generic PCD8544 library: https://github.com/adafruit/Adafruit-PCD8544-Nokia-5110-LCD-library/blob/master/Adafruit_PCD8544.h#L69
What you presented provides functions that use SPIClass and functions that don't.
We also need two initialization functions like this.
Adafruit_PCD8544 ( int8_t sclk_pin, int8_t din_pin, int8_t dc_pin,
int8_t cs_pin, int8_t rst_pin);
Adafruit_PCD8544 ( int8_t dc_pin, int8_t cs_pin, int8_t rst_pin,
SPIClass *theSPI = &SPI);
We need to apologize to you
I noticed that specifying the SPIClass is optional.
bool init(SPIClass* spi = &SPI);
We accept PR.
Please make a PR again.
I just made a new PR. Also, thank you for taking a look into my code and accepting it. Have a good day!
Some platforms (e.g. ESP32) have multiple SPI buses; therefore, it would be nice if the user can choose which SPI bus to use. Also, I've made the SDN pin optional since there are also cases when the user may want to use external circuitry to perform automatic POR for the Si4432.