X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/ed77aabe00d1453217b16f2d3cc4711d0981fb93..b01e7d206dcb98f1549df1ace52bfc8ce2719b1e:/client/ui.c diff --git a/client/ui.c b/client/ui.c index c0d01bc3..9c24f17d 100644 --- a/client/ui.c +++ b/client/ui.c @@ -9,19 +9,11 @@ // UI utilities //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include - #include "ui.h" - double CursorScaleFactor; int PlotGridX, PlotGridY, PlotGridXdefault= 64, PlotGridYdefault= 64; int offline; -int flushAfterWrite = 0; //buzzy +int flushAfterWrite = 0; extern pthread_mutex_t print_lock; static char *logfilename = "proxmark3.log"; @@ -32,13 +24,13 @@ void PrintAndLog(char *fmt, ...) int saved_point; va_list argptr, argptr2; static FILE *logfile = NULL; - static int logging=1; + static int logging = 1; // lock this section to avoid interlacing prints from different threats pthread_mutex_lock(&print_lock); if (logging && !logfile) { - logfile=fopen(logfilename, "a"); + logfile = fopen(logfilename, "a"); if (!logfile) { fprintf(stderr, "Can't open logfile, logging disabled!\n"); logging=0; @@ -77,16 +69,70 @@ void PrintAndLog(char *fmt, ...) } va_end(argptr2); - if (flushAfterWrite == 1) //buzzy - { + if (flushAfterWrite == 1) { fflush(NULL); } //release lock pthread_mutex_unlock(&print_lock); } +void SetLogFilename(char *fn) { + logfilename = fn; +} + +void iceIIR_Butterworth(int *data, const size_t len){ + + int i,j; + + int * output = (int* ) malloc(sizeof(int) * len); + memset(output, 0x00, len); + float fc = 0.1125f; // center frequency + size_t adjustedLen = len; + + // create very simple low-pass filter to remove images (2nd-order Butterworth) + float complex iir_buf[3] = {0,0,0}; + float b[3] = {0.003621681514929, 0.007243363029857, 0.003621681514929}; + float a[3] = {1.000000000000000, -1.822694925196308, 0.837181651256023}; + + float sample = 0; // input sample read from array + float complex x_prime = 1.0f; // save sample for estimating frequency + float complex x; + + for (i=0; i 0)? 10 : -10; + } + + // show data + for (j=0; j