From e42911405c4bc2f8c097f47d4598baf8522ef3da Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Sun, 8 May 2016 16:02:01 +0100 Subject: Moved source to src directory --- src/core/Kconfig | 28 ++++++++++++++++++++++++++++ src/core/make.mk | 11 +++++++++++ src/core/math.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/core/math.h | 16 ++++++++++++++++ 4 files changed, 103 insertions(+) create mode 100644 src/core/Kconfig create mode 100644 src/core/make.mk create mode 100644 src/core/math.c create mode 100644 src/core/math.h (limited to 'src/core') diff --git a/src/core/Kconfig b/src/core/Kconfig new file mode 100644 index 0000000..28befc6 --- /dev/null +++ b/src/core/Kconfig @@ -0,0 +1,28 @@ +menuconfig CORE + bool "Set core features" + default y + +if CORE + choice + prompt "OS support" + help + OS support configuration. Not all OS'es support all stuff + + config OS_LINUX + bool "Linux" + default y + + config OS_NETBSD + bool "NetBSD" + default n + + endchoice + + config FUTURE + bool "Future features that planned to be added" + default n + +endif + + + diff --git a/src/core/make.mk b/src/core/make.mk new file mode 100644 index 0000000..52f08ec --- /dev/null +++ b/src/core/make.mk @@ -0,0 +1,11 @@ +DIR_CORE = core/ +SOURCES_CORE += $(SRC_DIR)core/math.c +OBJECTS_CORE += $(SOURCES_CORE:.c=.o) +LDFLAGS += -lm +LDFLAGS_BSD += -lm + + +OBJECTS_DIR_CORE += $(subst $(SRC_DIR)$(DIR_CORE),$(BUILD_DIR)$(SRC_DIR)$(DIR_CORE),$(OBJECTS_CORE)) + +OBJECTS += $(OBJECTS_CORE) +OBJECTS_FINAL += $(OBJECTS_DIR_CORE) \ No newline at end of file diff --git a/src/core/math.c b/src/core/math.c new file mode 100644 index 0000000..f962534 --- /dev/null +++ b/src/core/math.c @@ -0,0 +1,48 @@ +#include "math.h" + + +float to_float(uint8_t x) +{ + return (1.0f/127.0f)*(((float)x)-127.0f); +} + + +//float ph_ch( uint8_t i1, uint8_t q1, uint8_t i2, uint8_t q2) +float ph_ch( uint8_t i1, uint8_t q1 ) +{ + static float complex last=0.0+0.0i; + float out; + float complex xy,c1; + //float c2; + + c1 = to_float(i1) + I*to_float(q1); + //c1 = CMPLXF( to_float(i1), to_float(q1) ); + //c2 = to_float(i2) + I*to_float(q2); + //c2 = CMPLXF( to_float(i2), to_float(q2) ); + xy = conjf(last)*c1; + out = cargf( xy ); + last = c1; + + return out; +} + +void rotate_90(uint8_t *buf, uint32_t len) +/* 90 rotation is 1+0j, 0+1j, -1+0j, 0-1j + or [0, 1, -3, 2, -4, -5, 7, -6] */ +{ + uint32_t i; + uint8_t tmp; + for (i=0; i +#include +#include +#include +#include + +float to_float(uint8_t x); + +float ph_ch( uint8_t i1, uint8_t q1 ); + +void rotate_90(uint8_t *buf, uint32_t len); + +#endif \ No newline at end of file -- cgit v1.2.3