2025-08-20 11:28:11 +08:00
|
|
|
#include "sertrf.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sertrf_t sertrf;
|
|
|
|
|
void sertrf_init(void)
|
|
|
|
|
{
|
|
|
|
|
uint8_t res = 0;
|
|
|
|
|
res = device_init(&sertrf.device);
|
|
|
|
|
if(!res)
|
|
|
|
|
{
|
|
|
|
|
SYS_LOG_WRN("device init error");
|
|
|
|
|
}
|
2025-08-20 11:31:55 +08:00
|
|
|
//RGB灯
|
|
|
|
|
work_rgb_led_start();
|
2025-08-20 11:28:11 +08:00
|
|
|
sertrf_start();
|
|
|
|
|
}
|
|
|
|
|
void sertrf_start(void)
|
|
|
|
|
{
|
|
|
|
|
os_thread_create(&sertrf.embedded_thread,
|
|
|
|
|
"embedded_thread",
|
|
|
|
|
embedded_thread,
|
|
|
|
|
NULL,
|
|
|
|
|
4096,
|
|
|
|
|
20);
|
|
|
|
|
}
|
|
|
|
|
void embedded_thread(void* arg)
|
|
|
|
|
{
|
|
|
|
|
while(true)
|
|
|
|
|
{
|
|
|
|
|
uint32_t embedded_size = embedded_device_get_rx_length(&sertrf.device);
|
|
|
|
|
if(embedded_size > 0)
|
|
|
|
|
{
|
|
|
|
|
uint8_t data[embedded_size];
|
|
|
|
|
embedded_device_read(&sertrf.device, data, embedded_size);
|
|
|
|
|
SYS_LOG_INF("data : %s", data);
|
|
|
|
|
embedded_device_write(&sertrf.device, data, embedded_size);
|
|
|
|
|
}
|
|
|
|
|
//需要添加一些延时,否则会卡死,导致看门狗复位
|
|
|
|
|
// vTaskDelay(( TickType_t ) 1000 / configTICK_RATE_HZ);
|
|
|
|
|
os_thread_sleep(1);
|
|
|
|
|
}
|
|
|
|
|
}
|