Beispiel #1
0
// Close the serial port.
func (p *Port) Close() error {
	if !p.opened {
		panic("already closed")
	}
	err := errmsg(C.sp_close(p.p))
	p.opened = false
	return err
}
Beispiel #2
0
// Close restores the port to how it was before initialisation, closes the port and
// frees resources.
func Close(s *Conf) {
	C.sp_flush(s.Port, SP_BUF_BOTH)
	C.sp_free_config(s.newConfig)
	C.sp_set_config(s.Port, s.oldConfig)
	C.sp_free_config(s.oldConfig)

	C.sp_close(s.Port)
}
Beispiel #3
0
// Finalizer callback for garbage collection.
func (i *Info) free() {
	if i.p != nil {
		if i.opened {
			C.sp_close(i.p)
		}
		C.sp_free_port(i.p)
	}
	i.opened = false
	i.p = nil
}
Beispiel #4
0
Datei: sp.go Projekt: proxyio/xio
func sp_close(eid int) (rc int) {
	rc = int(C.sp_close(C.int(eid)))
	return rc
}