add sink source

This commit is contained in:
wmano
2025-08-31 22:41:57 +08:00
parent 050eb19fc8
commit d633c6b55f
14 changed files with 657 additions and 309 deletions
+16 -11
View File
@@ -7,13 +7,26 @@
#define DBG_LEVEL DBG_LOG
#include <rtdbg.h>
struct chrg_north_t chrgnor = {
struct chrg_north_t chrgnorth = {
.name = THR_NAME_NORTH,
.tid = RT_NULL,
.tty = RT_NULL,
.rx_len = 0,
};
int chrg_north_send (rt_uint8_t *data, rt_size_t length)
{
rt_ssize_t ret = -1;
struct chrg_tty_t *pTTY = chrgnorth.tty;
if ((RT_NULL != pTTY)&&(RT_NULL != pTTY->dev)) {
ret = rt_device_write(pTTY->dev, 0, data, length);
}
return ret;
}
static void chrg_north_thread_entry (void *data)
{
rt_err_t ret = RT_EOK;
@@ -49,7 +62,7 @@ static void chrg_north_thread_entry (void *data)
static int chrg_north_init (void)
{
rt_err_t ret;
struct chrg_north_t *pNOR = &chrgnor;
struct chrg_north_t *pNOR = &chrgnorth;
pNOR->tty = &chrgtty[IDX_TTY_NORTH];
rt_memset(pNOR->rx_buf, 0, SIZE_BUF_UART);
@@ -77,15 +90,7 @@ INIT_APP_EXPORT(chrg_north_init);
static int north_send(rt_uint8_t argc, char **argv)
{
rt_ssize_t ret = 0;
struct chrg_north_t *pNOR = &chrgnor;
struct chrg_tty_t *pTTY = pNOR->tty;
if (RT_NULL != pTTY->dev) {
ret = rt_device_write(pTTY->dev, 0, "1234567890abcdef", 16);
}
return ret;
return chrg_north_send("1234567890abcdef", 16);
}