From f14363967420215203ec2a988037de509e90a95e Mon Sep 17 00:00:00 2001 From: Madhur Jain Date: Sat, 14 Mar 2015 22:54:28 +0530 Subject: [PATCH] Added comment to Flush() for godoc --- serial_linux.go | 2 ++ serial_posix.go | 2 ++ serial_windows.go | 2 ++ 3 files changed, 6 insertions(+) diff --git a/serial_linux.go b/serial_linux.go index 2ed613a..9f0f884 100644 --- a/serial_linux.go +++ b/serial_linux.go @@ -103,6 +103,8 @@ func (p *Port) Write(b []byte) (n int, err error) { return p.f.Write(b) } +// Discards data written to the port but not transmitted, +// or data received but not read func (p *Port) Flush() error { const TCFLSH = 0x540B _, _, err := syscall.Syscall( diff --git a/serial_posix.go b/serial_posix.go index 5387947..95a592b 100644 --- a/serial_posix.go +++ b/serial_posix.go @@ -133,6 +133,8 @@ func (p *Port) Write(b []byte) (n int, err error) { return p.f.Write(b) } +// Discards data written to the port but not transmitted, +// or data received but not read func (p *Port) Flush() error { _, err := C.tcflush(C.int(p.f.Fd()), C.TCIOFLUSH) return err diff --git a/serial_windows.go b/serial_windows.go index ea99e68..3c747bc 100644 --- a/serial_windows.go +++ b/serial_windows.go @@ -127,6 +127,8 @@ func (p *Port) Read(buf []byte) (int, error) { return getOverlappedResult(p.fd, p.ro) } +// Discards data written to the port but not transmitted, +// or data received but not read func (p *Port) Flush() error { return purgeComm(p.fd) }