-t55xx_conf_block_t config = { .modulation = DEMOD_ASK, .inverted = FALSE, .offset = 0x00, .block0 = 0x00, .Q5 = FALSE };\r
+t55xx_conf_block_t config = { .modulation = DEMOD_ASK, .inverted = false, .offset = 0x00, .block0 = 0x00, .Q5 = false };\r
PrintAndLog("Options:");\r
PrintAndLog(" b <block> - block number to write. Between 0-7");\r
PrintAndLog(" d <data> - 4 bytes of data to write (8 hex characters)");\r
PrintAndLog("Options:");\r
PrintAndLog(" b <block> - block number to write. Between 0-7");\r
PrintAndLog(" d <data> - 4 bytes of data to write (8 hex characters)");\r
- PrintAndLog(" lf t55xx wr b 3 d 11223344 - write 11223344 to block 3");\r
- PrintAndLog(" lf t55xx wr b 3 d 11223344 p feedbeef - write 11223344 to block 3 password feedbeef");\r
+ PrintAndLog(" lf t55xx write b 3 d 11223344 - write 11223344 to block 3");\r
+ PrintAndLog(" lf t55xx write b 3 d 11223344 p feedbeef - write 11223344 to block 3 password feedbeef");\r
uint8_t bitRate = 0;\r
uint8_t rates[9] = {8,16,32,40,50,64,100,128,0};\r
uint8_t cmdp = 0;\r
uint8_t bitRate = 0;\r
uint8_t rates[9] = {8,16,32,40,50,64,100,128,0};\r
uint8_t cmdp = 0;\r
while(param_getchar(Cmd, cmdp) != 0x00 && !errors)\r
{\r
tmp = param_getchar(Cmd, cmdp);\r
while(param_getchar(Cmd, cmdp) != 0x00 && !errors)\r
{\r
tmp = param_getchar(Cmd, cmdp);\r
switch( config.modulation ){\r
case DEMOD_FSK:\r
snprintf(cmdStr, sizeof(buf),"%d %d", bitRate[config.bitrate], config.inverted );\r
switch( config.modulation ){\r
case DEMOD_FSK:\r
snprintf(cmdStr, sizeof(buf),"%d %d", bitRate[config.bitrate], config.inverted );\r
break;\r
case DEMOD_FSK1:\r
case DEMOD_FSK1a:\r
snprintf(cmdStr, sizeof(buf),"%d %d 8 5", bitRate[config.bitrate], config.inverted );\r
break;\r
case DEMOD_FSK1:\r
case DEMOD_FSK1a:\r
snprintf(cmdStr, sizeof(buf),"%d %d 8 5", bitRate[config.bitrate], config.inverted );\r
break;\r
case DEMOD_FSK2:\r
case DEMOD_FSK2a:\r
snprintf(cmdStr, sizeof(buf),"%d %d 10 8", bitRate[config.bitrate], config.inverted );\r
break;\r
case DEMOD_FSK2:\r
case DEMOD_FSK2a:\r
snprintf(cmdStr, sizeof(buf),"%d %d 10 8", bitRate[config.bitrate], config.inverted );\r
break;\r
case DEMOD_ASK:\r
snprintf(cmdStr, sizeof(buf),"%d %d 1", bitRate[config.bitrate], config.inverted );\r
break;\r
case DEMOD_ASK:\r
snprintf(cmdStr, sizeof(buf),"%d %d 1", bitRate[config.bitrate], config.inverted );\r
- ans = ASKDemod_ext(cmdStr, FALSE, FALSE, 1, &ST);\r
+ ans = ASKDemod_ext(cmdStr, false, false, 1, &ST);\r
break;\r
case DEMOD_PSK1:\r
// skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise)\r
save_restoreGB(1);\r
CmdLtrim("160");\r
snprintf(cmdStr, sizeof(buf),"%d %d 6", bitRate[config.bitrate], config.inverted );\r
break;\r
case DEMOD_PSK1:\r
// skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise)\r
save_restoreGB(1);\r
CmdLtrim("160");\r
snprintf(cmdStr, sizeof(buf),"%d %d 6", bitRate[config.bitrate], config.inverted );\r
save_restoreGB(1);\r
CmdLtrim("160");\r
snprintf(cmdStr, sizeof(buf),"%d 0 6", bitRate[config.bitrate] );\r
save_restoreGB(1);\r
CmdLtrim("160");\r
snprintf(cmdStr, sizeof(buf),"%d 0 6", bitRate[config.bitrate] );\r
psk1TOpsk2(DemodBuffer, DemodBufferLen);\r
//undo trim samples\r
save_restoreGB(0);\r
break;\r
case DEMOD_NRZ:\r
snprintf(cmdStr, sizeof(buf),"%d %d 1", bitRate[config.bitrate], config.inverted );\r
psk1TOpsk2(DemodBuffer, DemodBufferLen);\r
//undo trim samples\r
save_restoreGB(0);\r
break;\r
case DEMOD_NRZ:\r
snprintf(cmdStr, sizeof(buf),"%d %d 1", bitRate[config.bitrate], config.inverted );\r
break;\r
case DEMOD_BI:\r
case DEMOD_BIa:\r
snprintf(cmdStr, sizeof(buf),"0 %d %d 1", bitRate[config.bitrate], config.inverted );\r
break;\r
case DEMOD_BI:\r
case DEMOD_BIa:\r
snprintf(cmdStr, sizeof(buf),"0 %d %d 1", bitRate[config.bitrate], config.inverted );\r
- return (bool) ASKDemod("64 0 1", FALSE, FALSE, 1);\r
+ return (bool) ASKDemod("64 0 1", false, false, 1);\r
case 'p':\r
case 'P':\r
password = param_get32ex(Cmd, cmdp+1, 0, 16);\r
case 'p':\r
case 'P':\r
password = param_get32ex(Cmd, cmdp+1, 0, 16);\r
t55xx_conf_block_t tests[15];\r
int bitRate=0;\r
uint8_t fc1 = 0, fc2 = 0, clk=0;\r
t55xx_conf_block_t tests[15];\r
int bitRate=0;\r
uint8_t fc1 = 0, fc2 = 0, clk=0;\r
- if (GetFskClock("", FALSE, FALSE)){ \r
- fskClocks(&fc1, &fc2, &clk, FALSE);\r
- if ( FSKrawDemod("0 0", FALSE) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
+ if (GetFskClock("", false, false)){ \r
+ fskClocks(&fc1, &fc2, &clk, false);\r
+ if ( FSKrawDemod("0 0", false) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
tests[hits].modulation = DEMOD_FSK;\r
if (fc1==8 && fc2 == 5)\r
tests[hits].modulation = DEMOD_FSK1a;\r
else if (fc1==10 && fc2 == 8)\r
tests[hits].modulation = DEMOD_FSK2;\r
tests[hits].bitrate = bitRate;\r
tests[hits].modulation = DEMOD_FSK;\r
if (fc1==8 && fc2 == 5)\r
tests[hits].modulation = DEMOD_FSK1a;\r
else if (fc1==10 && fc2 == 8)\r
tests[hits].modulation = DEMOD_FSK2;\r
tests[hits].bitrate = bitRate;\r
- if ( FSKrawDemod("0 1", FALSE) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
+ if ( FSKrawDemod("0 1", false) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
tests[hits].modulation = DEMOD_FSK;\r
if (fc1 == 8 && fc2 == 5)\r
tests[hits].modulation = DEMOD_FSK1;\r
else if (fc1 == 10 && fc2 == 8)\r
tests[hits].modulation = DEMOD_FSK2a;\r
tests[hits].bitrate = bitRate;\r
tests[hits].modulation = DEMOD_FSK;\r
if (fc1 == 8 && fc2 == 5)\r
tests[hits].modulation = DEMOD_FSK1;\r
else if (fc1 == 10 && fc2 == 8)\r
tests[hits].modulation = DEMOD_FSK2a;\r
tests[hits].bitrate = bitRate;\r
- tests[hits].ST = TRUE;\r
- if ( ASKDemod_ext("0 0 1", FALSE, FALSE, 1, &tests[hits].ST) && test(DEMOD_ASK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
+ tests[hits].ST = true;\r
+ if ( ASKDemod_ext("0 0 1", false, false, 1, &tests[hits].ST) && test(DEMOD_ASK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
- tests[hits].ST = TRUE;\r
- if ( ASKDemod_ext("0 1 1", FALSE, FALSE, 1, &tests[hits].ST) && test(DEMOD_ASK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
+ tests[hits].ST = true;\r
+ if ( ASKDemod_ext("0 1 1", false, false, 1, &tests[hits].ST) && test(DEMOD_ASK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
- if ( ASKbiphaseDemod("0 0 0 2", FALSE) && test(DEMOD_BI, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5) ) {\r
+ if ( ASKbiphaseDemod("0 0 0 2", false) && test(DEMOD_BI, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5) ) {\r
- if ( ASKbiphaseDemod("0 0 1 2", FALSE) && test(DEMOD_BIa, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5) ) {\r
+ if ( ASKbiphaseDemod("0 0 1 2", false) && test(DEMOD_BIa, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5) ) {\r
- if ( NRZrawDemod("0 0 1", FALSE) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
+ if ( NRZrawDemod("0 0 1", false) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
- if ( NRZrawDemod("0 1 1", FALSE) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
+ if ( NRZrawDemod("0 1 1", false) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
- if ( PSKDemod("0 0 6", FALSE) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
+ if ( PSKDemod("0 0 6", false) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
- if ( PSKDemod("0 1 6", FALSE) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
+ if ( PSKDemod("0 1 6", false) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
psk1TOpsk2(DemodBuffer, DemodBufferLen);\r
if (test(DEMOD_PSK2, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)){\r
tests[hits].modulation = DEMOD_PSK2;\r
tests[hits].bitrate = bitRate;\r
psk1TOpsk2(DemodBuffer, DemodBufferLen);\r
if (test(DEMOD_PSK2, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)){\r
tests[hits].modulation = DEMOD_PSK2;\r
tests[hits].bitrate = bitRate;\r
psk1TOpsk2(DemodBuffer, DemodBufferLen);\r
if (test(DEMOD_PSK3, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)){\r
tests[hits].modulation = DEMOD_PSK3;\r
tests[hits].bitrate = bitRate;\r
psk1TOpsk2(DemodBuffer, DemodBufferLen);\r
if (test(DEMOD_PSK3, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)){\r
tests[hits].modulation = DEMOD_PSK3;\r
tests[hits].bitrate = bitRate;\r
config.Q5 = tests[0].Q5;\r
config.ST = tests[0].ST;\r
printConfiguration( config );\r
config.Q5 = tests[0].Q5;\r
config.ST = tests[0].ST;\r
printConfiguration( config );\r
\r
bool testQ5(uint8_t mode, uint8_t *offset, int *fndBitRate, uint8_t clk){\r
\r
\r
bool testQ5(uint8_t mode, uint8_t *offset, int *fndBitRate, uint8_t clk){\r
\r
\r
bool test(uint8_t mode, uint8_t *offset, int *fndBitRate, uint8_t clk, bool *Q5){\r
\r
\r
bool test(uint8_t mode, uint8_t *offset, int *fndBitRate, uint8_t clk, bool *Q5){\r
\r
uint8_t extend = PackBits(si, 1, DemodBuffer); si += 1; //bit 15 extended mode\r
uint8_t modread = PackBits(si, 5, DemodBuffer); si += 5+2+1; \r
//uint8_t pskcr = PackBits(si, 2, DemodBuffer); si += 2+1; //could check psk cr\r
uint8_t extend = PackBits(si, 1, DemodBuffer); si += 1; //bit 15 extended mode\r
uint8_t modread = PackBits(si, 5, DemodBuffer); si += 5+2+1; \r
//uint8_t pskcr = PackBits(si, 2, DemodBuffer); si += 2+1; //could check psk cr\r
- uint8_t nml01 = PackBits(si, 1, DemodBuffer); si += 1+5; //bit 24, 30, 31 could be tested for 0 if not extended mode\r
- uint8_t nml02 = PackBits(si, 2, DemodBuffer); si += 2;\r
+ //uint8_t nml01 = PackBits(si, 1, DemodBuffer); si += 1+5; //bit 24, 30, 31 could be tested for 0 if not extended mode\r
+ //uint8_t nml02 = PackBits(si, 2, DemodBuffer); si += 2;\r
}\r
//test modulation\r
if (!testModulation(mode, modread)) continue;\r
if (!testBitRate(bitRate, clk)) continue;\r
*fndBitRate = bitRate;\r
*offset = idx;\r
}\r
//test modulation\r
if (!testModulation(mode, modread)) continue;\r
if (!testBitRate(bitRate, clk)) continue;\r
*fndBitRate = bitRate;\r
*offset = idx;\r
}\r
if (testQ5(mode, offset, fndBitRate, clk)) {\r
}\r
if (testQ5(mode, offset, fndBitRate, clk)) {\r
PrintAndLog("Bit Rate : %s", GetBitRateStr(b.bitrate) );\r
PrintAndLog("Inverted : %s", (b.inverted) ? "Yes" : "No" );\r
PrintAndLog("Offset : %d", b.offset);\r
PrintAndLog("Bit Rate : %s", GetBitRateStr(b.bitrate) );\r
PrintAndLog("Inverted : %s", (b.inverted) ? "Yes" : "No" );\r
PrintAndLog("Offset : %d", b.offset);\r
- if ( !AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, TRUE, testpwd)) {\r
+ if ( !AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, testpwd)) {\r
- if (!AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, TRUE, i)) {\r
+ if (!AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, i)) {\r