* @brief uart_flush() flushes uart buffer.
*
* @param[in] file_hndl handle of uart_context
-* @return On success, 0 is returned. On failure, a negative value is returned.
*/
-int peripheral_interface_uart_flush(peripheral_uart_h uart);
+void peripheral_interface_uart_flush(peripheral_uart_h uart);
/**
* @brief uart_set_baudrate() sets uart baud rate.
close(uart->fd);
}
-int peripheral_interface_uart_flush(peripheral_uart_h uart)
+void peripheral_interface_uart_flush(peripheral_uart_h uart)
{
- int ret = tcflush(uart->fd, TCIOFLUSH);
- CHECK_ERROR(ret != 0);
-
- return PERIPHERAL_ERROR_NONE;
+ tcflush(uart->fd, TCIOFLUSH);
}
int peripheral_interface_uart_set_baud_rate(peripheral_uart_h uart, peripheral_uart_baud_rate_e baud)
tio.c_cc[VTIME] = 0;
peripheral_interface_uart_flush(uart);
+
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);
tio.c_cflag |= (CLOCAL | CREAD);
peripheral_interface_uart_flush(uart);
+
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);
}
peripheral_interface_uart_flush(uart);
+
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);
}
peripheral_interface_uart_flush(uart);
+
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);
else
return PERIPHERAL_ERROR_INVALID_PARAMETER;
+ peripheral_interface_uart_flush(uart);
+
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);