summaryrefslogtreecommitdiff
path: root/examples/getbaud.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/getbaud.h')
-rw-r--r--examples/getbaud.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/getbaud.h b/examples/getbaud.h
new file mode 100644
index 0000000..db7b092
--- /dev/null
+++ b/examples/getbaud.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#include <termios.h>
+
+//! Exception
+struct bad_speed {};
+
+//! Convert requested int based speed to corresponding speed_t enum value.
+//! The retuened enum value will be the closed value not bigger than the
+//! requested value.
+//! If no matching enum value could be found a bad_speed exception is thrown.
+speed_t getBaud(int speed);