mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-13 18:57:12 +08:00
..and the AskEdgeDetect
This commit is contained in:
parent
86237b629f
commit
bee9e986f1
2 changed files with 17 additions and 10 deletions
|
@ -1020,6 +1020,18 @@ int CmdGraphShiftZero(const char *Cmd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AskEdgeDetect(const int *in, int *out, int len, int threshold) {
|
||||||
|
int last = 0;
|
||||||
|
for(int i = 1; i<len; i++) {
|
||||||
|
if (in[i]-in[i-1] >= threshold) //large jump up
|
||||||
|
last = 127;
|
||||||
|
else if(in[i]-in[i-1] <= -1 * threshold) //large jump down
|
||||||
|
last = -127;
|
||||||
|
out[i-1] = last;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//by marshmellow
|
//by marshmellow
|
||||||
//use large jumps in read samples to identify edges of waves and then amplify that wave to max
|
//use large jumps in read samples to identify edges of waves and then amplify that wave to max
|
||||||
//similar to dirtheshold, threshold commands
|
//similar to dirtheshold, threshold commands
|
||||||
|
@ -1027,19 +1039,12 @@ int CmdGraphShiftZero(const char *Cmd)
|
||||||
int CmdAskEdgeDetect(const char *Cmd)
|
int CmdAskEdgeDetect(const char *Cmd)
|
||||||
{
|
{
|
||||||
int thresLen = 25;
|
int thresLen = 25;
|
||||||
int last = 0;
|
int ans = 0;
|
||||||
sscanf(Cmd, "%i", &thresLen);
|
sscanf(Cmd, "%i", &thresLen);
|
||||||
|
|
||||||
for(int i = 1; i < GraphTraceLen; ++i){
|
ans = AskEdgeDetect(GraphBuffer, GraphBuffer, GraphTraceLen, thresLen);
|
||||||
if (GraphBuffer[i] - GraphBuffer[i-1] >= thresLen) //large jump up
|
|
||||||
last = 127;
|
|
||||||
else if(GraphBuffer[i] - GraphBuffer[i-1] <= -1 * thresLen) //large jump down
|
|
||||||
last = -127;
|
|
||||||
|
|
||||||
GraphBuffer[i-1] = last;
|
|
||||||
}
|
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
return 0;
|
return ans;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print our clock rate */
|
/* Print our clock rate */
|
||||||
|
|
|
@ -78,6 +78,8 @@ int getSamples(const char *Cmd, bool silent);
|
||||||
|
|
||||||
void setGrid_Clock(uint8_t clock);
|
void setGrid_Clock(uint8_t clock);
|
||||||
int directionalThreshold(const int* in, int *out, size_t len, int8_t up, int8_t down);
|
int directionalThreshold(const int* in, int *out, size_t len, int8_t up, int8_t down);
|
||||||
|
extern int AskEdgeDetect(const int *in, int *out, int len, int threshold);
|
||||||
|
|
||||||
int CmdDataIIR(const char *Cmd);
|
int CmdDataIIR(const char *Cmd);
|
||||||
|
|
||||||
#define MAX_DEMOD_BUF_LEN (1024*128)
|
#define MAX_DEMOD_BUF_LEN (1024*128)
|
||||||
|
|
Loading…
Reference in a new issue