Documentation ¶
Overview ¶
Package uart defines the UART protocol.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn interface { conn.Conn // Speed changes the bus speed. Speed(baud int) error // Configure changes the communication parameters of the bus. // // There's rarely a reason to use anything else than One stop bit and 8 bits // per character. Configure(stopBit Stop, parity Parity, bits int) error }
Conn defines the interface a concrete UART driver must implement.
It implements conn.Conn.
type ConnCloser ¶
ConnCloser is a connection that can be closed.
type Pins ¶
type Pins interface { // RX returns the receive pin. RX() gpio.PinIn // TX returns the transmit pin. TX() gpio.PinOut // RTS returns the request to send pin. RTS() gpio.PinIO // CTS returns the clear to send pin. CTS() gpio.PinIO }
Pins defines the pins that an UART bus interconnect is using on the host.
It is expected that a implementer of Conn also implement Pins but this is not a requirement.
Example ¶
//b, err := uartreg.Open("") //defer b.Close() var b Conn // Prints out the gpio pin used. if p, ok := b.(Pins); ok { fmt.Printf(" RX : %s", p.RX()) fmt.Printf(" TX : %s", p.TX()) fmt.Printf(" RTS: %s", p.RTS()) fmt.Printf(" CTS: %s", p.CTS()) }
Output:
Click to show internal directories.
Click to hide internal directories.