diff --git a/PN5180.cpp b/PN5180.cpp index 9ab344e..6a95c9e 100644 --- a/PN5180.cpp +++ b/PN5180.cpp @@ -79,12 +79,23 @@ void PN5180::begin(int8_t sck, int8_t miso, int8_t mosi, int8_t ss) { digitalWrite(PN5180_NSS, HIGH); // disable digitalWrite(PN5180_RST, HIGH); // no reset - PN5180_SPI.begin(PN5180_SCK, PN5180_MISO, PN5180_MOSI, PN5180_NSS); - PN5180DEBUG(F("SPI pinout: ")); - PN5180DEBUG(F("SS=")); PN5180DEBUG(PN5180_NSS); - PN5180DEBUG(F(", MOSI=")); PN5180DEBUG(PN5180_MOSI); - PN5180DEBUG(F(", MISO=")); PN5180DEBUG(PN5180_MISO); - PN5180DEBUG(F(", SCK=")); PN5180DEBUG(PN5180_SCK); + if ((PN5180_SCK > 0) && (PN5180_MISO > 0) && (PN5180_MOSI > 0)) { + // start SPI with custom pins + PN5180_SPI.begin(PN5180_SCK, PN5180_MISO, PN5180_MOSI, PN5180_NSS); + PN5180DEBUG(F("Custom SPI pinout: ")); + PN5180DEBUG(F("SS=")); PN5180DEBUG(PN5180_NSS); + PN5180DEBUG(F(", MOSI=")); PN5180DEBUG(PN5180_MOSI); + PN5180DEBUG(F(", MISO=")); PN5180DEBUG(PN5180_MISO); + PN5180DEBUG(F(", SCK=")); PN5180DEBUG(PN5180_SCK); + } else { + // start SPI with default pINs + PN5180_SPI.begin(); + PN5180DEBUG(F("Default SPI pinout: ")); + PN5180DEBUG(F("SS=")); PN5180DEBUG(SS); + PN5180DEBUG(F(", MOSI=")); PN5180DEBUG(MOSI); + PN5180DEBUG(F(", MISO=")); PN5180DEBUG(MISO); + PN5180DEBUG(F(", SCK=")); PN5180DEBUG(SCK); + } PN5180DEBUG("\n"); } diff --git a/README.md b/README.md index d24c1e5..011bb14 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,10 @@ Arduino Uno / Arduino ESP-32 library for PN5180-NFC Module from NXP Semiconducto Release Notes: +Version 2.3.3 - 27.10.2024 + + * Bugfix start with default SPI + Version 2.3.2 - 27.10.2024 * Allow to use custom spi pins #12, thanks to @mjmeans !