From 8c1815fbeac4d98806fb95b167dd17dd9e92dd5f Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Tue, 18 May 2010 08:27:50 +0000 Subject: [PATCH] Move variable declarations in order to compile using non-C99 compiler. Fix Issue 80. --- libnfc/drivers/arygon.c | 2 +- libnfc/drivers/pn532_uart.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libnfc/drivers/arygon.c b/libnfc/drivers/arygon.c index 92259d7..889bf25 100644 --- a/libnfc/drivers/arygon.c +++ b/libnfc/drivers/arygon.c @@ -307,6 +307,7 @@ arygon_check_communication(const nfc_device_spec_t nds) { byte_t abtRx[BUFFER_LENGTH]; size_t szRxLen; + const byte_t attempted_result[] = { 0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0xff,0x09,0xf7,0xD5,0x01,0x00,'l','i','b','n','f','c',0xbc,0x00}; /** To be sure that PN532 is alive, we have put a "Diagnose" command to execute a "Communication Line Test" */ const byte_t pncmd_communication_test[] = { DEV_ARYGON_PROTOCOL_TAMA, 0x00,0x00,0xff,0x09,0xf7,0xd4,0x00,0x00,'l','i','b','n','f','c',0xbe,0x00 }; @@ -323,7 +324,6 @@ arygon_check_communication(const nfc_device_spec_t nds) PRINT_HEX("RX", abtRx,szRxLen); #endif - const byte_t attempted_result[] = { 0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0xff,0x09,0xf7,0xD5,0x01,0x00,'l','i','b','n','f','c',0xbc,0x00}; if(0 != memcmp(abtRx,attempted_result,sizeof(attempted_result))) { DBG("%s", "Communication test failed, result doesn't match to attempted one."); return false; diff --git a/libnfc/drivers/pn532_uart.c b/libnfc/drivers/pn532_uart.c index 35c89ae..c9a3f8e 100644 --- a/libnfc/drivers/pn532_uart.c +++ b/libnfc/drivers/pn532_uart.c @@ -203,6 +203,8 @@ bool pn532_uart_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, con byte_t abtRxBuf[BUFFER_LENGTH]; size_t szRxBufLen = BUFFER_LENGTH; size_t szPos; + const byte_t pn53x_ack_frame[] = { 0x00,0x00,0xff,0x00,0xff,0x00 }; + const byte_t pn53x_nack_frame[] = { 0x00,0x00,0xff,0xff,0x00,0x00 }; // Packet length = data length (len) + checksum (1) + end of stream marker (1) abtTxBuf[3] = szTxLen; @@ -238,8 +240,6 @@ bool pn532_uart_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, con PRINT_HEX("RX", abtRxBuf,szRxBufLen); #endif - const byte_t pn53x_ack_frame[] = { 0x00,0x00,0xff,0x00,0xff,0x00 }; - const byte_t pn53x_nack_frame[] = { 0x00,0x00,0xff,0xff,0x00,0x00 }; if(szRxBufLen >= sizeof(pn53x_ack_frame)) { // Check if PN53x reply ACK @@ -301,6 +301,7 @@ pn532_uart_check_communication(const nfc_device_spec_t nds) { byte_t abtRx[BUFFER_LENGTH]; size_t szRxLen; + const byte_t attempted_result[] = { 0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0xff,0x09,0xf7,0xD5,0x01,0x00,'l','i','b','n','f','c',0xbc,0x00}; /** To be sure that PN532 is alive, we have put a "Diagnose" command to execute a "Communication Line Test" */ const byte_t pncmd_communication_test[] = { 0x00,0x00,0xff,0x09,0xf7,0xd4,0x00,0x00,'l','i','b','n','f','c',0xbe,0x00 }; @@ -317,7 +318,6 @@ pn532_uart_check_communication(const nfc_device_spec_t nds) PRINT_HEX("RX", abtRx,szRxLen); #endif - const byte_t attempted_result[] = { 0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0xff,0x09,0xf7,0xD5,0x01,0x00,'l','i','b','n','f','c',0xbc,0x00}; if(0 != memcmp(abtRx,attempted_result,sizeof(attempted_result))) { DBG("%s", "Communication test failed, result doesn't match to attempted one."); return false;