test new mqtt client
This commit is contained in:
parent
7df4f53741
commit
9d7f739be5
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
cube/build/
|
cube/build/
|
||||||
cube/w5500.a
|
cube/w5500.a
|
||||||
|
cube/pubsubc.a
|
||||||
.*.sw?
|
.*.sw?
|
||||||
*.o
|
*.o
|
||||||
test
|
test
|
||||||
|
@ -37,7 +37,7 @@ BUILD_DIR = build
|
|||||||
######################################
|
######################################
|
||||||
# C sources
|
# C sources
|
||||||
C_SOURCES = \
|
C_SOURCES = \
|
||||||
User/Src/tcpTest.c User/Src/ports.c User/Src/eeprom.c User/Src/frontend.c User/Src/logger.c User/Src/loopCtrl.c User/Src/main2.c User/Src/mbusComm.c User/Src/ringbuffer.c User/Src/show.c User/Src/utils.c User/Src/wizHelper.c hottislib/PontCoopScheduler.c \
|
User/Src/mqttTest.c User/Src/tcpTest.c User/Src/ports.c User/Src/eeprom.c User/Src/frontend.c User/Src/logger.c User/Src/loopCtrl.c User/Src/main2.c User/Src/mbusComm.c User/Src/ringbuffer.c User/Src/show.c User/Src/utils.c User/Src/wizHelper.c hottislib/PontCoopScheduler.c \
|
||||||
libmbus/mbus/mbus-protocol.c \
|
libmbus/mbus/mbus-protocol.c \
|
||||||
Core/Src/main.c \
|
Core/Src/main.c \
|
||||||
Core/Src/gpio.c \
|
Core/Src/gpio.c \
|
||||||
@ -126,6 +126,7 @@ C_INCLUDES = \
|
|||||||
-IioLibrary_Driver/Ethernet \
|
-IioLibrary_Driver/Ethernet \
|
||||||
-IioLibrary_Driver/Internet/DHCP \
|
-IioLibrary_Driver/Internet/DHCP \
|
||||||
-IioLibrary_Driver/Internet/MQTT \
|
-IioLibrary_Driver/Internet/MQTT \
|
||||||
|
-Ipubsubc/src \
|
||||||
-ICore/Inc \
|
-ICore/Inc \
|
||||||
-IDrivers/STM32F1xx_HAL_Driver/Inc \
|
-IDrivers/STM32F1xx_HAL_Driver/Inc \
|
||||||
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
|
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
|
||||||
@ -169,14 +170,18 @@ all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET
|
|||||||
# list of objects
|
# list of objects
|
||||||
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
|
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
|
||||||
vpath %.c $(sort $(dir $(C_SOURCES)))
|
vpath %.c $(sort $(dir $(C_SOURCES)))
|
||||||
OBJECTS += $(addprefix $(BUILD_DIR)/,w5500.a)
|
OBJECTS += $(addprefix $(BUILD_DIR)/,pubsubc.a w5500.a)
|
||||||
# list of ASM program objects
|
# list of ASM program objects
|
||||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
|
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
|
||||||
vpath %.s $(sort $(dir $(ASM_SOURCES)))
|
vpath %.s $(sort $(dir $(ASM_SOURCES)))
|
||||||
|
|
||||||
|
|
||||||
$(BUILD_DIR)/w5500.a:
|
$(BUILD_DIR)/w5500.a:
|
||||||
(cd ioLibrary_Driver && $(MAKE) && cp w5500.a ../$(BUILD_DIR) && cd ..)
|
(cd ioLibrary_Driver && $(MAKE) && cp w5500.a ../$(BUILD_DIR) && cd ..)
|
||||||
|
|
||||||
|
$(BUILD_DIR)/pubsubc.a:
|
||||||
|
(cd pubsubc && $(MAKE) && cp pubsubc.a ../$(BUILD_DIR) && cd ..)
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
||||||
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
||||||
|
|
||||||
|
@ -35,35 +35,35 @@ BUILD_DIR = build
|
|||||||
# source
|
# source
|
||||||
######################################
|
######################################
|
||||||
# C sources
|
# C sources
|
||||||
C_SOURCES = \
|
C_SOURCES = \
|
||||||
Core/Src/main.c \
|
Core/Src/main.c \
|
||||||
Core/Src/gpio.c \
|
Core/Src/gpio.c \
|
||||||
Core/Src/adc.c \
|
Core/Src/adc.c \
|
||||||
Core/Src/spi.c \
|
Core/Src/spi.c \
|
||||||
Core/Src/usart.c \
|
Core/Src/usart.c \
|
||||||
Core/Src/stm32f1xx_it.c \
|
Core/Src/stm32f1xx_it.c \
|
||||||
Core/Src/stm32f1xx_hal_msp.c \
|
Core/Src/stm32f1xx_hal_msp.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \
|
||||||
Core/Src/system_stm32f1xx.c
|
Core/Src/system_stm32f1xx.c
|
||||||
|
|
||||||
# ASM sources
|
# ASM sources
|
||||||
ASM_SOURCES = \
|
ASM_SOURCES = \
|
||||||
startup_stm32f103xe.s
|
startup_stm32f103xe.s
|
||||||
|
|
||||||
|
|
||||||
@ -107,8 +107,8 @@ MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
|
|||||||
AS_DEFS =
|
AS_DEFS =
|
||||||
|
|
||||||
# C defines
|
# C defines
|
||||||
C_DEFS = \
|
C_DEFS = \
|
||||||
-DUSE_HAL_DRIVER \
|
-DUSE_HAL_DRIVER \
|
||||||
-DSTM32F103xE
|
-DSTM32F103xE
|
||||||
|
|
||||||
|
|
||||||
@ -116,12 +116,12 @@ C_DEFS = \
|
|||||||
AS_INCLUDES =
|
AS_INCLUDES =
|
||||||
|
|
||||||
# C includes
|
# C includes
|
||||||
C_INCLUDES = \
|
C_INCLUDES = \
|
||||||
-ICore/Inc \
|
-ICore/Inc \
|
||||||
-IDrivers/STM32F1xx_HAL_Driver/Inc \
|
-IDrivers/STM32F1xx_HAL_Driver/Inc \
|
||||||
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
|
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
|
||||||
-IDrivers/CMSIS/Device/ST/STM32F1xx/Include \
|
-IDrivers/CMSIS/Device/ST/STM32F1xx/Include \
|
||||||
-IDrivers/CMSIS/Include \
|
-IDrivers/CMSIS/Include \
|
||||||
-IDrivers/CMSIS/Include
|
-IDrivers/CMSIS/Include
|
||||||
|
|
||||||
|
|
||||||
@ -164,6 +164,13 @@ vpath %.c $(sort $(dir $(C_SOURCES)))
|
|||||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
|
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
|
||||||
vpath %.s $(sort $(dir $(ASM_SOURCES)))
|
vpath %.s $(sort $(dir $(ASM_SOURCES)))
|
||||||
|
|
||||||
|
$(BUILD_DIR)/w5500.a:
|
||||||
|
(cd ioLibrary_Driver && $(MAKE) && cp w5500.a ../$(BUILD_DIR) && cd ..)
|
||||||
|
|
||||||
|
$(BUILD_DIR)/pubsubc.a:
|
||||||
|
(cd pubsubc && $(MAKE) && cp pubsubc.a ../$(BUILD_DIR) && cd ..)
|
||||||
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
||||||
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
||||||
|
|
||||||
|
10
cube/User/Inc/mqttTest.h
Normal file
10
cube/User/Inc/mqttTest.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifndef _MQTTTEST_H_
|
||||||
|
#define _MQTTTEST_H_
|
||||||
|
|
||||||
|
|
||||||
|
void mqttTestInit();
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _MQTTTEST_H_
|
||||||
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
|||||||
#include <eeprom.h>
|
#include <eeprom.h>
|
||||||
#include <wizHelper.h>
|
#include <wizHelper.h>
|
||||||
#include <tcpTest.h>
|
#include <tcpTest.h>
|
||||||
|
#include <mqttTest.h>
|
||||||
|
|
||||||
|
|
||||||
void my_setup_1() {
|
void my_setup_1() {
|
||||||
schInit();
|
schInit();
|
||||||
@ -191,7 +193,7 @@ void my_setup_2() {
|
|||||||
|
|
||||||
wizInit();
|
wizInit();
|
||||||
|
|
||||||
tcpTestInit();
|
mqttTestInit();
|
||||||
|
|
||||||
|
|
||||||
// frontendInit();
|
// frontendInit();
|
||||||
|
35
cube/User/Src/mqttTest.c
Normal file
35
cube/User/Src/mqttTest.c
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#include <mqttTest.h>
|
||||||
|
#include <logger.h>
|
||||||
|
|
||||||
|
#include <pubsubc.h>
|
||||||
|
#include <platformAdaption.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern const uint8_t MQTT_SOCK;
|
||||||
|
|
||||||
|
client_t client;
|
||||||
|
mqttClient_t mqttClient;
|
||||||
|
|
||||||
|
|
||||||
|
// typedef void (*callback_t)(char*, uint8_t*, uint16_t);
|
||||||
|
static void mqttCallback(char *topic, uint8_t *payload, uint16_t payloadLength) {
|
||||||
|
logMsg("mcb");
|
||||||
|
}
|
||||||
|
|
||||||
|
void mqttTestInit() {
|
||||||
|
logMsg("mti: initializing mqtt client");
|
||||||
|
client.sockNum = MQTT_SOCK;
|
||||||
|
mqttClientInit(&mqttClient, &client, mqttCallback);
|
||||||
|
logMsg("mti: mqtt client initialized");
|
||||||
|
|
||||||
|
logMsg("mti: connecting to broker");
|
||||||
|
uint8_t brokerAddress[] = { 172, 16, 2, 16 };
|
||||||
|
bool res = mqttConnect(&mqttClient, brokerAddress, 1883, "mbv3gw-client", NULL, NULL, NULL, 0, false, NULL, false);
|
||||||
|
logMsg("mti: mqttConnect returns %d", res);
|
||||||
|
}
|
||||||
|
|
@ -12,7 +12,7 @@
|
|||||||
#include <wizHelper.h>
|
#include <wizHelper.h>
|
||||||
|
|
||||||
|
|
||||||
const uint8_t TCPTEST_SOCK;
|
extern const uint8_t TCPTEST_SOCK;
|
||||||
|
|
||||||
uint8_t remoteAddr[] = { 172, 16, 3, 31 };
|
uint8_t remoteAddr[] = { 172, 16, 3, 31 };
|
||||||
uint16_t remotePort = 5000;
|
uint16_t remotePort = 5000;
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 11d4a046e11b0afda3e32f46f9059b9191e9a5f3
|
Subproject commit 477f3e2e3f3d4245867f3cb7ad1deba9d33f85d2
|
Loading…
x
Reference in New Issue
Block a user