mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-24 15:05:29 -07:00
CHG: syntax suger
This commit is contained in:
parent
dd79e03a1a
commit
5cc88edfaf
3 changed files with 51 additions and 56 deletions
|
@ -94,7 +94,6 @@ static uint64_t cipher_state;
|
||||||
#define rotl64(x, n) ((((u64)(x))<<((n)&63))+(((u64)(x))>>((0-(n))&63)))
|
#define rotl64(x, n) ((((u64)(x))<<((n)&63))+(((u64)(x))>>((0-(n))&63)))
|
||||||
|
|
||||||
// Single bit Hitag2 functions:
|
// Single bit Hitag2 functions:
|
||||||
|
|
||||||
#define i4(x,a,b,c,d) ((u32)((((x)>>(a))&1)+(((x)>>(b))&1)*2+(((x)>>(c))&1)*4+(((x)>>(d))&1)*8))
|
#define i4(x,a,b,c,d) ((u32)((((x)>>(a))&1)+(((x)>>(b))&1)*2+(((x)>>(c))&1)*4+(((x)>>(d))&1)*8))
|
||||||
|
|
||||||
static const u32 ht2_f4a = 0x2C79; // 0010 1100 0111 1001
|
static const u32 ht2_f4a = 0x2C79; // 0010 1100 0111 1001
|
||||||
|
|
|
@ -427,9 +427,10 @@ static RAMFUNC int ManchesterDecoding(int v)
|
||||||
error = 0x88;
|
error = 0x88;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: use this error value to print? Ask Holiman.
|
||||||
|
// 2016-01-08 iceman
|
||||||
}
|
}
|
||||||
error = 0;
|
error = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -511,16 +511,15 @@ int CmdIndalaClone(const char *Cmd)
|
||||||
|
|
||||||
int CmdLFSetConfig(const char *Cmd)
|
int CmdLFSetConfig(const char *Cmd)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint8_t divisor = 0;//Frequency divisor
|
uint8_t divisor = 0;//Frequency divisor
|
||||||
uint8_t bps = 0; // Bits per sample
|
uint8_t bps = 0; // Bits per sample
|
||||||
uint8_t decimation = 0; //How many to keep
|
uint8_t decimation = 0; //How many to keep
|
||||||
bool averaging = 1; // Defaults to true
|
bool averaging = 1; // Defaults to true
|
||||||
bool errors = FALSE;
|
bool errors = FALSE;
|
||||||
int trigger_threshold =-1;//Means no change
|
int trigger_threshold = -1;//Means no change
|
||||||
uint8_t unsigned_trigg = 0;
|
uint8_t unsigned_trigg = 0;
|
||||||
|
|
||||||
uint8_t cmdp =0;
|
uint8_t cmdp = 0;
|
||||||
while(param_getchar(Cmd, cmdp) != 0x00)
|
while(param_getchar(Cmd, cmdp) != 0x00)
|
||||||
{
|
{
|
||||||
switch(param_getchar(Cmd, cmdp))
|
switch(param_getchar(Cmd, cmdp))
|
||||||
|
@ -563,22 +562,18 @@ int CmdLFSetConfig(const char *Cmd)
|
||||||
}
|
}
|
||||||
if(errors) break;
|
if(errors) break;
|
||||||
}
|
}
|
||||||
if(cmdp == 0)
|
|
||||||
{
|
// No args
|
||||||
errors = 1;// No args
|
if (cmdp == 0) errors = 1;
|
||||||
}
|
|
||||||
|
|
||||||
//Validations
|
//Validations
|
||||||
if(errors)
|
if (errors) return usage_lf_config();
|
||||||
{
|
|
||||||
return usage_lf_config();
|
//Bps is limited to 8, so fits in lower half of arg1
|
||||||
}
|
if (bps >> 4) bps = 8;
|
||||||
//Bps is limited to 8, so fits in lower half of arg1
|
|
||||||
if(bps >> 8) bps = 8;
|
sample_config config = { decimation, bps, averaging, divisor, trigger_threshold };
|
||||||
|
|
||||||
sample_config config = {
|
|
||||||
decimation,bps,averaging,divisor,trigger_threshold
|
|
||||||
};
|
|
||||||
//Averaging is a flag on high-bit of arg[1]
|
//Averaging is a flag on high-bit of arg[1]
|
||||||
UsbCommand c = {CMD_SET_LF_SAMPLING_CONFIG};
|
UsbCommand c = {CMD_SET_LF_SAMPLING_CONFIG};
|
||||||
memcpy(c.d.asBytes,&config,sizeof(sample_config));
|
memcpy(c.d.asBytes,&config,sizeof(sample_config));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue