| 141 | } |
| 142 | |
| 143 | static 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 | |
| 160 | int uart_sample_v1(int argc, char *argv[]) |
| 161 | { |
nothing calls this directly
no test coverage detected