]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - client/cmddata.c
b01b45ba02c582f9bc209f0a8feff1d3a7c936c8
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
7 //-----------------------------------------------------------------------------
8 // Data and Graph commands
9 //-----------------------------------------------------------------------------
15 #include "proxmark3.h"
19 #include "cmdparser.h"
24 static int CmdHelp(const char *Cmd
);
26 int CmdAmp(const char *Cmd
)
28 int i
, rising
, falling
;
29 int max
= INT_MIN
, min
= INT_MAX
;
31 for (i
= 10; i
< GraphTraceLen
; ++i
) {
32 if (GraphBuffer
[i
] > max
)
34 if (GraphBuffer
[i
] < min
)
40 for (i
= 0; i
< GraphTraceLen
; ++i
) {
41 if (GraphBuffer
[i
+ 1] < GraphBuffer
[i
]) {
48 if (GraphBuffer
[i
+ 1] > GraphBuffer
[i
]) {
62 * Generic command to demodulate ASK.
64 * Argument is convention: positive or negative (High mod means zero
65 * or high mod means one)
67 * Updates the Graph trace with 0/1 values
72 int Cmdaskdemod(const char *Cmd
)
75 int c
, high
= 0, low
= 0;
77 sscanf(Cmd
, "%i", &c
);
79 if (c
!= 0 && c
!= 1) {
80 PrintAndLog("Invalid argument: %s", Cmd
);
84 /* Detect high and lows */
85 for (i
= 0; i
< GraphTraceLen
; ++i
)
87 if (GraphBuffer
[i
] > high
)
88 high
= GraphBuffer
[i
];
89 else if (GraphBuffer
[i
] < low
)
93 if (GraphBuffer
[0] > 0) {
98 for (i
= 1; i
< GraphTraceLen
; ++i
) {
99 /* Transitions are detected at each peak
100 * Transitions are either:
101 * - we're low: transition if we hit a high
102 * - we're high: transition if we hit a low
103 * (we need to do it this way because some tags keep high or
104 * low for long periods, others just reach the peak and go
107 if ((GraphBuffer
[i
] == high
) && (GraphBuffer
[i
- 1] == c
)) {
108 GraphBuffer
[i
] = 1 - c
;
109 } else if ((GraphBuffer
[i
] == low
) && (GraphBuffer
[i
- 1] == (1 - c
))){
113 GraphBuffer
[i
] = GraphBuffer
[i
- 1];
116 RepaintGraphWindow();
120 int CmdAutoCorr(const char *Cmd
)
122 static int CorrelBuffer
[MAX_GRAPH_TRACE_LEN
];
124 int window
= atoi(Cmd
);
127 PrintAndLog("needs a window");
130 if (window
>= GraphTraceLen
) {
131 PrintAndLog("window must be smaller than trace (%d samples)",
136 PrintAndLog("performing %d correlations", GraphTraceLen
- window
);
138 for (int i
= 0; i
< GraphTraceLen
- window
; ++i
) {
140 for (int j
= 0; j
< window
; ++j
) {
141 sum
+= (GraphBuffer
[j
]*GraphBuffer
[i
+ j
]) / 256;
143 CorrelBuffer
[i
] = sum
;
145 GraphTraceLen
= GraphTraceLen
- window
;
146 memcpy(GraphBuffer
, CorrelBuffer
, GraphTraceLen
* sizeof (int));
148 RepaintGraphWindow();
152 int CmdBitsamples(const char *Cmd
)
157 GetFromBigBuf(got
,sizeof(got
),0);
158 WaitForResponse(CMD_ACK
,NULL
);
160 for (int j
= 0; j
< sizeof(got
); j
++) {
161 for (int k
= 0; k
< 8; k
++) {
162 if(got
[j
] & (1 << (7 - k
))) {
163 GraphBuffer
[cnt
++] = 1;
165 GraphBuffer
[cnt
++] = 0;
170 RepaintGraphWindow();
175 * Convert to a bitstream
177 int CmdBitstream(const char *Cmd
)
185 int hithigh
, hitlow
, first
;
187 /* Detect high and lows and clock */
188 for (i
= 0; i
< GraphTraceLen
; ++i
)
190 if (GraphBuffer
[i
] > high
)
191 high
= GraphBuffer
[i
];
192 else if (GraphBuffer
[i
] < low
)
193 low
= GraphBuffer
[i
];
197 clock
= GetClock(Cmd
, high
, 1);
201 for (i
= 0; i
< (int)(gtl
/ clock
); ++i
)
206 /* Find out if we hit both high and low peaks */
207 for (j
= 0; j
< clock
; ++j
)
209 if (GraphBuffer
[(i
* clock
) + j
] == high
)
211 else if (GraphBuffer
[(i
* clock
) + j
] == low
)
213 /* it doesn't count if it's the first part of our read
214 because it's really just trailing from the last sequence */
215 if (first
&& (hithigh
|| hitlow
))
216 hithigh
= hitlow
= 0;
220 if (hithigh
&& hitlow
)
224 /* If we didn't hit both high and low peaks, we had a bit transition */
225 if (!hithigh
|| !hitlow
)
228 AppendGraph(0, clock
, bit
);
229 // for (j = 0; j < (int)(clock/2); j++)
230 // GraphBuffer[(i * clock) + j] = bit ^ 1;
231 // for (j = (int)(clock/2); j < clock; j++)
232 // GraphBuffer[(i * clock) + j] = bit;
235 RepaintGraphWindow();
239 int CmdBuffClear(const char *Cmd
)
241 UsbCommand c
= {CMD_BUFF_CLEAR
};
247 int CmdDec(const char *Cmd
)
249 for (int i
= 0; i
< (GraphTraceLen
/ 2); ++i
)
250 GraphBuffer
[i
] = GraphBuffer
[i
* 2];
252 PrintAndLog("decimated by 2");
253 RepaintGraphWindow();
257 /* Print our clock rate */
258 int CmdDetectClockRate(const char *Cmd
)
260 int clock
= DetectClock(0);
261 PrintAndLog("Auto-detected clock rate: %d", clock
);
265 int CmdFSKdemod(const char *Cmd
)
267 static const int LowTone
[] = {
268 1, 1, 1, 1, 1, -1, -1, -1, -1, -1,
269 1, 1, 1, 1, 1, -1, -1, -1, -1, -1,
270 1, 1, 1, 1, 1, -1, -1, -1, -1, -1,
271 1, 1, 1, 1, 1, -1, -1, -1, -1, -1,
272 1, 1, 1, 1, 1, -1, -1, -1, -1, -1
274 static const int HighTone
[] = {
275 1, 1, 1, 1, 1, -1, -1, -1, -1,
276 1, 1, 1, 1, -1, -1, -1, -1,
277 1, 1, 1, 1, -1, -1, -1, -1,
278 1, 1, 1, 1, -1, -1, -1, -1,
279 1, 1, 1, 1, -1, -1, -1, -1,
280 1, 1, 1, 1, -1, -1, -1, -1, -1,
283 int lowLen
= sizeof (LowTone
) / sizeof (int);
284 int highLen
= sizeof (HighTone
) / sizeof (int);
285 int convLen
= (highLen
> lowLen
) ? highLen
: lowLen
;
286 uint32_t hi
= 0, lo
= 0;
289 int minMark
= 0, maxMark
= 0;
291 for (i
= 0; i
< GraphTraceLen
- convLen
; ++i
) {
292 int lowSum
= 0, highSum
= 0;
294 for (j
= 0; j
< lowLen
; ++j
) {
295 lowSum
+= LowTone
[j
]*GraphBuffer
[i
+j
];
297 for (j
= 0; j
< highLen
; ++j
) {
298 highSum
+= HighTone
[j
] * GraphBuffer
[i
+ j
];
300 lowSum
= abs(100 * lowSum
/ lowLen
);
301 highSum
= abs(100 * highSum
/ highLen
);
302 GraphBuffer
[i
] = (highSum
<< 16) | lowSum
;
305 for(i
= 0; i
< GraphTraceLen
- convLen
- 16; ++i
) {
306 int lowTot
= 0, highTot
= 0;
307 // 10 and 8 are f_s divided by f_l and f_h, rounded
308 for (j
= 0; j
< 10; ++j
) {
309 lowTot
+= (GraphBuffer
[i
+j
] & 0xffff);
311 for (j
= 0; j
< 8; j
++) {
312 highTot
+= (GraphBuffer
[i
+ j
] >> 16);
314 GraphBuffer
[i
] = lowTot
- highTot
;
315 if (GraphBuffer
[i
] > maxMark
) maxMark
= GraphBuffer
[i
];
316 if (GraphBuffer
[i
] < minMark
) minMark
= GraphBuffer
[i
];
319 GraphTraceLen
-= (convLen
+ 16);
320 RepaintGraphWindow();
322 // Find bit-sync (3 lo followed by 3 high)
323 int max
= 0, maxPos
= 0;
324 for (i
= 0; i
< 6000; ++i
) {
326 for (j
= 0; j
< 3 * lowLen
; ++j
) {
327 dec
-= GraphBuffer
[i
+ j
];
329 for (; j
< 3 * (lowLen
+ highLen
); ++j
) {
330 dec
+= GraphBuffer
[i
+ j
];
338 // place start of bit sync marker in graph
339 GraphBuffer
[maxPos
] = maxMark
;
340 GraphBuffer
[maxPos
+ 1] = minMark
;
344 // place end of bit sync marker in graph
345 GraphBuffer
[maxPos
] = maxMark
;
346 GraphBuffer
[maxPos
+1] = minMark
;
348 PrintAndLog("actual data bits start at sample %d", maxPos
);
349 PrintAndLog("length %d/%d", highLen
, lowLen
);
352 bits
[sizeof(bits
)-1] = '\0';
354 // find bit pairs and manchester decode them
355 for (i
= 0; i
< arraylen(bits
) - 1; ++i
) {
357 for (j
= 0; j
< lowLen
; ++j
) {
358 dec
-= GraphBuffer
[maxPos
+ j
];
360 for (; j
< lowLen
+ highLen
; ++j
) {
361 dec
+= GraphBuffer
[maxPos
+ j
];
364 // place inter bit marker in graph
365 GraphBuffer
[maxPos
] = maxMark
;
366 GraphBuffer
[maxPos
+ 1] = minMark
;
368 // hi and lo form a 64 bit pair
369 hi
= (hi
<< 1) | (lo
>> 31);
371 // store decoded bit as binary (in hi/lo) and text (in bits[])
379 PrintAndLog("bits: '%s'", bits
);
380 PrintAndLog("hex: %08x %08x", hi
, lo
);
384 int CmdGrid(const char *Cmd
)
386 sscanf(Cmd
, "%i %i", &PlotGridX
, &PlotGridY
);
387 PlotGridXdefault
= PlotGridX
;
388 PlotGridYdefault
= PlotGridY
;
389 RepaintGraphWindow();
393 int CmdHexsamples(const char *Cmd
)
399 char* string_ptr
= string_buf
;
402 sscanf(Cmd
, "%i %i", &requested
, &offset
);
404 /* if no args send something */
405 if (requested
== 0) {
408 if (offset
+ requested
> sizeof(got
)) {
409 PrintAndLog("Tried to read past end of buffer, <bytes> + <offset> > 40000");
413 GetFromBigBuf(got
,requested
,offset
);
414 WaitForResponse(CMD_ACK
,NULL
);
417 for (j
= 0; j
< requested
; j
++) {
419 string_ptr
+= sprintf(string_ptr
, "%02x ", got
[j
]);
421 *(string_ptr
- 1) = '\0'; // remove the trailing space
422 PrintAndLog("%s", string_buf
);
423 string_buf
[0] = '\0';
424 string_ptr
= string_buf
;
427 if (j
== requested
- 1 && string_buf
[0] != '\0') { // print any remaining bytes
428 *(string_ptr
- 1) = '\0';
429 PrintAndLog("%s", string_buf
);
430 string_buf
[0] = '\0';
436 int CmdHide(const char *Cmd
)
442 int CmdHpf(const char *Cmd
)
447 for (i
= 10; i
< GraphTraceLen
; ++i
)
448 accum
+= GraphBuffer
[i
];
449 accum
/= (GraphTraceLen
- 10);
450 for (i
= 0; i
< GraphTraceLen
; ++i
)
451 GraphBuffer
[i
] -= accum
;
453 RepaintGraphWindow();
457 int CmdSamples(const char *Cmd
)
459 uint8_t got
[36440] = {0x00};
461 int n
= strtol(Cmd
, NULL
, 0);
467 PrintAndLog("Reading %d samples from device memory\n", n
);
468 GetFromBigBuf(got
,n
,3560);
469 WaitForResponse(CMD_ACK
,NULL
);
470 for (int j
= 0; j
< n
; ++j
) {
471 GraphBuffer
[j
] = ((int)got
[j
]) - 128;
474 RepaintGraphWindow();
478 int CmdLoad(const char *Cmd
)
480 FILE *f
= fopen(Cmd
, "r");
482 PrintAndLog("couldn't open '%s'", Cmd
);
488 while (fgets(line
, sizeof (line
), f
)) {
489 GraphBuffer
[GraphTraceLen
] = atoi(line
);
493 PrintAndLog("loaded %d samples", GraphTraceLen
);
494 RepaintGraphWindow();
498 int CmdLtrim(const char *Cmd
)
502 for (int i
= ds
; i
< GraphTraceLen
; ++i
)
503 GraphBuffer
[i
-ds
] = GraphBuffer
[i
];
506 RepaintGraphWindow();
511 * Manchester demodulate a bitstream. The bitstream needs to be already in
512 * the GraphBuffer as 0 and 1 values
514 * Give the clock rate as argument in order to help the sync - the algorithm
515 * resyncs at each pulse anyway.
517 * Not optimized by any means, this is the 1st time I'm writing this type of
518 * routine, feel free to improve...
520 * 1st argument: clock rate (as number of samples per clock rate)
521 * Typical values can be 64, 32, 128...
523 int CmdManchesterDemod(const char *Cmd
)
531 int hithigh
, hitlow
, first
;
537 /* check if we're inverting output */
540 PrintAndLog("Inverting output");
545 while(*Cmd
== ' '); // in case a 2nd argument was given
548 /* Holds the decoded bitstream: each clock period contains 2 bits */
549 /* later simplified to 1 bit after manchester decoding. */
550 /* Add 10 bits to allow for noisy / uncertain traces without aborting */
551 /* int BitStream[GraphTraceLen*2/clock+10]; */
553 /* But it does not work if compiling on WIndows: therefore we just allocate a */
555 uint8_t BitStream
[MAX_GRAPH_TRACE_LEN
] = {0x00};
557 /* Detect high and lows */
558 for (i
= 0; i
< GraphTraceLen
; i
++)
560 if (GraphBuffer
[i
] > high
)
561 high
= GraphBuffer
[i
];
562 else if (GraphBuffer
[i
] < low
)
563 low
= GraphBuffer
[i
];
567 clock
= GetClock(Cmd
, high
, 1);
568 int tolerance
= clock
/4;
570 /* Detect first transition */
571 /* Lo-Hi (arbitrary) */
572 /* skip to the first high */
573 for (i
= 0; i
< GraphTraceLen
; i
++)
574 if (GraphBuffer
[i
] == high
)
576 /* now look for the first low */
577 for (; i
< GraphTraceLen
; i
++)
579 if (GraphBuffer
[i
] == low
)
586 /* If we're not working with 1/0s, demod based off clock */
589 PrintAndLog("Entering path A");
590 bit
= 0; /* We assume the 1st bit is zero, it may not be
591 * the case: this routine (I think) has an init problem.
594 for (; i
< (int)(GraphTraceLen
/ clock
); i
++)
600 /* Find out if we hit both high and low peaks */
601 for (j
= 0; j
< clock
; j
++)
603 if (GraphBuffer
[(i
* clock
) + j
] == high
)
605 else if (GraphBuffer
[(i
* clock
) + j
] == low
)
608 /* it doesn't count if it's the first part of our read
609 because it's really just trailing from the last sequence */
610 if (first
&& (hithigh
|| hitlow
))
611 hithigh
= hitlow
= 0;
615 if (hithigh
&& hitlow
)
619 /* If we didn't hit both high and low peaks, we had a bit transition */
620 if (!hithigh
|| !hitlow
)
623 BitStream
[bit2idx
++] = bit
^ invert
;
627 /* standard 1/0 bitstream */
631 /* Then detect duration between 2 successive transitions */
632 for (bitidx
= 1; i
< GraphTraceLen
; i
++)
634 if (GraphBuffer
[i
-1] != GraphBuffer
[i
])
639 // Error check: if bitidx becomes too large, we do not
640 // have a Manchester encoded bitstream or the clock is really
642 if (bitidx
> (GraphTraceLen
*2/clock
+8) ) {
643 PrintAndLog("Error: the clock you gave is probably wrong, aborting.");
646 // Then switch depending on lc length:
647 // Tolerance is 1/4 of clock rate (arbitrary)
648 if (abs(lc
-clock
/2) < tolerance
) {
649 // Short pulse : either "1" or "0"
650 BitStream
[bitidx
++]=GraphBuffer
[i
-1];
651 } else if (abs(lc
-clock
) < tolerance
) {
652 // Long pulse: either "11" or "00"
653 BitStream
[bitidx
++]=GraphBuffer
[i
-1];
654 BitStream
[bitidx
++]=GraphBuffer
[i
-1];
658 PrintAndLog("Warning: Manchester decode error for pulse width detection.");
659 PrintAndLog("(too many of those messages mean either the stream is not Manchester encoded, or clock is wrong)");
663 PrintAndLog("Error: too many detection errors, aborting.");
670 // At this stage, we now have a bitstream of "01" ("1") or "10" ("0"), parse it into final decoded bitstream
671 // Actually, we overwrite BitStream with the new decoded bitstream, we just need to be careful
672 // to stop output at the final bitidx2 value, not bitidx
673 for (i
= 0; i
< bitidx
; i
+= 2) {
674 if ((BitStream
[i
] == 0) && (BitStream
[i
+1] == 1)) {
675 BitStream
[bit2idx
++] = 1 ^ invert
;
676 } else if ((BitStream
[i
] == 1) && (BitStream
[i
+1] == 0)) {
677 BitStream
[bit2idx
++] = 0 ^ invert
;
679 // We cannot end up in this state, this means we are unsynchronized,
683 PrintAndLog("Unsynchronized, resync...");
684 PrintAndLog("(too many of those messages mean the stream is not Manchester encoded)");
688 PrintAndLog("Error: too many decode errors, aborting.");
695 PrintAndLog("Manchester decoded bitstream");
696 // Now output the bitstream to the scrollback by line of 16 bits
697 for (i
= 0; i
< (bit2idx
-16); i
+=16) {
698 PrintAndLog("%i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i",
719 /* Modulate our data into manchester */
720 int CmdManchesterMod(const char *Cmd
)
723 int bit
, lastbit
, wave
;
724 int clock
= GetClock(Cmd
, 0, 1);
725 int clock1
= GetT55x7Clock( GraphBuffer
, GraphTraceLen
, 0 );
726 PrintAndLog("MAN MOD CLOCKS: %d ice %d", clock
,clock1
);
728 int half
= (int)(clock
/2);
732 for (i
= 0; i
< (int)(GraphTraceLen
/ clock
); i
++)
734 bit
= GraphBuffer
[i
* clock
] ^ 1;
736 for (j
= 0; j
< half
; ++j
)
737 GraphBuffer
[(i
* clock
) + j
] = bit
^ lastbit
^ wave
;
738 for (j
= half
; j
< clock
; ++j
)
739 GraphBuffer
[(i
* clock
) + j
] = bit
^ lastbit
^ wave
^ 1;
741 /* Keep track of how we start our wave and if we changed or not this time */
742 wave
^= bit
^ lastbit
;
746 RepaintGraphWindow();
750 int CmdNorm(const char *Cmd
)
753 int max
= INT_MIN
, min
= INT_MAX
;
755 for (i
= 10; i
< GraphTraceLen
; ++i
) {
756 if (GraphBuffer
[i
] > max
)
757 max
= GraphBuffer
[i
];
758 if (GraphBuffer
[i
] < min
)
759 min
= GraphBuffer
[i
];
763 for (i
= 0; i
< GraphTraceLen
; ++i
) {
764 GraphBuffer
[i
] = (GraphBuffer
[i
] - ((max
+ min
) / 2)) * 1000 /
768 RepaintGraphWindow();
772 int CmdPlot(const char *Cmd
)
778 int CmdSave(const char *Cmd
)
780 FILE *f
= fopen(Cmd
, "w");
782 PrintAndLog("couldn't open '%s'", Cmd
);
786 for (i
= 0; i
< GraphTraceLen
; i
++) {
787 fprintf(f
, "%d\n", GraphBuffer
[i
]);
790 PrintAndLog("saved to '%s'", Cmd
);
794 int CmdScale(const char *Cmd
)
796 CursorScaleFactor
= atoi(Cmd
);
797 if (CursorScaleFactor
== 0) {
798 PrintAndLog("bad, can't have zero scale");
799 CursorScaleFactor
= 1;
801 RepaintGraphWindow();
805 int CmdThreshold(const char *Cmd
)
807 int threshold
= atoi(Cmd
);
809 for (int i
= 0; i
< GraphTraceLen
; ++i
) {
810 if (GraphBuffer
[i
] >= threshold
)
815 RepaintGraphWindow();
819 int CmdDirectionalThreshold(const char *Cmd
)
821 int8_t upThres
= param_get8(Cmd
, 0);
822 int8_t downThres
= param_get8(Cmd
, 1);
824 printf("Applying Up Threshold: %d, Down Threshold: %d\n", upThres
, downThres
);
826 int lastValue
= GraphBuffer
[0];
827 GraphBuffer
[0] = 0; // Will be changed at the end, but init 0 as we adjust to last samples value if no threshold kicks in.
829 for (int i
= 1; i
< GraphTraceLen
; ++i
) {
830 // Apply first threshold to samples heading up
831 if (GraphBuffer
[i
] >= upThres
&& GraphBuffer
[i
] > lastValue
)
833 lastValue
= GraphBuffer
[i
]; // Buffer last value as we overwrite it.
836 // Apply second threshold to samples heading down
837 else if (GraphBuffer
[i
] <= downThres
&& GraphBuffer
[i
] < lastValue
)
839 lastValue
= GraphBuffer
[i
]; // Buffer last value as we overwrite it.
844 lastValue
= GraphBuffer
[i
]; // Buffer last value as we overwrite it.
845 GraphBuffer
[i
] = GraphBuffer
[i
-1];
849 GraphBuffer
[0] = GraphBuffer
[1]; // Aline with first edited sample.
850 RepaintGraphWindow();
854 int CmdZerocrossings(const char *Cmd
)
856 // Zero-crossings aren't meaningful unless the signal is zero-mean.
863 for (int i
= 0; i
< GraphTraceLen
; ++i
) {
864 if (GraphBuffer
[i
] * sign
>= 0) {
865 // No change in sign, reproduce the previous sample count.
867 GraphBuffer
[i
] = lastZc
;
869 // Change in sign, reset the sample count.
871 GraphBuffer
[i
] = lastZc
;
879 RepaintGraphWindow();
883 static command_t CommandTable
[] =
885 {"help", CmdHelp
, 1, "This help"},
886 {"amp", CmdAmp
, 1, "Amplify peaks"},
887 {"askdemod", Cmdaskdemod
, 1, "<0 or 1> -- Attempt to demodulate simple ASK tags"},
888 {"autocorr", CmdAutoCorr
, 1, "<window length> -- Autocorrelation over window"},
889 {"bitsamples", CmdBitsamples
, 0, "Get raw samples as bitstring"},
890 {"bitstream", CmdBitstream
, 1, "[clock rate] -- Convert waveform into a bitstream"},
891 {"buffclear", CmdBuffClear
, 1, "Clear sample buffer and graph window"},
892 {"dec", CmdDec
, 1, "Decimate samples"},
893 {"detectclock", CmdDetectClockRate
, 1, "Detect clock rate"},
894 {"fskdemod", CmdFSKdemod
, 1, "Demodulate graph window as a HID FSK"},
895 {"grid", CmdGrid
, 1, "<x> <y> -- overlay grid on graph window, use zero value to turn off either"},
896 {"hexsamples", CmdHexsamples
, 0, "<bytes> [<offset>] -- Dump big buffer as hex bytes"},
897 {"hide", CmdHide
, 1, "Hide graph window"},
898 {"hpf", CmdHpf
, 1, "Remove DC offset from trace"},
899 {"load", CmdLoad
, 1, "<filename> -- Load trace (to graph window"},
900 {"ltrim", CmdLtrim
, 1, "<samples> -- Trim samples from left of trace"},
901 {"mandemod", CmdManchesterDemod
, 1, "[i] [clock rate] -- Manchester demodulate binary stream (option 'i' to invert output)"},
902 {"manmod", CmdManchesterMod
, 1, "[clock rate] -- Manchester modulate a binary stream"},
903 {"norm", CmdNorm
, 1, "Normalize max/min to +/-500"},
904 {"plot", CmdPlot
, 1, "Show graph window (hit 'h' in window for keystroke help)"},
905 {"samples", CmdSamples
, 0, "[512 - 40000] -- Get raw samples for graph window"},
906 {"save", CmdSave
, 1, "<filename> -- Save trace (from graph window)"},
907 {"scale", CmdScale
, 1, "<int> -- Set cursor display scale"},
908 {"threshold", CmdThreshold
, 1, "<threshold> -- Maximize/minimize every value in the graph window depending on threshold"},
909 {"zerocrossings", CmdZerocrossings
, 1, "Count time between zero-crossings"},
910 {"dirthreshold", CmdDirectionalThreshold
, 1, "<thres up> <thres down> -- Max rising higher up-thres/ Min falling lower down-thres, keep rest as prev."},
911 {NULL
, NULL
, 0, NULL
}
914 int CmdData(const char *Cmd
)
916 CmdsParse(CommandTable
, Cmd
);
920 int CmdHelp(const char *Cmd
)
922 CmdsHelp(CommandTable
);