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

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

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

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

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

@ -8,7 +8,7 @@ import (
"log" "log"
"testing" "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/conn/gpio/gpiotest"
"periph.io/x/periph/host" "periph.io/x/periph/host"
) )
@ -30,7 +30,7 @@ func Example() {
if _, err := host.Init(); err != nil { if _, err := host.Init(); err != nil {
log.Fatalf("failed to initialize periph: %v", err) 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 { if err != nil {
log.Fatalf("failed to initialize tm1637: %v", err) log.Fatalf("failed to initialize tm1637: %v", err)
} }

Loading…
Cancel
Save