Commit 41a7880e81894c34b237d4c7c1ba82d417af86c4

Authored by Geoffrey Hunter
1 parent 819155b9

- Added support for setting the num. data bits.

- Added support for setting the parity.
- Added support for setting the num. stop bits.
.vscode/c_cpp_properties.json
1 { 1 {
  2 + "version": 4,
2 "configurations": [ 3 "configurations": [
3 { 4 {
4 "name": "Mac", 5 "name": "Mac",
  6 + "compilerPath": "/usr/bin/gcc",
  7 + "compilerArgs": [],
  8 + "intelliSenseMode": "clang-x64",
5 "includePath": [ 9 "includePath": [
6 "/usr/include", 10 "/usr/include",
7 "/usr/local/include", 11 "/usr/local/include",
8 "${workspaceRoot}" 12 "${workspaceRoot}"
9 ], 13 ],
10 - "defines": [],  
11 - "intelliSenseMode": "clang-x64",  
12 - "browse": {  
13 - "path": [  
14 - "/usr/include",  
15 - "/usr/local/include",  
16 - "${workspaceRoot}"  
17 - ],  
18 - "limitSymbolsToIncludedHeaders": true,  
19 - "databaseFilename": ""  
20 - },  
21 - "macFrameworkPath": [  
22 - "/System/Library/Frameworks",  
23 - "/Library/Frameworks"  
24 - ],  
25 - "compilerPath": "/usr/bin/gcc", 14 + "forcedInclude": [],
26 "cStandard": "c11", 15 "cStandard": "c11",
27 - "cppStandard": "c++17" 16 + "cppStandard": "c++17",
  17 + "defines": []
28 }, 18 },
29 { 19 {
30 "name": "Linux", 20 "name": "Linux",
  21 + "compilerPath": "/usr/bin/gcc",
  22 + "compilerArgs": [],
  23 + "intelliSenseMode": "clang-x64",
31 "includePath": [ 24 "includePath": [
32 "/usr/include/c++/6", 25 "/usr/include/c++/6",
33 "/usr/include/x86_64-linux-gnu/c++/6", 26 "/usr/include/x86_64-linux-gnu/c++/6",
@@ -40,52 +33,559 @@ @@ -40,52 +33,559 @@
40 "${workspaceRoot}", 33 "${workspaceRoot}",
41 "${workspaceRoot}/include" 34 "${workspaceRoot}/include"
42 ], 35 ],
43 - "defines": [],  
44 - "intelliSenseMode": "clang-x64",  
45 - "browse": {  
46 - "path": [  
47 - "/usr/include/c++/6",  
48 - "/usr/include/x86_64-linux-gnu/c++/6",  
49 - "/usr/include/c++/6/backward",  
50 - "/usr/lib/gcc/x86_64-linux-gnu/6/include",  
51 - "/usr/local/include",  
52 - "/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed",  
53 - "/usr/include/x86_64-linux-gnu",  
54 - "/usr/include",  
55 - "${workspaceRoot}",  
56 - "${workspaceRoot}/include"  
57 - ],  
58 - "limitSymbolsToIncludedHeaders": true,  
59 - "databaseFilename": ""  
60 - },  
61 - "compilerPath": "/usr/bin/gcc", 36 + "forcedInclude": [],
62 "cStandard": "c11", 37 "cStandard": "c11",
63 "cppStandard": "c++17", 38 "cppStandard": "c++17",
  39 + "defines": [],
64 "configurationProvider": "ms-vscode.cmake-tools" 40 "configurationProvider": "ms-vscode.cmake-tools"
65 }, 41 },
66 { 42 {
67 "name": "Win32", 43 "name": "Win32",
  44 + "compilerPath": "/usr/bin/gcc",
  45 + "compilerArgs": [],
  46 + "intelliSenseMode": "msvc-x64",
68 "includePath": [ 47 "includePath": [
69 "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include", 48 "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include",
70 "${workspaceRoot}" 49 "${workspaceRoot}"
71 ], 50 ],
  51 + "forcedInclude": [],
  52 + "cStandard": "c11",
  53 + "cppStandard": "c++17",
72 "defines": [ 54 "defines": [
73 "_DEBUG", 55 "_DEBUG",
74 "UNICODE" 56 "UNICODE"
  57 + ]
  58 + },
  59 + {
  60 + "name": "Arduino",
  61 + "compilerPath": "/home/gbmhunter/Downloads/arduino-1.8.19/hardware/tools/avr/bin/avr-g++",
  62 + "compilerArgs": [
  63 + "-std=gnu++11",
  64 + "-fpermissive",
  65 + "-fno-exceptions",
  66 + "-ffunction-sections",
  67 + "-fdata-sections",
  68 + "-fno-threadsafe-statics",
  69 + "-Wno-error=narrowing"
  70 + ],
  71 + "intelliSenseMode": "gcc-x64",
  72 + "includePath": [
  73 + "/home/gbmhunter/Downloads/arduino-1.8.19/hardware/arduino/avr/cores/arduino",
  74 + "/home/gbmhunter/Downloads/arduino-1.8.19/hardware/arduino/avr/variants/standard",
  75 + "/home/gbmhunter/Downloads/arduino-1.8.19/hardware/tools/avr/lib/gcc/avr/7.3.0/include",
  76 + "/home/gbmhunter/Downloads/arduino-1.8.19/hardware/tools/avr/lib/gcc/avr/7.3.0/include-fixed",
  77 + "/home/gbmhunter/Downloads/arduino-1.8.19/hardware/tools/avr/avr/include"
  78 + ],
  79 + "forcedInclude": [
  80 + "/home/gbmhunter/Downloads/arduino-1.8.19/hardware/arduino/avr/cores/arduino/Arduino.h"
75 ], 81 ],
76 - "intelliSenseMode": "msvc-x64",  
77 - "browse": {  
78 - "path": [  
79 - "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*",  
80 - "${workspaceRoot}"  
81 - ],  
82 - "limitSymbolsToIncludedHeaders": true,  
83 - "databaseFilename": ""  
84 - },  
85 - "compilerPath": "/usr/bin/gcc",  
86 "cStandard": "c11", 82 "cStandard": "c11",
87 - "cppStandard": "c++17" 83 + "cppStandard": "c++11",
  84 + "defines": [
  85 + "F_CPU=16000000L",
  86 + "ARDUINO=10819",
  87 + "ARDUINO_AVR_UNO",
  88 + "ARDUINO_ARCH_AVR",
  89 + "__DBL_MIN_EXP__=(-125)",
  90 + "__HQ_FBIT__=15",
  91 + "__cpp_attributes=200809",
  92 + "__UINT_LEAST16_MAX__=0xffffU",
  93 + "__ATOMIC_ACQUIRE=2",
  94 + "__SFRACT_IBIT__=0",
  95 + "__FLT_MIN__=1.17549435e-38F",
  96 + "__GCC_IEC_559_COMPLEX=0",
  97 + "__BUILTIN_AVR_SLEEP=1",
  98 + "__BUILTIN_AVR_COUNTLSULLK=1",
  99 + "__cpp_aggregate_nsdmi=201304",
  100 + "__BUILTIN_AVR_COUNTLSULLR=1",
  101 + "__UFRACT_MAX__=0XFFFFP-16UR",
  102 + "__UINT_LEAST8_TYPE__=unsigned char",
  103 + "__DQ_FBIT__=63",
  104 + "__INTMAX_C(c)=c ## LL",
  105 + "__ULFRACT_FBIT__=32",
  106 + "__SACCUM_EPSILON__=0x1P-7HK",
  107 + "__CHAR_BIT__=8",
  108 + "__USQ_IBIT__=0",
  109 + "__UINT8_MAX__=0xff",
  110 + "__ACCUM_FBIT__=15",
  111 + "__WINT_MAX__=0x7fff",
  112 + "__FLT32_MIN_EXP__=(-125)",
  113 + "__cpp_static_assert=200410",
  114 + "__USFRACT_FBIT__=8",
  115 + "__ORDER_LITTLE_ENDIAN__=1234",
  116 + "__SIZE_MAX__=0xffffU",
  117 + "__WCHAR_MAX__=0x7fff",
  118 + "__LACCUM_IBIT__=32",
  119 + "__DBL_DENORM_MIN__=double(1.40129846e-45L)",
  120 + "__GCC_ATOMIC_CHAR_LOCK_FREE=1",
  121 + "__GCC_IEC_559=0",
  122 + "__FLT_EVAL_METHOD__=0",
  123 + "__BUILTIN_AVR_LLKBITS=1",
  124 + "__cpp_binary_literals=201304",
  125 + "__LLACCUM_MAX__=0X7FFFFFFFFFFFFFFFP-47LLK",
  126 + "__GCC_ATOMIC_CHAR32_T_LOCK_FREE=1",
  127 + "__BUILTIN_AVR_HKBITS=1",
  128 + "__BUILTIN_AVR_BITSLLK=1",
  129 + "__FRACT_FBIT__=15",
  130 + "__BUILTIN_AVR_BITSLLR=1",
  131 + "__cpp_variadic_templates=200704",
  132 + "__UINT_FAST64_MAX__=0xffffffffffffffffULL",
  133 + "__SIG_ATOMIC_TYPE__=char",
  134 + "__BUILTIN_AVR_UHKBITS=1",
  135 + "__UACCUM_FBIT__=16",
  136 + "__DBL_MIN_10_EXP__=(-37)",
  137 + "__FINITE_MATH_ONLY__=0",
  138 + "__cpp_variable_templates=201304",
  139 + "__LFRACT_IBIT__=0",
  140 + "__GNUC_PATCHLEVEL__=0",
  141 + "__FLT32_HAS_DENORM__=1",
  142 + "__LFRACT_MAX__=0X7FFFFFFFP-31LR",
  143 + "__UINT_FAST8_MAX__=0xff",
  144 + "__has_include(STR)=__has_include__(STR)",
  145 + "__DEC64_MAX_EXP__=385",
  146 + "__INT8_C(c)=c",
  147 + "__INT_LEAST8_WIDTH__=8",
  148 + "__UINT_LEAST64_MAX__=0xffffffffffffffffULL",
  149 + "__SA_FBIT__=15",
  150 + "__SHRT_MAX__=0x7fff",
  151 + "__LDBL_MAX__=3.40282347e+38L",
  152 + "__FRACT_MAX__=0X7FFFP-15R",
  153 + "__UFRACT_FBIT__=16",
  154 + "__UFRACT_MIN__=0.0UR",
  155 + "__UINT_LEAST8_MAX__=0xff",
  156 + "__GCC_ATOMIC_BOOL_LOCK_FREE=1",
  157 + "__UINTMAX_TYPE__=long long unsigned int",
  158 + "__LLFRACT_EPSILON__=0x1P-63LLR",
  159 + "__BUILTIN_AVR_DELAY_CYCLES=1",
  160 + "__DEC32_EPSILON__=1E-6DF",
  161 + "__FLT_EVAL_METHOD_TS_18661_3__=0",
  162 + "__UINT32_MAX__=0xffffffffUL",
  163 + "__GXX_EXPERIMENTAL_CXX0X__=1",
  164 + "__ULFRACT_MAX__=0XFFFFFFFFP-32ULR",
  165 + "__TA_IBIT__=16",
  166 + "__LDBL_MAX_EXP__=128",
  167 + "__WINT_MIN__=(-__WINT_MAX__ - 1)",
  168 + "__INT_LEAST16_WIDTH__=16",
  169 + "__ULLFRACT_MIN__=0.0ULLR",
  170 + "__SCHAR_MAX__=0x7f",
  171 + "__WCHAR_MIN__=(-__WCHAR_MAX__ - 1)",
  172 + "__INT64_C(c)=c ## LL",
  173 + "__DBL_DIG__=6",
  174 + "__GCC_ATOMIC_POINTER_LOCK_FREE=1",
  175 + "__AVR_HAVE_SPH__=1",
  176 + "__LLACCUM_MIN__=(-0X1P15LLK-0X1P15LLK)",
  177 + "__BUILTIN_AVR_KBITS=1",
  178 + "__BUILTIN_AVR_ABSK=1",
  179 + "__BUILTIN_AVR_ABSR=1",
  180 + "__SIZEOF_INT__=2",
  181 + "__SIZEOF_POINTER__=2",
  182 + "__GCC_ATOMIC_CHAR16_T_LOCK_FREE=1",
  183 + "__USACCUM_IBIT__=8",
  184 + "__USER_LABEL_PREFIX__",
  185 + "__STDC_HOSTED__=1",
  186 + "__LDBL_HAS_INFINITY__=1",
  187 + "__LFRACT_MIN__=(-0.5LR-0.5LR)",
  188 + "__HA_IBIT__=8",
  189 + "__FLT32_DIG__=6",
  190 + "__TQ_IBIT__=0",
  191 + "__FLT_EPSILON__=1.19209290e-7F",
  192 + "__GXX_WEAK__=1",
  193 + "__SHRT_WIDTH__=16",
  194 + "__USFRACT_IBIT__=0",
  195 + "__LDBL_MIN__=1.17549435e-38L",
  196 + "__FRACT_MIN__=(-0.5R-0.5R)",
  197 + "__AVR_SFR_OFFSET__=0x20",
  198 + "__DEC32_MAX__=9.999999E96DF",
  199 + "__cpp_threadsafe_static_init=200806",
  200 + "__DA_IBIT__=32",
  201 + "__INT32_MAX__=0x7fffffffL",
  202 + "__UQQ_FBIT__=8",
  203 + "__INT_WIDTH__=16",
  204 + "__SIZEOF_LONG__=4",
  205 + "__UACCUM_MAX__=0XFFFFFFFFP-16UK",
  206 + "__UINT16_C(c)=c ## U",
  207 + "__PTRDIFF_WIDTH__=16",
  208 + "__DECIMAL_DIG__=9",
  209 + "__LFRACT_EPSILON__=0x1P-31LR",
  210 + "__AVR_2_BYTE_PC__=1",
  211 + "__ULFRACT_MIN__=0.0ULR",
  212 + "__INTMAX_WIDTH__=64",
  213 + "__has_include_next(STR)=__has_include_next__(STR)",
  214 + "__BUILTIN_AVR_ULLRBITS=1",
  215 + "__LDBL_HAS_QUIET_NAN__=1",
  216 + "__ULACCUM_IBIT__=32",
  217 + "__UACCUM_EPSILON__=0x1P-16UK",
  218 + "__BUILTIN_AVR_SEI=1",
  219 + "__GNUC__=7",
  220 + "__ULLACCUM_MAX__=0XFFFFFFFFFFFFFFFFP-48ULLK",
  221 + "__cpp_delegating_constructors=200604",
  222 + "__HQ_IBIT__=0",
  223 + "__BUILTIN_AVR_SWAP=1",
  224 + "__FLT_HAS_DENORM__=1",
  225 + "__SIZEOF_LONG_DOUBLE__=4",
  226 + "__BIGGEST_ALIGNMENT__=1",
  227 + "__STDC_UTF_16__=1",
  228 + "__UINT24_MAX__=16777215UL",
  229 + "__BUILTIN_AVR_NOP=1",
  230 + "__GNUC_STDC_INLINE__=1",
  231 + "__DQ_IBIT__=0",
  232 + "__FLT32_HAS_INFINITY__=1",
  233 + "__DBL_MAX__=double(3.40282347e+38L)",
  234 + "__ULFRACT_IBIT__=0",
  235 + "__cpp_raw_strings=200710",
  236 + "__INT_FAST32_MAX__=0x7fffffffL",
  237 + "__DBL_HAS_INFINITY__=1",
  238 + "__INT64_MAX__=0x7fffffffffffffffLL",
  239 + "__ACCUM_IBIT__=16",
  240 + "__DEC32_MIN_EXP__=(-94)",
  241 + "__BUILTIN_AVR_UKBITS=1",
  242 + "__INTPTR_WIDTH__=16",
  243 + "__BUILTIN_AVR_FMULSU=1",
  244 + "__LACCUM_MAX__=0X7FFFFFFFFFFFFFFFP-31LK",
  245 + "__INT_FAST16_TYPE__=int",
  246 + "__LDBL_HAS_DENORM__=1",
  247 + "__BUILTIN_AVR_BITSK=1",
  248 + "__BUILTIN_AVR_BITSR=1",
  249 + "__cplusplus=201402L",
  250 + "__cpp_ref_qualifiers=200710",
  251 + "__DEC128_MAX__=9.999999999999999999999999999999999E6144DL",
  252 + "__INT_LEAST32_MAX__=0x7fffffffL",
  253 + "__USING_SJLJ_EXCEPTIONS__=1",
  254 + "__DEC32_MIN__=1E-95DF",
  255 + "__ACCUM_MAX__=0X7FFFFFFFP-15K",
  256 + "__DEPRECATED=1",
  257 + "__cpp_rvalue_references=200610",
  258 + "__DBL_MAX_EXP__=128",
  259 + "__USACCUM_EPSILON__=0x1P-8UHK",
  260 + "__WCHAR_WIDTH__=16",
  261 + "__FLT32_MAX__=3.40282347e+38F32",
  262 + "__DEC128_EPSILON__=1E-33DL",
  263 + "__SFRACT_MAX__=0X7FP-7HR",
  264 + "__FRACT_IBIT__=0",
  265 + "__PTRDIFF_MAX__=0x7fff",
  266 + "__UACCUM_MIN__=0.0UK",
  267 + "__UACCUM_IBIT__=16",
  268 + "__BUILTIN_AVR_NOPS=1",
  269 + "__BUILTIN_AVR_WDR=1",
  270 + "__FLT32_HAS_QUIET_NAN__=1",
  271 + "__GNUG__=7",
  272 + "__LONG_LONG_MAX__=0x7fffffffffffffffLL",
  273 + "__SIZEOF_SIZE_T__=2",
  274 + "__ULACCUM_MAX__=0XFFFFFFFFFFFFFFFFP-32ULK",
  275 + "__cpp_rvalue_reference=200610",
  276 + "__cpp_nsdmi=200809",
  277 + "__SIZEOF_WINT_T__=2",
  278 + "__LONG_LONG_WIDTH__=64",
  279 + "__cpp_initializer_lists=200806",
  280 + "__FLT32_MAX_EXP__=128",
  281 + "__SA_IBIT__=16",
  282 + "__ULLACCUM_MIN__=0.0ULLK",
  283 + "__BUILTIN_AVR_ROUNDUHK=1",
  284 + "__BUILTIN_AVR_ROUNDUHR=1",
  285 + "__cpp_hex_float=201603",
  286 + "__GXX_ABI_VERSION=1011",
  287 + "__INT24_MAX__=8388607L",
  288 + "__UTA_FBIT__=48",
  289 + "__FLT_MIN_EXP__=(-125)",
  290 + "__USFRACT_MAX__=0XFFP-8UHR",
  291 + "__UFRACT_IBIT__=0",
  292 + "__BUILTIN_AVR_ROUNDFX=1",
  293 + "__BUILTIN_AVR_ROUNDULK=1",
  294 + "__BUILTIN_AVR_ROUNDULR=1",
  295 + "__cpp_lambdas=200907",
  296 + "__BUILTIN_AVR_COUNTLSLLK=1",
  297 + "__BUILTIN_AVR_COUNTLSLLR=1",
  298 + "__BUILTIN_AVR_ROUNDHK=1",
  299 + "__INT_FAST64_TYPE__=long long int",
  300 + "__BUILTIN_AVR_ROUNDHR=1",
  301 + "__DBL_MIN__=double(1.17549435e-38L)",
  302 + "__BUILTIN_AVR_COUNTLSK=1",
  303 + "__BUILTIN_AVR_ROUNDLK=1",
  304 + "__BUILTIN_AVR_COUNTLSR=1",
  305 + "__BUILTIN_AVR_ROUNDLR=1",
  306 + "__LACCUM_MIN__=(-0X1P31LK-0X1P31LK)",
  307 + "__ULLACCUM_FBIT__=48",
  308 + "__BUILTIN_AVR_LKBITS=1",
  309 + "__ULLFRACT_EPSILON__=0x1P-64ULLR",
  310 + "__DEC128_MIN__=1E-6143DL",
  311 + "__REGISTER_PREFIX__",
  312 + "__UINT16_MAX__=0xffffU",
  313 + "__DBL_HAS_DENORM__=1",
  314 + "__BUILTIN_AVR_ULKBITS=1",
  315 + "__ACCUM_MIN__=(-0X1P15K-0X1P15K)",
  316 + "__AVR_ARCH__=2",
  317 + "__SQ_IBIT__=0",
  318 + "__FLT32_MIN__=1.17549435e-38F32",
  319 + "__UINT8_TYPE__=unsigned char",
  320 + "__BUILTIN_AVR_ROUNDUK=1",
  321 + "__BUILTIN_AVR_ROUNDUR=1",
  322 + "__UHA_FBIT__=8",
  323 + "__NO_INLINE__=1",
  324 + "__SFRACT_MIN__=(-0.5HR-0.5HR)",
  325 + "__UTQ_FBIT__=128",
  326 + "__FLT_MANT_DIG__=24",
  327 + "__LDBL_DECIMAL_DIG__=9",
  328 + "__VERSION__=\"7.3.0\"",
  329 + "__UINT64_C(c)=c ## ULL",
  330 + "__ULLFRACT_FBIT__=64",
  331 + "__cpp_unicode_characters=200704",
  332 + "__FRACT_EPSILON__=0x1P-15R",
  333 + "__ULACCUM_MIN__=0.0ULK",
  334 + "__UDA_FBIT__=32",
  335 + "__cpp_decltype_auto=201304",
  336 + "__LLACCUM_EPSILON__=0x1P-47LLK",
  337 + "__GCC_ATOMIC_INT_LOCK_FREE=1",
  338 + "__FLT32_MANT_DIG__=24",
  339 + "__BUILTIN_AVR_BITSUHK=1",
  340 + "__BUILTIN_AVR_BITSUHR=1",
  341 + "__FLOAT_WORD_ORDER__=__ORDER_LITTLE_ENDIAN__",
  342 + "__USFRACT_MIN__=0.0UHR",
  343 + "__BUILTIN_AVR_BITSULK=1",
  344 + "__ULLACCUM_IBIT__=16",
  345 + "__BUILTIN_AVR_BITSULR=1",
  346 + "__UQQ_IBIT__=0",
  347 + "__BUILTIN_AVR_LLRBITS=1",
  348 + "__SCHAR_WIDTH__=8",
  349 + "__BUILTIN_AVR_BITSULLK=1",
  350 + "__BUILTIN_AVR_BITSULLR=1",
  351 + "__INT32_C(c)=c ## L",
  352 + "__DEC64_EPSILON__=1E-15DD",
  353 + "__ORDER_PDP_ENDIAN__=3412",
  354 + "__DEC128_MIN_EXP__=(-6142)",
  355 + "__UHQ_FBIT__=16",
  356 + "__LLACCUM_FBIT__=47",
  357 + "__FLT32_MAX_10_EXP__=38",
  358 + "__BUILTIN_AVR_ROUNDULLK=1",
  359 + "__BUILTIN_AVR_ROUNDULLR=1",
  360 + "__INT_FAST32_TYPE__=long int",
  361 + "__BUILTIN_AVR_HRBITS=1",
  362 + "__UINT_LEAST16_TYPE__=unsigned int",
  363 + "__BUILTIN_AVR_UHRBITS=1",
  364 + "__INT16_MAX__=0x7fff",
  365 + "__SIZE_TYPE__=unsigned int",
  366 + "__UINT64_MAX__=0xffffffffffffffffULL",
  367 + "__UDQ_FBIT__=64",
  368 + "__INT8_TYPE__=signed char",
  369 + "__cpp_digit_separators=201309",
  370 + "__ELF__=1",
  371 + "__ULFRACT_EPSILON__=0x1P-32ULR",
  372 + "__LLFRACT_FBIT__=63",
  373 + "__FLT_RADIX__=2",
  374 + "__INT_LEAST16_TYPE__=int",
  375 + "__BUILTIN_AVR_ABSFX=1",
  376 + "__LDBL_EPSILON__=1.19209290e-7L",
  377 + "__UINTMAX_C(c)=c ## ULL",
  378 + "__INT24_MIN__=(-__INT24_MAX__-1)",
  379 + "__SACCUM_MAX__=0X7FFFP-7HK",
  380 + "__BUILTIN_AVR_ABSHR=1",
  381 + "__SIG_ATOMIC_MAX__=0x7f",
  382 + "__GCC_ATOMIC_WCHAR_T_LOCK_FREE=1",
  383 + "__cpp_sized_deallocation=201309",
  384 + "__SIZEOF_PTRDIFF_T__=2",
  385 + "__AVR=1",
  386 + "__BUILTIN_AVR_ABSLK=1",
  387 + "__BUILTIN_AVR_ABSLR=1",
  388 + "__LACCUM_EPSILON__=0x1P-31LK",
  389 + "__DEC32_SUBNORMAL_MIN__=0.000001E-95DF",
  390 + "__INT_FAST16_MAX__=0x7fff",
  391 + "__UINT_FAST32_MAX__=0xffffffffUL",
  392 + "__UINT_LEAST64_TYPE__=long long unsigned int",
  393 + "__USACCUM_MAX__=0XFFFFP-8UHK",
  394 + "__SFRACT_EPSILON__=0x1P-7HR",
  395 + "__FLT_HAS_QUIET_NAN__=1",
  396 + "__FLT_MAX_10_EXP__=38",
  397 + "__LONG_MAX__=0x7fffffffL",
  398 + "__DEC128_SUBNORMAL_MIN__=0.000000000000000000000000000000001E-6143DL",
  399 + "__FLT_HAS_INFINITY__=1",
  400 + "__cpp_unicode_literals=200710",
  401 + "__USA_FBIT__=16",
  402 + "__UINT_FAST16_TYPE__=unsigned int",
  403 + "__DEC64_MAX__=9.999999999999999E384DD",
  404 + "__INT_FAST32_WIDTH__=32",
  405 + "__BUILTIN_AVR_RBITS=1",
  406 + "__CHAR16_TYPE__=unsigned int",
  407 + "__PRAGMA_REDEFINE_EXTNAME=1",
  408 + "__SIZE_WIDTH__=16",
  409 + "__INT_LEAST16_MAX__=0x7fff",
  410 + "__DEC64_MANT_DIG__=16",
  411 + "__UINT_LEAST32_MAX__=0xffffffffUL",
  412 + "__SACCUM_FBIT__=7",
  413 + "__FLT32_DENORM_MIN__=1.40129846e-45F32",
  414 + "__GCC_ATOMIC_LONG_LOCK_FREE=1",
  415 + "__SIG_ATOMIC_WIDTH__=8",
  416 + "__INT_LEAST64_TYPE__=long long int",
  417 + "__INT16_TYPE__=int",
  418 + "__INT_LEAST8_TYPE__=signed char",
  419 + "__SQ_FBIT__=31",
  420 + "__DEC32_MAX_EXP__=97",
  421 + "__INT_FAST8_MAX__=0x7f",
  422 + "__INTPTR_MAX__=0x7fff",
  423 + "__QQ_FBIT__=7",
  424 + "__cpp_range_based_for=200907",
  425 + "__UTA_IBIT__=16",
  426 + "__AVR_ERRATA_SKIP__=1",
  427 + "__FLT32_MIN_10_EXP__=(-37)",
  428 + "__LDBL_MANT_DIG__=24",
  429 + "__SFRACT_FBIT__=7",
  430 + "__SACCUM_MIN__=(-0X1P7HK-0X1P7HK)",
  431 + "__DBL_HAS_QUIET_NAN__=1",
  432 + "__SIG_ATOMIC_MIN__=(-__SIG_ATOMIC_MAX__ - 1)",
  433 + "AVR=1",
  434 + "__BUILTIN_AVR_FMULS=1",
  435 + "__cpp_return_type_deduction=201304",
  436 + "__INTPTR_TYPE__=int",
  437 + "__UINT16_TYPE__=unsigned int",
  438 + "__WCHAR_TYPE__=int",
  439 + "__SIZEOF_FLOAT__=4",
  440 + "__AVR__=1",
  441 + "__BUILTIN_AVR_INSERT_BITS=1",
  442 + "__USQ_FBIT__=32",
  443 + "__UINTPTR_MAX__=0xffffU",
  444 + "__INT_FAST64_WIDTH__=64",
  445 + "__DEC64_MIN_EXP__=(-382)",
  446 + "__cpp_decltype=200707",
  447 + "__FLT32_DECIMAL_DIG__=9",
  448 + "__INT_FAST64_MAX__=0x7fffffffffffffffLL",
  449 + "__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1",
  450 + "__FLT_DIG__=6",
  451 + "__UINT_FAST64_TYPE__=long long unsigned int",
  452 + "__BUILTIN_AVR_BITSHK=1",
  453 + "__BUILTIN_AVR_BITSHR=1",
  454 + "__INT_MAX__=0x7fff",
  455 + "__LACCUM_FBIT__=31",
  456 + "__USACCUM_MIN__=0.0UHK",
  457 + "__UHA_IBIT__=8",
  458 + "__INT64_TYPE__=long long int",
  459 + "__BUILTIN_AVR_BITSLK=1",
  460 + "__BUILTIN_AVR_BITSLR=1",
  461 + "__FLT_MAX_EXP__=128",
  462 + "__UTQ_IBIT__=0",
  463 + "__DBL_MANT_DIG__=24",
  464 + "__cpp_inheriting_constructors=201511",
  465 + "__BUILTIN_AVR_ULLKBITS=1",
  466 + "__INT_LEAST64_MAX__=0x7fffffffffffffffLL",
  467 + "__DEC64_MIN__=1E-383DD",
  468 + "__WINT_TYPE__=int",
  469 + "__UINT_LEAST32_TYPE__=long unsigned int",
  470 + "__SIZEOF_SHORT__=2",
  471 + "__ULLFRACT_IBIT__=0",
  472 + "__LDBL_MIN_EXP__=(-125)",
  473 + "__UDA_IBIT__=32",
  474 + "__WINT_WIDTH__=16",
  475 + "__INT_LEAST8_MAX__=0x7f",
  476 + "__LFRACT_FBIT__=31",
  477 + "__LDBL_MAX_10_EXP__=38",
  478 + "__ATOMIC_RELAXED=0",
  479 + "__DBL_EPSILON__=double(1.19209290e-7L)",
  480 + "__BUILTIN_AVR_BITSUK=1",
  481 + "__BUILTIN_AVR_BITSUR=1",
  482 + "__UINT8_C(c)=c",
  483 + "__INT_LEAST32_TYPE__=long int",
  484 + "__BUILTIN_AVR_URBITS=1",
  485 + "__SIZEOF_WCHAR_T__=2",
  486 + "__LLFRACT_MAX__=0X7FFFFFFFFFFFFFFFP-63LLR",
  487 + "__TQ_FBIT__=127",
  488 + "__INT_FAST8_TYPE__=signed char",
  489 + "__ULLACCUM_EPSILON__=0x1P-48ULLK",
  490 + "__BUILTIN_AVR_ROUNDK=1",
  491 + "__BUILTIN_AVR_ROUNDR=1",
  492 + "__UHQ_IBIT__=0",
  493 + "__LLACCUM_IBIT__=16",
  494 + "__FLT32_EPSILON__=1.19209290e-7F32",
  495 + "__DBL_DECIMAL_DIG__=9",
  496 + "__STDC_UTF_32__=1",
  497 + "__INT_FAST8_WIDTH__=8",
  498 + "__DEC_EVAL_METHOD__=2",
  499 + "__TA_FBIT__=47",
  500 + "__UDQ_IBIT__=0",
  501 + "__ORDER_BIG_ENDIAN__=4321",
  502 + "__cpp_runtime_arrays=198712",
  503 + "__WITH_AVRLIBC__=1",
  504 + "__UINT64_TYPE__=long long unsigned int",
  505 + "__ACCUM_EPSILON__=0x1P-15K",
  506 + "__UINT32_C(c)=c ## UL",
  507 + "__BUILTIN_AVR_COUNTLSUHK=1",
  508 + "__INTMAX_MAX__=0x7fffffffffffffffLL",
  509 + "__cpp_alias_templates=200704",
  510 + "__BUILTIN_AVR_COUNTLSUHR=1",
  511 + "__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__",
  512 + "__FLT_DENORM_MIN__=1.40129846e-45F",
  513 + "__LLFRACT_IBIT__=0",
  514 + "__INT8_MAX__=0x7f",
  515 + "__LONG_WIDTH__=32",
  516 + "__UINT_FAST32_TYPE__=long unsigned int",
  517 + "__CHAR32_TYPE__=long unsigned int",
  518 + "__BUILTIN_AVR_COUNTLSULK=1",
  519 + "__BUILTIN_AVR_COUNTLSULR=1",
  520 + "__FLT_MAX__=3.40282347e+38F",
  521 + "__cpp_constexpr=201304",
  522 + "__USACCUM_FBIT__=8",
  523 + "__BUILTIN_AVR_COUNTLSFX=1",
  524 + "__INT32_TYPE__=long int",
  525 + "__SIZEOF_DOUBLE__=4",
  526 + "__FLT_MIN_10_EXP__=(-37)",
  527 + "__UFRACT_EPSILON__=0x1P-16UR",
  528 + "__INT_LEAST32_WIDTH__=32",
  529 + "__BUILTIN_AVR_COUNTLSHK=1",
  530 + "__BUILTIN_AVR_COUNTLSHR=1",
  531 + "__INTMAX_TYPE__=long long int",
  532 + "__BUILTIN_AVR_ABSLLK=1",
  533 + "__BUILTIN_AVR_ABSLLR=1",
  534 + "__DEC128_MAX_EXP__=6145",
  535 + "__AVR_HAVE_16BIT_SP__=1",
  536 + "__ATOMIC_CONSUME=1",
  537 + "__GNUC_MINOR__=3",
  538 + "__INT_FAST16_WIDTH__=16",
  539 + "__UINTMAX_MAX__=0xffffffffffffffffULL",
  540 + "__DEC32_MANT_DIG__=7",
  541 + "__HA_FBIT__=7",
  542 + "__BUILTIN_AVR_COUNTLSLK=1",
  543 + "__BUILTIN_AVR_COUNTLSLR=1",
  544 + "__BUILTIN_AVR_CLI=1",
  545 + "__DBL_MAX_10_EXP__=38",
  546 + "__LDBL_DENORM_MIN__=1.40129846e-45L",
  547 + "__INT16_C(c)=c",
  548 + "__cpp_generic_lambdas=201304",
  549 + "__STDC__=1",
  550 + "__PTRDIFF_TYPE__=int",
  551 + "__LLFRACT_MIN__=(-0.5LLR-0.5LLR)",
  552 + "__BUILTIN_AVR_LRBITS=1",
  553 + "__ATOMIC_SEQ_CST=5",
  554 + "__DA_FBIT__=31",
  555 + "__UINT32_TYPE__=long unsigned int",
  556 + "__BUILTIN_AVR_ROUNDLLK=1",
  557 + "__UINTPTR_TYPE__=unsigned int",
  558 + "__BUILTIN_AVR_ROUNDLLR=1",
  559 + "__USA_IBIT__=16",
  560 + "__BUILTIN_AVR_ULRBITS=1",
  561 + "__DEC64_SUBNORMAL_MIN__=0.000000000000001E-383DD",
  562 + "__DEC128_MANT_DIG__=34",
  563 + "__LDBL_MIN_10_EXP__=(-37)",
  564 + "__BUILTIN_AVR_COUNTLSUK=1",
  565 + "__BUILTIN_AVR_COUNTLSUR=1",
  566 + "__SIZEOF_LONG_LONG__=8",
  567 + "__ULACCUM_EPSILON__=0x1P-32ULK",
  568 + "__cpp_user_defined_literals=200809",
  569 + "__SACCUM_IBIT__=8",
  570 + "__GCC_ATOMIC_LLONG_LOCK_FREE=1",
  571 + "__LDBL_DIG__=6",
  572 + "__FLT_DECIMAL_DIG__=9",
  573 + "__UINT_FAST16_MAX__=0xffffU",
  574 + "__GCC_ATOMIC_SHORT_LOCK_FREE=1",
  575 + "__BUILTIN_AVR_ABSHK=1",
  576 + "__BUILTIN_AVR_FLASH_SEGMENT=1",
  577 + "__INT_LEAST64_WIDTH__=64",
  578 + "__ULLFRACT_MAX__=0XFFFFFFFFFFFFFFFFP-64ULLR",
  579 + "__UINT_FAST8_TYPE__=unsigned char",
  580 + "__USFRACT_EPSILON__=0x1P-8UHR",
  581 + "__ULACCUM_FBIT__=32",
  582 + "__QQ_IBIT__=0",
  583 + "__cpp_init_captures=201304",
  584 + "__ATOMIC_ACQ_REL=4",
  585 + "__ATOMIC_RELEASE=3",
  586 + "__BUILTIN_AVR_FMUL=1",
  587 + "USBCON"
  588 + ]
88 } 589 }
89 - ],  
90 - "version": 4 590 + ]
91 } 591 }
92 \ No newline at end of file 592 \ No newline at end of file
CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5 The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) 5 The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6 and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 6 and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7 7
  8 +## [v2.3.0] - 2021-12-23
  9 +
  10 +- Added support for setting the num. data bits.
  11 +- Added support for setting the parity.
  12 +- Added support for setting the num. stop bits.
  13 +
8 ## [v2.2.1] - 2021-12-06 14 ## [v2.2.1] - 2021-12-06
9 15
10 - Fixed a build error by changing the branch cmake downloads googletest from master to main. 16 - Fixed a build error by changing the branch cmake downloads googletest from master to main.
README.md
@@ -67,8 +67,8 @@ Library for communicating with COM ports on a Linux system. @@ -67,8 +67,8 @@ Library for communicating with COM ports on a Linux system.
67 using namespace mn::CppLinuxSerial; 67 using namespace mn::CppLinuxSerial;
68 68
69 int main() { 69 int main() {
70 - // Create serial port object and open serial port  
71 - SerialPort serialPort("/dev/ttyUSB0", BaudRate::B_57600); 70 + // Create serial port object and open serial port at 57600 buad, 8 data bits, no parity bit, and one stop bit (8n1)
  71 + SerialPort serialPort("/dev/ttyUSB0", BaudRate::B_57600, NumDataBits::EIGHT, Parity::NONE, NumStopBits::ONE);
72 // Use SerialPort serialPort("/dev/ttyACM0", 13000); instead if you want to provide a custom baud rate 72 // Use SerialPort serialPort("/dev/ttyACM0", 13000); instead if you want to provide a custom baud rate
73 serialPort.SetTimeout(-1); // Block when reading until any data is received 73 serialPort.SetTimeout(-1); // Block when reading until any data is received
74 serialPort.Open(); 74 serialPort.Open();
include/CppLinuxSerial/SerialPort.hpp
@@ -61,6 +61,26 @@ namespace mn { @@ -61,6 +61,26 @@ namespace mn {
61 B_CUSTOM, // Placeholder 61 B_CUSTOM, // Placeholder
62 }; 62 };
63 63
  64 + /// \brief Enumeration of all the valid num. of data bits. Must align with the options
  65 + /// provided in termbits.h, i.e. CS5, CS6, CS7 and CS8.
  66 + enum class NumDataBits {
  67 + FIVE,
  68 + SIX,
  69 + SEVEN,
  70 + EIGHT,
  71 + };
  72 +
  73 + enum class Parity {
  74 + NONE,
  75 + EVEN,
  76 + ODD,
  77 + };
  78 +
  79 + enum class NumStopBits {
  80 + ONE,
  81 + TWO,
  82 + };
  83 +
64 /// \brief Represents the state of the serial port. 84 /// \brief Represents the state of the serial port.
65 enum class State { 85 enum class State {
66 CLOSED, 86 CLOSED,
@@ -77,7 +97,10 @@ namespace mn { @@ -77,7 +97,10 @@ namespace mn {
77 /// \brief Constructor that sets up serial port with the basic (required) parameters. 97 /// \brief Constructor that sets up serial port with the basic (required) parameters.
78 SerialPort(const std::string &device, BaudRate baudRate); 98 SerialPort(const std::string &device, BaudRate baudRate);
79 99
80 - /// \brief Constructor that sets up serial port with the basic (required) parameters. 100 + /// \brief Constructor that sets up serial port and allows the user to specify all the common parameters.
  101 + SerialPort(const std::string &device, BaudRate baudRate, NumDataBits numDataBits, Parity parity, NumStopBits numStopBits);
  102 +
  103 + /// \brief Constructor that sets up serial port with the basic parameters, and a custom baud rate.
81 SerialPort(const std::string &device, speed_t baudRate); 104 SerialPort(const std::string &device, speed_t baudRate);
82 105
83 /// \brief Destructor. Closes serial port if still open. 106 /// \brief Destructor. Closes serial port if still open.
@@ -87,12 +110,20 @@ namespace mn { @@ -87,12 +110,20 @@ namespace mn {
87 /// \details Method can be called when serial port is in any state. 110 /// \details Method can be called when serial port is in any state.
88 void SetDevice(const std::string &device); 111 void SetDevice(const std::string &device);
89 112
90 - /// \brief Allows the user to set a standard baud rate. 113 + /// \brief Call this to set a standard baud rate.
91 void SetBaudRate(BaudRate baudRate); 114 void SetBaudRate(BaudRate baudRate);
92 115
93 - /// \brief Allows the user to set a custom baud rate. 116 + /// \brief Call this to set a custom baud rate.
94 void SetBaudRate(speed_t baudRate); 117 void SetBaudRate(speed_t baudRate);
95 118
  119 + /// \brief Call this to set the num. of data bits.
  120 + void SetNumDataBits(NumDataBits numDataBits);
  121 +
  122 + /// \brief Call this to set the parity.
  123 + void SetParity(Parity parity);
  124 +
  125 + void SetNumStopBits(NumStopBits numStopBits);
  126 +
96 /// \brief Sets the read timeout (in milliseconds)/blocking mode. 127 /// \brief Sets the read timeout (in milliseconds)/blocking mode.
97 /// \details Only call when state != OPEN. This method manupulates VMIN and VTIME. 128 /// \details Only call when state != OPEN. This method manupulates VMIN and VTIME.
98 /// \param timeout_ms Set to -1 to infinite timeout, 0 to return immediately with any data (non 129 /// \param timeout_ms Set to -1 to infinite timeout, 0 to return immediately with any data (non
@@ -169,6 +200,15 @@ namespace mn { @@ -169,6 +200,15 @@ namespace mn {
169 /// \brief The current baud rate if baudRateType_ == CUSTOM. 200 /// \brief The current baud rate if baudRateType_ == CUSTOM.
170 speed_t baudRateCustom_; 201 speed_t baudRateCustom_;
171 202
  203 + /// \brief The num. of data bits. Defaults to 8 (most common).
  204 + NumDataBits numDataBits_ = NumDataBits::EIGHT;
  205 +
  206 + /// \brief The parity. Defaults to none (most common).
  207 + Parity parity_ = Parity::NONE;
  208 +
  209 + /// \brief The num. of stop bits. Defaults to 1 (most common).
  210 + NumStopBits numStopBits_ = NumStopBits::ONE;
  211 +
172 /// \brief The file descriptor for the open file. This gets written to when Open() is called. 212 /// \brief The file descriptor for the open file. This gets written to when Open() is called.
173 int fileDesc_; 213 int fileDesc_;
174 214
src/SerialPort.cpp
@@ -58,6 +58,16 @@ namespace CppLinuxSerial { @@ -58,6 +58,16 @@ namespace CppLinuxSerial {
58 baudRateCustom_ = baudRate; 58 baudRateCustom_ = baudRate;
59 } 59 }
60 60
  61 + SerialPort::SerialPort(const std::string& device, BaudRate baudRate, NumDataBits numDataBits, Parity parity, NumStopBits numStopBits) :
  62 + SerialPort() {
  63 + device_ = device;
  64 + baudRateType_ = BaudRateType::STANDARD;
  65 + baudRateStandard_ = baudRate;
  66 + numDataBits_ = numDataBits;
  67 + parity_ = parity;
  68 + numStopBits_ = numStopBits;
  69 + }
  70 +
61 SerialPort::~SerialPort() { 71 SerialPort::~SerialPort() {
62 try { 72 try {
63 Close(); 73 Close();
@@ -73,22 +83,38 @@ namespace CppLinuxSerial { @@ -73,22 +83,38 @@ namespace CppLinuxSerial {
73 ConfigureTermios(); 83 ConfigureTermios();
74 } 84 }
75 85
76 - void SerialPort::SetBaudRate(BaudRate baudRate) {  
77 - std::cout << "standard called\n"; 86 + void SerialPort::SetBaudRate(BaudRate baudRate) {
78 baudRateType_ = BaudRateType::STANDARD; 87 baudRateType_ = BaudRateType::STANDARD;
79 baudRateStandard_ = baudRate; 88 baudRateStandard_ = baudRate;
80 if(state_ == State::OPEN) 89 if(state_ == State::OPEN)
81 ConfigureTermios(); 90 ConfigureTermios();
82 } 91 }
83 92
84 - void SerialPort::SetBaudRate(speed_t baudRate) {  
85 - std::cout << " custom called\n"; 93 + void SerialPort::SetBaudRate(speed_t baudRate) {
86 baudRateType_ = BaudRateType::CUSTOM; 94 baudRateType_ = BaudRateType::CUSTOM;
87 baudRateCustom_ = baudRate; 95 baudRateCustom_ = baudRate;
88 if(state_ == State::OPEN) 96 if(state_ == State::OPEN)
89 ConfigureTermios(); 97 ConfigureTermios();
90 } 98 }
91 99
  100 + void SerialPort::SetNumDataBits(NumDataBits numDataBits) {
  101 + numDataBits_ = numDataBits;
  102 + if(state_ == State::OPEN)
  103 + ConfigureTermios();
  104 + }
  105 +
  106 + void SerialPort::SetParity(Parity parity) {
  107 + parity_ = parity;
  108 + if(state_ == State::OPEN)
  109 + ConfigureTermios();
  110 + }
  111 +
  112 + void SerialPort::SetNumStopBits(NumStopBits numStopBits) {
  113 + numStopBits_ = numStopBits;
  114 + if(state_ == State::OPEN)
  115 + ConfigureTermios();
  116 + }
  117 +
92 void SerialPort::Open() 118 void SerialPort::Open()
93 { 119 {
94 120
@@ -132,10 +158,57 @@ namespace CppLinuxSerial { @@ -132,10 +158,57 @@ namespace CppLinuxSerial {
132 158
133 //================= (.c_cflag) ===============// 159 //================= (.c_cflag) ===============//
134 160
135 - tty.c_cflag &= ~PARENB; // No parity bit is added to the output characters  
136 - tty.c_cflag &= ~CSTOPB; // Only one stop-bit is used 161 + // Set num. data bits
  162 + // See https://man7.org/linux/man-pages/man3/tcflush.3.html
137 tty.c_cflag &= ~CSIZE; // CSIZE is a mask for the number of bits per character 163 tty.c_cflag &= ~CSIZE; // CSIZE is a mask for the number of bits per character
138 - tty.c_cflag |= CS8; // Set to 8 bits per character 164 + switch(numDataBits_) {
  165 + case NumDataBits::FIVE:
  166 + tty.c_cflag |= CS5;
  167 + break;
  168 + case NumDataBits::SIX:
  169 + tty.c_cflag |= CS6;
  170 + break;
  171 + case NumDataBits::SEVEN:
  172 + tty.c_cflag |= CS7;
  173 + break;
  174 + case NumDataBits::EIGHT:
  175 + tty.c_cflag |= CS8;
  176 + break;
  177 + default:
  178 + THROW_EXCEPT("numDataBits_ value not supported!");
  179 + }
  180 +
  181 + // Set parity
  182 + // See https://man7.org/linux/man-pages/man3/tcflush.3.html
  183 + switch(parity_) {
  184 + case Parity::NONE:
  185 + tty.c_cflag &= ~PARENB;
  186 + break;
  187 + case Parity::EVEN:
  188 + tty.c_cflag |= PARENB;
  189 + tty.c_cflag &= ~PARODD; // Clearing PARODD makes the parity even
  190 + break;
  191 + case Parity::ODD:
  192 + tty.c_cflag |= PARENB;
  193 + tty.c_cflag |= PARODD;
  194 + break;
  195 + default:
  196 + THROW_EXCEPT("parity_ value not supported!");
  197 +
  198 + }
  199 +
  200 + // Set num. stop bits
  201 + switch(numStopBits_) {
  202 + case NumStopBits::ONE:
  203 + tty.c_cflag &= ~CSTOPB;
  204 + break;
  205 + case NumStopBits::TWO:
  206 + tty.c_cflag |= CSTOPB;
  207 + break;
  208 + default:
  209 + THROW_EXCEPT("numStopBits_ value not supported!");
  210 + }
  211 +
139 tty.c_cflag &= ~CRTSCTS; // Disable hadrware flow control (RTS/CTS) 212 tty.c_cflag &= ~CRTSCTS; // Disable hadrware flow control (RTS/CTS)
140 tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1) 213 tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1)
141 214
test/arduino/Basic/Basic.ino
@@ -13,7 +13,9 @@ @@ -13,7 +13,9 @@
13 // the setup routine runs once when you press reset: 13 // the setup routine runs once when you press reset:
14 void setup() { 14 void setup() {
15 // initialize serial communication at 9600 bits per second: 15 // initialize serial communication at 9600 bits per second:
16 - Serial.begin(9600); 16 + // Serial.begin(9600);
  17 + // Serial.begin(9600, SERIAL_5N1); // 5 data bits, no parity, 1 stop bit
  18 + Serial.begin(9600, SERIAL_8E2); // 8 data bits, even parity, 2 stop bits
17 // Serial.begin(81234); // Used to test custom baud rates 19 // Serial.begin(81234); // Used to test custom baud rates
18 } 20 }
19 21
test/arduino/main.cpp
@@ -4,7 +4,7 @@ using namespace mn::CppLinuxSerial; @@ -4,7 +4,7 @@ using namespace mn::CppLinuxSerial;
4 4
5 int main() { 5 int main() {
6 // Create serial port object and open serial port 6 // Create serial port object and open serial port
7 - SerialPort serialPort("/dev/ttyACM0", BaudRate::B_9600); 7 + SerialPort serialPort("/dev/ttyACM0", BaudRate::B_9600, NumDataBits::EIGHT, Parity::NONE, NumStopBits::ONE);
8 // SerialPort serialPort("/dev/ttyACM0", 13000); 8 // SerialPort serialPort("/dev/ttyACM0", 13000);
9 serialPort.SetTimeout(-1); // Block when reading until any data is received 9 serialPort.SetTimeout(-1); // Block when reading until any data is received
10 serialPort.Open(); 10 serialPort.Open();