From 3f5aab8f058909ebcfd8e62f3b00e0cdb564fd3e Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 3 Apr 2018 11:45:20 +0200 Subject: [PATCH] chg: preparing for iso7816 module statuses --- armsrc/appmain.c | 1 + armsrc/iso14443a.c | 3 ++- armsrc/iso7816.c | 13 ++++++++++++- armsrc/iso7816.h | 7 ++----- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 39f2a6441..f32544ed2 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -364,6 +364,7 @@ void SendStatus(void) { BigBuf_print_status(); Fpga_print_status(); Flashmem_print_status(); + //Iso7816_print_status(); printConfig(); //LF Sampling config printUSBSpeed(); Dbprintf("Various"); diff --git a/armsrc/iso14443a.c b/armsrc/iso14443a.c index 249104949..e002a5bc6 100644 --- a/armsrc/iso14443a.c +++ b/armsrc/iso14443a.c @@ -782,7 +782,7 @@ bool prepare_tag_modulation(tag_response_info_t* response_info, size_t max_buffe if (ToSendMax > max_buffer_size) { Dbprintf("Out of memory, when modulating bits for tag answer:"); Dbhexdump(response_info->response_n,response_info->response,false); - return false; + return false; } // Copy the byte array, used for this modulation to the buffer position @@ -3045,6 +3045,7 @@ void Mifare1ksim(uint8_t flags, uint8_t exitAfterNReads, uint8_t arg2, uint8_t * // find reader field if (cardSTATE == MFEMUL_NOFIELD) { + vHf = (MAX_ADC_HF_VOLTAGE * AvgAdc(ADC_CHAN_HF)) >> 10; if (vHf > MF_MINFIELDV) { cardSTATE_TO_IDLE(); diff --git a/armsrc/iso7816.c b/armsrc/iso7816.c index 9ca4f081d..605733385 100644 --- a/armsrc/iso7816.c +++ b/armsrc/iso7816.c @@ -121,7 +121,6 @@ bool ISO7816_init(void) { StartTicks(); - // StopTicks(); // return false; @@ -134,4 +133,16 @@ void ISO7816_test(void) { if (!ISO7816_init()) return; ISO7816_stop(); +} + +void Iso7816_print_status(void) { + DbpString("Contact module (iso7816)"); + + if (!ISO7816_init()) { + DbpString(" init....................FAIL"); + return; + } + DbpString(" init....................OK"); + + ISO7816_stop(); } \ No newline at end of file diff --git a/armsrc/iso7816.h b/armsrc/iso7816.h index cce5a7e71..153b4723e 100644 --- a/armsrc/iso7816.h +++ b/armsrc/iso7816.h @@ -5,10 +5,7 @@ #include "apps.h" #include "ticks.h" -// Used Command -#define ID 0x90 - -#define SPI_CLK 75000000 //Hex equivalent of 75MHz +#define ISO_CLK 75000000 //Hex equivalent of 75MHz //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// extern void Dbprintf(const char *fmt, ...); @@ -19,5 +16,5 @@ bool ISO7816_waitidle(void); uint16_t ISO7816_sendbyte(uint32_t data); bool ISO7816_init(); void ISO7816_test(void); - +void Iso7816_print_status(void); #endif \ No newline at end of file