MCPcopy Create free account
hub / github.com/brainflow-dev/brainflow / flush_buffer

Method flush_buffer

src/utils/libftdi_serial.cpp:150–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150int LibFTDISerial::flush_buffer ()
151{
152#if FTDI_MAJOR_VERSION >= 2 || (FTDI_MAJOR_VERSION == 1 && FTDI_MINOR_VERSIOM >= 5)
153 // correct tcflush was added in libftdi 1.5
154 last_result = ftdi_tcioflush (&ftdi);
155 switch (last_result)
156 {
157 case 0:
158 return (int)SerialExitCodes::OK;
159 case -3: // usb device unavailable
160 log_error ("flush_buffer ()");
161 return (int)SerialExitCodes::OPEN_PORT_ERROR;
162 default: // -1,-2 chip failed to purge a buffer
163 log_error ("flush_buffer ()");
164 }
165#else
166 log_error ("flush_buffer ()", "libftdi version <=1.4, tcflush unimplemented");
167#endif
168 return (int)SerialExitCodes::SET_PORT_STATE_ERROR;
169}
170
171int LibFTDISerial::read_from_serial_port (void *bytes_to_read, int size)
172{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected