//FIXED time between sending frame and now listening frame. 330us
uint32_t starttime = GET_TICKS;
// its about 9+9 ticks delay from end-send to here.
- //WaitTicks( 495 - 9 - 9 );
WaitTicks( 477 );
next_bit_at = GET_TICKS + TAG_BIT_PERIOD;
int LegicRfReader(uint16_t offset, uint16_t len, uint8_t iv) {
- len &= 0x3FF;
-
uint16_t i = 0;
uint8_t isOK = 1;
legic_card_select_t card;
setup_phase_reader(iv);
LED_B_ON();
- while (i < len) {
+ while (i <= len) {
int r = legic_read_byte(offset + i, card.cmdsize);
if (r == -1 || BUTTON_PRESS()) {
WDT_HIT();
switch_off_tag_rwd();
LEDsoff();
- cmd_send(CMD_ACK,isOK,len,0,cardmem,len);
+ cmd_send(CMD_ACK, isOK, len, 0, cardmem, len);
return 0;
}