MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / serial_thread_entry_int

Function serial_thread_entry_int

bsp/hc32/tests/test_uart_v1.c:143–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143static void serial_thread_entry_int(void *parameter)
144{
145 char ch;
146
147 while (1)
148 {
149 /* 从串口读取一个字节的数据,没有读取到则等待接收信号量 */
150 while (rt_device_read(serial, -1, &ch, 1) != 1)
151 {
152 /* 阻塞等待接收信号量,等到信号量后再次读取数据 */
153 rt_sem_take(&rx_sem, RT_WAITING_FOREVER);
154 }
155 /* 读取到的数据通过串口错位输出 */
156 rt_device_write(serial, 0, &ch, 1);
157 }
158}
159
160int uart_sample_v1(int argc, char *argv[])
161{

Callers

nothing calls this directly

Calls 3

rt_device_readFunction · 0.85
rt_sem_takeFunction · 0.85
rt_device_writeFunction · 0.85

Tested by

no test coverage detected