diff options
| author | Tetralux <tetraluxonpc@gmail.com> | 2022-09-21 19:01:33 +0000 |
|---|---|---|
| committer | Tetralux <tetraluxonpc@gmail.com> | 2022-09-22 15:14:14 +0000 |
| commit | 37a2356485d66bc777105e0520a1206713cbb86f (patch) | |
| tree | 9ebabc8d23bdcf9ae5387649f8cef68a93136948 /src/check_expr.cpp | |
| parent | 3455e5690ce8d09eda37bff8478dadae73160af1 (diff) | |
[sys/windows] Add DCB structure, SetCommState, GetCommState
These are the procedures for configuring a serial port.
You simply open the port with CreateFile (os.open), followed by a call to GetCommState,
setting the DCB as desired, followed by a SetCommState call.
The DCB structure uses C bitfields, so a configuration struct is provided along with a helper procedure to make it easier
to initialize in Odin code.
This makes it possible to initialize a DCB structure with one call to the helper:
```
dcb: DCB
windows.init_dcb_with_config(&dcb, {
BaudRate = 115200,
ByteSize = 8,
Parity = .None,
StopBits = .One,
})
```
(The parity and the stopbits are actually optional in this example, as their zero-values are None and One, respectively.)
Diffstat (limited to 'src/check_expr.cpp')
0 files changed, 0 insertions, 0 deletions