-// cmd_send(CMD_ACK,0,0,0,0,0);
- LED_A_OFF();
-}
-
-void T55xxReadBlockExt_1of4 (uint16_t arg0, uint8_t Block, uint32_t Pwd) {
- LED_A_ON();
- bool PwdMode = arg0 & 0x1;
- uint8_t Page = (arg0 & 0x2) >> 1;
- //uint32_t i = 0;
- bool RegReadMode = (Block == 0xFF);//regular read mode
- uint8_t bits;
- int bitpos;
-
- //clear buffer now so it does not interfere with timing later
- BigBuf_Clear_ext(false);
-
- //make sure block is at max 7
- Block &= 0x7;
-
- // Set up FPGA, 125kHz to power up the tag
- LFSetupFPGAForADC(95, true);
- StartTicks();
- // make sure tag is fully powered up...
- WaitMS(5);
- // Trigger T55x7 Direct Access Mode with start gap
- FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
- WaitUS(START_GAP1of4);
-
- T55xxWriteBit_1of4 (0); // 2 Bit 00 leading reference
-
- // Opcode 1[page]
- bits = 2 + Page;
- T55xxWriteBit_1of4 (bits);
-
- if (PwdMode) {
- // 1 of 4 00 - insert two fixed 00 between opcode and password
- T55xxWriteBit_1of4 (0); // 00
-
- // Send Pwd
- for (bitpos = 31; bitpos >= 1; bitpos -= 2) { // 2 bits at a time
- bits = (((Pwd >> bitpos) & 1) << 1) + ((Pwd >> (bitpos-1)) & 1);
- T55xxWriteBit_1of4 (bits);
- }
- }
-
- // Send Lock bit
- bits = 0; // Add lock bit (Not Set) to the next 2 bits
-
- // Send Block number (if direct access mode)
- if (!RegReadMode){
- // Send Block number
- bits += ((Block >> 2) & 1);
- T55xxWriteBit_1of4 (bits);
- bits = (Block & 3); // + (Block & 1);
- T55xxWriteBit_1of4 (bits);
- }
-
- // Turn field on to read the response
- // 137*8 seems to get to the start of data pretty well...
- // but we want to go past the start and let the repeating data settle in...
- TurnReadLFOn(210*8);