From bc078da645412c6b36ef59e635d6c35d11088c96 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 28 Sep 2021 17:05:31 +0200 Subject: Improve example --- examples/getbaud.h | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'examples/getbaud.h') 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 +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); -- cgit v1.2.3