Skip to content

Commit

Permalink
Bugfix start with default SPI
Browse files Browse the repository at this point in the history
  • Loading branch information
tueddy committed Oct 27, 2024
1 parent 56e02a8 commit b22583f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
23 changes: 17 additions & 6 deletions PN5180.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 !
Expand Down

0 comments on commit b22583f

Please sign in to comment.