Skip to content

Commit

Permalink
Remove transaction from begin
Browse files Browse the repository at this point in the history
if SPI_HAS_TRANSACTION is used. Transaction already happens inside of sendCommandCheckAck. Fixes adafruit#53
  • Loading branch information
robbi5 authored Sep 25, 2018
1 parent 941cac4 commit 4646dc5
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions Adafruit_PN532.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,12 @@ void Adafruit_PN532::begin() {
if (_hardwareSPI) {
SPI.begin();

#ifdef SPI_HAS_TRANSACTION
SPI.beginTransaction(PN532_SPI_SETTING);
#else
#ifndef SPI_HAS_TRANSACTION
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(LSBFIRST);
SPI.setClockDivider(PN532_SPI_CLOCKDIV);
#endif
}
digitalWrite(_ss, LOW);

delay(1000);

Expand All @@ -210,11 +207,6 @@ void Adafruit_PN532::begin() {
sendCommandCheckAck(pn532_packetbuffer, 1);

// ignore response!

digitalWrite(_ss, HIGH);
#ifdef SPI_HAS_TRANSACTION
if (_hardwareSPI) SPI.endTransaction();
#endif
}
else {
// I2C initialization.
Expand Down

0 comments on commit 4646dc5

Please sign in to comment.