From 62673c4137abd04a309115440899431bdb9909e3 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 19 Sep 2020 18:26:41 +0200 Subject: Add README and getBaud example. --- examples/getbaud.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 examples/getbaud.h (limited to 'examples/getbaud.h') 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 + +//! 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); -- cgit v1.2.3