From 21c34937937f27a89290f4377b4ff1801079e6ec Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Tue, 6 Oct 2015 20:53:28 +0100 Subject: Added new interface files --- Makefile | 2 ++ draw/tui.c | 4 +++- filt/f_5th.c | 32 ++++++++++++++++++++++++++++++++ filt/filt.h | 11 +++++++++++ filt/make.mk | 10 ++++++++++ mod/make.mk | 10 ++++++++++ mod/mod.h | 11 +++++++++++ mod/mod_fm.c | 12 ++++++++++++ test/ui_tui_waterfall.c | 2 +- 9 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 filt/f_5th.c create mode 100644 filt/filt.h create mode 100644 filt/make.mk create mode 100644 mod/make.mk create mode 100644 mod/mod.h create mode 100644 mod/mod_fm.c diff --git a/Makefile b/Makefile index 2955502..788987c 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,9 @@ OBJECTS= OBJECTS_FINAL= include draw/make.mk +include filt/make.mk include hw/make.mk +include mod/make.mk make: $(OBJECTS) $(CC) $(OBJECTS_FINAL) $(PROJECT).c -o $(PROJECT) $(LDFLAGS) diff --git a/draw/tui.c b/draw/tui.c index ba6ed1e..c431a61 100644 --- a/draw/tui.c +++ b/draw/tui.c @@ -190,6 +190,7 @@ uint8_t tui_waterfall_color( uint8_t d ) uint8_t color=15; + /* if ( d < 50 ) { @@ -210,6 +211,7 @@ uint8_t tui_waterfall_color( uint8_t d ) */ + if ( d == 0 ) { color = 17; @@ -236,7 +238,7 @@ uint8_t tui_waterfall_color( uint8_t d ) color = 44; } else { - color = 230; + color = 45; } /* diff --git a/filt/f_5th.c b/filt/f_5th.c new file mode 100644 index 0000000..811fb18 --- /dev/null +++ b/filt/f_5th.c @@ -0,0 +1,32 @@ +#include "filt.h" + +void f_5th(int16_t *data, int length, int16_t *hist) +/* for half of interleaved data */ +{ + int i; + int16_t a, b, c, d, e, f; + a = hist[1]; + b = hist[2]; + c = hist[3]; + d = hist[4]; + e = hist[5]; + f = data[0]; + /* a downsample should improve resolution, so don't fully shift */ + data[0] = (a + (b+e)*5 + (c+d)*10 + f) >> 4; + for (i=4; i> 4; + } + /* archive */ + hist[0] = a; + hist[1] = b; + hist[2] = c; + hist[3] = d; + hist[4] = e; + hist[5] = f; +} \ No newline at end of file diff --git a/filt/filt.h b/filt/filt.h new file mode 100644 index 0000000..d235449 --- /dev/null +++ b/filt/filt.h @@ -0,0 +1,11 @@ +#ifndef __RADIOLA_FILT_H +#define __RADIOLA_FILT_H + +#include +#include +#include + +//fifth order filter from rtlsdr +void f_5th(int16_t *data, int length, int16_t *hist); + +#endif \ No newline at end of file diff --git a/filt/make.mk b/filt/make.mk new file mode 100644 index 0000000..e65653c --- /dev/null +++ b/filt/make.mk @@ -0,0 +1,10 @@ +DIR_FILT = filt/ +SOURCES_FILT += filt/f_5th.c +OBJECTS_FILT += $(SOURCES_FILT:.c=.o) +LDFLAGS += + + +OBJECTS_DIR_FILT += $(subst $(DIR_FILT),$(BUILD_DIR)$(DIR_FILT),$(OBJECTS_FILT)) + +OBJECTS += $(OBJECTS_FILT) +OBJECTS_FINAL += $(OBJECTS_DIR_FILT) \ No newline at end of file diff --git a/mod/make.mk b/mod/make.mk new file mode 100644 index 0000000..6093819 --- /dev/null +++ b/mod/make.mk @@ -0,0 +1,10 @@ +DIR_MOD = mod/ +SOURCES_MOD += mod/mod_fm.c +OBJECTS_MOD += $(SOURCES_MOD:.c=.o) +LDFLAGS += + + +OBJECTS_DIR_MOD += $(subst $(DIR_MOD),$(BUILD_DIR)$(DIR_MOD),$(OBJECTS_MOD)) + +OBJECTS += $(OBJECTS_MOD) +OBJECTS_FINAL += $(OBJECTS_DIR_MOD) \ No newline at end of file diff --git a/mod/mod.h b/mod/mod.h new file mode 100644 index 0000000..288d40b --- /dev/null +++ b/mod/mod.h @@ -0,0 +1,11 @@ +#ifndef __RADIOLA_MOD_H +#define __RADIOLA_MOD_H + +#include +#include +#include + +void fm_demod(); +void fm_mod(); + +#endif \ No newline at end of file diff --git a/mod/mod_fm.c b/mod/mod_fm.c new file mode 100644 index 0000000..22b296b --- /dev/null +++ b/mod/mod_fm.c @@ -0,0 +1,12 @@ +#include "mod.h" + + +void fm_demod() +{ + +} + +void fm_mod() +{ + +} diff --git a/test/ui_tui_waterfall.c b/test/ui_tui_waterfall.c index bc4f297..46445b0 100644 --- a/test/ui_tui_waterfall.c +++ b/test/ui_tui_waterfall.c @@ -9,7 +9,7 @@ #define SAMPLE_RATE 2048000 -#define CENTER_FREQ 446500000 +#define CENTER_FREQ 445500000 #define FFT_LEVEL 10 #define FFT_SIZE (1 << FFT_LEVEL) #define SAMPLE_LENGHT (2 * FFT_SIZE) -- cgit v1.2.3