Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PN532 UART support + macOS support #633

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Add Windows support for single byte UART TX
  • Loading branch information
samyk committed Jan 17, 2021
commit 27836d78106d56fed04c89b1e7d63a65224d8ef2
20 changes: 20 additions & 0 deletions contrib/win32/libnfc/buses/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,26 @@ uart_send(serial_port sp, const uint8_t *pbtTx, const size_t szTx, int timeout)
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this I guess

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)
{
TCHAR szPort[15];
Expand Down