-
Notifications
You must be signed in to change notification settings - Fork 7
/
serial.go
51 lines (44 loc) · 1.22 KB
/
serial.go
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package winapi
const (
ONESTOPBIT = 0
TWOSTOPBITS = 2
NOPARITY = 0
ODDPARITY = 1
EVENPARITY = 2
MARKPARITY = 3
SPACEPARITY = 4
)
type DCB struct {
DCBlength uint32
BaudRate uint32
Flags uint32
_ uint16
XonLim uint16
XoffLim uint16
ByteSize byte
Parity byte
StopBits byte
XonChar byte
XoffChar byte
ErrorChar byte
EofChar byte
EvtChar byte
_ uint16
}
type COMMTIMEOUTS struct {
ReadIntervalTimeout uint32
ReadTotalTimeoutMultiplier uint32
ReadTotalTimeoutConstant uint32
WriteTotalTimeoutMultiplier uint32
WriteTotalTimeoutConstant uint32
}
//sys GetCommState(handle syscall.Handle, dcb *DCB) (err error)
//sys SetCommState(handle syscall.Handle, dcb *DCB) (err error)
//sys GetCommTimeouts(handle syscall.Handle, timeouts *COMMTIMEOUTS) (err error)
//sys SetCommTimeouts(handle syscall.Handle, timeouts *COMMTIMEOUTS) (err error)
//sys SetupComm(handle syscall.Handle, inqueue uint32, outqueue uint32) (err error)
//sys SetCommMask(handle syscall.Handle, mask uint32) (err error)