add threads
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user