diff --git a/api/mraa/uart.h b/api/mraa/uart.h index 3495b2f..64835a8 100644 --- a/api/mraa/uart.h +++ b/api/mraa/uart.h @@ -171,8 +171,8 @@ const char* mraa_uart_get_dev_path(mraa_uart_context dev); * @param databits pointer to an integer to contain the number databits (5--8) * @param stopbits pointer to an integer to contain the number stopbits (1--2) * @param parity will contain the current parity mode - * @param rtscts will point to non-zero if CTS/RTS flow control is enabled, zero otherwise - * @param xonxoff will point to a non-zero value if xon/xoff flow control is enabled + * @param rtscts will point to true if CTS/RTS flow control is enabled + * @param xonxoff will point to a true if xon/xoff flow control is enabled * @return result */ mraa_result_t @@ -183,8 +183,8 @@ mraa_uart_settings(int index, int* databits, int* stopbits, mraa_uart_parity_t* parity, - unsigned int* rtscts, - unsigned int* xonxoff); + mraa_boolean_t* rtscts, + mraa_boolean_t* xonxoff); /** * Destroy a mraa_uart_context diff --git a/src/uart/uart.c b/src/uart/uart.c index 8522e01..36517fa 100644 --- a/src/uart/uart.c +++ b/src/uart/uart.c @@ -337,7 +337,7 @@ mraa_uart_stop(mraa_uart_context dev) } mraa_result_t -mraa_uart_settings(int index, const char **devpath, const char **name, int* baudrate, int* databits, int* stopbits, mraa_uart_parity_t* parity, unsigned int* ctsrts, unsigned int* xonxoff) { +mraa_uart_settings(int index, const char **devpath, const char **name, int* baudrate, int* databits, int* stopbits, mraa_uart_parity_t* parity, mraa_boolean_t* ctsrts, mraa_boolean_t* xonxoff) { struct termios term; int fd; @@ -415,11 +415,11 @@ mraa_uart_settings(int index, const char **devpath, const char **name, int* baud } if (ctsrts != NULL) { - *ctsrts = term.c_cflag & CRTSCTS; + *ctsrts = (term.c_cflag & CRTSCTS) != 0; } if (xonxoff != NULL) { - *xonxoff = term.c_iflag & (IXON|IXOFF); + *xonxoff = (term.c_iflag & (IXON|IXOFF)) != 0; } close(fd); diff --git a/tools/mraa-uart.c b/tools/mraa-uart.c index 77123f5..384f13b 100644 --- a/tools/mraa-uart.c +++ b/tools/mraa-uart.c @@ -106,7 +106,7 @@ main(int argc, const char** argv) { int baudrate = 115200, stopbits = 1, databits = 8; mraa_uart_parity_t parity = MRAA_UART_PARITY_NONE; - unsigned int ctsrts = FALSE, xonxoff = FALSE; + mraa_boolean_t ctsrts = FALSE, xonxoff = FALSE; const char *name = NULL, *dev = NULL; double recieve_timeout = 0.0;