From 86eaac46dcc2b4e347b24935ae9780ca85e2f383 Mon Sep 17 00:00:00 2001 From: tharexde Date: Sat, 27 Jun 2020 00:20:56 +0200 Subject: [PATCH] formal adjustments --- armsrc/em4x50.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/armsrc/em4x50.c b/armsrc/em4x50.c index 1df07798c..cfbfb9fe0 100644 --- a/armsrc/em4x50.c +++ b/armsrc/em4x50.c @@ -604,7 +604,9 @@ static int get_word_from_bitstream(uint8_t bits[EM4X50_TAG_WORD]) { } } +//============================================================================== // login function +//============================================================================== static bool login(uint8_t password[4]) { @@ -631,7 +633,9 @@ static bool login(uint8_t password[4]) { return false; } +//============================================================================== // reset function +//============================================================================== static bool reset(void) { @@ -653,7 +657,9 @@ static bool reset(void) { return false; } +//============================================================================== // read functions +//============================================================================== static bool standard_read(int *now) { @@ -756,7 +762,7 @@ void em4x50_info(em4x50_data_t *etd) { void em4x50_sread(em4x50_data_t *etd) { - // reads single word in two alternative ways: + // reads in two different ways: // - using "selective read mode" -> bidirectional communication // - using "standard read mode" -> unidirectional communication (read // data that tag transmits "voluntarily") @@ -764,7 +770,7 @@ void em4x50_sread(em4x50_data_t *etd) { bool bsuccess = false, blogin = false; int now = 0; uint8_t status = 0; - uint8_t addresses[] = {0x00, 0x00, 0x00, 0x00}; // fwr = 0, lwr = 33 + uint8_t addresses[] = {0x00, 0x00, 0x00, 0x00}; init_tag(); em4x50_setup_read(); @@ -790,14 +796,16 @@ void em4x50_sread(em4x50_data_t *etd) { bsuccess = standard_read(&now); } + status = (now << 2) + (bsuccess << 1) + blogin; lf_finalize(); reply_ng(CMD_ACK, status, (uint8_t *)tag.sectors, 238); } - +//============================================================================== // write functions +//============================================================================== static bool write(uint8_t word[4], uint8_t address) {