From 14c3d41ac29b5e0c0afa4fbbd59c26e7cab3d739 Mon Sep 17 00:00:00 2001 From: Th3maz1ng Date: Tue, 16 Aug 2022 18:06:29 +0200 Subject: [PATCH] Reworked file tree + added new header and source file for the NRF driver that i'll eventually write one day when I get to it ^^ --- Makefile | 6 ++++-- app/common.h | 1 - app/main.c | 4 ++-- app/nano_shell_command.c | 4 ++-- app/nano_shell_port.c | 2 -- app/nano_shell_server_task.c | 4 ++-- app/third_party/driver/NRF24L01P/Makefile | 14 ++++++++++++++ app/third_party/driver/NRF24L01P/NRF24L01P.c | 6 ++++++ app/third_party/driver/NRF24L01P/NRF24L01P.h | 4 ++++ app_include/app_common.h | 6 ++++++ app_include/nano_shell_interface.h | 6 ++++++ tools/w800/inc.mk | 2 ++ 12 files changed, 48 insertions(+), 11 deletions(-) delete mode 100644 app/common.h create mode 100644 app/third_party/driver/NRF24L01P/Makefile create mode 100644 app/third_party/driver/NRF24L01P/NRF24L01P.c create mode 100644 app/third_party/driver/NRF24L01P/NRF24L01P.h create mode 100644 app_include/app_common.h create mode 100644 app_include/nano_shell_interface.h diff --git a/Makefile b/Makefile index 4fea2e7..ac37f7f 100755 --- a/Makefile +++ b/Makefile @@ -6,7 +6,8 @@ GEN_IMAGES= $(TARGET).elf GEN_BINS = $(TARGET).bin SUBDIRS = \ $(TOP_DIR)/app \ - $(TOP_DIR)/app/third_party/nano-shell-master + $(TOP_DIR)/app/third_party/nano-shell-master \ + $(TOP_DIR)/app/third_party/driver/NRF24L01P endif # } PDIR ifndef PDIR # { @@ -31,7 +32,8 @@ endif COMPONENTS_$(TARGET) = \ $(TOP_DIR)/app/libuser$(LIB_EXT) \ - $(TOP_DIR)/app/third_party/nano-shell-master/libnanoshell$(LIB_EXT) + $(TOP_DIR)/app/third_party/nano-shell-master/libnanoshell$(LIB_EXT) \ + $(TOP_DIR)/app/third_party/driver/libnrf24l01p$(LIB_EXT) ifeq ($(USE_LIB), 0) COMPONENTS_$(TARGET) += \ diff --git a/app/common.h b/app/common.h deleted file mode 100644 index a87f316..0000000 --- a/app/common.h +++ /dev/null @@ -1 +0,0 @@ -#define NEW_LINE "\r\n" \ No newline at end of file diff --git a/app/main.c b/app/main.c index 658987f..591e91f 100644 --- a/app/main.c +++ b/app/main.c @@ -16,16 +16,16 @@ #include "wm_include.h" #include "wm_gpio_afsel.h" #include "nano_shell.h" +#include "nano_shell_interface.h" #include "lwip/netif.h" #include "FreeRTOS.h" #include "FreeRTOSConfig.h" -#include "common.h" +#include "app_common.h" tls_os_task_t nano_shell_task_handle = NULL; tls_os_task_t nano_shell_server_task_handle = NULL; extern s16 uart0_rx_callback(u16 len, void *user_data); extern s16 uart1_rx_callback(u16 len, void *user_data); -extern int shell_printf(const char *format, ...); #define NANO_SHELL_TASK_STK_SIZE 640 #define NANO_SHELL_SERVER_TASK_STK_SIZE 640 diff --git a/app/nano_shell_command.c b/app/nano_shell_command.c index b07fea2..01eade1 100644 --- a/app/nano_shell_command.c +++ b/app/nano_shell_command.c @@ -6,10 +6,10 @@ #include "FreeRTOS.h" #include "task.h" #include "lwip/netif.h" -#include "common.h" +#include "app_common.h" +#include "nano_shell_interface.h" #include "wm_gpio_afsel.h" -extern int shell_printf(const char *format, ...); extern int wm_printf(const char *fmt,...); extern u32 tls_mem_get_avail_heapsize(void); extern bool disconnect_client(void); diff --git a/app/nano_shell_port.c b/app/nano_shell_port.c index 254d2e7..a983e75 100644 --- a/app/nano_shell_port.c +++ b/app/nano_shell_port.c @@ -93,8 +93,6 @@ void shell_putc(char ch) (void)shell_printf("%c", ch); } -bool got_linefeed = false; - void low_level_write_char(char ch) { (void)sendchar((int)ch); diff --git a/app/nano_shell_server_task.c b/app/nano_shell_server_task.c index 131ecd3..a5a2586 100644 --- a/app/nano_shell_server_task.c +++ b/app/nano_shell_server_task.c @@ -4,9 +4,9 @@ #include "FreeRTOS.h" #include "FreeRTOSConfig.h" #include "nano_shell_server_task.h" -#include "common.h" +#include "nano_shell_interface.h" +#include "app_common.h" -extern int shell_printf(const char *format, ...); extern void network_rx_callback(u16 len, char *data); tls_os_mutex_t *socket_mutex = NULL; diff --git a/app/third_party/driver/NRF24L01P/Makefile b/app/third_party/driver/NRF24L01P/Makefile new file mode 100644 index 0000000..abcd4a2 --- /dev/null +++ b/app/third_party/driver/NRF24L01P/Makefile @@ -0,0 +1,14 @@ +TOP_DIR = ../../../.. +sinclude $(TOP_DIR)/tools/w800/conf.mk + +ifndef PDIR +GEN_LIBS = libnrf24l01p$(LIB_EXT) +endif + +#DEFINES += + +sinclude $(TOP_DIR)/tools/w800/rules.mk + +INCLUDES := $(INCLUDES) -I $(PDIR)include +PDIR := ../$(PDIR) +sinclude $(PDIR)Makefile \ No newline at end of file diff --git a/app/third_party/driver/NRF24L01P/NRF24L01P.c b/app/third_party/driver/NRF24L01P/NRF24L01P.c new file mode 100644 index 0000000..c095433 --- /dev/null +++ b/app/third_party/driver/NRF24L01P/NRF24L01P.c @@ -0,0 +1,6 @@ +#include "NRF24L01P.h" + +bool NRF24L01_init(void) +{ + return true; +} \ No newline at end of file diff --git a/app/third_party/driver/NRF24L01P/NRF24L01P.h b/app/third_party/driver/NRF24L01P/NRF24L01P.h new file mode 100644 index 0000000..e28dedb --- /dev/null +++ b/app/third_party/driver/NRF24L01P/NRF24L01P.h @@ -0,0 +1,4 @@ +#include "wm_include.h" +#include "app_common.h" + +bool NRF24L01_init(void); \ No newline at end of file diff --git a/app_include/app_common.h b/app_include/app_common.h new file mode 100644 index 0000000..b4bddf2 --- /dev/null +++ b/app_include/app_common.h @@ -0,0 +1,6 @@ +#ifndef APP_COMMON_H +#define APP_COMMON_H + +#define NEW_LINE "\r\n" + +#endif //APP_COMMON_H \ No newline at end of file diff --git a/app_include/nano_shell_interface.h b/app_include/nano_shell_interface.h new file mode 100644 index 0000000..ab49c99 --- /dev/null +++ b/app_include/nano_shell_interface.h @@ -0,0 +1,6 @@ +#ifndef NANO_SHELL_INTERFACE_H +#define NANO_SHELL_INTERFACE_H + +extern int shell_printf(const char *format, ...); + +#endif //NANO_SHELL_INTERFACE_H \ No newline at end of file diff --git a/tools/w800/inc.mk b/tools/w800/inc.mk index 5674699..5edc40e 100644 --- a/tools/w800/inc.mk +++ b/tools/w800/inc.mk @@ -42,7 +42,9 @@ INCLUDES += -I $(TOP_DIR)/src/network/lwip2.0.3/include INCLUDES += -I $(TOP_DIR)/src/os/rtos/include INCLUDES += -I $(TOP_DIR)/src/app/factorycmd +INCLUDES += -I $(TOP_DIR)/app_include INCLUDES += -I $(TOP_DIR)/app/third_party/nano-shell-master +INCLUDES += -I $(TOP_DIR)/app/third_party/driver/NRF24L01P #nimble host INCLUDES += -I $(TOP_DIR)/src/bt/blehost/ext/tinycrypt/include INCLUDES += -I $(TOP_DIR)/src/bt/blehost/nimble/host/include