diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/README.md" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/README.md" deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\345\274\240\344\270\211/\344\275\234\344\270\232/README.md" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\345\274\240\344\270\211/\344\275\234\344\270\232/README.md" deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git "a/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\345\274\240\344\270\211/\347\254\224\350\256\260/README.md" "b/2025/\347\254\2541\347\273\204(STM32H750-ART-PI)/\345\274\240\344\270\211/\347\254\224\350\256\260/README.md" deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git "a/2025/\347\254\2542\347\273\204(RA8D1-Vision-Board)/README.md" "b/2025/\347\254\2542\347\273\204(RA8D1-Vision-Board)/README.md" deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\200\345\244\251\344\275\234\344\270\232.md" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\200\345\244\251\344\275\234\344\270\232.md" new file mode 100644 index 0000000000000000000000000000000000000000..d0dad5236f84b9c75a954bff0e645c5b4a332165 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\200\345\244\251\344\275\234\344\270\232.md" @@ -0,0 +1,4 @@ +1. 完成对git fork的配置 +2. 更新git和发布博客 + +[RT-Thread-【RSOC25】Day1课程笔记:环境配置RT-Thread问答社区 - RT-Thread](https://club.rt-thread.org/ask/article/0cad960cf550a11d.html) \ No newline at end of file diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/event.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/event.c" new file mode 100644 index 0000000000000000000000000000000000000000..52a8f9223688d4117f2c05bcc29d540fa70bfc2d --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/event.c" @@ -0,0 +1,78 @@ +/*信号量、互斥量、事件集、邮箱、消息队列、信号*/ + +#include "board.h" +#include "rtthread.h" + + +ALIGN(RT_ALIGN_SIZE) + +static rt_thread_t thread1 = RT_NULL; +static rt_thread_t thread2 = RT_NULL; + +static void thread1_entry(void*parm); +static void thread2_entry(void*parm); + +/* 事件TCB */ +static rt_event_t test_event; + +#define Key1_event (0x01<<0) +#define Key2_event (0x01<<1) + +int main(void) +{ + /* 创建信号量 */ + test_event = rt_event_create("test_event",RT_IPC_FLAG_PRIO); + + if(test_event !=RT_NULL) + { + rt_kprintf("create test_event\r\n"); + } + + thread1 = rt_thread_create("thread1",thread1_entry, RT_NULL, 1024, 3, 20); + + if(thread1 != RT_NULL) + { + rt_thread_startup(thread1); + } + thread2 = rt_thread_create("thread2",thread2_entry, RT_NULL, 1024, 2, 20); + + if(thread2 != RT_NULL) + { + rt_thread_startup(thread2); + } + +} + +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) ||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\r\n"); + rt_event_send(test_event, Key1_event); + } + if(Key_Scan(KEY2_GPIO_PORT, KEY2_GPIO_PIN) == KEY_ON) + { + rt_kprintf("key2\r\n"); + rt_event_send(test_event, Key2_event); + } + rt_thread_delay(20); + } +} + diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/mailbox.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/mailbox.c" new file mode 100644 index 0000000000000000000000000000000000000000..14086fd885e0a150f6eab4eaaf9d336ec3bf53a8 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/mailbox.c" @@ -0,0 +1,77 @@ +/*信号量、互斥量、事件集、邮箱、消息队列、信号*/ + +#include "board.h" +#include "rtthread.h" + + +ALIGN(RT_ALIGN_SIZE) + +static rt_thread_t thread1 = RT_NULL; +static rt_thread_t thread2 = RT_NULL; + +static void thread1_entry(void*parm); +static void thread2_entry(void*parm); + +/* 邮箱TCB */ +static rt_mailbox_t test_mb =RT_NULL; + +char test_str1[] = "this is mailbox test\r\n"; + +int main(void) +{ + /* 创建邮箱 */ + test_mb = rt_mb_create("test_mb", 10, RT_IPC_FLAG_FIFO); + + if(test_mb !=RT_NULL) + { + rt_kprintf("create mb\r\n"); + } + + thread1 = rt_thread_create("thread1",thread1_entry, RT_NULL, 1024, 5, 20); + + if(thread1 != RT_NULL) + { + rt_thread_startup(thread1); + } + thread2 = rt_thread_create("thread2",thread2_entry, RT_NULL, 1024, 3, 20); + + if(thread2 != RT_NULL) + { + rt_thread_startup(thread2); + } + +} + +static void thread1_entry(void*parm) +{ + rt_err_t uwRet = RT_EOK; + char* r_str ; + + while(1) + { + uwRet = rt_mb_recv(test_mb,(rt_ubase_t*)&r_str,1000); + if(uwRet == RT_EOK) + { + rt_kprintf("revice mail = %s\r\n",r_str); + } + rt_thread_delay(200); + } +} +static void thread2_entry(void*parm) +{ + rt_err_t uwRet = RT_EOK; + + while(1) + { + if(Key_Scan(KEY1_GPIO_PORT, KEY1_GPIO_PIN) == KEY_ON) + { + uwRet = rt_mb_send(test_mb, (uint32_t)&test_str1); + if(uwRet !=RT_EOK) + { + rt_kprintf("Send error %lx\r\n",uwRet); + } + rt_thread_delay(20); + } + } +} + diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/mutex.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/mutex.c" new file mode 100644 index 0000000000000000000000000000000000000000..71a1cac1372593edd534fa6466983e8369ed8647 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/mutex.c" @@ -0,0 +1,72 @@ +/*信号量、互斥量、事件集、邮箱、消息队列、信号*/ + +#include "board.h" +#include "rtthread.h" + + +ALIGN(RT_ALIGN_SIZE) + +static rt_thread_t thread1 = RT_NULL; +static rt_thread_t thread2 = RT_NULL; + +static void thread1_entry(void*parm); +static void thread2_entry(void*parm); + +/* 互斥量TCB */ +static rt_mutex_t test_mutex =RT_NULL; + +char uwdata[2] = {0,0}; + +int main(void) +{ + /* 创建信号量 */ + test_mutex = rt_mutex_create("test_mutex",RT_IPC_FLAG_FIFO); + + if(test_mutex !=RT_NULL) + { + rt_kprintf("create mutex\r\n"); + } + + thread1 = rt_thread_create("thread1",thread1_entry, RT_NULL, 1024, 3, 20); + + if(thread1 != RT_NULL) + { + rt_thread_startup(thread1); + } + thread2 = rt_thread_create("thread2",thread2_entry, RT_NULL, 1024, 5, 20); + + if(thread2 != RT_NULL) + { + rt_thread_startup(thread2); + } + +} + +static void thread1_entry(void*parm) +{ + + while(1) + { + rt_mutex_take(test_mutex, RT_WAITING_FOREVER); + if(uwdata[0] == uwdata[1]) + { + rt_kprintf("successful \r\n"); + } + 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); + uwdata[0]++; + rt_thread_delay(100); + uwdata[1]++; + rt_mutex_release(test_mutex); + rt_thread_yield(); + } +} + diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/queue.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/queue.c" new file mode 100644 index 0000000000000000000000000000000000000000..cefae1a41bd246f8efbe63dddc3bd2a866665764 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/queue.c" @@ -0,0 +1,76 @@ + +#include "board.h" +#include "rtthread.h" + + +ALIGN(RT_ALIGN_SIZE) + +static rt_thread_t thread1 = RT_NULL; +static rt_thread_t thread2 = RT_NULL; + +static void thread1_entry(void*parm); +static void thread2_entry(void*parm); + +/* 消息队列TCB */ +static rt_mq_t test_mq =RT_NULL; + + +int main(void) +{ + /* 创建消息队列 */ + test_mq = rt_mq_create("test_mq",40,20,RT_IPC_FLAG_FIFO); + + if(test_mq !=RT_NULL) + { + rt_kprintf("create mq\r\n"); + } + + thread1 = rt_thread_create("thread1",thread1_entry, RT_NULL, 1024, 5, 20); + + if(thread1 != RT_NULL) + { + rt_thread_startup(thread1); + } + thread2 = rt_thread_create("thread2",thread2_entry, RT_NULL, 1024, 3, 20); + + if(thread2 != RT_NULL) + { + rt_thread_startup(thread2); + } + +} + +static void thread1_entry(void*parm) +{ + rt_err_t uwRet = RT_EOK; + uint32_t rev_data = 0; + + while(1) + { + uwRet = rt_mq_recv(test_mq, &rev_data, sizeof(rev_data), 100); + if(uwRet == RT_EOK) + { + rt_kprintf("revice data = %d\r\n",rev_data); + } + rt_thread_delay(200); + } +} +static void thread2_entry(void*parm) +{ + rt_err_t uwRet = RT_EOK; + uint32_t send_data = 1; + + while(1) + { + if(Key_Scan(KEY1_GPIO_PORT, KEY1_GPIO_PIN) == KEY_ON) + { + uwRet = rt_mq_send(test_mq, &send_data, sizeof(send_data)); + if(uwRet !=RT_EOK) + { + rt_kprintf("Send error %lx\r\n",uwRet); + } + rt_thread_delay(20); + } + } +} + diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/sem.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/sem.c" new file mode 100644 index 0000000000000000000000000000000000000000..f7f4d29d008251c50331644644c24a168b35572f --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/sem.c" @@ -0,0 +1,72 @@ +/*信号量、互斥量、事件集、邮箱、消息队列、信号*/ + +#include "board.h" +#include "rtthread.h" + + +ALIGN(RT_ALIGN_SIZE) + +static rt_thread_t thread1 = RT_NULL; +static rt_thread_t thread2 = RT_NULL; + +static void thread1_entry(void*parm); +static void thread2_entry(void*parm); + +/* 信号量TCB */ +static rt_sem_t test_sem =RT_NULL; + +char uwdata[2] = {0,0}; + +int main(void) +{ + /* 创建信号量 */ + test_sem = rt_sem_create("test_sem", 1, RT_IPC_FLAG_FIFO); + + if(test_sem !=RT_NULL) + { + rt_kprintf("create sem\r\n"); + } + + thread1 = rt_thread_create("thread1",thread1_entry, RT_NULL, 1024, 5, 20); + + if(thread1 != RT_NULL) + { + rt_thread_startup(thread1); + } + thread2 = rt_thread_create("thread2",thread2_entry, RT_NULL, 1024, 3, 20); + + if(thread2 != RT_NULL) + { + rt_thread_startup(thread2); + } + +} + +static void thread1_entry(void*parm) +{ + + while(1) + { + rt_sem_take(test_sem, RT_WAITING_FOREVER); + if(uwdata[0] == uwdata[1]) + { + rt_kprintf("successful \r\n"); + } + 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); + uwdata[0]++; + rt_thread_delay(100); + uwdata[1]++; + rt_sem_release(test_sem); + rt_thread_yield(); + } +} + diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/signal.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/signal.c" new file mode 100644 index 0000000000000000000000000000000000000000..1a74dafc5adc4c79f260b1d7d71b7917970f9763 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\270\211\345\244\251\344\275\234\344\270\232/signal.c" @@ -0,0 +1,118 @@ + + +#include +#include +#include + + + +static struct rt_thread *thread1; +static struct rt_thread *thread2; + + +void thread1_signal_handler(int sig) +{ + rt_kprintf("Thread1 received signal %d\n", sig); +} + +static void thread1_entry(void *parameter) +{ + const char *thread_name = parameter; + + rt_kprintf(thread_name); + + rt_signal_install(SIGUSR1, thread1_signal_handler); + + rt_signal_unmask(SIGUSR1); + + while(1) + { + rt_thread_mdelay(500); + } +} + + +static void thread2_entry(void *parameter) +{ + const char *thread_name = parameter; + + + rt_kprintf(thread_name); + + + rt_signal_install(SIGUSR1, SIG_IGN); + + + rt_signal_unmask(SIGUSR1); + + while(1) + { + rt_thread_mdelay(500); + } +} + +static const char *thread1_name = "Thread1 run\r\n"; +static const char *thread2_name = "Thread2 run\r\n"; + +int main(void) +{ + + thread1 = rt_thread_create("thread1", + thread1_entry, + (void *)thread1_name, + 1024, + 4, + 20); + + + if (thread1 != RT_NULL) + rt_thread_startup(thread1); + + + thread2 = rt_thread_create("thread2", + thread2_entry, + (void *)thread2_name, + 1024, + 6, + 20); + + + if (thread2 != RT_NULL) + rt_thread_startup(thread2); + + rt_thread_mdelay(100); + + rt_thread_kill(thread1, SIGUSR1); + rt_thread_kill(thread2, SIGUSR1); + + + return 0; +} + + + +#include "app_esp8266.h" +#include +#include +#include + + +int Set_esp8266(void) +{ + rt_pin_mode(GET_PIN(B,8), PIN_MODE_OUTPUT); + rt_pin_write(GET_PIN(B,8), 1); + + return 0; +} +INIT_BOARD_EXPORT(Set_esp8266); + +int Reset_esp8266(void) +{ + rt_pin_mode(GET_PIN(B,9), PIN_MODE_OUTPUT); + rt_pin_write(GET_PIN(B,9), 0); + rt_thread_mdelay(200); + rt_pin_write(GET_PIN(B,9), 1); + return 0; +} +INIT_BOARD_EXPORT(Reset_esp8266); + diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\272\214\345\244\251\344\275\234\344\270\232.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\272\214\345\244\251\344\275\234\344\270\232.c" new file mode 100644 index 0000000000000000000000000000000000000000..32f65c768acea3bb550dea738e716421863a7cdd --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\272\214\345\244\251\344\275\234\344\270\232.c" @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2018-11-06 SummerGift first version + * 2018-11-19 flybreak add stm32f407-atk-explorer bsp + */ + +#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\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\272\224\345\244\251\344\275\234\344\270\232.md" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\272\224\345\244\251\344\275\234\344\270\232.md" new file mode 100644 index 0000000000000000000000000000000000000000..39ab13eba65f8d2f6380b790b635bc62bbfbc986 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\344\272\224\345\244\251\344\275\234\344\270\232.md" @@ -0,0 +1,178 @@ +# 使用PSoC6和esp8266 配置MQTT + +## 参考文章 + +[RT-Thread开发之路(4)— MQTT通信_rtthread mqtt-CSDN博客](https://blog.csdn.net/qq_38113006/article/details/105935328) + +## 环境配置 + +### esp8266 + +使用1.5版本以上的固件包 + +**![image-20250730104604015](pic.assets/image-20250730104604015.png)** + +### psoc6 + +#### 使用 rtthread studio提供的软件包 + +![image-20250730104803634](pic.assets/image-20250730104803634.png) + + + + + +#### 配置软件包 + +![image-20250730105008248](pic.assets/image-20250730105008248.png) + +##### 选择固件包 + +###### mqtt + +![image-20250730105042388](pic.assets/image-20250730105042388.png) + +###### AT指令固件包 + +AT![image-20250730105345301](pic.assets/image-20250730105345301.png) + +##### 配置固件包: + +mqtt默认即可,不需启动示例 + +![image-20250730105131340](pic.assets/image-20250730105131340.png) + +esp8266,启动sample,填写自己的wifi账号和密码,并修改缓存大小 + +![](pic.assets/image-20250730114613709.png) + + + +#### 修改软件包 + +##### 串口部分 + +###### kconfig设置 + +![image-20250730105755127](pic.assets/image-20250730105755127.png) + +使用at指令时防止数据溢出 + +![image-20250730105914040](pic.assets/image-20250730105914040.png) + +开启uart5,给esp8266的端口 + + + +###### 修改代码 + +![image-20250730115240398](pic.assets/image-20250730115240398.png) + +![image-20250730110300592](pic.assets/image-20250730110300592.png) + +查看驱动版本,如不是2025.5.2更新,则替换代码https://github.com/RT-Thread-Studio/sdk-bsp-cy8c624-infineon-evaluationkit/blob/main/libraries/HAL_Drivers/drv_uart.c + + + +## 代码 + +配置服务器参数 + +```c +#define MQTT_Uri "tcp://xxxx" // MQTT服务器的地址和端口号 +#define ClientId "xxx" // ClientId需要唯一 +#define USERNAME "xxx" // 用户名 +#define PASSWORD "xxx" // 用户名对应的密码 +``` + +mqtt配置 + +```c +/* 定义一个MQTT客户端结构体 */ +static MQTTClient client; + + /* 对MQTT客户端结构体变量进行配置 */ + client.isconnected = 0; + client.uri = MQTT_Uri; + + /* 配置MQTT的连接参数 */ + MQTTPacket_connectData condata = MQTTPacket_connectData_initializer; + memcpy(&client.condata, &condata, sizeof(condata)); + client.condata.clientID.cstring = ClientId; + client.condata.keepAliveInterval = 30; + client.condata.cleansession = 1; + client.condata.username.cstring = (char*)USERNAME; + client.condata.password.cstring = (char*)PASSWORD; + + + /* 为mqtt申请内存 */ + client.buf_size = client.readbuf_size = 1024; + client.buf = rt_calloc(1, client.buf_size); + client.readbuf = rt_calloc(1, client.readbuf_size); + if (!(client.buf && client.readbuf)) + { + rt_kprintf("no memory for MQTT client buffer!\r\n"); + return -1; + } + /* 设置回调函数 */ + client.connect_callback = mqtt_connect_callback; + client.online_callback = mqtt_online_callback; + client.offline_callback = RT_NULL; + + /* 订阅一个主题,并设置其回调函数 */ + client.messageHandlers[0].topicFilter = rt_strdup("BearPi_Sub"); + client.messageHandlers[0].callback = mqtt_sub_callback; + client.messageHandlers[0].qos = QOS0; + + /* 设置默认的回调函数 */ + client.defaultMessageHandler = mqtt_sub_default_callback; + + /* 启动 mqtt client */ + paho_mqtt_start(&client); + +``` + +回调函数设置;仅供参考 + +```c +/* 收到订阅主题的消息时的回调函数*/ +static void mqtt_sub_callback(MQTTClient *c, MessageData *msg_data) +{ + *((char *)msg_data->message->payload + msg_data->message->payloadlen) = '\0'; + rt_kprintf("Receive topic: %.*s, message data:\r\n", msg_data->topicName->lenstring.len, msg_data->topicName->lenstring.data); + rt_kprintf("%.*s\r\n", msg_data->message->payloadlen, (char *)msg_data->message->payload); +} + +/* 默认的订阅回调函数,如果有订阅的 Topic 没有设置回调函数,则使用该默认回调函数 */ +static void mqtt_sub_default_callback(MQTTClient *c, MessageData *msg_data) +{ + *((char *)msg_data->message->payload + msg_data->message->payloadlen) = '\0'; + rt_kprintf("Receive topic: %.*s, message data:\r\n", msg_data->topicName->lenstring.len, msg_data->topicName->lenstring.data); + rt_kprintf("%.*s\r\n", msg_data->message->payloadlen, (char *)msg_data->message->payload); +} + +/* 连接成功回调函数 */ +static void mqtt_connect_callback(MQTTClient *c) +{ + rt_kprintf("mqtt connect success! \r\n"); +} + +/* 上线回调函数 */ +static void mqtt_online_callback(MQTTClient *c) +{ + rt_kprintf("mqtt online \r\n"); + paho_mqtt_publish(&client, QOS1, "/topic/humiture", "{\"name:fjp\",\"study:keep up the good work\"}"); +} +``` + + + +测试 + +可在main线程:调用mqtt_test(); + +![image-20250730220636531](pic.assets/image-20250730220636531.png) + +串口打印:方便查看 + +![image-20250730220740045](pic.assets/image-20250730220740045.png) \ No newline at end of file diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\345\233\233\345\244\251\344\275\234\344\270\232/drv_hello.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\345\233\233\345\244\251\344\275\234\344\270\232/drv_hello.c" new file mode 100644 index 0000000000000000000000000000000000000000..0fe7ebf41aa0eb5f5312a195f6343aa49946608b --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\344\275\234\344\270\232/\347\254\254\345\233\233\345\244\251\344\275\234\344\270\232/drv_hello.c" @@ -0,0 +1,132 @@ + +#include +#include +#include + +#include +#include "drv_config.h" + +//#define DRV_DEBUG +#define LOG_TAG "drv.hello" +#include + + +#include "drv_hello.h" + + +static struct hello_dev* hello_devs[100]; +static int hello_dev_cnt; + + +int register_hello_devs(struct hello_dev*dev) +{ + if(hello_dev_cnt<100) + { + hello_devs[hello_dev_cnt++] = dev; + return 0; + } + else + return -1; +} + +struct hello_dev* get_hello_devs(char* name) +{ + int i; + for(i=0;i<100;i++) + { + if(strcmp(name,hello_devs[i]->name) == 0) + return hello_devs[i]; + } + + return NULL; +} +static rt_size_t hello_write (rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size) +{ + char name[10]; + char word[10]; + int len; + struct hello_dev* hello_dev; + char*str = strstr(buffer,","); + /* 解析buffer,格式为hello,word */ + if(!str) + { + rt_set_errno(-RT_ERROR); + rt_kprintf("string format err\n"); + return 0; + } + len = str - (char*)buffer; + + if(len > 10) + len = 10; + + strncpy(name,buffer,len); + name[len] = '\0'; + + str++; + len = 0; + while(*str && (len<10)) + { + word[len++] = *str; + str++; + } + if(len == 10) + len--; + word[len] = '\0'; + +/* 根据设备name 找到设备 */ + hello_dev = get_hello_devs(name); + if(!hello_dev) + { + rt_kprintf("get hello_dev(%s)error\n",name); + rt_set_errno(-RT_ERROR); + return 0; + } + hello_dev->say(word); + + return size; +} + + +static struct rt_device hello_drv; + + +/* operations */ +#ifdef RT_USING_DEVICE_OPS +const static struct rt_device_ops hello_ops = +{ + RT_NULL, + RT_NULL, + RT_NULL, + RT_NULL, + hello_write, + RT_NULL, +}; +#endif + +static int drv_hello_init(void) +{ + int ret; + + hello_drv.type = RT_Device_Class_Miscellaneous; + hello_drv.rx_indicate = RT_NULL; + hello_drv.tx_complete = RT_NULL; + +#ifdef RT_USING_DEVICE_OPS + hello_drv.ops = &hello_ops; +#else + hello_drv.init = RT_NULL; + hello_drv.open = RT_NULL; + hello_drv.close = RT_NULL; + hello_drv.read = RT_NULL; + hello_drv.write = hello_write; + hello_drv.control = RT_NULL; +#endif + + ret = rt_device_register(&hello_drv, "hello", RT_DEVICE_FLAG_RDWR); + + return ret; + +} + +INIT_BOARD_EXPORT(drv_hello_init); + diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/psoc_last.zip" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/psoc_last.zip" new file mode 100644 index 0000000000000000000000000000000000000000..7be7918496dd14da2b41b5748c58a4e62fb0c225 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/psoc_last.zip" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/SConscript" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/SConscript" new file mode 100644 index 0000000000000000000000000000000000000000..4699367457793396d45fa90b340c230273e478e2 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/SConscript" @@ -0,0 +1,18 @@ +from building import * +import os + +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd] + +if GetDepend(['PKG_USING_RTDUINO']) and not GetDepend(['RTDUINO_NO_SETUP_LOOP']): + src += ['arduino_main.cpp'] + +group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) + +list = os.listdir(cwd) +for item in list: + if os.path.isfile(os.path.join(cwd, item, 'SConscript')): + group = group + SConscript(os.path.join(item, 'SConscript')) + +Return('group') \ No newline at end of file diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_main.cpp" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_main.cpp" new file mode 100644 index 0000000000000000000000000000000000000000..124dde1903346d70b4944e935f0e8b56b1059542 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_main.cpp" @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2006-2024, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-08-16 LZerro first version + */ + +#include + +void setup(void) +{ + /* put your setup code here, to run once: */ + Serial.begin(); +} + +void loop(void) +{ + /* put your main code here, to run repeatedly: */ + Serial.println("Hello Arduino!"); + delay(800); +} diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_pinout/README.md" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_pinout/README.md" new file mode 100644 index 0000000000000000000000000000000000000000..2bc7ffe75d525da19c8ce6ba76199c5b42e68f8f --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_pinout/README.md" @@ -0,0 +1,43 @@ +# board_default 开发板的Arduino生态兼容说明 + +## 1 RTduino - RT-Thread的Arduino生态兼容层 + +board_default 开发板已经完整适配了[RTduino软件包](https://github.com/RTduino/RTduino),即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作该BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino)。 + +### 1.1 如何开启针对本BSP的Arduino生态兼容层 + +Env 工具下敲入 menuconfig 命令,或者 RT-Thread Studio IDE 下选择 RT-Thread Settings: + +```Kconfig +Hardware Drivers Config ---> + Onboard Peripheral Drivers ---> + [*] Compatible with Arduino Ecosystem (RTduino) +``` + +## 2 Arduino引脚排布 + +更多引脚布局相关信息参见 [pins_arduino.c](pins_arduino.c) 和 [pins_arduino.h](pins_arduino.h)。 + +| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 | +| ------------------- | --------- | ---- | ------------------------------------------------------------------------- | +| 0 (D0) | BSP_IO_PORT_06_PIN_04 | 否 | Serial-RX,默认被RT-Thread的UART设备框架uart6接管 | +| 1 (D1) | BSP_IO_PORT_06_PIN_05 | 否 | Serial-TX,默认被RT-Thread的UART设备框架uart6接管 | +| 2 (D2) | BSP_IO_PORT_05_PIN_00 | 否 | | +| 3 (D3) | BSP_IO_PORT_05_PIN_01 | 否 | PWM0-CH0,默认被RT-Thread的PWM设备框架pwm0接管 | +| 4 (D4) | BSP_IO_PORT_11_PIN_02 | 否 | | +| 5 (D5) | BSP_IO_PORT_11_PIN_03 | 否 | PWM0-CH0,默认被RT-Thread的PWM设备框架pwm0接管 | +| 6 (D6) | BSP_IO_PORT_11_PIN_04 | 否 | PWM0-CH0,默认被RT-Thread的PWM设备框架pwm0接管 | +| 7 (D7) | BSP_IO_PORT_11_PIN_05 | 否 | | +| 8 (D8) | BSP_IO_PORT_11_PIN_06 | 否 | | +| 9 (D9) | BSP_IO_PORT_05_PIN_07 | 否 | PWM0-CH0,默认被RT-Thread的PWM设备框架pwm0接管 | +| 10 (D10) | BSP_IO_PORT_00_PIN_05 | 否 | | +| 11 (D11) | BSP_IO_PORT_00_PIN_02 | 否 | SPI0-MOSI,默认被RT-Thread的SPI设备框架spi0接管 | +| 12 (D12) | BSP_IO_PORT_00_PIN_03 | 否 | SPI0-MISO,默认被RT-Thread的SPI设备框架spi0接管 | +| 13 (D13) | BSP_IO_PORT_00_PIN_04 | 否 | SPI0-SCK,默认被RT-Thread的SPI设备框架spi0接管 | +| 14 (D14) | BSP_IO_PORT_08_PIN_01 | 否 | I2C0-SDA,默认被RT-Thread的I2C设备框架i2c0接管 | +| 15 (D15) | BSP_IO_PORT_08_PIN_00 | 否 | I2C0-SCL,默认被RT-Thread的I2C设备框架i2c0接管 | + +> 注意: +> +> 1. xxxxxxxxx +> 2. xxxxxxxxx diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_pinout/SConscript" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_pinout/SConscript" new file mode 100644 index 0000000000000000000000000000000000000000..d6ff4e1030f032553eca1824371b9a3cf460bcfe --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_pinout/SConscript" @@ -0,0 +1,11 @@ +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') + Glob('*.cpp') +inc = [cwd] + +print(cwd) + +group = DefineGroup('RTduino', src, depend = ['PKG_USING_RTDUINO'], CPPPATH = inc) + +Return('group') diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_pinout/pins_arduino.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_pinout/pins_arduino.c" new file mode 100644 index 0000000000000000000000000000000000000000..64f3a59b21ee02f49c15f70dd2d7dc73f17b2850 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_pinout/pins_arduino.c" @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2006-2024, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-08-16 LZerro first version + */ + +#include +#include "drv_gpio.h" +#include "pins_arduino.h" + +/* + * {Arduino Pin, RT-Thread Pin [, Device Name, Channel]} + * [] means optional + * Digital pins must NOT give the device name and channel. + * Analog pins MUST give the device name and channel(ADC, PWM or DAC). + * Arduino Pin must keep in sequence. + */ +const pin_map_t pin_map_table[]= +{ + {D00, GET_PIN(6, 4), "uart6"}, /* Serial6-RX */ + {D01, GET_PIN(6, 5), "uart6"}, /* Serial6-TX */ + {D2, GET_PIN(5, 0)}, + {D3, GET_PIN(5, 1), "pwm0", 4}, /* PWM */ + {D4, GET_PIN(11, 2)}, + {D5, GET_PIN(11, 3), "pwm0", 2}, /* PWM */ + {D6, GET_PIN(11, 4), "pwm0", 3}, + {D7, GET_PIN(11, 5)}, + {D8, GET_PIN(5, 6)}, + {D9, GET_PIN(5, 7), "pwm0", 7}, /* PWM */ + {D10, GET_PIN(0, 5)}, /* SPI0_CS*/ + {D11, GET_PIN(0, 2), "spi0"}, /* SPI0_MOSI */ + {D12, GET_PIN(0, 3), "spi0"}, /* SPI0_MISO */ + {D13, GET_PIN(0, 4), "spi0"}, /* SPI_SCK */ + {D14, GET_PIN(8, 1), "i2c4"}, /* I2C-SDA (Soft Wire) */ + {D15, GET_PIN(8, 0), "i2c4"}, /* I2C-SCL (Soft Wire) */ +}; diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_pinout/pins_arduino.h" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_pinout/pins_arduino.h" new file mode 100644 index 0000000000000000000000000000000000000000..d56dfea9bde652bb7e4c453813811c88f0ea3fc6 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/arduino_pinout/pins_arduino.h" @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2006-2024, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-08-16 LZerro first version + */ + +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +/* pins alias. Must keep in sequence */ +#define D00 (0) +#define D01 (1) +#define D2 (2) +#define D3 (3) +#define D4 (4) +#define D5 (5) +#define D6 (6) +#define D7 (7) +#define D8 (8) +#define D9 (9) +#define D10 (10) +#define D11 (11) +#define D12 (12) +#define D13 (13) +#define D14 (14) +#define D15 (15) + +#define RTDUINO_PIN_MAX_LIMIT D15 /* pin number max limit check */ + +#define F_CPU 150000000L /* CPU:150MHz */ + +// #define LED_BUILTIN D0 /* Default Built-in LED */ + +/* i2c0 : P08.01-SDA P08.00-SCL */ +#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c4" + +/* spi0 : P0.04-SCK P00.03-MISO P00.02-MOSI */ +#define SS D10 /* Chip select pin of default spi */ +#define RTDUINO_DEFAULT_SPI_BUS_NAME "spi0" + +#endif /* Pins_Arduino_h */ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/dev_control.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/dev_control.c" new file mode 100644 index 0000000000000000000000000000000000000000..c3b432da2b4de81c742f81628c092cd9652ce116 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/dev_control.c" @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2025-08-08 HP the first version + */ + + #include "dev_control.h" + +rt_mq_t touch_mq; +rt_mutex_t message_mutex; +dev_message_t g_dev_message; + + +static rt_thread_t devctrl_thread; + +static rt_timer_t buzz_timer; +static struct rt_device_pwm *pwm_buzz; +static struct rt_device_pwm *pwm_led; + +static uint8_t led_brightness_map[5] ={90,45,20,5,0}; + +static note_t buzz_notes[] = +{ + {262, run_ms}, /* do */ + {294, run_ms}, /* re */ + {330, run_ms}, /* mi */ + {349, run_ms}, /* fa */ + {392, run_ms}, /* so */ +}; + + +/* buzzer 软件定时器 控制播放时间 */ +static void buzz_timer_callback(void* parameter) +{ + if (pwm_buzz) + { + rt_pwm_disable(pwm_buzz, PWM_BUZZ_CHANNEL); + } +} + + +void dev_state_init(void) +{ + rt_pwm_disable(pwm_buzz,PWM_BUZZ_CHANNEL); + rt_pwm_disable(pwm_led, PWM_LED_CHANNEL); +} + +void led_bright_ctrl(uint8_t brightness) +{ + if (brightness > 100) brightness = 100; + + + rt_pwm_set(pwm_led, PWM_LED_CHANNEL, PWM_LED_PERIOD_NS, GET_DUTY_CYCLE(brightness)); + rt_pwm_enable(pwm_led, PWM_LED_CHANNEL); + + if (brightness == 0) + { + rt_pwm_disable(pwm_led, PWM_LED_CHANNEL); + } +} + +void buzz_play_ctrl(uint32_t note_index) +{ + note_t note = buzz_notes[note_index]; + if (note.freq == 0) + { + rt_pwm_disable(pwm_buzz, PWM_BUZZ_CHANNEL); + } + else + { + uint32_t period_ns = 1000000000 / note.freq; + uint32_t pulse_ns = period_ns / 2; + rt_tick_t run_tick; + + rt_pwm_set(pwm_buzz, PWM_BUZZ_CHANNEL, period_ns, pulse_ns); + rt_pwm_enable(pwm_buzz, PWM_BUZZ_CHANNEL); + + run_tick = rt_tick_from_millisecond(note.duration); + + rt_timer_control(buzz_timer, RT_TIMER_CTRL_SET_TIME, &run_tick); + rt_timer_start(buzz_timer); + } +} + + +static void dev_ctrl_thread_entry(void*parm) +{ + while(1) + { + touch_message_t rx_msg; + if(rt_mq_recv(touch_mq, &rx_msg, sizeof(touch_message_t),RT_WAITING_FOREVER)); + { + control_mode_e now_mode; + + rt_mutex_take(message_mutex, RT_WAITING_FOREVER); + now_mode = g_dev_message.mode; + rt_mutex_release(message_mutex); + + if(rx_msg.gesture == GESTURE_LONG_PRESS) + { + led_bright_ctrl(0); + rt_pwm_disable(pwm_buzz,PWM_BUZZ_CHANNEL); + //长按一次切换控制模式 + now_mode = (now_mode == MODE_LED_CONTROL) ? MODE_BUZZER_CONTROL : MODE_LED_CONTROL; + } + else + { + switch(now_mode) + { + case MODE_LED_CONTROL: + if(rx_msg.gesture == GESTURE_TAP) + { + if(rx_msg.sensor_id < sizeof(led_brightness_map) / sizeof(led_brightness_map[0])) + { + led_bright_ctrl(led_brightness_map[rx_msg.sensor_id]); + } + } + break; + case MODE_BUZZER_CONTROL: + if (rx_msg.gesture == GESTURE_TAP) + { + buzz_play_ctrl(rx_msg.sensor_id); + } + break; + + } + + } + rt_mutex_take(message_mutex, RT_WAITING_FOREVER); + g_dev_message.mode = now_mode; + // g_dev_message.event = rx_msg; + rt_mutex_release(message_mutex); + } + + } +} + +int dev_control_init(void) +{ + + + pwm_buzz= (struct rt_device_pwm *)rt_device_find(PWM_BUZZ_NAME); + pwm_led= (struct rt_device_pwm *)rt_device_find(PWM_LED_NAME); + + + if (!pwm_buzz || !pwm_led) + { + rt_kprintf("create pwmdevice error\n"); + return -RT_ERROR; + } + + /* 设备初始化 */ + dev_state_init(); + + buzz_timer = rt_timer_create("buzz_timer", + buzz_timer_callback, RT_NULL, + rt_tick_from_millisecond(run_ms), + RT_TIMER_FLAG_ONE_SHOT); + if (buzz_timer == RT_NULL) + { + rt_kprintf("create buzz_timer error \n"); + return -RT_ERROR; + } + // 创建互斥锁 + message_mutex = rt_mutex_create("message_mutex", RT_IPC_FLAG_FIFO); + if (message_mutex == RT_NULL) + { + rt_kprintf("create message_mutex error\n"); + return -RT_ERROR; + } + + //信息块初始化 + memset(&g_dev_message, 0, sizeof(dev_message_t)); + g_dev_message.mode = MODE_LED_CONTROL; + //g_dev_message.event.gesture = 0xf; //1 + devctrl_thread = rt_thread_create("devctrl_thread", dev_ctrl_thread_entry, + RT_NULL, 2048, 9,10); + + if(devctrl_thread != RT_NULL) + { + rt_thread_startup(devctrl_thread); + return RT_EOK; + } + else + { + rt_kprintf("create error dev_Crtl\n"); + } +} diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/dev_control.h" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/dev_control.h" new file mode 100644 index 0000000000000000000000000000000000000000..f7c23697ba059d494f4878d66698dc9193c215c3 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/dev_control.h" @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2025-08-09 HP the first version + */ +#ifndef APPLICATIONS_DEV_CONTROL_H_ +#define APPLICATIONS_DEV_CONTROL_H_ + +#include "input_touch.h" + +#define PWM_LED_NAME "pwm0" +#define PWM_LED_CHANNEL 0 +#define PWM_LED_PERIOD_NS (1 * 1000 * 1000) // 1kHz +#define GET_DUTY_CYCLE(x) (1 * 1000 * 1000 - x * 10 * 1000) + +#define PWM_BUZZ_NAME "pwm0" +#define PWM_BUZZ_CHANNEL 7 + +#define run_ms 1000 +typedef struct +{ + uint16_t freq; + uint16_t duration; +} note_t; + +int dev_control_init(void); + + +#endif /* APPLICATIONS_DEV_CONTROL_H_ */ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/display_oled.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/display_oled.c" new file mode 100644 index 0000000000000000000000000000000000000000..473c0b92430fd05ae585543d52043c3499228e10 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/display_oled.c" @@ -0,0 +1,113 @@ +/* +#include + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2025-08-05 HP the first version + */ + +#include "display_oled.h" + +rt_mq_t display_mq; + +rt_thread_t display_thread = RT_NULL; + + + +static const char* gesture_to_string(touch_gesture_e gesture) +{ + switch(gesture) + { + case GESTURE_TOUCH_DOWN: return "down"; + case GESTURE_TOUCH_UP: return "up"; + case GESTURE_TAP: return "tap"; + case GESTURE_SWIPE_LEFT: return "left"; + case GESTURE_SWIPE_RIGHT: return "right"; + case GESTURE_LONG_PRESS: return "long"; + default: return "wait"; + } +} + + + static void display_thread_entry(void* parm) + { + char date_str[16]; + char time_str[16]; + char touch_str[32]; + char control_str[32]; + snprintf(touch_str,sizeof(touch_str),"W:-- S:-- G:--"); + + while(1) + { + dev_message_t display_dev; + rt_mutex_take(message_mutex, RT_WAITING_FOREVER); + display_dev = g_dev_message; + rt_mutex_release(message_mutex); + + /* --- new--- */ + + touch_message_t rx_msg; + + rt_err_t result = rt_mq_recv(display_mq, &rx_msg, sizeof(touch_message_t), rt_tick_from_millisecond(200)); + + if (result >= RT_EOK) + { + snprintf(touch_str, sizeof(touch_str), "W:%-2lu S:%-2lu G:%s", + rx_msg.widget_id, + rx_msg.sensor_id, + gesture_to_string(rx_msg.gesture)); + } + + + time_t now = time(NULL); + struct tm *p_tm = localtime(&now); + if (p_tm->tm_year > (2024-1900)) // 检查NTP是否同步 + { + strftime(date_str, sizeof(date_str), "%Y-%m-%d", p_tm); + strftime(time_str, sizeof(time_str), "%H:%M:%S", p_tm); + } + else + { + sprintf(date_str, "NTP Syncing..."); + sprintf(time_str, " "); + } + + snprintf(control_str, sizeof(control_str), "Control: %s", + (display_dev.mode == MODE_LED_CONTROL) ? "LED" : "Buzzer"); + +// snprintf(touch_str, sizeof(touch_str), "W:%-2lu S:%-2lu G:%s", +// display_state.event.widget_id, +// display_state.event.sensor_id, +// gesture_to_string(display_state.event.gesture)); + + // 更新OLED屏幕 + ssd1306_Fill(Black); + ssd1306_SetCursor(0, 2); + ssd1306_WriteString(date_str, Font_7x10, White); + ssd1306_SetCursor(0, 18); + ssd1306_WriteString(time_str, Font_7x10, White); + ssd1306_SetCursor(0, 34); + ssd1306_WriteString(control_str, Font_7x10, White); + ssd1306_SetCursor(0, 50); + ssd1306_WriteString(touch_str, Font_7x10, White); + ssd1306_UpdateScreen(); + rt_thread_mdelay(200); // 每秒刷新5次 + } + } + + int display_oled_init(void) + { + ssd1306_Init(); + + display_thread = rt_thread_create("display_thread", display_thread_entry, + RT_NULL, 1024, 10,10); + + if(display_thread !=RT_NULL) + { + rt_thread_startup(display_thread); + return RT_EOK; + } + } diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/display_oled.h" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/display_oled.h" new file mode 100644 index 0000000000000000000000000000000000000000..a7d3929c3fc58a597660b5e6fdd5f89446d7693f --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/display_oled.h" @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2025-08-05 HP the first version + */ +#ifndef APPLICATIONS_DISPLAY_OLED_H_ +#define APPLICATIONS_DISPLAY_OLED_H_ + +#include "input_touch.h" +#include +#include +#include +#include + +int display_oled_init(void); + + +#endif /* APPLICATIONS_DISPLAY_OLED_H_ */ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/input_touch.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/input_touch.c" new file mode 100644 index 0000000000000000000000000000000000000000..58565586e2a172aca19833bf59de7dadec8ea045 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/input_touch.c" @@ -0,0 +1,343 @@ +#include + + +//static volatile rt_tick_t capsense_begaintime = 0;//信息处理计时 +//扫描完成信号 +static rt_sem_t tran_semp = RT_NULL; +//滑条处理线程 +static rt_thread_t sld_thread = RT_NULL; + + + +/* 连接成功回调函数 */ +static void mqtt_connect_callback(MQTTClient *c) +{ + rt_kprintf("mqtt connect success! \r\n"); +} + +/* 上线回调函数 */ +static void mqtt_online_callback(MQTTClient *c) +{ + rt_kprintf("mqtt online \r\n"); +} + +/* 创建客户端 */ +static MQTTClient client; + + +static int mqtt_init_user(void) +{ + client.isconnected = 0; + client.uri = MQTT_Uri; + + MQTTPacket_connectData condata = MQTTPacket_connectData_initializer; + memcpy(&client.condata, &condata, sizeof(condata)); + client.condata.clientID.cstring = ClientId; + client.condata.keepAliveInterval = 30; + client.condata.cleansession = 1; + client.condata.username.cstring = (char*)USERNAME; + client.condata.password.cstring = (char*)PASSWORD; + + client.buf_size = client.readbuf_size = 1024; + client.buf = rt_calloc(1, client.buf_size); + client.readbuf = rt_calloc(1, client.readbuf_size); + if (!(client.buf && client.readbuf)) + { + rt_kprintf("no memory for MQTT client buffer!\r\n"); + return -1; + } + + client.connect_callback = mqtt_connect_callback; + client.online_callback = mqtt_online_callback; + client.offline_callback = RT_NULL; + + client.messageHandlers[0].topicFilter = rt_strdup("topic/psoc"); + client.messageHandlers[0].callback = RT_NULL; + client.messageHandlers[0].qos = QOS1; + + client.defaultMessageHandler = RT_NULL; + + paho_mqtt_start(&client); +} + +INIT_APP_EXPORT(mqtt_init_user); + + +static void capsense_isr(void) +{ + rt_interrupt_enter();//中断上下文 + Cy_CapSense_InterruptHandler(CYBSP_CSD_HW, &cy_capsense_context); + rt_interrupt_leave(); +} + + +void capsense_callback(cy_stc_active_scan_sns_t *ptrActiveScan) +{ + rt_sem_release(tran_semp);//capsense处理完成 +} + + + +static uint32_t capsense_init_user(void) +{ + uint32_t status = CYRET_SUCCESS; + /* 中断配置 */ + static const cy_stc_sysint_t capSense_intr_config = + { + .intrSrc = csd_interrupt_IRQn, + .intrPriority = CAPSENSE_INTR_PRIORITY, + }; + /* 初始化硬件模块 */ + status = Cy_CapSense_Init(&cy_capsense_context); + /* 判断是否初始化成功 */ + if (CYRET_SUCCESS != status) + { + return status; + } + /* 设置并使能capsense中断 */ + cyhal_system_set_isr(csd_interrupt_IRQn, csd_interrupt_IRQn, CAPSENSE_INTR_PRIORITY, &capsense_isr); + NVIC_ClearPendingIRQ(capSense_intr_config.intrSrc); + NVIC_EnableIRQ(capSense_intr_config.intrSrc); + /* 使能capsence模块 */ + status = Cy_CapSense_Enable(&cy_capsense_context); + if (CYRET_SUCCESS != status) + { + return status; + } + /* 注册触摸完成的回调函数capsense_callback */ + status = Cy_CapSense_RegisterCallback(CY_CAPSENSE_END_OF_SCAN_E, + capsense_callback, &cy_capsense_context); + if (CYRET_SUCCESS != status) + { + return status; + } + + return status; +} + + +void Slider_Init(void) +{ + cy_rslt_t result; + result = capsense_init_user(); + if (CYRET_SUCCESS != result) + { + /* Halt the CPU if CapSense initialization failed */ + rt_kprintf("create capsense_init error\n"); + } + Cy_CapSense_ScanAllWidgets(&cy_capsense_context);//扫描启动 + + tran_semp = rt_sem_create("slider_sem", 0, RT_IPC_FLAG_PRIO); + if (tran_semp == RT_NULL) + { + rt_kprintf("create tran_semp error\n"); + } +} + + + +extern cy_stc_capsense_context_t cy_capsense_context; +//存widget状态信息 +static widget_state_t g_widget_states[WIDGET_COUNT]; + +static rt_bool_t g_state_init = RT_FALSE; + +rt_mq_t touch_mq = RT_NULL; + + +//触摸控制设备的信息处理function +static void send_touch_dev(uint32_t widget_id,uint32_t sensor_id,touch_gesture_e gesture) +{ + touch_message_t msg; + msg.gesture = gesture; + msg.sensor_id = sensor_id; + msg.widget_id = widget_id; + rt_err_t result1 = rt_mq_send(touch_mq,&msg, sizeof(touch_message_t)); + rt_err_t result2 = rt_mq_send(display_mq, &msg, sizeof(touch_message_t)); + if((result1 != RT_EOK) || (result2 != RT_EOK))//1 + { + rt_kprintf("send_touch_message send error\r\n"); + } +} + + +/* + use:发布触摸信息到MQTT服务器和设备控制端 +*/ +static void publish_gesture_event(uint32_t widget_id,uint32_t sensor_id, touch_gesture_e gesture) +{ + char payload_buffer[120]; + const char* event_string = "NULL"; + //根据序号转化为字符串 + switch(gesture) + { + case GESTURE_TOUCH_DOWN: event_string = "down"; break; + case GESTURE_TOUCH_UP: event_string = "up"; break; + case GESTURE_TAP: event_string = "tap"; break; + case GESTURE_SWIPE_LEFT: event_string = "swipe_left"; break; + case GESTURE_SWIPE_RIGHT: event_string = "swipe_right"; break; + case GESTURE_LONG_PRESS: event_string = "long_press"; break; + default: break; + } + snprintf(payload_buffer, sizeof(payload_buffer), + "{\"widget\":%lu, \"sensor\":%lu, \"event\":\"%s\"}", + widget_id, sensor_id, event_string); + //转发信息 + send_touch_dev(widget_id,sensor_id,gesture); + paho_mqtt_publish(&client, QOS1, "/topic/psoc", payload_buffer); +} + + +/* + use:capsense数据处理端,分析获取触摸位置和手势判断 +*/ + +void process_id_gestures(void) +{ + + uint32_t widget_id; + const rt_tick_t long_press_ticks = rt_tick_from_millisecond(LONG_PRESS_THRESHOLD_MS); + + if (!g_state_init) + { + memset(g_widget_states, 0, sizeof(g_widget_states)); + g_state_init = RT_TRUE; + } + + Cy_CapSense_ScanAllWidgets(&cy_capsense_context); + while(Cy_CapSense_IsBusy(&cy_capsense_context) != CY_CAPSENSE_NOT_BUSY); + Cy_CapSense_ProcessAllWidgets(&cy_capsense_context); + + + for (widget_id = 0; widget_id < WIDGET_COUNT; widget_id++) + { + //获取触摸widget + uint8_t cur_statu = Cy_CapSense_IsWidgetActive(widget_id, &cy_capsense_context); + uint16_t cur_pos = 0; + widget_state_t* state = &g_widget_states[widget_id]; + + if (cur_statu) + { + // 获取Widget的位置信息 + const cy_stc_capsense_touch_t* touch_info = Cy_CapSense_GetTouchInfo(widget_id, &cy_capsense_context); + //记录在x轴上的变化位置确定手势类型 + if (touch_info != NULL && touch_info->numPosition > 0) + { + cur_pos = touch_info->ptrPosition[0].x; + } + //获取触摸滑块id + for(uint32_t i = 0; i sensor_id = i; + break; + } + } + } + + //根据widget进行状态机分析 + + //当前被触摸 + if (cur_statu && !state->is_touched) + { + state->is_touched = 1; + state->long_press = 0; + state->start_pos = cur_pos; + state->last_pos = cur_pos; + state->touch_down_tick = rt_tick_get(); + + rt_kprintf("Widget %lu (Sensor %lu): Touch Down time %d\r\n", widget_id, state->sensor_id); + publish_gesture_event(widget_id,state->sensor_id, GESTURE_TOUCH_DOWN ); + } + //触摸结束 + else if (!cur_statu && state->is_touched) + { + state->is_touched = 0; + + if (state->long_press) + { + publish_gesture_event(widget_id,state->sensor_id,GESTURE_TOUCH_UP); + } + else + { + touch_gesture_e final_gesture = GESTURE_TAP; + int16_t delta_x = state->last_pos - state->start_pos; + + if (delta_x > SWIPE_THRESHOLD) { + final_gesture = GESTURE_SWIPE_RIGHT; + } else if (delta_x < -SWIPE_THRESHOLD) { + final_gesture = GESTURE_SWIPE_LEFT; + } + publish_gesture_event(widget_id, state->sensor_id,final_gesture); + } + } + //长按 + else if (cur_statu) + { + state->last_pos = cur_pos; + //1.是否达到时间 2.触摸位移不超过滑动位移 + if (!state->long_press && + ((rt_tick_get() - state->touch_down_tick) >= long_press_ticks) && + (abs(state->last_pos - state->start_pos) < SWIPE_THRESHOLD)) + { + state->long_press = 1; + rt_kprintf("Widget %lu (Sensor %lu): Long Press\r\n", widget_id, state->sensor_id); + publish_gesture_event(widget_id, state->sensor_id,GESTURE_LONG_PRESS); + } + } + + } +} + + + + + + +static void Slider_thread_entry(void *parameter) +{ + Slider_Init(); + for (;;) + { + //等待触发信息 + rt_sem_take(tran_semp, RT_WAITING_FOREVER); + // 处理所有CapSense控件的数据 + Cy_CapSense_ProcessAllWidgets(&cy_capsense_context); + // 处理触摸输入 + process_id_gestures(); + // 运行CapSense Tuner,用于调试 + //Cy_CapSense_RunTuner(&cy_capsense_context); + // 启动下一次扫描 + Cy_CapSense_ScanAllWidgets(&cy_capsense_context); + rt_thread_mdelay(50); + } +} + +int slider_thread_init(void) +{ + rt_err_t ret = RT_EOK; + + //触摸信息队列 + touch_mq = rt_mq_create("touch_mq", sizeof(touch_message_t), 8, RT_IPC_FLAG_FIFO); + display_mq = rt_mq_create("display_mq", sizeof(touch_message_t), 8, RT_IPC_FLAG_FIFO); + if ((touch_mq == RT_NULL) || (display_mq == RT_NULL) ) + { + rt_kprintf("message_mq create error\r\n"); + return -1; + } + // 创建线程 + sld_thread = rt_thread_create("slider_th",Slider_thread_entry, + RT_NULL,1024,9,10); + if (sld_thread != RT_NULL) + { + rt_thread_startup(sld_thread); + } + else + { + ret = -RT_ERROR; + } + return ret; +} + + diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/input_touch.h" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/input_touch.h" new file mode 100644 index 0000000000000000000000000000000000000000..c1292edcdfa98b324bafc1dbc180a73fd7191554 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/input_touch.h" @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2025-08-05 HP the first version + */ +#ifndef APPLICATIONS_INPUT_TOUCH_H_ +#define APPLICATIONS_INPUT_TOUCH_H_ +#define CAPSENSE_INTR_PRIORITY (7u) +#define EZI2C_INTR_PRIORITY (6u) + + +#include +#include "drv_common.h" +#include +#include +#include + +#include "cy_capsense.h" + +#include "cycfg_capsense.h" +#include "paho_mqtt.h" + + +int slider_thread_init(void); + + + + +/* new */ +#define SWIPE_THRESHOLD 80 /* 滑动差值 */ +#define LONG_PRESS_THRESHOLD_MS 1000 /* 长按时间 1s*/ +#define WIDGET_COUNT 1 /* caspense */ +#define SNS_COUNT 5 /* 滑块 */ + + +#define MQTT_Uri "tcp://v3145171.ala.dedicated.aliyun.emqxcloud.cn:1883" +#define ClientId "1234" +#define USERNAME "admin2" +#define PASSWORD "123456" + + +//手势类型 +typedef enum +{ + GESTURE_TOUCH_DOWN, + GESTURE_TOUCH_UP, + GESTURE_TAP, + GESTURE_SWIPE_LEFT, + GESTURE_SWIPE_RIGHT, + GESTURE_LONG_PRESS +} touch_gesture_e; + +//触摸状态 +typedef struct +{ + uint8_t is_touched; + uint8_t long_press; + uint16_t start_pos; + uint16_t last_pos; + rt_tick_t touch_down_tick;//触摸时间记录 + uint32_t sensor_id; +} widget_state_t; + +//触摸display信息 +typedef struct +{ + uint32_t widget_id; + uint32_t sensor_id; + touch_gesture_e gesture; +}touch_message_t; + + + +// 设备控制模式 +typedef enum +{ + MODE_LED_CONTROL, + MODE_BUZZER_CONTROL +} control_mode_e; + +//设备显示信息块 +typedef struct +{ + control_mode_e mode; + // touch_message_t event; +}dev_message_t; + +extern rt_mq_t display_mq; +extern rt_mq_t touch_mq; +extern dev_message_t g_dev_message; +extern rt_mutex_t message_mutex; + + +#endif /* APPLICATIONS_INPUT_TOUCH_H_ */ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/SConscript" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/SConscript" new file mode 100644 index 0000000000000000000000000000000000000000..79d9772177a0332daef02160aa973e48161ed906 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/SConscript" @@ -0,0 +1,16 @@ +from building import * +import os + +cwd = GetCurrentDir() +group = [] +src = Glob('*.c') +CPPPATH = [cwd] + +list = os.listdir(cwd) +for d in list: + path = os.path.join(cwd, d) + if os.path.isfile(os.path.join(path, 'SConscript')): + group = group + SConscript(os.path.join(d, 'SConscript')) + +group = group + DefineGroup('LVGL-port', src, depend = ['BSP_USING_LVGL'], CPPPATH = CPPPATH) +Return('group') diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/demo/SConscript" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/demo/SConscript" new file mode 100644 index 0000000000000000000000000000000000000000..9c1b6d1ebd0ba47cd31cb54827c2c25ea10d2c65 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/demo/SConscript" @@ -0,0 +1,17 @@ +from building import * +import os + +cwd = GetCurrentDir() +group = [] +src = Glob('*.c') +CPPPATH = [cwd] + +list = os.listdir(cwd) +for d in list: + path = os.path.join(cwd, d) + if os.path.isfile(os.path.join(path, 'SConscript')): + group = group + SConscript(os.path.join(d, 'SConscript')) + +group = group + DefineGroup('LVGL-demo', src, depend = ['BSP_USING_LVGL', 'BSP_USING_LVGL_DEMO'], CPPPATH = CPPPATH) + +Return('group') diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/demo/lv_demo.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/demo/lv_demo.c" new file mode 100644 index 0000000000000000000000000000000000000000..fd30e46f96536e9d7916cee77a24e440e85760ca --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/demo/lv_demo.c" @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-10-17 Meco Man First version + * 2022-05-10 Meco Man improve rt-thread initialization process + */ + +void lv_user_gui_init(void) +{ + /* display demo; you may replace with your LVGL application at here */ + extern void lv_demo_music(void); + lv_demo_music(); +} diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/lv_conf.h" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/lv_conf.h" new file mode 100644 index 0000000000000000000000000000000000000000..ae1c4a526258bf28e6682d07f6848a8b7821a29d --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/lv_conf.h" @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2023-02-22 Rbb666 First version + */ + +#ifndef LV_CONF_H +#define LV_CONF_H + +#include + +#define LV_USE_PERF_MONITOR 1 +#define LV_COLOR_DEPTH 16 + +#ifdef PKG_USING_ILI9341 + #define LV_HOR_RES_MAX 240 + #define LV_VER_RES_MAX 320 + #define LV_COLOR_16_SWAP 1 + #define LV_DPI_DEF 99 +#endif + +#ifdef PKG_USING_LV_MUSIC_DEMO +/* music player demo */ +#define LV_USE_DEMO_RTT_MUSIC 1 +#define LV_DEMO_RTT_MUSIC_AUTO_PLAY 1 +#define LV_FONT_MONTSERRAT_12 1 +#define LV_FONT_MONTSERRAT_16 1 +#define LV_COLOR_SCREEN_TRANSP 0 +#endif /* PKG_USING_LV_MUSIC_DEMO */ + +#endif diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/lv_port_disp.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/lv_port_disp.c" new file mode 100644 index 0000000000000000000000000000000000000000..8d44148d923d4cb9cf79fa53b05a58cec51ee83c --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/lv_port_disp.c" @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2022-04-04 Rbb666 The first version + */ +#include + +#ifdef PKG_USING_ILI9341 + #include "lcd_ili9341.h" +#endif + +#define COLOR_BUFFER (LV_HOR_RES_MAX * LV_VER_RES_MAX) + +/*A static or global variable to store the buffers*/ +static lv_disp_draw_buf_t disp_buf; + +/*Descriptor of a display driver*/ +static lv_disp_drv_t disp_drv; +static struct rt_device_graphic_info info; + +/*Static or global buffer(s). The second buffer is optional*/ +static lv_color_t buf_1[COLOR_BUFFER]; + +static void disp_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p) +{ +#ifdef PKG_USING_ILI9341 + lcd_fill_array_spi(area->x1, area->y1, area->x2, area->y2, color_p); +#endif + lv_disp_flush_ready(disp_drv); +} + +void lv_port_disp_init(void) +{ +#ifdef PKG_USING_ILI9341 + spi_lcd_init(25); +#endif + /*Initialize `disp_buf` with the buffer(s). With only one buffer use NULL instead buf_2 */ + lv_disp_draw_buf_init(&disp_buf, buf_1, NULL, COLOR_BUFFER); + + lv_disp_drv_init(&disp_drv); /*Basic initialization*/ + + /*Set the resolution of the display*/ + disp_drv.hor_res = LV_HOR_RES_MAX; + disp_drv.ver_res = LV_VER_RES_MAX; + + /*Set a display buffer*/ + disp_drv.draw_buf = &disp_buf; + + /*Used to copy the buffer's content to the display*/ + disp_drv.flush_cb = disp_flush; + + /*Finally register the driver*/ + lv_disp_drv_register(&disp_drv); +} diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/lv_port_indev.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/lv_port_indev.c" new file mode 100644 index 0000000000000000000000000000000000000000..efb97a82f14e4e06dfe77e7fb072fa6ef8d39799 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/lvgl/lv_port_indev.c" @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2022-04-04 Rbb666 The first version + */ +#include +#include + +void lv_port_indev_init(void) +{ +} diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/main.c" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/main.c" new file mode 100644 index 0000000000000000000000000000000000000000..158a530515f8bff49b34a2b2e3c80e6d3189b4e0 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\345\267\245\347\250\213\344\273\243\347\240\201/\344\270\273\346\226\207\344\273\266/main.c" @@ -0,0 +1,40 @@ +/* +#include + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2022-06-29 Rbb666 first version + */ + +#include +#include +#include "display_oled.h" +#include "input_touch.h" +#include "dev_control.h" + +int main(void) +{ +/* 发布信息 */ + if(slider_thread_init() !=RT_EOK) + { + rt_kprintf("caspsense thread error\n"); + } + +/* 处理信息 */ + if((dev_control_init()) != RT_EOK) + { + rt_kprintf("dev_control thread error\n"); + } + +/* 显示信息 */ + if((display_oled_init()) != RT_EOK) + { + rt_kprintf("display thread error\n"); + } + + + +} diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250721210740643.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250721210740643.png" new file mode 100644 index 0000000000000000000000000000000000000000..769408bf916649a07bcad0508e7493d52afb91a4 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250721210740643.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250721210756229.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250721210756229.png" new file mode 100644 index 0000000000000000000000000000000000000000..9960d68065f5ef77f2f0262fa49608563ed47da1 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250721210756229.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250721210932327.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250721210932327.png" new file mode 100644 index 0000000000000000000000000000000000000000..c29717cc3cec96504935e5cfa0e0c9f7f30a8929 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250721210932327.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250721211009294.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250721211009294.png" new file mode 100644 index 0000000000000000000000000000000000000000..662375639d85e17fae9dab77b7674fd52b35a9dc Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250721211009294.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250722195430124.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250722195430124.png" new file mode 100644 index 0000000000000000000000000000000000000000..350354ff69b699cfe75f1b6e48c4e5f93ef0d995 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250722195430124.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250722195441203.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250722195441203.png" new file mode 100644 index 0000000000000000000000000000000000000000..e4fa46c62921ea62cbc35de2322e52f6d30715f6 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250722195441203.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250722195844159.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250722195844159.png" new file mode 100644 index 0000000000000000000000000000000000000000..8569ba3931c618bb69a9855d80ec2c6a34353ee3 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250722195844159.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725064318917.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725064318917.png" new file mode 100644 index 0000000000000000000000000000000000000000..9d6b95ecceffc0bd52d2260b014a51fc65462e38 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725064318917.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725065922301.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725065922301.png" new file mode 100644 index 0000000000000000000000000000000000000000..371304a8287c8a6ccd6f2657437e645a00d47bda Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725065922301.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725070225595.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725070225595.png" new file mode 100644 index 0000000000000000000000000000000000000000..cbe87cccab67f8248716b5d7ff9648b4d132179b Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725070225595.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725070325412.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725070325412.png" new file mode 100644 index 0000000000000000000000000000000000000000..c61d23c775e1a30f15c5b55797f54bc42902ee6e Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725070325412.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725070504692.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725070504692.png" new file mode 100644 index 0000000000000000000000000000000000000000..75fee45f7c100a4732f6200d305f6c9bec3c073c Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725070504692.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725071114460.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725071114460.png" new file mode 100644 index 0000000000000000000000000000000000000000..d3e1b9cc86cc51b729aa7b204e749a6c29eb497f Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725071114460.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725071146852.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725071146852.png" new file mode 100644 index 0000000000000000000000000000000000000000..b5ec0664da84383dc681c4bef7ac18b361461ffe Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725071146852.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725215048565.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725215048565.png" new file mode 100644 index 0000000000000000000000000000000000000000..78358381a56c1def90dff765dd238168c72a73e5 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725215048565.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725222357245.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725222357245.png" new file mode 100644 index 0000000000000000000000000000000000000000..ec69710caebccd8870ec67017a2c54c2deb69d61 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250725222357245.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250726124444734.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250726124444734.png" new file mode 100644 index 0000000000000000000000000000000000000000..a46111c4eee04902a2050fc29da703893c8352d6 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250726124444734.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250726124613342.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250726124613342.png" new file mode 100644 index 0000000000000000000000000000000000000000..9f38d3dd3ad332aa194dff84517ef5ac8251a8a3 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250726124613342.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250726125024101.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250726125024101.png" new file mode 100644 index 0000000000000000000000000000000000000000..545148966f18cde0109e6142d5029aff88ca91b7 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250726125024101.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250726231038191.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250726231038191.png" new file mode 100644 index 0000000000000000000000000000000000000000..a89c1da8faad5250d67d48196f12e32914e00da4 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250726231038191.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727083317783.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727083317783.png" new file mode 100644 index 0000000000000000000000000000000000000000..8ec61f456dcc402f044c6be208b068e89ec9d655 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727083317783.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727085836665.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727085836665.png" new file mode 100644 index 0000000000000000000000000000000000000000..c346ae26e335e7bf9649004235173319563ac668 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727085836665.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727111419742.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727111419742.png" new file mode 100644 index 0000000000000000000000000000000000000000..0ac7db5ae4791a90f4047163438a4fe6662aaeb8 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727111419742.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727111433117.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727111433117.png" new file mode 100644 index 0000000000000000000000000000000000000000..0ac7db5ae4791a90f4047163438a4fe6662aaeb8 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727111433117.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727215100773.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727215100773.png" new file mode 100644 index 0000000000000000000000000000000000000000..02728354c332b432880828a2e8d23830b69beeff Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727215100773.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727221022867.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727221022867.png" new file mode 100644 index 0000000000000000000000000000000000000000..3d95f23f4c0c9c545f5f0a481d3f6442679af10b Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727221022867.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727221042271.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727221042271.png" new file mode 100644 index 0000000000000000000000000000000000000000..b38250e8a2bafd55b572c3c16446417874bdea3a Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250727221042271.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730104604015.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730104604015.png" new file mode 100644 index 0000000000000000000000000000000000000000..d086cca300d8dc9c7df4441874aa99391565867f Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730104604015.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730104803634.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730104803634.png" new file mode 100644 index 0000000000000000000000000000000000000000..efc70e57dddff67bca2f250170617e6d6a3bc52c Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730104803634.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105008248.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105008248.png" new file mode 100644 index 0000000000000000000000000000000000000000..e278acc44cb13c55ac641f9cf967fc4dcf9b494c Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105008248.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105042388.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105042388.png" new file mode 100644 index 0000000000000000000000000000000000000000..2f0fdb81a079c984bbce38bcf55c3e4e6934b025 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105042388.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105131340.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105131340.png" new file mode 100644 index 0000000000000000000000000000000000000000..d5e3a34771949e709cd3c5f25953819dfd0389cc Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105131340.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105345301.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105345301.png" new file mode 100644 index 0000000000000000000000000000000000000000..2ad2b781f9fead7e42b1a2fa0a83b371e7eea208 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105345301.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105532569.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105532569.png" new file mode 100644 index 0000000000000000000000000000000000000000..240bde34719dce74b5b9b98fb6f4e4b6405613f1 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105532569.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105755127.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105755127.png" new file mode 100644 index 0000000000000000000000000000000000000000..a3fa1f3309fc1cda2c2f882c8a055ed2f87fe020 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105755127.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105914040.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105914040.png" new file mode 100644 index 0000000000000000000000000000000000000000..296911a49cf48e958c5006767c7e155d2141b38c Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730105914040.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730110300592.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730110300592.png" new file mode 100644 index 0000000000000000000000000000000000000000..b030ca158c94e96cf5668ece4a7cbccd8fbac068 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730110300592.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730110603845.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730110603845.png" new file mode 100644 index 0000000000000000000000000000000000000000..8df47c19908c91e7dc9d5cda6fffd3dd8757235a Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730110603845.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730114613709.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730114613709.png" new file mode 100644 index 0000000000000000000000000000000000000000..d0460b82569a04d70ce33f24279d247dfe397521 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730114613709.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730115133495.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730115133495.png" new file mode 100644 index 0000000000000000000000000000000000000000..308ee25bffa786942b122ca98cd12007a4a78aa4 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730115133495.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730115240398.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730115240398.png" new file mode 100644 index 0000000000000000000000000000000000000000..d22b57da9f1af5fa3aa3f302451b8e8f57158e53 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730115240398.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730115957262.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730115957262.png" new file mode 100644 index 0000000000000000000000000000000000000000..0d37d27570ba067b191bf2cf87403e93e48bc5f0 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730115957262.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730220636531.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730220636531.png" new file mode 100644 index 0000000000000000000000000000000000000000..d90c6fd50d4301358a5fafd8385cb641d809d12c Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730220636531.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730220740045.png" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730220740045.png" new file mode 100644 index 0000000000000000000000000000000000000000..225a2e5df9cc2f830573f09794111be73bbecbd5 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/pic.assets/image-20250730220740045.png" differ diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\344\270\200\345\244\251\347\254\224\350\256\260.md" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\344\270\200\345\244\251\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..875ee0aab6f1a6f7ce6c72aa1bd7e8126ab97288 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\344\270\200\345\244\251\347\254\224\350\256\260.md" @@ -0,0 +1,61 @@ + + +## env工具 + +### 环境配置 + +![image-20250721210756229](pic.assets/image-20250721210756229.png) + +放在c盘进行register,右键选择comemu here进入env + +![image-20250721210740643](pic.assets/image-20250721210740643.png) + +### 功能介绍 + +#### 内核的裁剪 + +#### env进入在rtconfig,h文件目录下 + +![image-20250721211009294](pic.assets/image-20250721211009294.png) + +![image-20250721210932327](pic.assets/image-20250721210932327.png) + +```c +menuconfig 进入配置界面 +``` + +#### 对项目进行编译和生成工程 + +```c +scons --target = xxx (xxx=mak4\mdk5\iar) +``` + +## git 工具 + +### 常用指令 + +```c +git init //创建仓库地址 +``` + +```c +git commit -m "xxx" //名称 +``` + +```c +git log // 查看历史版本 +``` + +```c +git branch -a //查看所有分支 +``` + +```c +git swtich xxx //切换分支 +``` + +### 图形化插件 + +在vscode中下载插件Git Graph + +使用参考文章[快速搞懂 Git Graph-CSDN博客](https://blog.csdn.net/weixin_43242506/article/details/123230514) \ No newline at end of file diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\344\270\211\345\244\251\347\254\224\350\256\260.md" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\344\270\211\345\244\251\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..cabe5878c20cee5f307540e22fb0b7b76354bd76 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\344\270\211\345\244\251\347\254\224\350\256\260.md" @@ -0,0 +1,83 @@ +#### IPC_FLAG声明 + +RT_IPC_FLAG_PRIO:表示唤醒优先级最高的等待线程 + RT_IPC_FLAG_FIFO:表示唤醒等待时间最长的等待线程 + +#### 消息队列 + +API: + +```c + 1/队列控制块 static rt_mq_t test_mq =RT_NULL; + 2/创建队列 rt_mq_create(); + 3/发送消息 rt_mq_send(); + 4/获取消息 rt_mq_recv(); + 5/删除队列 rt_mq_delete(); +``` + +使用: + +1. 先创建消息队列,通过句柄进行操作 +2. 采样FIFO,或者使用紧急函数将发送消息放入队列头部 +3. 获取消息时,必须定义储存地址,并传入recv,且接收消息为复制信息,需要保证存放大小 + + + +#### 邮箱 + +API + +```c +1/ 邮箱控制块 rt_mailbox_t test_mb =RT_NULL; +2/ 创建邮箱 test_mb = rt_mb_create() +3/ 发送信件 rt_mb_send(); +4/ 获取信件 rt_mb_recv(); +5/ 删除邮箱 rt_mb_delete(); +``` + +使用: + +1. 每封邮件为4字节大小,通常用于传地址,效率高,可以传递大数据时指向缓冲区的指针作为邮件 +2. 设定发送区和接收区 + + + +#### 信号量 + +API: + +```c +1/ 信号量控制块 rt_sem_t test_sem =RT_NULL; +2/ 创建信号量 test_sem = rt_sem_create +3/ 获取信号量 rt_sem_take(); +4/ 释放信号量 rt_sem_release(); +5/ 删除信号量 rt_sem_delete(); +``` + +使用: + +1. 线程和中断同步的重要手段 +2. 在同步时不会消耗太多资源,且响应快 + + + + + +#### 互斥量 + +API + +```c +1/ 互斥量控制块 rt_mutex_t test_mutex =RT_NULL; +2/ 创建互斥量 test_mutex = rt_sem_create +3/ 获取互斥量 rt_mutex_take(); +4/ 释放互斥量 rt_mutex_release(); +5/ 删除互斥量 rt_mutex_delete(); +``` + + + +使用: + +1. 优先级继承,且不能在中断程序中使用, +2. 可使用其对资源保护,例如串口资源,进行单一访问 \ No newline at end of file diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\344\272\214\345\244\251\347\254\224\350\256\260.md" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\344\272\214\345\244\251\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..35f7dac3977090b59827ebd80290ca7559caecae --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\344\272\214\345\244\251\347\254\224\350\256\260.md" @@ -0,0 +1,71 @@ +# 详细分析RT-Thread的启动流程 + +![image-20250722195430124](pic.assets/image-20250722195430124.png) + +![image-20211203093350029](file://E:/BaiduNetdiskDownload/90%E5%A4%A9learn/0--RTOS%E5%9F%B9%E8%AE%AD%E8%B5%84%E6%96%99/07_%E9%A1%B9%E7%9B%AE6_RT-Thread%E7%A7%BB%E6%A4%8D%E4%B8%8E%E5%86%85%E9%83%A8%E5%AE%9E%E7%8E%B0/07_%E9%A1%B9%E7%9B%AE6_RT-Thread%E7%A7%BB%E6%A4%8D%E4%B8%8E%E5%86%85%E9%83%A8%E5%AE%9E%E7%8E%B0/01_RT-Thread%E5%86%85%E9%83%A8%E5%AE%9E%E7%8E%B0/2_%E5%AD%A6%E4%B9%A0%E6%96%87%E6%A1%A3/pic/23_rtt_startup_code.png?lastModify=1750853466) + +##### startup.s + +![image-20250722195441203](pic.assets/image-20250722195441203.png) + +1. 初始化时钟和配置中断向量表 +2. 初始化堆栈 +3. 进行Flash上的变量初始化 ==》重定位“+RW”/清零“+ZI” +4. __main跳转到!![image-20250722195844159](pic.assets/image-20250722195844159.png) + +##### components.c(以mdk为例) + +###### Sub$main + +```c +int $Sub$$main(void) +{ + rtthread_startup(); + return 0; +} +``` + +###### rtthread_startup + +- 关中断 + +- 初始化系统相关硬件(硬件初始化gpio,uart,系统时钟等) + +- 初始化系统内核对象(定时器、调度器、信号等) + + tick设定:msh + +- 创建用户进程:rt_application_init (各模块初始化) + +- 启动调度器 + +###### rt_application_init + +```c +tid = rt_thread_create("main", main_thread_entry, RT_NULL, + RT_MAIN_THREAD_STACK_SIZE, RT_MAIN_THREAD_PRIORITY, 20); +``` + +###### main_thread_entry + +- 调用rt_components_init函数:这会初始化一系列的组件,比如创建shell线程 +- 调用$Super$$main函数:就是调用main函数 + +```c +void main_thread_entry(void *parameter) +{ + extern int main(void); + extern int $Super$$main(void); + +#ifdef RT_USING_COMPONENTS_INIT + /* RT-Thread components initialization */ + rt_components_init(); +#endif + /* invoke system main function */ +#if defined(__CC_ARM) || defined(__CLANG_ARM) + $Super$$main(); /* for ARMCC. */ +#elif defined(__ICCARM__) || defined(__GNUC__) + main(); +#endif +} +``` \ No newline at end of file diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\344\272\224\345\244\251\347\254\224\350\256\260.md" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\344\272\224\345\244\251\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..39ab13eba65f8d2f6380b790b635bc62bbfbc986 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\344\272\224\345\244\251\347\254\224\350\256\260.md" @@ -0,0 +1,178 @@ +# 使用PSoC6和esp8266 配置MQTT + +## 参考文章 + +[RT-Thread开发之路(4)— MQTT通信_rtthread mqtt-CSDN博客](https://blog.csdn.net/qq_38113006/article/details/105935328) + +## 环境配置 + +### esp8266 + +使用1.5版本以上的固件包 + +**![image-20250730104604015](pic.assets/image-20250730104604015.png)** + +### psoc6 + +#### 使用 rtthread studio提供的软件包 + +![image-20250730104803634](pic.assets/image-20250730104803634.png) + + + + + +#### 配置软件包 + +![image-20250730105008248](pic.assets/image-20250730105008248.png) + +##### 选择固件包 + +###### mqtt + +![image-20250730105042388](pic.assets/image-20250730105042388.png) + +###### AT指令固件包 + +AT![image-20250730105345301](pic.assets/image-20250730105345301.png) + +##### 配置固件包: + +mqtt默认即可,不需启动示例 + +![image-20250730105131340](pic.assets/image-20250730105131340.png) + +esp8266,启动sample,填写自己的wifi账号和密码,并修改缓存大小 + +![](pic.assets/image-20250730114613709.png) + + + +#### 修改软件包 + +##### 串口部分 + +###### kconfig设置 + +![image-20250730105755127](pic.assets/image-20250730105755127.png) + +使用at指令时防止数据溢出 + +![image-20250730105914040](pic.assets/image-20250730105914040.png) + +开启uart5,给esp8266的端口 + + + +###### 修改代码 + +![image-20250730115240398](pic.assets/image-20250730115240398.png) + +![image-20250730110300592](pic.assets/image-20250730110300592.png) + +查看驱动版本,如不是2025.5.2更新,则替换代码https://github.com/RT-Thread-Studio/sdk-bsp-cy8c624-infineon-evaluationkit/blob/main/libraries/HAL_Drivers/drv_uart.c + + + +## 代码 + +配置服务器参数 + +```c +#define MQTT_Uri "tcp://xxxx" // MQTT服务器的地址和端口号 +#define ClientId "xxx" // ClientId需要唯一 +#define USERNAME "xxx" // 用户名 +#define PASSWORD "xxx" // 用户名对应的密码 +``` + +mqtt配置 + +```c +/* 定义一个MQTT客户端结构体 */ +static MQTTClient client; + + /* 对MQTT客户端结构体变量进行配置 */ + client.isconnected = 0; + client.uri = MQTT_Uri; + + /* 配置MQTT的连接参数 */ + MQTTPacket_connectData condata = MQTTPacket_connectData_initializer; + memcpy(&client.condata, &condata, sizeof(condata)); + client.condata.clientID.cstring = ClientId; + client.condata.keepAliveInterval = 30; + client.condata.cleansession = 1; + client.condata.username.cstring = (char*)USERNAME; + client.condata.password.cstring = (char*)PASSWORD; + + + /* 为mqtt申请内存 */ + client.buf_size = client.readbuf_size = 1024; + client.buf = rt_calloc(1, client.buf_size); + client.readbuf = rt_calloc(1, client.readbuf_size); + if (!(client.buf && client.readbuf)) + { + rt_kprintf("no memory for MQTT client buffer!\r\n"); + return -1; + } + /* 设置回调函数 */ + client.connect_callback = mqtt_connect_callback; + client.online_callback = mqtt_online_callback; + client.offline_callback = RT_NULL; + + /* 订阅一个主题,并设置其回调函数 */ + client.messageHandlers[0].topicFilter = rt_strdup("BearPi_Sub"); + client.messageHandlers[0].callback = mqtt_sub_callback; + client.messageHandlers[0].qos = QOS0; + + /* 设置默认的回调函数 */ + client.defaultMessageHandler = mqtt_sub_default_callback; + + /* 启动 mqtt client */ + paho_mqtt_start(&client); + +``` + +回调函数设置;仅供参考 + +```c +/* 收到订阅主题的消息时的回调函数*/ +static void mqtt_sub_callback(MQTTClient *c, MessageData *msg_data) +{ + *((char *)msg_data->message->payload + msg_data->message->payloadlen) = '\0'; + rt_kprintf("Receive topic: %.*s, message data:\r\n", msg_data->topicName->lenstring.len, msg_data->topicName->lenstring.data); + rt_kprintf("%.*s\r\n", msg_data->message->payloadlen, (char *)msg_data->message->payload); +} + +/* 默认的订阅回调函数,如果有订阅的 Topic 没有设置回调函数,则使用该默认回调函数 */ +static void mqtt_sub_default_callback(MQTTClient *c, MessageData *msg_data) +{ + *((char *)msg_data->message->payload + msg_data->message->payloadlen) = '\0'; + rt_kprintf("Receive topic: %.*s, message data:\r\n", msg_data->topicName->lenstring.len, msg_data->topicName->lenstring.data); + rt_kprintf("%.*s\r\n", msg_data->message->payloadlen, (char *)msg_data->message->payload); +} + +/* 连接成功回调函数 */ +static void mqtt_connect_callback(MQTTClient *c) +{ + rt_kprintf("mqtt connect success! \r\n"); +} + +/* 上线回调函数 */ +static void mqtt_online_callback(MQTTClient *c) +{ + rt_kprintf("mqtt online \r\n"); + paho_mqtt_publish(&client, QOS1, "/topic/humiture", "{\"name:fjp\",\"study:keep up the good work\"}"); +} +``` + + + +测试 + +可在main线程:调用mqtt_test(); + +![image-20250730220636531](pic.assets/image-20250730220636531.png) + +串口打印:方便查看 + +![image-20250730220740045](pic.assets/image-20250730220740045.png) \ No newline at end of file diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\345\233\233\345\244\251\347\254\224\350\256\260.md" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\345\233\233\345\244\251\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..3575e04755cc1f78faff3fb78a88be818124a544 --- /dev/null +++ "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\347\254\224\350\256\260/\347\254\254\345\233\233\345\244\251\347\254\224\350\256\260.md" @@ -0,0 +1,54 @@ +## rtthread的驱动分析 + +### 驱动模型 + +![I/O 设备模型框架](file://E:/BaiduNetdiskDownload/90%E5%A4%A9learn/0--RTOS%E5%9F%B9%E8%AE%AD%E8%B5%84%E6%96%99/06_%E9%A1%B9%E7%9B%AE5_%E5%9F%BA%E4%BA%8ERT-Thread_nano%E5%AE%9E%E7%8E%B0%E6%99%BA%E8%83%BD%E5%AE%B6%E5%B1%85/06_%E9%A1%B9%E7%9B%AE5/03_RT-Thread%E9%A9%B1%E5%8A%A8%E7%A8%8B%E5%BA%8F/2_%E5%AD%A6%E4%B9%A0%E6%96%87%E6%A1%A3/02_%E8%A7%86%E9%A2%91%E9%85%8D%E5%A5%97%E6%96%87%E4%BB%B6/pic/02_io_drv_module.png?lastModify=1753397044) + +### 分析pin驱动 + +![image-20250725065922301](pic.assets/image-20250725065922301.png) + +#### 向上申请父类结构体 rt_device + +```c + struct rt_object parent; /**< inherit from rt_object */ + + enum rt_device_class_type type; /**< device type */ + rt_uint16_t flag; /**< device flag */ + rt_uint16_t open_flag; /**< device open flag */ + + rt_uint8_t ref_count; /**< reference count */ + rt_uint8_t device_id; /**< 0 - 255 */ + +/* 向上提供信息 */ +``` + +#### 定义PIN驱动框架 + +![image-20250725070225595](pic.assets/image-20250725070225595.png) + +#### 提供框架函数并注册设备 + +![image-20250725070325412](pic.assets/image-20250725070325412.png) + +![image-20250725070504692](pic.assets/image-20250725070504692.png) + +```c +/* 实现继承,并向上提供设备信息*/ +&_hw_pin.parent ---> rt_device_t dev +``` + +#### 底层硬件实现 + +![image-20250725071146852](pic.assets/image-20250725071146852.png) + +![image-20250725071114460](pic.assets/image-20250725071114460.png) + +```文本 +1,向上申请ops结构体,得到PIN的驱动框架 + +2.通过pin_register实现框架与硬件的链接,实现信息的转发 + +3.之后可通过调用PIN设备即可操作stm32的gpio +``` + diff --git "a/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\351\241\271\347\233\256\345\274\200\345\217\221\350\256\260\345\275\225.pdf" "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\351\241\271\347\233\256\345\274\200\345\217\221\350\256\260\345\275\225.pdf" new file mode 100644 index 0000000000000000000000000000000000000000..15d989f00502c528f97285853dcbe18d7e554800 Binary files /dev/null and "b/2025/\347\254\2543\347\273\204(PSoC62 evaluation Kit)/\345\206\257\344\275\263\345\271\263/\351\241\271\347\233\256\345\274\200\345\217\221\350\256\260\345\275\225.pdf" differ diff --git "a/2025/\347\254\2544\347\273\204(FRDM-MCXA156)/README.md" "b/2025/\347\254\2544\347\273\204(FRDM-MCXA156)/README.md" deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git "a/2025/\347\254\2545\347\273\204(CanMV-K230)/README.md" "b/2025/\347\254\2545\347\273\204(CanMV-K230)/README.md" deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git "a/2025/\347\254\2546\347\273\204(GD32F527I-EVAL)/README.md" "b/2025/\347\254\2546\347\273\204(GD32F527I-EVAL)/README.md" deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/README.md b/README.md deleted file mode 100644 index 9f5b07f46dd6135ac86be5bbfa19d83df157cc75..0000000000000000000000000000000000000000 --- a/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# RSOC-RTT - -RT-Thread夏令营学员笔记 - - - -## 学员笔记模板 - -学生姓名命名文件夹 + 每日笔记 + 每日作业 - -```c -└─2025 - ├─第1组(STM32H750-ART-PI) - │ └─张三 - │ └─笔记 - │ └─内核笔记.md - │ └─驱动笔记.md - │ └─xxx.md - │ └─... - │ └─作业 - │ └─第1天作业.md - │ └─第2天作业.md - │ └─第3天作业.md - │ └─第4天作业.md - │ └─第5天作业.md - ├─第2组(RA8D1-Vision-Board) - ├─第3组(PSoC62 evaluation Kit) - ├─第4组(FRDM-MCXA156) - ├─第5组(CanMV-K230) - └─第6组(GD32F527I-EVAL) -``` -