mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-19 19:40:56 +00:00
Tutorials - nits and mqtt client adoption
This commit is contained in:
1 parent
069ab78c02
commit
28e3b347d4
8 files changed
+14
-5
No files matched your search
@@ -7,7 +7,7 @@ include(pico_sdk_import.cmake)
|
||||
project(firmware)
|
||||
pico_sdk_init()
|
||||
|
||||
add_executable(firmware main.c wifi.c ../../../mongoose.c)
|
||||
add_executable(firmware main.c wifi.c ../../../mongoose.c ../../mqtt/mqtt-client/mongoose_mqtt.c)
|
||||
target_include_directories(firmware PRIVATE ../../.. ./)
|
||||
|
||||
target_link_libraries(firmware pico_stdlib hardware_spi pico_rand pico_cyw43_driver pico_cyw43_arch_none hardware_flash pico_bootrom)
|
||||
|
||||
@@ -65,11 +65,13 @@ static void run_mongoose(void) {
|
||||
struct mg_mgr mgr;
|
||||
mg_log_set_fn(log_fn, NULL);
|
||||
mg_mgr_init(&mgr);
|
||||
mg_mqtt_init(&mgr);
|
||||
mg_http_listen(&mgr, "http://0.0.0.0", http_ev_handler, NULL);
|
||||
mg_http_listen(&mgr, "https://0.0.0.0", http_ev_handler, NULL);
|
||||
|
||||
for (;;) {
|
||||
mg_mgr_poll(&mgr, 1);
|
||||
mg_mqtt_poll(&mgr);
|
||||
blink_task();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#define MG_TLS MG_TLS_BUILTIN
|
||||
#define MG_OTA MG_OTA_PICOSDK
|
||||
#define MG_IO_SIZE 2048
|
||||
#define MQTT_CLIENT_ID "rp" // For tutorials/mqtt/mqtt-client
|
||||
|
||||
#define MG_ENABLE_TCPIP 1
|
||||
#define MG_ENABLE_DRIVER_PICO_W 1
|
||||
|
||||
Reference in new issue
Block a user