Split registries into their own packages. (#122)

conn/gpio -> conn/gpio/gpioreg
conn/i2c -> conn/i2c/i2creg
conn/spi -> conn/spi/spireg
conn/pins -> conn/pin
host/headers -> conn/pin/pinreg
conn/reg -> conn/mmr
pull/1/head
M-A 9 years ago committed by GitHub
parent cbac673bcf
commit c8b66ce778

@ -15,6 +15,7 @@ import (
"testing"
"periph.io/x/periph/conn/spi"
"periph.io/x/periph/conn/spi/spireg"
"periph.io/x/periph/conn/spi/spitest"
)
@ -558,7 +559,7 @@ func TestInit(t *testing.T) {
//
func Example() {
bus, err := spi.Open("")
bus, err := spireg.Open("")
if err != nil {
log.Fatalf("failed to open SPI: %v", err)
}

@ -9,7 +9,7 @@ import (
"log"
"testing"
"periph.io/x/periph/conn/i2c"
"periph.io/x/periph/conn/i2c/i2creg"
"periph.io/x/periph/conn/i2c/i2ctest"
"periph.io/x/periph/devices"
)
@ -140,7 +140,7 @@ func TestCalibrationInt(t *testing.T) {
//
func Example() {
bus, err := i2c.Open("")
bus, err := i2creg.Open("")
if err != nil {
log.Fatalf("failed to open I²C: %v", err)
}

@ -8,7 +8,7 @@ import (
"fmt"
"testing"
"periph.io/x/periph/conn/i2c"
"periph.io/x/periph/conn/i2c/i2creg"
"periph.io/x/periph/conn/i2c/i2ctest"
)
@ -32,7 +32,7 @@ func TestInit(t *testing.T) {
func Example() {
// Open the I²C bus to which the DS248x is connected.
i2cBus, err := i2c.Open("")
i2cBus, err := i2creg.Open("")
if err != nil {
fmt.Println(err)
return
@ -72,7 +72,7 @@ func TestRecordInit(t *testing.T) {
}
host.Init()
i2cReal, err := i2c.Open("")
i2cReal, err := i2creg.Open("")
if err != nil {
t.Fatal(err)
}

@ -14,7 +14,7 @@ import (
"strings"
"sync"
"periph.io/x/periph/conn/gpio"
"periph.io/x/periph/conn/gpio/gpioreg"
"periph.io/x/periph/conn/ir"
)
@ -220,12 +220,12 @@ func (d *driver) Init() (bool, error) {
return false, nil
}
if in != -1 {
if err := gpio.RegisterAlias("IR_IN", in); err != nil {
if err := gpioreg.RegisterAlias("IR_IN", in); err != nil {
return true, err
}
}
if out != -1 {
if err := gpio.RegisterAlias("IR_OUT", out); err != nil {
if err := gpioreg.RegisterAlias("IR_OUT", out); err != nil {
return true, err
}
}

@ -14,7 +14,7 @@ import (
"golang.org/x/image/font/basicfont"
"golang.org/x/image/math/fixed"
"periph.io/x/periph/conn/i2c"
"periph.io/x/periph/conn/i2c/i2creg"
"periph.io/x/periph/conn/i2c/i2ctest"
"periph.io/x/periph/devices/ssd1306/image1bit"
)
@ -77,7 +77,7 @@ func TestDraw1D(t *testing.T) {
//
func Example() {
bus, err := i2c.Open("")
bus, err := i2creg.Open("")
if err != nil {
log.Fatalf("failed to open I²C: %v", err)
}

@ -8,7 +8,7 @@ import (
"log"
"testing"
"periph.io/x/periph/conn/gpio"
"periph.io/x/periph/conn/gpio/gpioreg"
"periph.io/x/periph/conn/gpio/gpiotest"
"periph.io/x/periph/host"
)
@ -30,7 +30,7 @@ func Example() {
if _, err := host.Init(); err != nil {
log.Fatalf("failed to initialize periph: %v", err)
}
dev, err := New(gpio.ByNumber(6), gpio.ByNumber(12))
dev, err := New(gpioreg.ByNumber(6), gpioreg.ByNumber(12))
if err != nil {
log.Fatalf("failed to initialize tm1637: %v", err)
}

Loading…
Cancel
Save