summaryrefslogtreecommitdiff
path: root/examples/getbaud.h
blob: 3cd1ff353c11cc0dcfc79a49dd413b7c25fe9f1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once

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 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);