From 33ba0c6f3676e2432ba0481a2d006b36a9eea392 Mon Sep 17 00:00:00 2001 From: bosb <12600404+bosb@users.noreply.github.com> Date: Tue, 25 Feb 2020 20:19:00 +0100 Subject: [PATCH] hitags fix uid sim + write --- armsrc/hitagS.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/armsrc/hitagS.c b/armsrc/hitagS.c index 40cdf47ed..68fa825e1 100644 --- a/armsrc/hitagS.c +++ b/armsrc/hitagS.c @@ -940,7 +940,7 @@ void SimulateHitagSTag(bool tag_mem_supplied, uint8_t *data) { memcpy((uint8_t *)tag.pages, data, 4 * 64); } - tag.uid = (uint32_t)tag.pages[0]; + tag.uid = (tag.pages[0][3] << 24 | tag.pages[0][2] << 16 | tag.pages[0][1] << 8 | tag.pages[0][0]); tag.key = (intptr_t)tag.pages[3]; tag.key <<= 16; tag.key += ((tag.pages[2][0]) << 8) + tag.pages[2][1]; @@ -1555,6 +1555,7 @@ void WritePageHitagS(hitag_function htf, hitag_data *htd, int page) { AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKDIS; // Capture mode, defaul timer source = MCK/2 (TIMER_CLOCK1), TIOA is external trigger, + AT91C_BASE_TC0->TC_CMR = AT91C_TC_CLKS_TIMER_DIV1_CLOCK; // external trigger rising edge, load RA on falling edge of TIOA. AT91C_BASE_TC1->TC_CMR = AT91C_TC_CLKS_TIMER_DIV1_CLOCK | AT91C_TC_ETRGEDG_FALLING