summaryrefslogtreecommitdiff
path: root/examples/getbaud.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-09-19 18:26:41 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2020-09-19 18:26:41 +0200
commit62673c4137abd04a309115440899431bdb9909e3 (patch)
tree6170d0d70f0fcded77f4db9a722a513438132ccb /examples/getbaud.h
parente46cf7b5489213ac0f8941c870121b04cf6091ac (diff)
Add README and getBaud example.
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);