summaryrefslogtreecommitdiff
path: root/examples/getbaud.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2021-09-28 17:05:31 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2021-09-28 17:05:31 +0200
commitbc078da645412c6b36ef59e635d6c35d11088c96 (patch)
treecd337c7a4d62d13d8f587f6fd02e6cc33961104c /examples/getbaud.h
parentc61b229a213ac1f1cc50c6c4af53131578a91d53 (diff)
Improve exampleHEADmasterdevelop
Diffstat (limited to 'examples/getbaud.h')
-rw-r--r--examples/getbaud.h33
1 files changed, 27 insertions, 6 deletions
diff --git a/examples/getbaud.h b/examples/getbaud.h
index db7b092..3cd1ff3 100644
--- a/examples/getbaud.h
+++ b/examples/getbaud.h
@@ -1,12 +1,33 @@
#pragma once
-#include <termios.h>
+enum class Speed
+{
+ B0,
+ B50,
+ B75,
+ B110,
+ B134,
+ B150,
+ B200,
+ B300,
+ B600,
+ B1200,
+ B1800,
+ B2400,
+ B4800,
+ B9600,
+ B19200,
+ B38400,
+ B57600,
+ B115200,
+ B230400,
+};
//! 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);
+//! Convert requested int based speed to corresponding Speed enum class value.
+//! The returned enum class value is the closest value not bigger than the
+//! requested int value.
+//! If no matching enum class value is found a bad_speed exception is thrown.
+Speed getBaud(int speed);