diff --git a/src/halimpl/pn54x/tml/i2c/phTmlNfc_alt.h b/src/halimpl/pn54x/tml/i2c/phTmlNfc_alt.h index 7646942..a5c3c2c 100755 --- a/src/halimpl/pn54x/tml/i2c/phTmlNfc_alt.h +++ b/src/halimpl/pn54x/tml/i2c/phTmlNfc_alt.h @@ -21,37 +21,8 @@ /* Basic type definitions */ #include "poll.h" -/* Describe PN71xx connection - * 0 = Custom configuration - * 1 = OM557x on Raspberry Pi - * 2 = OM557x on UdooNeo - * 3 = OM557x on BeagleBone black - * - */ -#define CONFIGURATION 1 - -#if (CONFIGURATION == 1) -/* OM557x on Raspberry Pi */ - #define I2C_BUS "/dev/i2c-1" - #define I2C_ADDRESS 0x28 - #define PIN_INT 23 - #define PIN_ENABLE 24 -#elif (CONFIGURATION == 2) -/* OM557x on UdooNeo */ - #define I2C_BUS "/dev/i2c-1" - #define I2C_ADDRESS 0x28 - #define PIN_INT 105 - #define PIN_ENABLE 149 -#elif (CONFIGURATION == 3) -/* OM557x on BeagleBone Black */ - #define I2C_BUS "/dev/i2c-2" - #define I2C_ADDRESS 0x28 - #define PIN_INT 61 - #define PIN_ENABLE 30 -#else -/* Custom configuration */ - #define I2C_BUS "/dev/i2c-1" - #define I2C_ADDRESS 0x28 - #define PIN_INT 23 - #define PIN_ENABLE 24 -#endif +#define I2C_BUS "/dev/i2c-2" +#define I2C_ADDRESS 0x29 +#define PIN_INT 833 +#define PIN_ENABLE 837 +#define PIN_FIRMWARE 834 diff --git a/src/halimpl/pn54x/tml/i2c/phTmlNfc_i2c.c b/src/halimpl/pn54x/tml/i2c/phTmlNfc_i2c.c index 6b45046..29f6b91 100755 --- a/src/halimpl/pn54x/tml/i2c/phTmlNfc_i2c.c +++ b/src/halimpl/pn54x/tml/i2c/phTmlNfc_i2c.c @@ -57,6 +57,7 @@ static bool_t bFwDnldFlag = FALSE; // ---------------------------------------------------------------------------- static int iEnableFd = 0; static int iInterruptFd = 0; +static int iFirmwareFd = 0; static int iI2CFd = 0; static int dummyHandle = 1234; @@ -163,6 +164,9 @@ static int verifyPin( int pin, int isoutput, int edge ) { static void pnOn( void ) { if ( iEnableFd ) write( iEnableFd, "1", 1 ); + + // Hack: prevent this from being in FW mode. + if ( iFirmwareFd ) write( iFirmwareFd, "1", 1 ); } static void pnOff( void ) { @@ -258,8 +262,9 @@ NFCSTATUS phTmlNfc_i2c_open_and_configure(pphTmlNfc_Config_t pConfig, void ** pL NXPLOG_TML_D("phTmlNfc_i2c_open_and_configure Alternative NFC\n"); NXPLOG_TML_D( "NFC - Assign IO pins\n"); // Assign IO pins - iInterruptFd = verifyPin( PIN_INT, 0, EDGE_RISING ); - iEnableFd = verifyPin( PIN_ENABLE, 1, EDGE_NONE ); + iInterruptFd = verifyPin( PIN_INT, 0, EDGE_RISING ); + iEnableFd = verifyPin( PIN_ENABLE, 1, EDGE_NONE ); + iFirmwareFd = verifyPin( PIN_FIRMWARE, 1, EDGE_NONE ); NXPLOG_TML_D( "NFCHW - open I2C bus - %s\n", I2C_BUS); // I2C bus @@ -268,6 +273,7 @@ NFCSTATUS phTmlNfc_i2c_open_and_configure(pphTmlNfc_Config_t pConfig, void ** pL NXPLOG_TML_E( "Could not open I2C bus '%s' (%s)", I2C_BUS, strerror(errno)); if ( iEnableFd ) close(iEnableFd); if ( iInterruptFd ) close(iInterruptFd); + if ( iFirmwareFd ) close(iFirmwareFd); return( NFCSTATUS_INVALID_DEVICE ); } @@ -278,6 +284,7 @@ NFCSTATUS phTmlNfc_i2c_open_and_configure(pphTmlNfc_Config_t pConfig, void ** pL NXPLOG_TML_E( "Cannot select I2C address (%s)\n", strerror(errno)); if ( iEnableFd ) close(iEnableFd); if ( iInterruptFd ) close(iInterruptFd); + if ( iFirmwareFd ) close(iFirmwareFd); close(iI2CFd); return( NFCSTATUS_INVALID_DEVICE ); }