]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - winsrc/command.cpp
Add defines for TIMER_CLOCK?
[proxmark3-svn] / winsrc / command.cpp
index c1b3e372d4b09a456fa2b290559b182704ebb11e..da0f23886dc2416d7733d323078016838d1a3ca9 100644 (file)
@@ -2272,9 +2272,11 @@ static void Cmdaskdemod(char *str) {
        int c, high = 0, low = 0;\r
 \r
        // TODO: complain if we do not give 2 arguments here !\r
        int c, high = 0, low = 0;\r
 \r
        // TODO: complain if we do not give 2 arguments here !\r
+       // (AL - this doesn't make sense! we're only using one argument!!!)\r
        sscanf(str, "%i", &c);\r
 \r
        /* Detect high and lows and clock */\r
        sscanf(str, "%i", &c);\r
 \r
        /* Detect high and lows and clock */\r
+       // (AL - clock???)\r
        for (i = 0; i < GraphTraceLen; i++)\r
        {\r
                if (GraphBuffer[i] > high)\r
        for (i = 0; i < GraphTraceLen; i++)\r
        {\r
                if (GraphBuffer[i] > high)\r
@@ -2282,6 +2284,10 @@ static void Cmdaskdemod(char *str) {
                else if (GraphBuffer[i] < low)\r
                        low = GraphBuffer[i];\r
        }\r
                else if (GraphBuffer[i] < low)\r
                        low = GraphBuffer[i];\r
        }\r
+       if(c != 0 && c != 1) {\r
+               PrintToScrollback("Invalid argument: %s",str);\r
+               return;\r
+               }\r
 \r
        if (GraphBuffer[0] > 0) {\r
                GraphBuffer[0] = 1-c;\r
 \r
        if (GraphBuffer[0] > 0) {\r
                GraphBuffer[0] = 1-c;\r
@@ -2526,7 +2532,12 @@ static void Cmdmanchesterdemod(char *str) {
 \r
        /* Detect first transition */\r
        /* Lo-Hi (arbitrary)       */\r
 \r
        /* Detect first transition */\r
        /* Lo-Hi (arbitrary)       */\r
-       for (i = 0; i < GraphTraceLen; i++)\r
+       /* skip to the first high */\r
+       for (i= 0; i < GraphTraceLen; i++)\r
+               if(GraphBuffer[i] == high)\r
+                       break;\r
+       /* now look for the first low */\r
+       for (; i < GraphTraceLen; i++)\r
        {\r
                if (GraphBuffer[i] == low)\r
                {\r
        {\r
                if (GraphBuffer[i] == low)\r
                {\r
@@ -2819,6 +2830,22 @@ static void CmdSetDivisor(char *str)
        }\r
 }\r
 \r
        }\r
 }\r
 \r
+static void CmdSetMux(char *str)\r
+{\r
+       UsbCommand c;\r
+       c.cmd = CMD_SET_ADC_MUX;\r
+       if(strncasecmp(str, "lopkd", 5) == 0) {\r
+               c.ext1 = 0;\r
+       } else if(strncasecmp(str, "loraw", 5) == 0) {\r
+               c.ext1 = 1;\r
+       } else if(strncasecmp(str, "hipkd", 5) == 0) {\r
+               c.ext1 = 2;\r
+       } else if(strncasecmp(str, "hiraw", 5) == 0) {\r
+               c.ext1 = 3;\r
+       }\r
+       SendCommand(&c, FALSE);\r
+}\r
+\r
 typedef void HandlerFunction(char *cmdline);\r
 \r
 /* in alphabetic order */\r
 typedef void HandlerFunction(char *cmdline);\r
 \r
 /* in alphabetic order */\r
@@ -2829,7 +2856,7 @@ static struct {
        char            *docString;\r
 } CommandTable[] = {\r
        {"amp",                                 CmdAmp,                                         1, "Amplify peaks"},\r
        char            *docString;\r
 } CommandTable[] = {\r
        {"amp",                                 CmdAmp,                                         1, "Amplify peaks"},\r
-       {"askdemod",                    Cmdaskdemod,                            1, "<samples per bit> <0|1> -- Attempt to demodulate simple ASK tags"},\r
+       {"askdemod",                    Cmdaskdemod,                            1, "<0|1> -- Attempt to demodulate simple ASK tags"},\r
        {"autocorr",                    CmdAutoCorr,                            1, "<window length> -- Autocorrelation over window"},\r
        {"bitsamples",          CmdBitsamples,                  0, "Get raw samples as bitstring"},\r
        {"bitstream",                   Cmdbitstream,                           1, "[clock rate] -- Convert waveform into a bitstream"},\r
        {"autocorr",                    CmdAutoCorr,                            1, "<window length> -- Autocorrelation over window"},\r
        {"bitsamples",          CmdBitsamples,                  0, "Get raw samples as bitstring"},\r
        {"bitstream",                   Cmdbitstream,                           1, "[clock rate] -- Convert waveform into a bitstream"},\r
@@ -2890,6 +2917,7 @@ static struct {
        {"save",                                        CmdSave,                                                1, "<filename> -- Save trace (from graph window)"},\r
        {"scale",                                       CmdScale,                                               1, "<int> -- Set cursor display scale"},\r
        {"setlfdivisor",        CmdSetDivisor,                  0, "<19 - 255> -- Drive LF antenna at 12Mhz/(divisor+1)"},\r
        {"save",                                        CmdSave,                                                1, "<filename> -- Save trace (from graph window)"},\r
        {"scale",                                       CmdScale,                                               1, "<int> -- Set cursor display scale"},\r
        {"setlfdivisor",        CmdSetDivisor,                  0, "<19 - 255> -- Drive LF antenna at 12Mhz/(divisor+1)"},\r
+       {"setmux",              CmdSetMux,                      0, "<loraw|hiraw|lopkd|hipkd> -- Set the ADC mux to a specific value"},\r
        {"sri512read",          CmdSri512read,                  0, "<int> -- Read contents of a SRI512 tag"},\r
        {"tidemod",                             CmdTIDemod,                                     1, "Demodulate raw bits for TI-type LF tag"},\r
        {"tiread",                              CmdTIRead,                                      0, "Read and decode a TI 134 kHz tag"},\r
        {"sri512read",          CmdSri512read,                  0, "<int> -- Read contents of a SRI512 tag"},\r
        {"tidemod",                             CmdTIDemod,                                     1, "Demodulate raw bits for TI-type LF tag"},\r
        {"tiread",                              CmdTIRead,                                      0, "Read and decode a TI 134 kHz tag"},\r
Impressum, Datenschutz