diff --git a/cube/Makefile b/cube/Makefile index 5d8d734..e3ba010 100644 --- a/cube/Makefile +++ b/cube/Makefile @@ -102,7 +102,8 @@ endif ifeq ($(NETWORK), WiFi) C_SOURCES += \ -User/Src/networkAbstractionLayer_wifi.c +User/Src/networkAbstractionLayer_wifi.c \ +User/Src/modemCom.c NETWORK_STACK=2 endif @@ -183,7 +184,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_STACK) -DVERSION="\"$(VERSION)\"" -Wall -Werror -fdata-sections -ffunction-sections +CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -DNETWORK_STACK=$(NETWORK_STACK) -DVERSION="\"$(VERSION)\"" -Wall -Werror -fdata-sections -ffunction-sections ifeq ($(DEBUG), 1) CFLAGS += -g -gdwarf-2 diff --git a/cube/User/Inc/modemCom.h b/cube/User/Inc/modemCom.h new file mode 100644 index 0000000..c063679 --- /dev/null +++ b/cube/User/Inc/modemCom.h @@ -0,0 +1,16 @@ +#ifndef _MODEM_COM_H_ +#define _MODEM_COM_H_ + +#include + + + +#if NETWORK_STACK == 2 // WiFi +void modemTxCpltCallback(UART_HandleTypeDef *huart); +void modemRxCpltCallback(UART_HandleTypeDef *huart); +#endif + + + + +#endif // _MODEM_COM_H_ diff --git a/cube/User/Inc/networkAbstractionLayer.h b/cube/User/Inc/networkAbstractionLayer.h index c6600f3..5f1af7d 100644 --- a/cube/User/Inc/networkAbstractionLayer.h +++ b/cube/User/Inc/networkAbstractionLayer.h @@ -17,4 +17,5 @@ t_seconds* networkGetSeconds(); int8_t networkSendMinuteBuffer(t_minuteBuffer *minuteBuffer); + #endif /* _NETWORK_ABSTRACTION_LAYER_H_ */ diff --git a/cube/User/Inc/networkAbstractionLayer_impl.h b/cube/User/Inc/networkAbstractionLayer_impl.h index fed8522..2a4df57 100644 --- a/cube/User/Inc/networkAbstractionLayer_impl.h +++ b/cube/User/Inc/networkAbstractionLayer_impl.h @@ -7,4 +7,5 @@ uint64_t networkSntpQuery(); int8_t networkUdpSend(char *hostname, uint16_t port, uint8_t *buf, uint16_t bufLen); void networkImplInit(); + #endif /* _NETWORK_ABSTRACTION_LAYER_IMPL_H_ */ diff --git a/cube/User/Src/main2.c b/cube/User/Src/main2.c index d032e89..425ec4d 100644 --- a/cube/User/Src/main2.c +++ b/cube/User/Src/main2.c @@ -17,6 +17,9 @@ #include #include +#if NETWORK_STACK == 2 +#include +#endif @@ -43,7 +46,7 @@ void my_setup_2() { networkInit(); - counterInit(); +// counterInit(); logMsg("Application running"); } @@ -76,6 +79,17 @@ void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) { #endif } + +void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { +#if NETWORK_STACK == 2 + if (huart == &modemUart) { + modemRxCpltCallback(huart); + } +#endif +} + + + void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi) { if (hspi == &eepromSpi) { eepromSpiTxCpltCallback(hspi); diff --git a/cube/User/Src/modemCom.c b/cube/User/Src/modemCom.c new file mode 100644 index 0000000..0779350 --- /dev/null +++ b/cube/User/Src/modemCom.c @@ -0,0 +1,12 @@ +#include +#include + + + +void modemTxCpltCallback(UART_HandleTypeDef *huart) { + +} + +void modemRxCpltCallback(UART_HandleTypeDef *huart) { + +} diff --git a/cube/User/Src/networkAbstractionLayer_wifi.c b/cube/User/Src/networkAbstractionLayer_wifi.c index d4285fb..7f8c9c5 100644 --- a/cube/User/Src/networkAbstractionLayer_wifi.c +++ b/cube/User/Src/networkAbstractionLayer_wifi.c @@ -3,7 +3,7 @@ #include #include - +#include uint64_t networkSntpQuery() {