From 84f58a343e11e7a88ad1665e1ec6644bbf371817 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Thu, 18 Feb 2021 17:32:15 +0100 Subject: [PATCH] modem stuff --- cube/Core/Inc/main.h | 1 + cube/Makefile | 4 +++- cube/User/Src/main2.c | 5 +++++ cube/User/Src/networkAbstractionLayer_wifi.c | 5 ++++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cube/Core/Inc/main.h b/cube/Core/Inc/main.h index fc3f1c4..686f13b 100644 --- a/cube/Core/Inc/main.h +++ b/cube/Core/Inc/main.h @@ -61,6 +61,7 @@ void Error_Handler(void); #define eepromSpi hspi1 #define etherSpi hspi2 #define debugUart huart1 +#define modemUart huart2 #define mainsCnt htim1 #define LED_Red_Pin GPIO_PIN_13 #define LED_Red_GPIO_Port GPIOC diff --git a/cube/Makefile b/cube/Makefile index d831d26..5d8d734 100644 --- a/cube/Makefile +++ b/cube/Makefile @@ -97,11 +97,13 @@ C_SOURCES += \ User/Src/ports.c \ User/Src/wizHelper.c \ User/Src/networkAbstractionLayer_lan.c +NETWORK_STACK=1 endif ifeq ($(NETWORK), WiFi) C_SOURCES += \ User/Src/networkAbstractionLayer_wifi.c +NETWORK_STACK=2 endif # ASM sources @@ -181,7 +183,7 @@ endif # compile gcc flags ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -Werror -fdata-sections -ffunction-sections -CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -DNETWORK=$(NETWORK) -DVERSION="\"$(VERSION)\"" -Wall -Werror -fdata-sections -ffunction-sections +CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -DNETWORK=$(NETWORK_STACK) -DVERSION="\"$(VERSION)\"" -Wall -Werror -fdata-sections -ffunction-sections ifeq ($(DEBUG), 1) CFLAGS += -g -gdwarf-2 diff --git a/cube/User/Src/main2.c b/cube/User/Src/main2.c index cce4a54..600ccba 100644 --- a/cube/User/Src/main2.c +++ b/cube/User/Src/main2.c @@ -68,6 +68,11 @@ void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) { debugTxCpltCallback(huart); } #endif //LOGGER_OUTPUT_BY_INTERRUPT +#if NETWORK_STACK == 2 + if (huart == &modemUart) { + modemTxCpltCallback(huart); + } +#endif } void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi) { diff --git a/cube/User/Src/networkAbstractionLayer_wifi.c b/cube/User/Src/networkAbstractionLayer_wifi.c index 6f35a37..2c17479 100644 --- a/cube/User/Src/networkAbstractionLayer_wifi.c +++ b/cube/User/Src/networkAbstractionLayer_wifi.c @@ -1,5 +1,6 @@ #include #include +#include #include @@ -15,5 +16,7 @@ int8_t networkUdpSend(char *hostname, uint16_t port, uint8_t *buf, uint16_t bufL } void networkImplInit() { - + HAL_GPIO_WritePin(MODEM_RES_GPIO_Port, MODEM_RES_Pin, GPIO_PIN_RESET); + activeDelay(500); + HAL_GPIO_WritePin(MODEM_RES_GPIO_Port, MODEM_RES_Pin, GPIO_PIN_SET); }