I recently downloaded this library for talking to a PN532 device from Elechouse.
The board comes with 3 different communication protocols to choose from.
There are a couple of slide switches on the board to determine which one to use.
The example code that comes with it, includes the following preprocessor statements.
#if 0 #include <SPI.h> #include <PN532_SPI.h> #include "PN532.h" PN532_SPI pn532spi(SPI, 10); PN532 nfc(pn532spi); #elif 1 #include <PN532_HSU.h> #include <PN532.h> PN532_HSU pn532hsu(Serial1); PN532 nfc(pn532hsu); #else #include <Wire.h> #include <PN532_I2C.h> #include <PN532.h> PN532_I2C pn532i2c(Wire); PN532 nfc(pn532i2c); #endif
So the setup code required depending of what communication protocol is required.
What I don't understand is where do the values: 0 or 1 or neither, come from ? From what I read I thought anything non zero would be considered true, so the above code would resolve to the following every time.
#include <PN532_HSU.h> #include <PN532.h> PN532_HSU pn532hsu(Serial1); PN532 nfc(pn532hsu);
Am I missing something?