From 86b2520f7d85e4b0209d47241bcab424a2e761de Mon Sep 17 00:00:00 2001 From: Eric Betts Date: Tue, 23 Jul 2024 19:19:02 -0700 Subject: [PATCH] Fix R-ack --- t_1.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/t_1.c b/t_1.c index f19dfed..31c31b0 100644 --- a/t_1.c +++ b/t_1.c @@ -6,17 +6,13 @@ /* I know my T=1 is terrible, but I'm also only targetting one specific 'card' */ -/* TODO: - - Implement T=1 chaining receving - - Implement T=1 chaining sending - */ - #define MORE_BIT 0x20 #define IFSD_VALUE 0xfe -#define IFSC_VALUE 20 // Fom the SAM ATR +#define IFSC_VALUE 0xfe // Fom the SAM ATR #define R_BLOCK 0x80 #define R_SEQUENCE_NUMBER_MASK 0x10 +// TODO: T1 struct uint8_t NAD = 0x00; uint8_t dPCB = 0x40; // Init to 0x40 so first call to next_pcb will return 0x00 uint8_t cPCB = 0x00; // Init to 0x40 so first call to next_pcb will return 0x00 @@ -59,7 +55,7 @@ void seader_t_1_send_ack(Seader* seader) { uint8_t frame_len = 0; frame[0] = NAD; - frame[1] = R_BLOCK | dPCB; + frame[1] = R_BLOCK | (seader_next_cpcb() >> 2); frame[2] = 0x00; frame_len = 3;