diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day1/\345\261\217\345\271\225\346\210\252\345\233\276 2025-08-06 153922.png" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day1/\345\261\217\345\271\225\346\210\252\345\233\276 2025-08-06 153922.png" new file mode 100644 index 0000000000000000000000000000000000000000..93603cbb9c351bf0dbfb3e6b86406a0110f81cdd Binary files /dev/null and "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day1/\345\261\217\345\271\225\346\210\252\345\233\276 2025-08-06 153922.png" differ diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day1/\345\261\217\345\271\225\346\210\252\345\233\276 2025-08-06 160353.png" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day1/\345\261\217\345\271\225\346\210\252\345\233\276 2025-08-06 160353.png" new file mode 100644 index 0000000000000000000000000000000000000000..5177bb20bdebc2061c78f4819fa7d31cbb44789b Binary files /dev/null and "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day1/\345\261\217\345\271\225\346\210\252\345\233\276 2025-08-06 160353.png" differ diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day1/\345\261\217\345\271\225\346\210\252\345\233\276 2025-08-06 160358.png" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day1/\345\261\217\345\271\225\346\210\252\345\233\276 2025-08-06 160358.png" new file mode 100644 index 0000000000000000000000000000000000000000..01c9c5b4578cb86a4c6c3acf454b578c89a8aa2f Binary files /dev/null and "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day1/\345\261\217\345\271\225\346\210\252\345\233\276 2025-08-06 160358.png" differ diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day1/\345\261\217\345\271\225\346\210\252\345\233\276 2025-08-06 184325.png" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day1/\345\261\217\345\271\225\346\210\252\345\233\276 2025-08-06 184325.png" new file mode 100644 index 0000000000000000000000000000000000000000..bfd24dcc10b661db0747a9d735b7e6940399ed5d Binary files /dev/null and "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day1/\345\261\217\345\271\225\346\210\252\345\233\276 2025-08-06 184325.png" differ diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day2/\347\254\254\344\272\214\345\244\251\344\275\234\344\270\232.c" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day2/\347\254\254\344\272\214\345\244\251\344\275\234\344\270\232.c" new file mode 100644 index 0000000000000000000000000000000000000000..9fa45a170bde29258dadb55c3ed26aaf9c516feb --- /dev/null +++ "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day2/\347\254\254\344\272\214\345\244\251\344\275\234\344\270\232.c" @@ -0,0 +1,55 @@ +#include +#include +#include + + +rt_thread_t thread1; +rt_thread_t thread2; +rt_thread_t thread3; + +void thread1_task(void*parm) +{ + while(1) + { + rt_kprintf("run the thread1\r\n"); + rt_thread_delay(1000); + } +} +void thread2_task(void*parm) +{ + while(1) + { + rt_kprintf("run the thread2\r\n"); + rt_thread_delay(500); + } +} +void thread3_task(void*parm) +{ + while(1) + { + rt_kprintf("run the thread3\r\n"); + rt_thread_delay(500); + } +} + +int main(void) +{ + + thread1 = rt_thread_create("thread1", thread1_task, RT_NULL, 1024, 4, 10); + thread2 = rt_thread_create("thread2", thread2_task, RT_NULL, 1024, 5, 10); + thread3 = rt_thread_create("thread3", thread3_task, RT_NULL, 1024, 5 ,10); + + if(thread1 !=RT_NULL) + { + rt_thread_startup(thread1); + } + if(thread2 !=RT_NULL) + { + rt_thread_startup(thread2); + } + if(thread3 !=RT_NULL) + { + rt_thread_startup(thread3); + } + return RT_EOK; +} diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/event.c" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/event.c" new file mode 100644 index 0000000000000000000000000000000000000000..f0d78d5bd62fbd488cd53914c328d198ccbddcc2 --- /dev/null +++ "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/event.c" @@ -0,0 +1,55 @@ +#include "board.h" +#include "rtthread.h" + +static rt_thread_t thread1 = RT_NULL; +static rt_thread_t thread2 = RT_NULL; +static rt_event_t test_event = RT_NULL; + +#define KEY1_EVENT (0x01 << 0) +#define KEY2_EVENT (0x01 << 1) + +static void thread1_entry(void* parm) { + rt_uint32_t recv; + while (1) { + rt_event_recv(test_event, + KEY1_EVENT | KEY2_EVENT, + RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, + RT_WAITING_FOREVER, + &recv); + + if (recv & KEY1_EVENT) LED1_TOGGLE; + if (recv & KEY2_EVENT) LED1_TOGGLE; + } +} + +static void thread2_entry(void* parm) { + while (1) { + if (Key_Scan(KEY1_GPIO_PORT, KEY1_GPIO_PIN) == KEY_ON) { + rt_kprintf("key1 pressed\n"); + rt_event_send(test_event, KEY1_EVENT); + } + if (Key_Scan(KEY2_GPIO_PORT, KEY2_GPIO_PIN) == KEY_ON) { + rt_kprintf("key2 pressed\n"); + rt_event_send(test_event, KEY2_EVENT); + } + rt_thread_delay(20); + } +} + +int main(void) { + test_event = rt_event_create("test_event", RT_IPC_FLAG_PRIO); + if (!test_event) { + rt_kprintf("Event creation failed\n"); + return -1; + } + + thread1 = rt_thread_create("thread1", thread1_entry, RT_NULL, + 1024, 3, 20); + thread2 = rt_thread_create("thread2", thread2_entry, RT_NULL, + 1024, 2, 20); + + if (thread1) rt_thread_startup(thread1); + if (thread2) rt_thread_startup(thread2); + + return 0; +} diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/mailbox.c" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/mailbox.c" new file mode 100644 index 0000000000000000000000000000000000000000..0cce8c47c83c04422ffaf86269d268ee18788da0 --- /dev/null +++ "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/mailbox.c" @@ -0,0 +1,47 @@ +#include "board.h" +#include "rtthread.h" + +static rt_thread_t thread1 = RT_NULL; +static rt_thread_t thread2 = RT_NULL; +static rt_mailbox_t test_mb = RT_NULL; + +static const char test_str[] = "Mailbox test message\n"; + +static void thread1_entry(void* parm) { + char* r_str; + while (1) { + if (rt_mb_recv(test_mb, (rt_ubase_t*)&r_str, 1000) == RT_EOK) { + rt_kprintf("Received: %s", r_str); + } + rt_thread_delay(200); + } +} + +static void thread2_entry(void* parm) { + while (1) { + if (Key_Scan(KEY1_GPIO_PORT, KEY1_GPIO_PIN) == KEY_ON) { + if (rt_mb_send(test_mb, (rt_ubase_t)test_str) != RT_EOK) { + rt_kprintf("Mail send failed\n"); + } + rt_thread_delay(20); + } + } +} + +int main(void) { + test_mb = rt_mb_create("test_mb", 10, RT_IPC_FLAG_FIFO); + if (!test_mb) { + rt_kprintf("Mailbox creation failed\n"); + return -1; + } + + thread1 = rt_thread_create("thread1", thread1_entry, RT_NULL, + 1024, 5, 20); + thread2 = rt_thread_create("thread2", thread2_entry, RT_NULL, + 1024, 3, 20); + + if (thread1) rt_thread_startup(thread1); + if (thread2) rt_thread_startup(thread2); + + return 0; +} \ No newline at end of file diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/mutex.c" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/mutex.c" new file mode 100644 index 0000000000000000000000000000000000000000..0a8e945a04668c57a7845f0498fbec1aaa0c1825 --- /dev/null +++ "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/mutex.c" @@ -0,0 +1,48 @@ +#include "board.h" +#include "rtthread.h" + +static rt_thread_t thread1 = RT_NULL; +static rt_thread_t thread2 = RT_NULL; +static rt_mutex_t test_mutex = RT_NULL; + +static int shared_data[2] = {0, 0}; + +static void thread1_entry(void* parm) { + while (1) { + rt_mutex_take(test_mutex, RT_WAITING_FOREVER); + if (shared_data[0] == shared_data[1]) { + rt_kprintf("Data consistent: %d\n", shared_data[0]); + } + rt_mutex_release(test_mutex); + rt_thread_delay(1000); + } +} + +static void thread2_entry(void* parm) { + while (1) { + rt_mutex_take(test_mutex, RT_WAITING_FOREVER); + shared_data[0]++; + rt_thread_delay(100); + shared_data[1]++; + rt_mutex_release(test_mutex); + rt_thread_yield(); + } +} + +int main(void) { + test_mutex = rt_mutex_create("test_mutex", RT_IPC_FLAG_FIFO); + if (!test_mutex) { + rt_kprintf("Mutex creation failed\n"); + return -1; + } + + thread1 = rt_thread_create("thread1", thread1_entry, RT_NULL, + 1024, 3, 20); + thread2 = rt_thread_create("thread2", thread2_entry, RT_NULL, + 1024, 5, 20); + + if (thread1) rt_thread_startup(thread1); + if (thread2) rt_thread_startup(thread2); + + return 0; +} \ No newline at end of file diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/queue.c" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/queue.c" new file mode 100644 index 0000000000000000000000000000000000000000..5f84cd81e0cb1793fa60858c82fb80f86caf6ce6 --- /dev/null +++ "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/queue.c" @@ -0,0 +1,47 @@ +#include "board.h" +#include "rtthread.h" + +static rt_thread_t thread1 = RT_NULL; +static rt_thread_t thread2 = RT_NULL; +static rt_mq_t test_mq = RT_NULL; + +static void thread1_entry(void* parm) { + uint32_t rev_data; + while (1) { + if (rt_mq_recv(test_mq, &rev_data, sizeof(rev_data), 100) == RT_EOK) { + rt_kprintf("Received data: %d\n", rev_data); + } + rt_thread_delay(200); + } +} + +static void thread2_entry(void* parm) { + static uint32_t send_data = 1; + while (1) { + if (Key_Scan(KEY1_GPIO_PORT, KEY1_GPIO_PIN) == KEY_ON) { + if (rt_mq_send(test_mq, &send_data, sizeof(send_data)) != RT_EOK) { + rt_kprintf("Queue send failed\n"); + } + send_data++; + rt_thread_delay(20); + } + } +} + +int main(void) { + test_mq = rt_mq_create("test_mq", sizeof(uint32_t), 20, RT_IPC_FLAG_FIFO); + if (!test_mq) { + rt_kprintf("Message queue creation failed\n"); + return -1; + } + + thread1 = rt_thread_create("thread1", thread1_entry, RT_NULL, + 1024, 5, 20); + thread2 = rt_thread_create("thread2", thread2_entry, RT_NULL, + 1024, 3, 20); + + if (thread1) rt_thread_startup(thread1); + if (thread2) rt_thread_startup(thread2); + + return 0; +} \ No newline at end of file diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/sem.c" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/sem.c" new file mode 100644 index 0000000000000000000000000000000000000000..eb87b04844a5f53ae3e380bd5851c6eb1a3ffffe --- /dev/null +++ "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/sem.c" @@ -0,0 +1,48 @@ +#include "board.h" +#include "rtthread.h" + +static rt_thread_t thread1 = RT_NULL; +static rt_thread_t thread2 = RT_NULL; +static rt_sem_t test_sem = RT_NULL; + +static int shared_data[2] = {0, 0}; + +static void thread1_entry(void* parm) { + while (1) { + rt_sem_take(test_sem, RT_WAITING_FOREVER); + if (shared_data[0] == shared_data[1]) { + rt_kprintf("Data consistent: %d\n", shared_data[0]); + } + rt_sem_release(test_sem); + rt_thread_delay(1000); + } +} + +static void thread2_entry(void* parm) { + while (1) { + rt_sem_take(test_sem, RT_WAITING_FOREVER); + shared_data[0]++; + rt_thread_delay(100); + shared_data[1]++; + rt_sem_release(test_sem); + rt_thread_yield(); + } +} + +int main(void) { + test_sem = rt_sem_create("test_sem", 1, RT_IPC_FLAG_FIFO); + if (!test_sem) { + rt_kprintf("Semaphore creation failed\n"); + return -1; + } + + thread1 = rt_thread_create("thread1", thread1_entry, RT_NULL, + 1024, 5, 20); + thread2 = rt_thread_create("thread2", thread2_entry, RT_NULL, + 1024, 3, 20); + + if (thread1) rt_thread_startup(thread1); + if (thread2) rt_thread_startup(thread2); + + return 0; +} \ No newline at end of file diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/signal.c" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/signal.c" new file mode 100644 index 0000000000000000000000000000000000000000..47dff50df2a8e01722e71b493c06fbab141ffd58 --- /dev/null +++ "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day3/signal.c" @@ -0,0 +1,46 @@ +#include "board.h" +#include "rtthread.h" + +#define SIG_USER 0x01 + +static rt_thread_t thread1 = RT_NULL; +static rt_thread_t thread2 = RT_NULL; + +static void signal_handler(int sig) { + rt_kprintf("Thread %s received signal %d\n", rt_thread_self()->name, sig); +} + +static void thread1_entry(void* parm) { + rt_signal_install(SIG_USER, signal_handler); + rt_signal_unmask(SIG_USER); + + while (1) { + rt_thread_delay(500); + } +} + +static void thread2_entry(void* parm) { + rt_signal_install(SIG_USER, SIG_IGN); + rt_signal_unmask(SIG_USER); + + while (1) { + rt_thread_delay(500); + } +} + +int main(void) { + thread1 = rt_thread_create("thread1", thread1_entry, RT_NULL, + 1024, 4, 20); + thread2 = rt_thread_create("thread2", thread2_entry, RT_NULL, + 1024, 6, 20); + + if (thread1) rt_thread_startup(thread1); + if (thread2) rt_thread_startup(thread2); + + rt_thread_delay(100); + + rt_thread_kill(thread1, SIG_USER); + rt_thread_kill(thread2, SIG_USER); + + return 0; +} \ No newline at end of file diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day4/drv_vir.c" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day4/drv_vir.c" new file mode 100644 index 0000000000000000000000000000000000000000..1a1eb9cec05f9d8e85e577864c35e450a6895a6b --- /dev/null +++ "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day4/drv_vir.c" @@ -0,0 +1,46 @@ +#include + +#if defined(RT_USING_VIR) + +struct vir_test vir; + +void printfinfo(struct rt_device *device, rt_uint8_t *str) +{ + RT_ASSERT(device); + rt_kprintf("VIR Device Info: %s\n", str); +} + +void vir_set_val(struct rt_device *device, rt_uint32_t val) +{ + RT_ASSERT(device); + vir.val = val; +} + +void vir_get_val(struct rt_device *device, rt_uint32_t *val) +{ + RT_ASSERT(device && val); + *val = vir.val; +} + +static struct rt_vir_ops ops = +{ + .print_info = printfinfo, + .set_value = vir_set_val, + .get_value = vir_get_val, +}; + +static int vir_init(void) +{ + vir.val = 0; + vir.info = "Virtual_Device"; + + if (rt_hw_vir_register(&vir.parent, "vir", &ops, (void*)vir.info) != RT_EOK) + { + return -RT_ERROR; + } + + return RT_EOK; +} +INIT_APP_EXPORT(vir_init); + +#endif \ No newline at end of file diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day5/test.c" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day5/test.c" new file mode 100644 index 0000000000000000000000000000000000000000..e8ea4fa93af659e4f38c5f764bb88e1f24f639ad --- /dev/null +++ "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\347\250\213\345\207\257/Day5/test.c" @@ -0,0 +1,170 @@ +#include +#include +#include +#include +#include +#include +#include "mqttclient.h" +#include + +#define MQTT_BROKER "jiejie01.top" +#define MQTT_PORT_NUM "1883" +#define CLIENT_ID_STR "rtthread1209" +#define MQTT_USER "rt-thread" +#define MQTT_PASS "rt-thread" +#define SUBSCRIBE_TOPIC "rtt-sub" +#define PUBLISH_TOPIC "rtt-pub" +#define DEVICE_NAME "xiaoming" +#define STUDY_MESSAGE "Keep up the good work!" + +static mqtt_client_t *mqtt_handle = NULL; + +/* 生成JSON格式数据 */ +static char* build_json_payload(void) +{ + cJSON *root_obj = cJSON_CreateObject(); + if (!root_obj) { + rt_kprintf("[ERROR] JSON creation failed\n"); + return NULL; + } + + cJSON_AddStringToObject(root_obj, "study", STUDY_MESSAGE); + cJSON_AddStringToObject(root_obj, "name", DEVICE_NAME); + + char *json_str = cJSON_PrintUnformatted(root_obj); + cJSON_Delete(root_obj); + + return json_str; +} + +/* 消息处理 */ +static void incoming_msg_handler(void* client, message_data_t* msg) +{ + char *msg_content = (char*)msg->message->payload; + + rt_kprintf("\n<< Received MQTT Message >>\n"); + rt_kprintf("Topic: %s\nData: %s\n", msg->topic_name, msg_content); + + /* 解析JSON数据 */ + cJSON *json_root = cJSON_Parse(msg_content); + if (!json_root) { + rt_kprintf("[ERROR] Invalid JSON format\n"); + return; + } + + cJSON *study_field = cJSON_GetObjectItem(json_root, "study"); + cJSON *name_field = cJSON_GetObjectItem(json_root, "name"); + + if (cJSON_IsString(name_field) && cJSON_IsString(study_field)) { + /* 验证消息有效性 */ + if (!strcmp(name_field->valuestring, DEVICE_NAME) && + !strcmp(study_field->valuestring, STUDY_MESSAGE)) { + + mqtt_message_t response; + memset(&response, 0, sizeof(response)); + response.qos = QOS0; + response.payload = "辛苦了,下周的比赛加油!"; + + if (mqtt_publish(mqtt_handle, PUBLISH_TOPIC, &response) == RT_EOK) { + rt_kprintf("Response sent: %s\n", (char*)response.payload); + } else { + rt_kprintf("[ERROR] Failed to send response\n"); + } + } + } else { + rt_kprintf("[ERROR] Missing required JSON fields\n"); + } + + cJSON_Delete(json_root); + rt_kprintf("<< End of Message >>\n\n"); +} + +/* 初始化MQTT客户端 */ +static int setup_mqtt_client(void) +{ + mqtt_handle = mqtt_lease(); + if (!mqtt_handle) { + rt_kprintf("[ERROR] MQTT client allocation failed\n"); + return -RT_ERROR; + } + + // 设置连接参数 + mqtt_set_host(mqtt_handle, MQTT_BROKER); + mqtt_set_port(mqtt_handle, MQTT_PORT_NUM); + mqtt_set_client_id(mqtt_handle, CLIENT_ID_STR); + mqtt_set_user_name(mqtt_handle, MQTT_USER); + mqtt_set_password(mqtt_handle, MQTT_PASS); + mqtt_set_clean_session(mqtt_handle, 1); + + /* 建立连接 */ + if (mqtt_connect(mqtt_handle)) { + rt_kprintf("[ERROR] MQTT connection failed\n"); + return -RT_ERROR; + } + + /* 订阅主题 */ + if (mqtt_subscribe(mqtt_handle, SUBSCRIBE_TOPIC, QOS0, incoming_msg_handler)) { + rt_kprintf("[ERROR] Subscription failed\n"); + return -RT_ERROR; + } + + rt_kprintf("MQTT initialized successfully\n"); + rt_kprintf("Client ID: %s\n", CLIENT_ID_STR); + rt_kprintf("Subscribed: %s\n", SUBSCRIBE_TOPIC); + rt_kprintf("Publishing: %s\n", PUBLISH_TOPIC); + + return RT_EOK; +} + +/* 发送测试消息 */ +static void publish_test_message(void) +{ + char *json_data = build_json_payload(); + if (!json_data) return; + + mqtt_message_t test_msg; + memset(&test_msg, 0, sizeof(test_msg)); + test_msg.qos = QOS0; + test_msg.payload = json_data; + + rt_kprintf("Sending: %s\n", json_data); + mqtt_publish(mqtt_handle, SUBSCRIBE_TOPIC, &test_msg); + + cJSON_free(json_data); +} + +/* MQTT主线程 */ +static void mqtt_main_thread(void *param) +{ + rt_thread_mdelay(5000); // 延迟5秒等待网络就绪 + + if (setup_mqtt_client() != RT_EOK) { + return; + } + + publish_test_message(); // 发送初始测试消息 + + while (1) { + // 主循环保持连接 + rt_thread_mdelay(1000); + } +} + +/* 启动MQTT示例 */ +int launch_mqtt_demo(void) +{ + rt_thread_t tid = rt_thread_create("mqtt_task", + mqtt_main_thread, + RT_NULL, + 4096, + 15, + 10); + if (tid) { + rt_thread_startup(tid); + return RT_EOK; + } + + return -RT_ERROR; +} + +MSH_CMD_EXPORT(launch_mqtt_demo, Start MQTT client with JSON processing); \ No newline at end of file