chg 'lf cmdread' - clientside checks, less wait times on device

This commit is contained in:
iceman1001 2019-09-30 23:18:48 +02:00
parent d40341d962
commit f142ad139b
2 changed files with 17 additions and 5 deletions

View file

@ -372,16 +372,19 @@ void loadT55xxConfig(void) {
*/
void ModThenAcquireRawAdcSamples125k(uint32_t delay_off, uint32_t period_0, uint32_t period_1, uint8_t *command) {
// start timer
StartTicks();
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
// use lf config settings
sample_config *sc = getSamplingConfig();
// Make sure the tag is reset
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
WaitMS(500);
// start timer
StartTicks();
WaitMS(100);
// clear read buffer
BigBuf_Clear_keep_EM();
@ -389,7 +392,7 @@ void ModThenAcquireRawAdcSamples125k(uint32_t delay_off, uint32_t period_0, uint
LFSetupFPGAForADC(sc->divisor, true);
// little more time for the tag to fully power up
WaitMS(200);
WaitMS(20);
// if delay_off = 0 then just bitbang 1 = antenna on 0 = off for respective periods.
bool bitbang = (delay_off == 0);
@ -463,6 +466,7 @@ void ModThenAcquireRawAdcSamples125k(uint32_t delay_off, uint32_t period_0, uint
// Turn off antenna
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
// tell client we are done
reply_ng(CMD_LF_MOD_THEN_ACQ_RAW_ADC, PM3_SUCCESS, NULL, 0);
}

View file

@ -289,6 +289,14 @@ int CmdLFCommandRead(const char *Cmd) {
}
}
// bitbang mode
if (payload.delay == 0){
if (payload.zeros < 7 || payload.ones < 7) {
PrintAndLogEx(WARNING, "Warning periods cannot be less than 7us in bit bang mode");
return PM3_EINVARG;
}
}
//Validations
if (errors || cmdp == 0) return usage_lf_cmdread();