Private
Public Access
2
0

uart: Convert rtscts and xonxoff in mraa_uart_settings into mraa_boolean_t

This aligns the getter with the setter (mraa_uart_set_flowcontrol).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka
2021-04-30 08:40:27 +02:00
committed by Tom Ingleby
parent aeb0b331b5
commit 11e65ee9bf
3 changed files with 8 additions and 8 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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;