CHG: syntax suger

This commit is contained in:
iceman1001 2016-01-09 17:19:09 +01:00
commit 5cc88edfaf
3 changed files with 51 additions and 56 deletions

View file

@ -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

View file

@ -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 {

View file

@ -511,7 +511,6 @@ 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
@ -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));