more baudrates for BlinkenOutput
Stefan Schuermans

Stefan Schuermans commited on 2013-12-28 14:30:17
Showing 2 changed files, with 52 additions and 20 deletions.

... ...
@@ -32,26 +32,54 @@ static int serial_settings_parse(char *str, int *settings, int *speed)
32 32
     return 0;
33 33
 
34 34
   // baud rate
35
-  if (baud == 300)
36
-    sp = B300;
37
-  else if (baud == 600)
38
-    sp = B600;
39
-  else if (baud == 1200)
40
-    sp = B1200;
41
-  else if (baud == 2400)
42
-    sp = B2400;
43
-  else if (baud == 4800)
44
-    sp = B4800;
45
-  else if (baud == 9600)
46
-    sp = B9600;
47
-  else if (baud == 19200)
48
-    sp = B19200;
49
-  else if (baud == 38400)
50
-    sp = B38400;
51
-  else if (baud == 57600)
52
-    sp = B57600;
53
-  else if (baud == 115200)
54
-    sp = B115200;
35
+#define BAUD(rate) else if (baud == rate) sp = B ## rate;
36
+  if (0) {}
37
+  BAUD(300)
38
+  BAUD(600)
39
+  BAUD(1200)
40
+  BAUD(2400)
41
+  BAUD(4800)
42
+  BAUD(9600)
43
+  BAUD(19200)
44
+  BAUD(38400)
45
+  BAUD(57600)
46
+  BAUD(115200)
47
+#ifdef B230400
48
+  BAUD(230400)
49
+#endif
50
+#ifdef B460800
51
+  BAUD(460800)
52
+#endif
53
+#ifdef B576000
54
+  BAUD(576000)
55
+#endif
56
+#ifdef B921600
57
+  BAUD(921600)
58
+#endif
59
+#ifdef B1000000
60
+  BAUD(1000000)
61
+#endif
62
+#ifdef B1152000
63
+  BAUD(1152000)
64
+#endif
65
+#ifdef B1500000
66
+  BAUD(1500000)
67
+#endif
68
+#ifdef B2000000
69
+  BAUD(2000000)
70
+#endif
71
+#ifdef B2500000
72
+  BAUD(2500000)
73
+#endif
74
+#ifdef B3000000
75
+  BAUD(3000000)
76
+#endif
77
+#ifdef B3500000
78
+  BAUD(3500000)
79
+#endif
80
+#ifdef B4000000
81
+  BAUD(4000000)
82
+#endif
55 83
   else {
56 84
     printf("illegal baudrate: %d\n", baud);
57 85
     return 0;
... ...
@@ -1,3 +1,7 @@
1
+0.7.3 2013-12-28
2
+----------------
3
+more baud rates for BlinkenOutput
4
+
1 5
 0.7.2 2013-12-27
2 6
 ----------------
3 7
 added minimum time between output option to BlinkenOutput
4 8