#define LF_TRACE_BUFF_SIZE 20000 // 32 x 32 x 10 (32 bit times numofblock (7), times clock skip..)\r
#define LF_BITSSTREAM_LEN 1000 // more then 1000 bits shouldn't happend.. 8block * 4 bytes * 8bits = \r
\r
-// 0 = FSK\r
-// 1 = ASK\r
-// 2 = PSK\r
-// 4 = NZR (direct)\r
-typedef struct {\r
- uint8_t modulation;\r
- bool inversed;\r
- uint32_t block0;\r
-} t55xx_conf_block_t;\r
-\r
-// Default configuration: FSK, not inversed.\r
+\r
+\r
+// Default configuration: ASK, not inversed.\r
t55xx_conf_block_t config = { .modulation = 2, .inversed = FALSE, .block0 = 0x00};\r
\r
int usage_t55xx_config(){\r
}\r
// No args\r
if (cmdp == 0) {\r
- PrintAndLog("Modulation: %d", config.modulation);\r
- PrintAndLog("Invert : %d", config.inversed);\r
- PrintAndLog("Block0 : %08X", config.block0);\r
+ printConfiguration( config );\r
return 0;\r
}\r
//Validations\r
// }\r
} \r
if ( hits == 1) {\r
- PrintAndLog("Modulation: %d Inverse: %d", tests[0].modulation, tests[0].inversed);\r
config.modulation = tests[0].modulation;\r
config.inversed = tests[0].inversed;\r
+ printConfiguration( config );\r
return TRUE;\r
}\r
\r
if ( hits > 1) {\r
PrintAndLog("Found [%d] possible matches for modulation.",hits);\r
for(int i=0; i<hits; ++i){\r
- PrintAndLog("Modulation: %d Inverse: %d", tests[i].modulation, tests[i].inversed);\r
+ printConfiguration( tests[i] );\r
}\r
}\r
return FALSE;\r
PrintAndLog("0x%08X %s [%s]", blockData, sprint_bin(bits+1,32), demodStr);\r
}\r
\r
+void printConfiguration( t55xx_conf_block_t b){\r
+ PrintAndLog("Modulation : %s", GetSelectedModulationStr(b.modulation) );\r
+ PrintAndLog("Inverted : %s", (b.inversed) ? "Yes" : "No" );\r
+ PrintAndLog("Block0 : %08X", b.block0);\r
+ PrintAndLog("");\r
+}\r
+\r
/*\r
FSK1 / FSK1a\r
size = fskdemod(dest, size, 32, 0, 8, 10); // fsk1 RF/32 \r
return buf;\r
}\r
\r
+char * GetSelectedModulationStr( uint8_t id){\r
+\r
+ static char buf[16];\r
+ char *retStr = buf;\r
+ \r
+ switch (id){\r
+ case 1:\r
+ sprintf(retStr,"FSK (%d)",id);\r
+ break;\r
+ case 2: \r
+ sprintf(retStr,"ASK (%d)",id);\r
+ break;\r
+ case 3:\r
+ sprintf(retStr,"DIRECT/NRZ (%d)",id);\r
+ break;\r
+ case 4:\r
+ sprintf(retStr,"PSK (%d)",id);\r
+ break;\r
+ case 5:\r
+ sprintf(retStr,"BIPHASE (%d)",id);\r
+ break;\r
+ default:\r
+ sprintf(retStr,"(Unknown)");\r
+ break;\r
+ }\r
+ return buf;\r
+}\r
+\r
uint32_t PackBits(uint8_t start, uint8_t len, uint8_t* bits){\r
\r
int i = start;\r
#ifndef CMDLFT55XX_H__\r
#define CMDLFT55XX_H__\r
\r
+typedef struct {\r
+ uint8_t modulation;\r
+ bool inversed;\r
+ uint32_t block0;\r
+} t55xx_conf_block_t;\r
+\r
+\r
int CmdLFT55XX(const char *Cmd);\r
int CmdT55xxSetConfig(const char *Cmd);\r
int CmdT55xxReadBlock(const char *Cmd);\r
char * GetBitRateStr(uint32_t id);\r
char * GetSaferStr(uint32_t id);\r
char * GetModulationStr( uint32_t id);\r
+char * GetSelectedModulationStr( uint8_t id);\r
uint32_t PackBits(uint8_t start, uint8_t len, uint8_t* bitstream);\r
void printT55xxBlock(const char *demodStr);\r
+void printConfiguration( t55xx_conf_block_t b);\r
+\r
void DecodeT55xxBlock();\r
bool tryDetectModulation();\r
bool test();\r