fix: updated constructor
This commit is contained in:
@@ -21,14 +21,11 @@ void PN532_SPI::begin()
|
||||
_spi->begin();
|
||||
_spi->setDataMode(SPI_MODE0); // PN532 only supports mode0
|
||||
_spi->setBitOrder(LSBFIRST);
|
||||
#if defined __SAM3X8E__
|
||||
#ifndef __SAM3X8E__
|
||||
_spi->setClockDivider(SPI_CLOCK_DIV8); // set clock 2MHz(max: 5MHz)
|
||||
#else
|
||||
/** DUE spi library does not support SPI_CLOCK_DIV8 macro */
|
||||
_spi->setClockDivider(42); // set clock 2MHz(max: 5MHz)
|
||||
#elif defined __SAMD21G18A__
|
||||
/** M0 spi library does not support SPI_CLOCK_DIV8 macro */
|
||||
_spi->setClockDivider(24); // set clock 2MHz(max: 5MHz)
|
||||
#else
|
||||
_spi->setClockDivider(SPI_CLOCK_DIV8); // set clock 2MHz(max: 5MHz)
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -69,7 +66,7 @@ int16_t PN532_SPI::readResponse(uint8_t buf[], uint8_t len, uint16_t timeout)
|
||||
while (!isReady()) {
|
||||
delay(1);
|
||||
time++;
|
||||
if (time > timeout) {
|
||||
if (timeout > 0 && time > timeout) {
|
||||
return PN532_TIMEOUT;
|
||||
}
|
||||
}
|
||||
@@ -142,7 +139,7 @@ int16_t PN532_SPI::readResponse(uint8_t buf[], uint8_t len, uint16_t timeout)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool PN532_SPI::isReady()
|
||||
boolean PN532_SPI::isReady()
|
||||
{
|
||||
digitalWrite(_ss, LOW);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ private:
|
||||
uint8_t _ss;
|
||||
uint8_t command;
|
||||
|
||||
bool isReady();
|
||||
boolean isReady();
|
||||
void writeFrame(const uint8_t *header, uint8_t hlen, const uint8_t *body = 0, uint8_t blen = 0);
|
||||
int8_t readAckFrame();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user