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

Function _serial_poll_tx

components/drivers/serial/dev_serial.c:265–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265rt_inline int _serial_poll_tx(struct rt_serial_device *serial, const rt_uint8_t *data, int length)
266{
267 int size;
268 RT_ASSERT(serial != RT_NULL);
269
270 size = length;
271 while (length)
272 {
273 /*
274 * to be polite with serial console add a line feed
275 * to the carriage return character
276 */
277 if (*data == '\n' && (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM))
278 {
279 serial->ops->putc(serial, '\r');
280 }
281
282 if(serial->ops->putc(serial, *data) < 0) {
283 break;
284 }
285
286 ++ data;
287 -- length;
288 }
289
290 return size - length;
291}
292
293/*
294 * Serial interrupt routines

Callers 1

rt_serial_writeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected