From 6b85a7d453414d31432e63045581b2602d4abf45 Mon Sep 17 00:00:00 2001 From: FreeArtMan <=> Date: Tue, 22 Sep 2015 21:37:16 +0100 Subject: Added tui interface, updated gitignores, updated makefiles --- .gitignore | 4 ++- Makefile | 6 +++-- draw/make.mk | 10 ++++++++ draw/tui.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ draw/tui.h | 40 ++++++++++++++++++++++++++++++ test/.gitignore | 3 ++- test/Makefile | 5 ++-- test/get_device_list.c | 2 +- test/read_samples.c | 2 +- test/ui_tui_waterfall.c | 11 +++++++++ 10 files changed, 139 insertions(+), 9 deletions(-) create mode 100644 test/ui_tui_waterfall.c diff --git a/.gitignore b/.gitignore index d8ab784..ebcd634 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -radiola \ No newline at end of file +radiola +radiola.o +build/ diff --git a/Makefile b/Makefile index 0a6c6e0..4faf17e 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ PROJECT=radiola CC=gcc CFLAGS= LDFLAGS= +CLEAN= BUILD_DIR=build/ @@ -9,15 +10,16 @@ SOURCES= OBJECTS= OBJECTS_FINAL= - - +include draw/make.mk include hw/make.mk make: $(OBJECTS) $(CC) $(OBJECTS_FINAL) $(PROJECT).c -o $(PROJECT) $(LDFLAGS) + ld -r $(OBJECTS_FINAL) -o $(PROJECT).o %.o: %.c $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $(BUILD_DIR)$@ clean: rm -f $(PROJECT) + rm -f $(OBJECTS_FINAL) diff --git a/draw/make.mk b/draw/make.mk index e69de29..1ce35d1 100644 --- a/draw/make.mk +++ b/draw/make.mk @@ -0,0 +1,10 @@ +DIR_DRAW = draw/ +SOURCES_DRAW += draw/glui.c draw/tui.c draw/ui.c +OBJECTS_DRAW += $(SOURCES_DRAW:.c=.o) +LDFLAGS += + + +OBJECTS_DIR_DRAW += $(subst $(DIR_DRAW),$(BUILD_DIR)$(DIR_DRAW),$(OBJECTS_DRAW)) + +OBJECTS += $(OBJECTS_DRAW) +OBJECTS_FINAL += $(OBJECTS_DIR_DRAW) \ No newline at end of file diff --git a/draw/tui.c b/draw/tui.c index e69de29..5f9b9c7 100644 --- a/draw/tui.c +++ b/draw/tui.c @@ -0,0 +1,65 @@ +#include "tui.h" + +//prepare terminal ui +int tui_init( tui_t *t ) +{ + int ret = -1; + //should be empty pointer + if (t != NULL) + return -1; + return ret; +} + + +//init waterfall +int tui_waterfall( tui_t *t, tui_waterfall_t *w ) +{ + int ret=-1; + //waterfall should be NULL + if ( w != NULL ) + return -1; + return ret; +} + + +//first draw, draw all buffer +int tui_waterfall_draw( tui_waterfall_t *w ) +{ + int ret = -1; + return ret; +} + + +//redraw only changed lines +int tui_waterfall_redraw( tui_waterfall_t *w ) +{ + int ret = -1; + return ret; +} + + +//update params of waterfall and then need to draw not redraw +int tui_waterfall_update( tui_waterfall_t *w ) +{ + int ret = -1; + return ret; +} + + +//push one line of data to buffer +int tui_waterfall_data( tui_waterfall_t *w, size_t *len, size_t *buf ) +{ + int ret = -1; + return ret; +} + + +//close terminal ui +int tui_close( tui_t *t ) +{ + int ret = -1; + //shouldnt be empty pointer + if ( t == NULL ) + return -1; + return ret; +} diff --git a/draw/tui.h b/draw/tui.h index e69de29..6357a59 100644 --- a/draw/tui.h +++ b/draw/tui.h @@ -0,0 +1,40 @@ +#ifndef __RADIOLA_TUI_H +#define __RADIOLA_TUI_H + +#include +#include +#include +#include + +//to draw waterfall +typedef struct tui_waterfall_t +{ + int type; + int h,w; + +} tui_waterfall_t; + +typedef struct tui_t +{ + int ifd, ofd; + struct termios orig_i, orig_o; + struct termios raw_i, raw_o; + tui_waterfall_t *wf; +} tui_t; + +//prepare terminal ui +int tui_init( tui_t *t ); +//init waterfall +int tui_waterfall( tui_t *t, tui_waterfall_t *w ); +//first draw, draw all buffer +int tui_waterfall_draw( tui_waterfall_t *w ); +//redraw only changed lines +int tui_waterfall_redraw( tui_waterfall_t *w ); +//update params of waterfall and then need to draw not redraw +int tui_waterfall_update( tui_waterfall_t *w ); +//push one line of data to buffer +int tui_waterfall_data( tui_waterfall_t *w, size_t *len, size_t *buf ); +//close terminal ui +int tui_close( tui_t *t ); + +#endif \ No newline at end of file diff --git a/test/.gitignore b/test/.gitignore index 3fc1845..bc5e3c4 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,3 +1,4 @@ get_device_list read_samples -*.o \ No newline at end of file +ui_tui_waterfall +*.o diff --git a/test/Makefile b/test/Makefile index 5ee5a91..7fb106d 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,7 +1,7 @@ CC=gcc -CFLAGS= +CFLAGS=-I../ #LDFLAGS= `pkg-config --libs libusb` -L../../../r820t -lr820t -Wl,-rpath=../../../r820t -LDFLAGS=`pkg-config --libs libusb` -lrtlsdr +LDFLAGS=`pkg-config --libs libusb` -lrtlsdr ../radiola.o SOURCE = $(wildcard *.c) OBJECTS = BIN = $(SOURCE:.c=) @@ -15,6 +15,5 @@ BIN = $(SOURCE:.c=) make: $(BIN) - clean: rm -f $(BIN) \ No newline at end of file diff --git a/test/get_device_list.c b/test/get_device_list.c index f65c551..867929a 100644 --- a/test/get_device_list.c +++ b/test/get_device_list.c @@ -3,7 +3,7 @@ #include //rtlsdr -#include +#include int main( ) { diff --git a/test/read_samples.c b/test/read_samples.c index 4ecf7be..2234cb8 100644 --- a/test/read_samples.c +++ b/test/read_samples.c @@ -2,7 +2,7 @@ #include //r820t -#include +#include void read_samples( uint32_t dev_index ) { diff --git a/test/ui_tui_waterfall.c b/test/ui_tui_waterfall.c new file mode 100644 index 0000000..a0a83bc --- /dev/null +++ b/test/ui_tui_waterfall.c @@ -0,0 +1,11 @@ +#include +#include + +//radiola +#include + +int main() +{ + + return 0; +} \ No newline at end of file -- cgit v1.2.3