@ -16,7 +16,7 @@
* [doc/users/ ](doc/users/ ) for ready-to-use tools.
* [doc/users/ ](doc/users/ ) for ready-to-use tools.
* [doc/apps/ ](doc/apps/ ) to use `periph` as a library. The complete API
* [doc/apps/ ](doc/apps/ ) to use `periph` as a library. The complete API
documentation, including examples, is at
documentation, including examples, is at
[](https://godoc.org/github.com/google /periph).
[](https://godoc.org/periph.io/x /periph).
* [doc/drivers/ ](doc/drivers/ ) to expand the list of supported hardware.
* [doc/drivers/ ](doc/drivers/ ) to expand the list of supported hardware.
@ -27,7 +27,7 @@ for more info on configuring the host and using the included tools.
```bash
```bash
# Retrieve and install all the commands at once:
# Retrieve and install all the commands at once:
go get github.com/google /periph/cmd/...
go get periph.io/x /periph/cmd/...
# List the host drivers registered and/or initialized:
# List the host drivers registered and/or initialized:
periph-info
periph-info
# List the known headers:
# List the known headers:
@ -49,8 +49,8 @@ package main
import (
import (
"time"
"time"
"github.com/google /periph/conn/gpio"
"periph.io/x /periph/conn/gpio"
"github.com/google /periph/host"
"periph.io/x /periph/host"
)
)
func main() {
func main() {
@ -64,11 +64,11 @@ func main() {
The following are synonyms, use the form you prefer:
The following are synonyms, use the form you prefer:
* Runtime discovery:
* Runtime discovery:
* [`gpio.ByNumber(13)` ](https://godoc.org/ github.com/google/periph/conn/gpio/#ByNumber) or [`gpio.ByName("13")` ](https://godoc.org/github.com/google /periph/conn/gpio/#ByName)
* [`gpio.ByNumber(13)` ](https://godoc.org/ periph.io/x/periph/conn/gpio/#ByNumber) or [`gpio.ByName("13")` ](https://godoc.org/periph.io/x /periph/conn/gpio/#ByName)
* [`gpio.ByName("GPIO13")` ](https://godoc.org/ github.com/google /periph/conn/gpio/#ByName)
* [`gpio.ByName("GPIO13")` ](https://godoc.org/ periph.io/x /periph/conn/gpio/#ByName)
* Using global variables:
* Using global variables:
* [`rpi.P1_33` ](https://godoc.org/ github.com/google /periph/host/rpi#/P1_33) to select the pin via its position on the board
* [`rpi.P1_33` ](https://godoc.org/ periph.io/x /periph/host/rpi#/P1_33) to select the pin via its position on the board
* [`bcm283x.GPIO13` ](https://godoc.org/ github.com/google /periph/host/bcm283x/#GPIO13)
* [`bcm283x.GPIO13` ](https://godoc.org/ periph.io/x /periph/host/bcm283x/#GPIO13)
This example uses basically no CPU: the `Out()` call doesn't call into the
This example uses basically no CPU: the `Out()` call doesn't call into the
kernel. Instead it directly changes the GPIO memory mapped register.
kernel. Instead it directly changes the GPIO memory mapped register.
@ -108,12 +108,12 @@ Google Contributor License. Please see
on each platform.
on each platform.
3. ... yet doesn't get in the way of platform specific code.
3. ... yet doesn't get in the way of platform specific code.
* e.g. A user can use statically typed global variables
* e.g. A user can use statically typed global variables
[rpi.P1_3 ](https://godoc.org/ github.com/google /periph/host/rpi#pkg-variables),
[rpi.P1_3 ](https://godoc.org/ periph.io/x /periph/host/rpi#pkg-variables),
[bcm283x.GPIO2 ](https://godoc.org/ github.com/google /periph/host/bcm283x#Pin)
[bcm283x.GPIO2 ](https://godoc.org/ periph.io/x /periph/host/bcm283x#Pin)
to refer to the exact same pin on a Raspberry Pi.
to refer to the exact same pin on a Raspberry Pi.
3. The user can chose to optimize for performance instead of usability.
3. The user can chose to optimize for performance instead of usability.
* e.g.
* e.g.
[apa102.Dev ](https://godoc.org/ github.com/google /periph/devices/apa102#Dev)
[apa102.Dev ](https://godoc.org/ periph.io/x /periph/devices/apa102#Dev)
exposes both high level
exposes both high level
[draw.Image ](https://golang.org/pkg/image/draw/#Image ) to draw an image and
[draw.Image ](https://golang.org/pkg/image/draw/#Image ) to draw an image and
low level [io.Writer ](https://golang.org/pkg/io/#Writer ) to write raw RGB
low level [io.Writer ](https://golang.org/pkg/io/#Writer ) to write raw RGB
@ -124,15 +124,15 @@ Google Contributor License. Please see
"component": one for the CPU, one for the board headers, one for each
"component": one for the CPU, one for the board headers, one for each
bus and sensor, etc.
bus and sensor, etc.
5. Extensible via a [driver
5. Extensible via a [driver
registry](https://godoc.org/github.com/google /periph#Register).
registry](https://godoc.org/periph.io/x /periph#Register).
* e.g. a user can inject a custom driver to expose more pins, headers, etc.
* e.g. a user can inject a custom driver to expose more pins, headers, etc.
A USB device (like an FT232H) can expose headers _in addition_ to the
A USB device (like an FT232H) can expose headers _in addition_ to the
headers found on the host.
headers found on the host.
6. The drivers must use the fastest possible implementation.
6. The drivers must use the fastest possible implementation.
* e.g. both
* e.g. both
[allwinner ](https://godoc.org/ github.com/google /periph/host/allwinner)
[allwinner ](https://godoc.org/ periph.io/x /periph/host/allwinner)
and
and
[bcm283x ](https://godoc.org/ github.com/google /periph/host/bcm283x)
[bcm283x ](https://godoc.org/ periph.io/x /periph/host/bcm283x)
leverage sysfs gpio to expose interrupt driven edge detection, yet use
leverage sysfs gpio to expose interrupt driven edge detection, yet use
memory mapped GPIO registers to perform single-cycle reads and writes.
memory mapped GPIO registers to perform single-cycle reads and writes.