add threads

This commit is contained in:
wmano
2025-08-28 23:32:26 +08:00
parent fa4d12b6e0
commit e26e47548f
13 changed files with 1330 additions and 2205 deletions
+17 -2
View File
@@ -1,9 +1,13 @@
#include <string.h>
#include <rtthread.h>
#include <rtdevice.h>
#include "chrg_tty.h"
#include "chrg_north.h"
#include "chrg_south.h"
struct chrg_tty_t chrgtty[TOTAL_TTY] = {
[IDX_TTY_RS485] = {
.dev = RT_NULL,
@@ -108,10 +112,21 @@ static void chrg_tty_recv_entry (void *data)
rt_memset(rx_raw, 0, RT_SERIAL_RB_BUFSZ);
rx_len = rt_device_read(pTTY->msg.dev, 0, rx_raw, pTTY->msg.size);
if (rx_len > 0) {
switch (pTTY->index) {
case IDX_TTY_NORTH: {
struct chrg_north_t *pNOR = &chrgnor;
rt_memset(&pNOR->buf, 0, sizeof(pNOR->buf));
strcpy((char *)pNOR->buf, "send mb msg");
rt_mb_send(&pNOR->mb, (rt_uint32_t)&pNOR->buf);
}
break;
default:
break;
}
}
}
}
}