- n = 12;
- requested = 12;
- } else {
- n = requested/4;
- }
-
- for (int i = offset; i < n+offset; i += 12) {
- UsbCommand c = {CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K, {i, 0, 0}};
- SendCommand(&c);
- WaitForResponse(CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K);
- for (int j = 0; j < 48; j += 8) {
- PrintAndLog("%02x %02x %02x %02x %02x %02x %02x %02x",
- sample_buf[j+0],
- sample_buf[j+1],
- sample_buf[j+2],
- sample_buf[j+3],
- sample_buf[j+4],
- sample_buf[j+5],
- sample_buf[j+6],
- sample_buf[j+7],
- sample_buf[j+8]
- );
- delivered += 8;
- if (delivered >= requested)
- break;
+ requested = 8;
+ }
+ if (offset + requested > sizeof(got)) {
+ PrintAndLog("Tried to read past end of buffer, <bytes> + <offset> > 40000");
+ return 0;
+ }
+
+ GetFromBigBuf(got,requested,offset);
+ WaitForResponse(CMD_ACK,NULL);
+
+ i = 0;
+ for (j = 0; j < requested; j++) {
+ i++;
+ string_ptr += sprintf(string_ptr, "%02x ", got[j]);
+ if (i == 8) {
+ *(string_ptr - 1) = '\0'; // remove the trailing space
+ PrintAndLog("%s", string_buf);
+ string_buf[0] = '\0';
+ string_ptr = string_buf;
+ i = 0;