fill samples - get samples

This commit is contained in:
merlokk 2022-06-25 15:42:11 +03:00
commit f007db6661
2 changed files with 11 additions and 2 deletions

View file

@ -26,6 +26,7 @@
#include "dbprint.h" #include "dbprint.h"
#include "util.h" #include "util.h"
#include "commonutil.h" #include "commonutil.h"
#include "lfsampling.h"
int HfReadADC(uint32_t samplesCount, bool ledcontrol) { int HfReadADC(uint32_t samplesCount, bool ledcontrol) {
@ -58,6 +59,9 @@ int HfReadADC(uint32_t samplesCount, bool ledcontrol) {
//uint32_t dma_start_time = 0; //uint32_t dma_start_time = 0;
uint16_t *upTo = dma->buf; uint16_t *upTo = dma->buf;
uint32_t sbs = samplesCount;
initSampleBuffer(&sbs);
for (;;) { for (;;) {
if (BUTTON_PRESS()) { if (BUTTON_PRESS()) {
break; break;
@ -95,8 +99,10 @@ int HfReadADC(uint32_t samplesCount, bool ledcontrol) {
} }
logSample(50, 1, 8, false);
if (getSampleCounter() >= samplesCount)
break;
} }
FpgaDisableSscDma(); FpgaDisableSscDma();
@ -109,7 +115,7 @@ int HfReadADC(uint32_t samplesCount, bool ledcontrol) {
reply_ng(CMD_HF_ACQ_RAW_ADC, PM3_SUCCESS, NULL, 0); reply_ng(CMD_HF_ACQ_RAW_ADC, PM3_SUCCESS, NULL, 0);
if (ledcontrol) LEDsoff(); if (ledcontrol) LEDsoff();
DbpString("HfReadADC " _GREEN_("success")); Dbprintf("-- samples: %d", getSampleCounter());
return 0; return 0;
} }

View file

@ -26,6 +26,7 @@
#include "comms.h" #include "comms.h"
#include "ui.h" #include "ui.h"
#include "cmdhf14a.h" #include "cmdhf14a.h"
#include "cmddata.h"
static int CmdHFTexkomReader(const char *Cmd) { static int CmdHFTexkomReader(const char *Cmd) {
CLIParserContext *ctx; CLIParserContext *ctx;
@ -50,6 +51,8 @@ static int CmdHFTexkomReader(const char *Cmd) {
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
} }
getSamples(samplesCount, true);
return PM3_SUCCESS; return PM3_SUCCESS;
} }