Documentation ¶
Overview ¶
Package conn defines core interfaces for protocols and connections.
Subpackages implements all the interfaces that can be used to connects peripherals.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn interface { // Tx does a single transaction. // // For full duplex protocols (generally SPI, UART), the two buffers must have // the same length as both reading and writing happen simultaneously. // // For half duplex protocols (I²C), there is no restriction as reading // happens after writing, and r can be nil. // // Query Limits.MaxTxSize() to know if there is a limit on the buffer size // per Tx() call. Tx(w, r []byte) error // Duplex returns the current duplex setting for this point-to-point // connection. // // It is expected to be either Half or Full unless the connection itself is // in an unknown state. Duplex() Duplex }
Conn defines the interface for a connection on a point-to-point communication channel.
The connection can either be unidirectional (read-only, write-only) or bidirectional (read-write). The connection can either be half-duplex or full duplex.
This is the lowest common denominator for all point-to-point communication channels.
Implementation are expected to also implement the following interfaces:
- fmt.Stringer which returns something meaningful to the user like "SPI0.1", "I2C1.76", "COM6", etc.
- io.Reader and io.Writer as an way to use io.Copy() on a read-only or write-only device. For example the FLIR Lepton is a read-only device, the SSD1306 is a write-only device.
type Duplex ¶
type Duplex int
Duplex declares whether communication can happen simultaneously both ways.
Some protocol can be either depending on configuration settings, like UART.
const ( // DuplexUnknown is used when the duplex of a connection is yet to be known. // // Some protocol can be configured either as half-duplex or full-duplex and // the connection is not yet is a determinate state. DuplexUnknown Duplex = 0 // Half means that communication can only occurs one way at a time. // // Examples include 1-wire and I²C. Half Duplex = 1 // Full means that communication occurs simultaneously both ways in a // synchronized manner. // // Examples include SPI (except rare variants). Full Duplex = 2 )
Directories ¶
Path | Synopsis |
---|---|
Package conntest implements fakes for package conn.
|
Package conntest implements fakes for package conn. |
Package gpio defines digital pins.
|
Package gpio defines digital pins. |
gpioreg
Package gpioreg defines a registry for the known digital pins.
|
Package gpioreg defines a registry for the known digital pins. |
gpiosmoketest
Package gpiosmoketest is leveraged by periph-smoketest to verify that basic GPIO pin functionality work.
|
Package gpiosmoketest is leveraged by periph-smoketest to verify that basic GPIO pin functionality work. |
gpiostream
Package gpiostream defines digital streams.
|
Package gpiostream defines digital streams. |
gpiotest
Package gpiotest is meant to be used to test drivers using fake Pins.
|
Package gpiotest is meant to be used to test drivers using fake Pins. |
Package i2c defines interface to an I²C bus and an I²C device.
|
Package i2c defines interface to an I²C bus and an I²C device. |
i2creg
Package i2creg defines I²C bus registry to list buses present on the host.
|
Package i2creg defines I²C bus registry to list buses present on the host. |
i2csmoketest
Package i2csmoketest is leveraged by periph-smoketest to verify that an I²C EEPROM device and a DS2483 device can be accessed on an I²C bus.
|
Package i2csmoketest is leveraged by periph-smoketest to verify that an I²C EEPROM device and a DS2483 device can be accessed on an I²C bus. |
i2ctest
Package i2ctest is meant to be used to test drivers over a fake I²C bus.
|
Package i2ctest is meant to be used to test drivers over a fake I²C bus. |
Package ir defines InfraRed codes for use with a IR remote control.
|
Package ir defines InfraRed codes for use with a IR remote control. |
Package mmr defines helpers to interact with devices exposing Memory Mapped Registers protocol.
|
Package mmr defines helpers to interact with devices exposing Memory Mapped Registers protocol. |
Package onewire defines a Dallas Semiconductor / Maxim Integrated 1-wire bus.
|
Package onewire defines a Dallas Semiconductor / Maxim Integrated 1-wire bus. |
onewirereg
Package onewirereg defines a registry for onewire buses present on the host.
|
Package onewirereg defines a registry for onewire buses present on the host. |
onewiresmoketest
Package onewiresmoketest is leveraged by periph-smoketest to verify that a 1-wire bus search returns two devices, that a ds18b20 temperature sensor can be read, and that a ds2431 eeprom can be written and read.
|
Package onewiresmoketest is leveraged by periph-smoketest to verify that a 1-wire bus search returns two devices, that a ds18b20 temperature sensor can be read, and that a ds2431 eeprom can be written and read. |
onewiretest
Package onewiretest is meant to be used to test drivers over a fake 1-wire bus.
|
Package onewiretest is meant to be used to test drivers over a fake 1-wire bus. |
Package pin declare well known pins.
|
Package pin declare well known pins. |
pinreg
Package pinreg is a registry for the physical headers (made up of pins) on a host.
|
Package pinreg is a registry for the physical headers (made up of pins) on a host. |
Package spi defines the SPI protocol.
|
Package spi defines the SPI protocol. |
spireg
Package spireg defines the SPI registry for SPI ports discovered on the host.
|
Package spireg defines the SPI registry for SPI ports discovered on the host. |
spismoketest
Package spismoketest is leveraged by periph-smoketest to verify that an EEPROM device can be accessed on a SPI port.
|
Package spismoketest is leveraged by periph-smoketest to verify that an EEPROM device can be accessed on a SPI port. |
spitest
Package spitest is meant to be used to test drivers over a fake SPI port.
|
Package spitest is meant to be used to test drivers over a fake SPI port. |