]> sigrok.org Git - libserialport.git/blobdiff - libserialport.h.in
Make sp_flush take an option for what to flush.
[libserialport.git] / libserialport.h.in
index 6fc7ef55ddd202d91ba51f69a309d44f701ede1b..12e9cba3a5556ae468f1957d4f36e2aff0304b31 100644 (file)
@@ -101,24 +101,34 @@ enum sp_return {
 
 /** Port access modes. */
 enum sp_mode {
-       /** Open port for read/write access. */
-       SP_MODE_RDWR = 1,
-       /** Open port for read access only. */
-       SP_MODE_RDONLY = 2,
+       /** Open port for read access. */
+       SP_MODE_READ = 1,
+       /** Open port for write access. */
+       SP_MODE_WRITE = 2,
        /** Open port in non-blocking mode. */
        SP_MODE_NONBLOCK = 4,
 };
 
+/** Buffer selection. */
+enum sp_buffer {
+       /** Input buffer. */
+       SP_BUF_INPUT = 1,
+       /** Output buffer. */
+       SP_BUF_OUTPUT = 2,
+       /** Both buffers. */
+       SP_BUF_BOTH = 3,
+};
+
 /** Parity settings. */
 enum sp_parity {
        /** Special value to indicate setting should be left alone. */
        SP_PARITY_INVALID = -1,
        /** No parity. */
        SP_PARITY_NONE = 0,
-       /** Even parity. */
-       SP_PARITY_EVEN = 1,
        /** Odd parity. */
-       SP_PARITY_ODD = 2,
+       SP_PARITY_ODD = 1,
+       /** Even parity. */
+       SP_PARITY_EVEN = 2,
 };
 
 /** RTS pin behaviour. */
@@ -506,12 +516,14 @@ enum sp_return sp_read(struct sp_port *port, void *buf, size_t count);
 enum sp_return sp_write(struct sp_port *port, const void *buf, size_t count);
 
 /**
- * Flush serial port buffers.
+ * Flush serial port buffers. Data in the selected buffer(s) is discarded.
+ *
+ * @param buffers Which buffer(s) to flush.
  *
  * @return SP_OK on success, SP_ERR_FAIL on failure, or SP_ERR_ARG
  *         if an invalid port is passed.
  */
-enum sp_return sp_flush(struct sp_port *port);
+enum sp_return sp_flush(struct sp_port *port, enum sp_buffer buffers);
 
 /**
  * @}