K
K
Kalombyr2021-12-19 18:52:04
Qt
Kalombyr, 2021-12-19 18:52:04

How to control flow in QSerialPort?

Hello.
There is a device based on ft232r, it requires flowControl settings in HardareControl to work.
I'm trying to communicate with him using Qt and QSerialPort, setting him

_serial->setFlowControl(QSerialPort::HardwareControl);

And now in confusion, I need to prescribe myself:
_serial->setRequestToSend(true);   // Устанавливаем готовность к передаче
while (  !_serial->pinoutSignals().testFlag(QSerialPort::ClearToSendSignal) ) {  processEvents(); } // Ждём ответа о готовности к приёму
_seria->write(data, size); //-- Пишем 
_serial->setRequestToSend(false); // Устанавливаем неготовность к передаче


Or does QSerialPort itself do it for me and just _serial.write(data, size) is enough?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jacob E, 2021-12-20
@Kalombyr

https://doc.qt.io/qt-5/qserialport.html#requestToS...

Note: An attempt to control the RTS signal in the HardwareControl mode will fail with error code set to UnsupportedOperationError, because the signal is automatically controlled by the driver.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question