I am using the NFC Shield V2.0 with an Arduino M0 Pro. The library code will not compile and gives the following error:
/Applications/Arduino.app/Contents/Java/libraries/PN532_SPI/PN532_SPI.cpp: In member function 'virtual void PN532_SPI::begin()':
/Applications/Arduino.app/Contents/Java/libraries/PN532_SPI/PN532_SPI.cpp:25:27: error: 'SPI_CLOCK_DIV8' was not declared in this scope
_spi->setClockDivider(SPI_CLOCK_DIV8); // set clock 2MHz(max: 5MHz)
I was able to correct the issue by replacing the following code found at PN532_SPI.cpp line 24:
#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)
#endif
with:
#if defined __SAM3X8E__
/** 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
I verified the change with several of the examples provided with this library. I would have pushed the change myself, but I don't have permission to push to this project. Hope you find the fix helpful.
I am using the NFC Shield V2.0 with an Arduino M0 Pro. The library code will not compile and gives the following error:
I was able to correct the issue by replacing the following code found at PN532_SPI.cpp line 24:
with:
I verified the change with several of the examples provided with this library. I would have pushed the change myself, but I don't have permission to push to this project. Hope you find the fix helpful.