summaryrefslogtreecommitdiff
path: root/examples/getbaud.cc
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.cc
parentc61b229a213ac1f1cc50c6c4af53131578a91d53 (diff)
Improve exampleHEADmasterdevelop
Diffstat (limited to 'examples/getbaud.cc')
-rw-r--r--examples/getbaud.cc48
1 files changed, 24 insertions, 24 deletions
diff --git a/examples/getbaud.cc b/examples/getbaud.cc
index e90c4f6..2488fc1 100644
--- a/examples/getbaud.cc
+++ b/examples/getbaud.cc
@@ -1,33 +1,33 @@
#include "getbaud.h"
-speed_t getBaud(int speed)
+Speed getBaud(int speed)
{
struct
{
int value;
- speed_t baud;
+ Speed speed;
}
speeds[] =
{
- { 0, B0 },
- { 50, B50 },
- { 75, B75 },
- { 110, B110 },
- { 134, B134 },
- { 150, B150 },
- { 200, B200 },
- { 300, B300 },
- { 600, B600 },
- { 1200, B1200 },
- { 1800, B1800 },
- { 2400, B2400 },
- { 4800, B4800 },
- { 9600, B9600 },
- { 19200, B19200 },
- { 38400, B38400 },
- { 57600, B57600 },
- { 115200, B115200 },
- { 230400, B230400 },
+ { 0, Speed::B0 },
+ { 50, Speed::B50 },
+ { 75, Speed::B75 },
+ { 110, Speed::B110 },
+ { 134, Speed::B134 },
+ { 150, Speed::B150 },
+ { 200, Speed::B200 },
+ { 300, Speed::B300 },
+ { 600, Speed::B600 },
+ { 1200, Speed::B1200 },
+ { 1800, Speed::B1800 },
+ { 2400, Speed::B2400 },
+ { 4800, Speed::B4800 },
+ { 9600, Speed::B9600 },
+ { 19200, Speed::B19200 },
+ { 38400, Speed::B38400 },
+ { 57600, Speed::B57600 },
+ { 115200, Speed::B115200 },
+ { 230400, Speed::B230400 },
};
if(speed < 0)
@@ -39,14 +39,14 @@ speed_t getBaud(int speed)
{
if(speed == s.value)
{
- return s.baud;
+ return s.speed;
}
if(speed < s.value)
{
- return (*((&s)-1)).baud;
+ return (*((&s)-1)).speed;
}
}
- return speeds[sizeof(speeds) / sizeof(*speeds) - 1].baud;
+ return speeds[sizeof(speeds) / sizeof(*speeds) - 1].speed;
}