| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
package serial |
| 5 |
|
| 6 |
const ( |
| 7 |
c_MAXDWORD = 0xffffffff |
| 8 |
c_ONESTOPBIT = 0x0 |
| 9 |
c_TWOSTOPBITS = 0x2 |
| 10 |
c_EVENPARITY = 0x2 |
| 11 |
c_ODDPARITY = 0x1 |
| 12 |
c_NOPARITY = 0x0 |
| 13 |
) |
| 14 |
|
| 15 |
type c_COMMTIMEOUTS struct { |
| 16 |
ReadIntervalTimeout uint32 |
| 17 |
ReadTotalTimeoutMultiplier uint32 |
| 18 |
ReadTotalTimeoutConstant uint32 |
| 19 |
WriteTotalTimeoutMultiplier uint32 |
| 20 |
WriteTotalTimeoutConstant uint32 |
| 21 |
} |
| 22 |
|
| 23 |
type c_DCB struct { |
| 24 |
DCBlength uint32 |
| 25 |
BaudRate uint32 |
| 26 |
Pad_cgo_0 [4]byte |
| 27 |
WReserved uint16 |
| 28 |
XonLim uint16 |
| 29 |
XoffLim uint16 |
| 30 |
ByteSize uint8 |
| 31 |
Parity uint8 |
| 32 |
StopBits uint8 |
| 33 |
XonChar int8 |
| 34 |
XoffChar int8 |
| 35 |
ErrorChar int8 |
| 36 |
EofChar int8 |
| 37 |
EvtChar int8 |
| 38 |
WReserved1 uint16 |
| 39 |
} |
| 40 |
|
| 41 |
func toDWORD(val int) uint32 { |
| 42 |
return uint32(val) |
| 43 |
} |
| 44 |
|
| 45 |
func toBYTE(val int) uint8 { |
| 46 |
return uint8(val) |
| 47 |
} |