Add Windows support for single byte UART TX
This commit is contained in:
parent
f1b6ee4c06
commit
27836d7810
@ -240,6 +240,26 @@ uart_send(serial_port sp, const uint8_t *pbtTx, const size_t szTx, int timeout)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Send \a pbtTx content to UART one byte at a time
|
||||||
|
*
|
||||||
|
* @return 0 on success, otherwise a driver error is returned
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
uart_send_single(serial_port sp, const uint8_t *pbtTx, const size_t szTx, int timeout)
|
||||||
|
{
|
||||||
|
(void) timeout;
|
||||||
|
int error = 0;
|
||||||
|
for (int i = 0; i < szTx; i++)
|
||||||
|
{
|
||||||
|
error |= uart_send(sp, pbtTx+i, 1, timeout);
|
||||||
|
usleep(9); // ceil(1_000_000us / 115200baud)
|
||||||
|
}
|
||||||
|
|
||||||
|
return error ? NFC_EIO : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL is_port_available(int nPort)
|
BOOL is_port_available(int nPort)
|
||||||
{
|
{
|
||||||
TCHAR szPort[15];
|
TCHAR szPort[15];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user