build: upgrade periph.io dependencies

This commit is contained in:
Cyrille Nofficial 2021-09-01 21:41:28 +02:00
parent 8b5888ee1b
commit 3393931a05
174 changed files with 6750 additions and 744 deletions

4
go.mod
View File

@ -8,7 +8,8 @@ require (
github.com/eclipse/paho.mqtt.golang v1.3.5 github.com/eclipse/paho.mqtt.golang v1.3.5
github.com/golang/protobuf v1.5.2 github.com/golang/protobuf v1.5.2
github.com/sirupsen/logrus v1.8.1 github.com/sirupsen/logrus v1.8.1
periph.io/x/periph v3.6.8+incompatible periph.io/x/conn/v3 v3.6.8
periph.io/x/host/v3 v3.7.0
) )
require ( require (
@ -17,4 +18,5 @@ require (
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 // indirect golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 // indirect
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect
google.golang.org/protobuf v1.26.0 // indirect google.golang.org/protobuf v1.26.0 // indirect
periph.io/x/d2xx v0.0.1 // indirect
) )

8
go.sum
View File

@ -124,5 +124,9 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v0.0.0-20181223230014-1083505acf35/go.mod h1:R//lfYlUuTOTfblYI3lGoAAAebUdzjvbmQsuB7Ykd90= gotest.tools v0.0.0-20181223230014-1083505acf35/go.mod h1:R//lfYlUuTOTfblYI3lGoAAAebUdzjvbmQsuB7Ykd90=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
periph.io/x/periph v3.6.8+incompatible h1:lki0ie6wHtvlilXhIkabdCUQMpb5QN4Fx33yNQdqnaA= periph.io/x/conn/v3 v3.6.8 h1:fnNSwSoKPzpoLOSxml70EInaP6YrrqcucP3KDfNxpmU=
periph.io/x/periph v3.6.8+incompatible/go.mod h1:EWr+FCIU2dBWz5/wSWeiIUJTriYv9v2j2ENBmgYyy7Y= periph.io/x/conn/v3 v3.6.8/go.mod h1:3OD27w9YVa5DS97VsUxsPGzD9Qrm5Ny7cF5b6xMMIWg=
periph.io/x/d2xx v0.0.1 h1:7iCO/aVK6k9GSZ45DcpMU8sOOcVLCqO/cheSm7nMUG0=
periph.io/x/d2xx v0.0.1/go.mod h1:38Euaaj+s6l0faIRHh32a+PrjXvxFTFkPBEQI0TKg34=
periph.io/x/host/v3 v3.7.0 h1:9CP/j0FcJmR+PRHlNzAmhV6Mt3GXoWnPmRhknJlQhnE=
periph.io/x/host/v3 v3.7.0/go.mod h1:okb5m0yUYLTM/dnMYWMBX47w4owTzyCPLpZUQb35nhs=

View File

@ -2,9 +2,9 @@ package led
import ( import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"periph.io/x/periph/conn/gpio" "periph.io/x/conn/v3/gpio"
"periph.io/x/periph/host" "periph.io/x/host/v3"
"periph.io/x/periph/host/bcm283x" "periph.io/x/host/v3/bcm283x"
"sync" "sync"
"time" "time"
) )

View File

@ -1,7 +1,7 @@
package led package led
import ( import (
"periph.io/x/periph/conn/gpio" "periph.io/x/conn/v3/gpio"
"sync" "sync"
"testing" "testing"
"time" "time"

69
vendor/modules.txt vendored
View File

@ -60,34 +60,41 @@ google.golang.org/protobuf/runtime/protoiface
google.golang.org/protobuf/runtime/protoimpl google.golang.org/protobuf/runtime/protoimpl
google.golang.org/protobuf/types/descriptorpb google.golang.org/protobuf/types/descriptorpb
google.golang.org/protobuf/types/known/timestamppb google.golang.org/protobuf/types/known/timestamppb
# periph.io/x/periph v3.6.8+incompatible # periph.io/x/conn/v3 v3.6.8
## explicit ## explicit; go 1.13
periph.io/x/periph periph.io/x/conn/v3
periph.io/x/periph/conn periph.io/x/conn/v3/driver
periph.io/x/periph/conn/gpio periph.io/x/conn/v3/driver/driverreg
periph.io/x/periph/conn/gpio/gpioreg periph.io/x/conn/v3/gpio
periph.io/x/periph/conn/gpio/gpiostream periph.io/x/conn/v3/gpio/gpioreg
periph.io/x/periph/conn/i2c periph.io/x/conn/v3/gpio/gpiostream
periph.io/x/periph/conn/i2c/i2creg periph.io/x/conn/v3/i2c
periph.io/x/periph/conn/physic periph.io/x/conn/v3/i2c/i2creg
periph.io/x/periph/conn/pin periph.io/x/conn/v3/physic
periph.io/x/periph/conn/pin/pinreg periph.io/x/conn/v3/pin
periph.io/x/periph/conn/spi periph.io/x/conn/v3/pin/pinreg
periph.io/x/periph/conn/spi/spireg periph.io/x/conn/v3/spi
periph.io/x/periph/host periph.io/x/conn/v3/spi/spireg
periph.io/x/periph/host/allwinner # periph.io/x/d2xx v0.0.1
periph.io/x/periph/host/am335x ## explicit; go 1.13
periph.io/x/periph/host/bcm283x periph.io/x/d2xx
periph.io/x/periph/host/beagle/black # periph.io/x/host/v3 v3.7.0
periph.io/x/periph/host/beagle/bone ## explicit; go 1.13
periph.io/x/periph/host/beagle/green periph.io/x/host/v3
periph.io/x/periph/host/chip periph.io/x/host/v3/allwinner
periph.io/x/periph/host/cpu periph.io/x/host/v3/am335x
periph.io/x/periph/host/distro periph.io/x/host/v3/bcm283x
periph.io/x/periph/host/fs periph.io/x/host/v3/beagle/black
periph.io/x/periph/host/odroidc1 periph.io/x/host/v3/beagle/bone
periph.io/x/periph/host/pine64 periph.io/x/host/v3/beagle/green
periph.io/x/periph/host/pmem periph.io/x/host/v3/chip
periph.io/x/periph/host/rpi periph.io/x/host/v3/cpu
periph.io/x/periph/host/sysfs periph.io/x/host/v3/distro
periph.io/x/periph/host/videocore periph.io/x/host/v3/fs
periph.io/x/host/v3/ftdi
periph.io/x/host/v3/odroidc1
periph.io/x/host/v3/pine64
periph.io/x/host/v3/pmem
periph.io/x/host/v3/rpi
periph.io/x/host/v3/sysfs
periph.io/x/host/v3/videocore

513
vendor/periph.io/x/conn/v3/.gohci.yml generated vendored Normal file
View File

@ -0,0 +1,513 @@
# Copyright 2021 The Periph Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
# See https://github.com/periph/gohci
version: 1
workers:
# BeagleBone Green Wireles by SeedStudio.
# https://beagleboard.org/green-wireless
- name: beaglebone-1860
checks:
- cmd:
- go
- test
- -cover
- -bench=.
- -benchtime=1000ms
- -benchmem
- ./...
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/host
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../host
- cmd:
- go
- test
- ./...
dir: ../host
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/devices
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../devices
- cmd:
- go
- test
- ./...
dir: ../devices
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/cmd
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../cmd
- cmd:
- go
- test
- ./...
dir: ../cmd
# Test commands.
- cmd:
- go
- install
- -v
- ./headers-list
- ./i2c-list
- ./periph-info
- ./periph-smoketest
- ./spi-list
dir: ../cmd
- cmd:
- periph-info
- cmd:
- headers-list
- -f
- cmd:
- i2c-list
- cmd:
- spi-list
- cmd:
- periph-smoketest
- gpio
- -pin1
- P8_45
- -pin2
- P8_46
# ODROID-C1+ by HardKernel
# https://www.hardkernel.com/shop/odroid-c1/
- name: odroid-483d
checks:
- cmd:
- go
- test
- -cover
- -bench=.
- -benchtime=1000ms
- -benchmem
- ./...
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/host
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../host
- cmd:
- go
- test
- ./...
dir: ../host
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/devices
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../devices
- cmd:
- go
- test
- ./...
dir: ../devices
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/cmd
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../cmd
- cmd:
- go
- test
- ./...
dir: ../cmd
# Test commands.
- cmd:
- go
- install
- -v
- ./gpio-list
- ./headers-list
- ./i2c-list
- ./periph-info
- ./periph-smoketest
- ./spi-list
dir: ../cmd
- cmd:
- periph-info
- cmd:
- gpio-list
- -f
- cmd:
- headers-list
- -f
- cmd:
- i2c-list
- cmd:
- spi-list
- cmd:
- periph-smoketest
- odroid-c1
- cmd:
- periph-smoketest
- i2c-testboard
- cmd:
- periph-smoketest
- onewire-testboard
- cmd:
- periph-smoketest
- spi-testboard
- cmd:
- periph-smoketest
- sysfs-benchmark
- -p
- 97
- -short
# Raspberry Pi 3
- name: raspberrypi-2f34
checks:
- cmd:
- go
- test
- -cover
- -bench=.
- -benchtime=1000ms
- -benchmem
- ./...
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/host
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../host
- cmd:
- go
- test
- ./...
dir: ../host
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/devices
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../devices
- cmd:
- go
- test
- ./...
dir: ../devices
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/cmd
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../cmd
- cmd:
- go
- test
- ./...
dir: ../cmd
# Test commands.
- cmd:
- go
- install
- -v
- ./gpio-list
- ./headers-list
- ./i2c-list
- ./periph-info
- ./periph-smoketest
- ./spi-list
dir: ../cmd
- cmd:
- periph-info
- cmd:
- gpio-list
- -f
- cmd:
- headers-list
- -f
- cmd:
- i2c-list
- cmd:
- spi-list
- cmd:
- periph-smoketest
- i2c-testboard
- cmd:
- periph-smoketest
- onewire-testboard
- -i2cbus
- 1
- cmd:
- periph-smoketest
- spi-testboard
- cmd:
- periph-smoketest
- sysfs-benchmark
- -p
- 12
- -short
- cmd:
- periph-smoketest
- bcm283x-benchmark
- -p
- 12
- -short
- cmd:
- periph-smoketest
- gpio
- -pin1
- P1_15
- -pin2
- P1_16
- cmd:
- periph-smoketest
- bcm283x
- -quick
# Old MacBook Pro on 10.9.
- name: mbp
checks:
- cmd:
- go
- test
- -cover
- -bench=.
- -benchtime=1000ms
- -benchmem
- ./...
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/host
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../host
- cmd:
- go
- test
- ./...
dir: ../host
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/devices
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../devices
- cmd:
- go
- test
- ./...
dir: ../devices
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/cmd
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../cmd
- cmd:
- go
- test
- ./...
dir: ../cmd
# Test commands.
- cmd:
- go
- install
- -v
- ./gpio-list
- ./headers-list
- ./i2c-list
- ./periph-info
- ./periph-smoketest
- ./spi-list
dir: ../cmd
- cmd:
- periph-info
- cmd:
- gpio-list
- -f
- cmd:
- headers-list
- -f
- cmd:
- i2c-list
- cmd:
- spi-list
# Laptop on Windows 10.
- name: win10
checks:
- cmd:
- go
- test
- -cover
- -bench=.
- -benchtime=1000ms
- -benchmem
- ./...
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/host
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../host
- cmd:
- go
- test
- ./...
dir: ../host
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/devices
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../devices
- cmd:
- go
- test
- ./...
dir: ../devices
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/cmd
dir: ..
- cmd:
- go
- get
- periph.io/x/conn/v3@${GIT_SHA}
dir: ../cmd
- cmd:
- go
- test
- ./...
dir: ../cmd
# Test commands.
- cmd:
- go
- install
- -v
- ./gpio-list
- ./headers-list
- ./i2c-list
- ./periph-info
- ./periph-smoketest
- ./spi-list
dir: ../cmd
- cmd:
- periph-info
- cmd:
- gpio-list
- -f
- cmd:
- headers-list
- -f
- cmd:
- i2c-list
- cmd:
- spi-list

57
vendor/periph.io/x/conn/v3/README.md generated vendored Normal file
View File

@ -0,0 +1,57 @@
# periph - Peripherals I/O in Go
Documentation is at https://periph.io
Join us for a chat on
[gophers.slack.com/messages/periph](https://gophers.slack.com/messages/periph),
get an [invite here](https://invite.slack.golangbridge.org/).
[![mascot](https://raw.githubusercontent.com/periph/website/master/site/static/img/periph-mascot-280.png)](https://periph.io/)
[![PkgGoDev](https://pkg.go.dev/badge/periph.io/x/conn/v3)](https://pkg.go.dev/periph.io/x/conn/v3)
[![Coverage
Status](https://codecov.io/gh/periph/conn/graph/badge.svg)](https://codecov.io/gh/periph/conn)
## Example
Blink a LED:
~~~go
package main
import (
"time"
"periph.io/x/conn/v3/gpio"
"periph.io/x/host"
"periph.io/x/host/rpi"
)
func main() {
host.Init()
t := time.NewTicker(500 * time.Millisecond)
for l := gpio.Low; ; l = !l {
rpi.P1_33.Out(l)
<-t.C
}
}
~~~
Curious? Look at [supported devices](https://periph.io/device/) for more
examples!
## Authors
`periph` was initiated with ❤️️ and passion by [Marc-Antoine
Ruel](https://github.com/maruel). The full list of contributors is in
[AUTHORS](https://github.com/periph/conn/blob/main/AUTHORS) and
[CONTRIBUTORS](https://github.com/periph/conn/blob/main/CONTRIBUTORS).
## Disclaimer
This is not an official Google product (experimental or otherwise), it
is just code that happens to be owned by Google.
This project is not affiliated with the Go project.

63
vendor/periph.io/x/conn/v3/doc.go generated vendored Normal file
View File

@ -0,0 +1,63 @@
// Copyright 2016 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// Package conn defines core interfaces for protocols and connections.
//
// This package and its subpackages describe the base interfaces to connect the
// software with the real world. It doesn't contain any implementation but
// includes registries to enable the application to discover the available
// hardware.
//
// Concepts
//
// periph uses 3 layered concepts for interfacing:
//
// Bus → Port → Conn
//
// Not every subpackage expose all 3 concepts. In fact, most packages don't.
// For example, SPI doesn't expose Bus as the OSes generally only expose the
// Port, that is, a Chip Select (CS) line must be selected right upfront to get
// an handle. For I²C, there's no Port to configure, so selecting a "slave"
// address is sufficient to jump directly from a Bus to a Conn.
//
// periph doesn't have yet a concept of star-like communication network, like
// an IP network.
//
// Bus
//
// A Bus is a multi-point communication channel where one "master" and multiple
// "slaves" communicate together. In the case of periph, the Bus handle is
// assumed to be the "master". The "master" generally initiates communications
// and selects the "slave" to talk to.
//
// As the "master" selects a "slave" over a bus, a virtual Port is
// automatically created.
//
// Examples include SPI, I²C and 1-wire. In each case, selecting a
// communication line (Chip Select (CS) line for SPI, address for I²C or
// 1-wire) converts the Bus into a Port.
//
// Port
//
// A port is a point-to-point communication channel that is yet to be
// initialized. It cannot be used for communication until it is connected and
// transformed into a Conn. Configuring a Port converts it into a Conn. Not all
// Port need configuration.
//
// Conn
//
// A Conn is a fully configured half or full duplex communication channel that
// is point-to-point, only between two devices. It is ready to use like any
// readable and/or writable pipe.
//
// Subpackages
//
// Most connection-type specific subpackages include subpackages:
//
// → XXXreg: registry as that is populated by the host drivers and that can be
// leveraged by applications.
//
// → XXXtest: fake implementation that can be leveraged when writing device
// driver unit test.
package conn

45
vendor/periph.io/x/conn/v3/driver/driver.go generated vendored Normal file
View File

@ -0,0 +1,45 @@
// Copyright 2016 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// Package driver devices a host peripheral driver to register when
// initializing.
//
// Drivers that can be automatically discovered should be registered in
// driverreg so discovery is done automatically.
package driver
// Impl is a host peripheral driver implementation.
type Impl interface {
// String returns the name of the driver, as to be presented to the user.
//
// It must be unique in the list of registered drivers.
String() string
// Prerequisites returns a list of drivers that must be successfully loaded
// first before attempting to load this driver.
//
// A driver listing a prerequisite not registered is a fatal failure at
// initialization time.
Prerequisites() []string
// After returns a list of drivers that must be loaded first before
// attempting to load this driver.
//
// Unlike Prerequisites(), this driver will still be attempted even if the
// listed driver is missing or failed to load.
//
// This permits serialization without hard requirement.
After() []string
// Init initializes the driver.
//
// A driver may enter one of the three following state: loaded successfully,
// was skipped as irrelevant on this host, failed to load.
//
// On success, it must return true, nil.
//
// When irrelevant (skipped), it must return false, errors.New(<reason>).
//
// On failure, it must return true, errors.New(<reason>). The failure must
// state why it failed, for example an expected OS provided driver couldn't
// be opened, e.g. /dev/gpiomem on Raspbian.
Init() (bool, error)
}

View File

@ -2,61 +2,23 @@
// Use of this source code is governed under the Apache License, Version 2.0 // Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file. // that can be found in the LICENSE file.
// Package periph is a peripheral I/O library. // Package driverreg is a registry for all host driver implementation that can
// // be automatically discovered.
// Is it now superseded by https://periph.io/x/conn/v3 (or later), package driverreg
// https://periph.io/x/host/v3 (or later), https://periph.io/x/devices/v3 (or
// later) and https://periph.io/x/cmd.
//
// See https://periph.io/news/2020/a_new_start/ for more details.
package periph // import "periph.io/x/periph"
import ( import (
"errors" "errors"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
)
// Driver is an implementation for a protocol. "periph.io/x/conn/v3/driver"
type Driver interface { )
// String returns the name of the driver, as to be presented to the user.
//
// It must be unique in the list of registered drivers.
String() string
// Prerequisites returns a list of drivers that must be successfully loaded
// first before attempting to load this driver.
//
// A driver listing a prerequisite not registered is a fatal failure at
// initialization time.
Prerequisites() []string
// After returns a list of drivers that must be loaded first before
// attempting to load this driver.
//
// Unlike Prerequisites(), this driver will still be attempted even if the
// listed driver is missing or failed to load.
//
// This permits serialization without hard requirement.
After() []string
// Init initializes the driver.
//
// A driver may enter one of the three following state: loaded successfully,
// was skipped as irrelevant on this host, failed to load.
//
// On success, it must return true, nil.
//
// When irrelevant (skipped), it must return false, errors.New(<reason>).
//
// On failure, it must return true, errors.New(<reason>). The failure must
// state why it failed, for example an expected OS provided driver couldn't
// be opened, e.g. /dev/gpiomem on Raspbian.
Init() (bool, error)
}
// DriverFailure is a driver that wasn't loaded, either because it was skipped // DriverFailure is a driver that wasn't loaded, either because it was skipped
// or because it failed to load. // or because it failed to load.
type DriverFailure struct { type DriverFailure struct {
D Driver D driver.Impl
Err error Err error
} }
@ -74,7 +36,7 @@ func (d DriverFailure) String() string {
// //
// Each list is sorted by the driver name. // Each list is sorted by the driver name.
type State struct { type State struct {
Loaded []Driver Loaded []driver.Impl
Skipped []DriverFailure Skipped []DriverFailure
Failed []DriverFailure Failed []DriverFailure
} }
@ -102,7 +64,7 @@ func Init() (*State, error) {
// The d.String() value must be unique across all registered drivers. // The d.String() value must be unique across all registered drivers.
// //
// It is an error to call Register() after Init() was called. // It is an error to call Register() after Init() was called.
func Register(d Driver) error { func Register(d driver.Impl) error {
mu.Lock() mu.Lock()
defer mu.Unlock() defer mu.Unlock()
if state != nil { if state != nil {
@ -120,7 +82,7 @@ func Register(d Driver) error {
// MustRegister calls Register() and panics if registration fails. // MustRegister calls Register() and panics if registration fails.
// //
// This is the function to call in a driver's package init() function. // This is the function to call in a driver's package init() function.
func MustRegister(d Driver) { func MustRegister(d driver.Impl) {
if err := Register(d); err != nil { if err := Register(d); err != nil {
panic(err) panic(err)
} }
@ -136,14 +98,14 @@ var (
// Once Init() is called, Register() refuses registering more drivers, thus // Once Init() is called, Register() refuses registering more drivers, thus
// byName is immutable once Init() started. // byName is immutable once Init() started.
mu sync.Mutex mu sync.Mutex
byName = map[string]Driver{} byName = map[string]driver.Impl{}
state *State state *State
) )
// stage is a set of drivers that can be loaded in parallel. // stage is a set of drivers that can be loaded in parallel.
type stage struct { type stage struct {
// Subset of byName drivers, for the ones in this stage. // Subset of byName drivers, for the ones in this stage.
drvs map[string]Driver drvs map[string]driver.Impl
} }
// explodeStages creates one or multiple stages by processing byName. // explodeStages creates one or multiple stages by processing byName.
@ -178,7 +140,7 @@ func explodeStages() ([]*stage, error) {
// Create stages. // Create stages.
var stages []*stage var stages []*stage
for len(dag) != 0 { for len(dag) != 0 {
s := &stage{drvs: map[string]Driver{}} s := &stage{drvs: map[string]driver.Impl{}}
for name, deps := range dag { for name, deps := range dag {
// This driver has no dependency, add it to the current stage. // This driver has no dependency, add it to the current stage.
if len(deps) == 0 { if len(deps) == 0 {
@ -211,7 +173,7 @@ func explodeStages() ([]*stage, error) {
return stages, nil return stages, nil
} }
func insertDriver(l []Driver, d Driver) []Driver { func insertDriver(l []driver.Impl, d driver.Impl) []driver.Impl {
n := d.String() n := d.String()
i := search(len(l), func(i int) bool { return l[i].String() > n }) i := search(len(l), func(i int) bool { return l[i].String() > n })
l = append(l, nil) l = append(l, nil)

View File

@ -7,18 +7,20 @@
// +build !tinygo // +build !tinygo
package periph package driverreg
import ( import (
"errors" "errors"
"strconv" "strconv"
"sync" "sync"
"periph.io/x/conn/v3/driver"
) )
func initImpl() (*State, error) { func initImpl() (*State, error) {
state = &State{} state = &State{}
// At this point, byName is guaranteed to be immutable. // At this point, byName is guaranteed to be immutable.
cD := make(chan Driver) cD := make(chan driver.Impl)
cS := make(chan DriverFailure) cS := make(chan DriverFailure)
cE := make(chan DriverFailure) cE := make(chan DriverFailure)
var wg sync.WaitGroup var wg sync.WaitGroup
@ -62,7 +64,7 @@ func initImpl() (*State, error) {
// loadParallel loads all the drivers for this stage in parallel. // loadParallel loads all the drivers for this stage in parallel.
// //
// Updates loaded in a safe way. // Updates loaded in a safe way.
func (s *stage) loadParallel(loaded map[string]struct{}, cD chan<- Driver, cS, cE chan<- DriverFailure) { func (s *stage) loadParallel(loaded map[string]struct{}, cD chan<- driver.Impl, cS, cE chan<- DriverFailure) {
success := make(chan string) success := make(chan string)
go func() { go func() {
defer close(success) defer close(success)
@ -79,7 +81,7 @@ func (s *stage) loadParallel(loaded map[string]struct{}, cD chan<- Driver, cS, c
// Not skipped driver, attempt loading in a goroutine. // Not skipped driver, attempt loading in a goroutine.
wg.Add(1) wg.Add(1)
go func(n string, d Driver) { go func(n string, d driver.Impl) {
defer wg.Done() defer wg.Done()
if ok, err := d.Init(); ok { if ok, err := d.Init(); ok {
if err == nil { if err == nil {

View File

@ -7,7 +7,7 @@
// +build tinygo // +build tinygo
package periph package driverreg
import ( import (
"errors" "errors"

View File

@ -4,7 +4,7 @@
package gpio package gpio
import "periph.io/x/periph/conn/pin" import "periph.io/x/conn/v3/pin"
// Well known pin functionality. // Well known pin functionality.
const ( const (

View File

@ -14,8 +14,8 @@ import (
"strings" "strings"
"time" "time"
"periph.io/x/periph/conn/physic" "periph.io/x/conn/v3/physic"
"periph.io/x/periph/conn/pin" "periph.io/x/conn/v3/pin"
) )
// Interfaces // Interfaces

View File

@ -10,7 +10,7 @@ import (
"strconv" "strconv"
"sync" "sync"
"periph.io/x/periph/conn/gpio" "periph.io/x/conn/v3/gpio"
) )
// ByName returns a GPIO pin from its name, gpio number or one of its aliases. // ByName returns a GPIO pin from its name, gpio number or one of its aliases.

View File

@ -13,9 +13,9 @@ import (
"fmt" "fmt"
"time" "time"
"periph.io/x/periph/conn/gpio" "periph.io/x/conn/v3/gpio"
"periph.io/x/periph/conn/physic" "periph.io/x/conn/v3/physic"
"periph.io/x/periph/conn/pin" "periph.io/x/conn/v3/pin"
) )
// Stream is the interface to define a generic stream. // Stream is the interface to define a generic stream.

View File

@ -4,7 +4,7 @@
package i2c package i2c
import "periph.io/x/periph/conn/pin" import "periph.io/x/conn/v3/pin"
// Well known pin functionality. // Well known pin functionality.
const ( const (

View File

@ -5,7 +5,7 @@
// Package i2c defines the API to communicate with devices over the I²C // Package i2c defines the API to communicate with devices over the I²C
// protocol. // protocol.
// //
// As described in https://periph.io/x/periph/conn#hdr-Concepts, periph.io uses // As described in https://periph.io/x/conn/v3#hdr-Concepts, periph.io uses
// the concepts of Bus, Port and Conn. // the concepts of Bus, Port and Conn.
// //
// In the package i2c, 'Port' is not exposed, since once you know the I²C // In the package i2c, 'Port' is not exposed, since once you know the I²C
@ -23,9 +23,9 @@ import (
"io" "io"
"strconv" "strconv"
"periph.io/x/periph/conn" "periph.io/x/conn/v3"
"periph.io/x/periph/conn/gpio" "periph.io/x/conn/v3/gpio"
"periph.io/x/periph/conn/physic" "periph.io/x/conn/v3/physic"
) )
// Bus defines the interface a concrete I²C driver must implement. // Bus defines the interface a concrete I²C driver must implement.

View File

@ -11,7 +11,7 @@ import (
"strings" "strings"
"sync" "sync"
"periph.io/x/periph/conn/i2c" "periph.io/x/conn/v3/i2c"
) )
// Opener opens an handle to a bus. // Opener opens an handle to a bus.

View File

@ -7,7 +7,7 @@ package physic
import ( import (
"time" "time"
"periph.io/x/periph/conn" "periph.io/x/conn/v3"
) )
// Env represents measurements from an environmental sensor. // Env represents measurements from an environmental sensor.

View File

@ -12,7 +12,7 @@ package pin
import ( import (
"errors" "errors"
"periph.io/x/periph/conn" "periph.io/x/conn/v3"
) )
// These are well known pins. // These are well known pins.

View File

@ -9,9 +9,9 @@ import (
"strconv" "strconv"
"sync" "sync"
"periph.io/x/periph/conn/gpio" "periph.io/x/conn/v3/gpio"
"periph.io/x/periph/conn/gpio/gpioreg" "periph.io/x/conn/v3/gpio/gpioreg"
"periph.io/x/periph/conn/pin" "periph.io/x/conn/v3/pin"
) )
// All contains all the on-board headers on a micro computer. // All contains all the on-board headers on a micro computer.

View File

@ -4,7 +4,7 @@
package spi package spi
import "periph.io/x/periph/conn/pin" import "periph.io/x/conn/v3/pin"
// Well known pin functionality. // Well known pin functionality.
const ( const (

View File

@ -5,7 +5,7 @@
// Package spi defines the API to communicate with devices over the SPI // Package spi defines the API to communicate with devices over the SPI
// protocol. // protocol.
// //
// As described in https://periph.io/x/periph/conn#hdr-Concepts, periph.io uses // As described in https://periph.io/x/conn/v3#hdr-Concepts, periph.io uses
// the concepts of Bus, Port and Conn. // the concepts of Bus, Port and Conn.
// //
// In the package spi, 'Bus' is not exposed, as it would be SPI bus number // In the package spi, 'Bus' is not exposed, as it would be SPI bus number
@ -25,9 +25,9 @@ import (
"io" "io"
"strconv" "strconv"
"periph.io/x/periph/conn" "periph.io/x/conn/v3"
"periph.io/x/periph/conn/gpio" "periph.io/x/conn/v3/gpio"
"periph.io/x/periph/conn/physic" "periph.io/x/conn/v3/physic"
) )
// Mode determines how communication is done. // Mode determines how communication is done.

View File

@ -14,7 +14,7 @@ import (
"strings" "strings"
"sync" "sync"
"periph.io/x/periph/conn/spi" "periph.io/x/conn/v3/spi"
) )
// Opener opens an handle to a port. // Opener opens an handle to a port.

48
vendor/periph.io/x/d2xx/.gohci.yml generated vendored Normal file
View File

@ -0,0 +1,48 @@
# Copyright 2021 The Periph Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
# See https://github.com/periph/gohci
version: 1
workers:
- checks:
- cmd:
- go
- test
- ./...
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/host
dir: ..
- cmd:
- go
- get
- periph.io/x/d2xx@${GIT_SHA}
dir: ../host
- cmd:
- go
- test
- ./...
dir: ../host
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/cmd
dir: ..
- cmd:
- go
- get
- periph.io/x/d2xx@${GIT_SHA}
dir: ../cmd
- cmd:
- go
- test
- ./...
dir: ../cmd

202
vendor/periph.io/x/d2xx/LICENSE generated vendored Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

16
vendor/periph.io/x/d2xx/README.md generated vendored Normal file
View File

@ -0,0 +1,16 @@
# d2xx
Package d2xx is a thin Go wrapper for the Future Technology "D2XX" driver at
https://ftdichip.com/drivers/d2xx-drivers/.
See https://periph.io/device/ftdi/ for more details, and how to configure
the host to be able to use this driver.
This package is not Go idiomatic. You will want to use
https://periph.io/x/host/v3/ftdi (or later) instead.
But if you really want, here it goes:
[![PkgGoDev](https://pkg.go.dev/badge/periph.io/x/d2xx)](https://pkg.go.dev/periph.io/x/d2xx)
This Go package includes third party software. See
[third_party/README.md](third_party/README.md).

132
vendor/periph.io/x/d2xx/d2xx.go generated vendored Normal file
View File

@ -0,0 +1,132 @@
// Copyright 2021 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
package d2xx
import (
"strconv"
)
// Err is the error type returned by d2xx functions.
type Err int
// These are additional synthetic error codes.
const (
// NoCGO is returned when the package was compiled without cgo, thus the d2xx
// library is unavailable.
//
// This is never returned on Windows.
NoCGO Err = -2
// Missing is returned when the dynamic library is not available.
Missing Err = -1
)
// String converts a error integer to a string representation of the error.
func (e Err) String() string {
switch e {
case Missing:
// when the library d2xx couldn't be loaded at runtime.
return "couldn't load driver; visit https://periph.io/device/ftdi/ for help"
case NoCGO:
return "can't be used without cgo"
case 0: // FT_OK
return ""
case 1: // FT_INVALID_HANDLE
return "invalid handle"
case 2: // FT_DEVICE_NOT_FOUND
return "device not found; see https://periph.io/device/ftdi/ for help"
case 3: // FT_DEVICE_NOT_OPENED
return "device busy; see https://periph.io/device/ftdi/ for help"
case 4: // FT_IO_ERROR
return "I/O error"
case 5: // FT_INSUFFICIENT_RESOURCES
return "insufficient resources"
case 6: // FT_INVALID_PARAMETER
return "invalid parameter"
case 7: // FT_INVALID_BAUD_RATE
return "invalid baud rate"
case 8: // FT_DEVICE_NOT_OPENED_FOR_ERASE
return "device not opened for erase"
case 9: // FT_DEVICE_NOT_OPENED_FOR_WRITE
return "device not opened for write"
case 10: // FT_FAILED_TO_WRITE_DEVICE
return "failed to write device"
case 11: // FT_EEPROM_READ_FAILED
return "eeprom read failed"
case 12: // FT_EEPROM_WRITE_FAILED
return "eeprom write failed"
case 13: // FT_EEPROM_ERASE_FAILED
return "eeprom erase failed"
case 14: // FT_EEPROM_NOT_PRESENT
return "eeprom not present"
case 15: // FT_EEPROM_NOT_PROGRAMMED
return "eeprom not programmed"
case 16: // FT_INVALID_ARGS
return "invalid argument"
case 17: // FT_NOT_SUPPORTED
return "not supported"
case 18: // FT_OTHER_ERROR
return "other error"
case 19: // FT_DEVICE_LIST_NOT_READY
return "device list not ready"
default:
return "unknown status " + strconv.Itoa(int(e))
}
}
// unknown is a forward declaration of ftdi.DevType.
const unknown = 3
// handle is a d2xx handle.
//
// This is the base type which each OS specific implementation adds methods to.
type handle uintptr
// Handle is d2xx device handle.
type Handle interface {
Close() Err
// ResetDevice takes >1.2ms
ResetDevice() Err
GetDeviceInfo() (uint32, uint16, uint16, Err)
EEPROMRead(devType uint32, e *EEPROM) Err
EEPROMProgram(e *EEPROM) Err
EraseEE() Err
WriteEE(offset uint8, value uint16) Err
EEUASize() (int, Err)
EEUARead(ua []byte) Err
EEUAWrite(ua []byte) Err
SetChars(eventChar byte, eventEn bool, errorChar byte, errorEn bool) Err
SetUSBParameters(in, out int) Err
SetFlowControl() Err
SetTimeouts(readMS, writeMS int) Err
SetLatencyTimer(delayMS uint8) Err
SetBaudRate(hz uint32) Err
// GetQueueStatus takes >60µs
GetQueueStatus() (uint32, Err)
// Read takes <5µs if GetQueueStatus was called just before,
// 300µs~800µs otherwise (!)
Read(b []byte) (int, Err)
// Write takes >0.1ms
Write(b []byte) (int, Err)
GetBitMode() (byte, Err)
// SetBitMode takes >0.1ms
SetBitMode(mask, mode byte) Err
}
var _ Handle = handle(0)
// Version returns the library's version.
func Version() (uint8, uint8, uint8) {
return version()
}
// CreateDeviceInfoList discovers the currently found devices.
func CreateDeviceInfoList() (int, Err) {
return createDeviceInfoList()
}
// Open opens the ith device discovered.
func Open(i int) (Handle, Err) {
return open(i)
}

12
vendor/periph.io/x/d2xx/d2xx_darwin_amd64.go generated vendored Normal file
View File

@ -0,0 +1,12 @@
// Copyright 2017 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// +build cgo
package d2xx
/*
#cgo LDFLAGS: -framework CoreFoundation -framework IOKit ${SRCDIR}/third_party/libftd2xx_darwin_amd64_v1.4.4.a
*/
import "C"

12
vendor/periph.io/x/d2xx/d2xx_linux_amd64.go generated vendored Normal file
View File

@ -0,0 +1,12 @@
// Copyright 2017 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// +build cgo
package d2xx
/*
#cgo LDFLAGS: ${SRCDIR}/third_party/libftd2xx_linux_amd64_v1.4.6.a
*/
import "C"

15
vendor/periph.io/x/d2xx/d2xx_linux_arm.go generated vendored Normal file
View File

@ -0,0 +1,15 @@
// Copyright 2017 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// +build cgo
package d2xx
// TODO(maruel): https://github.com/golang/go/issues/7211 would help target the
// optimal ARM architecture.
/*
#cgo LDFLAGS: ${SRCDIR}/third_party/libftd2xx_linux_arm6hf_v1.4.6.a
*/
import "C"

217
vendor/periph.io/x/d2xx/d2xx_posix.go generated vendored Normal file
View File

@ -0,0 +1,217 @@
// Copyright 2017 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// +build !windows
package d2xx
/*
#include "third_party/ftd2xx.h"
#include <stdlib.h>
*/
import "C"
import (
"unsafe"
)
// Available is true if the library is available on this system.
const Available = true
// Library functions.
func version() (uint8, uint8, uint8) {
var v C.DWORD
C.FT_GetLibraryVersion(&v)
return uint8(v >> 16), uint8(v >> 8), uint8(v)
}
func createDeviceInfoList() (int, Err) {
var num C.DWORD
e := C.FT_CreateDeviceInfoList(&num)
return int(num), Err(e)
}
func open(i int) (Handle, Err) {
var h C.FT_HANDLE
e := C.FT_Open(C.int(i), &h)
if uintptr(h) == 0 && e == 0 {
// 18 means FT_OTHER_ERROR. Kind of a hack but better than panic.
e = 18
}
return handle(h), Err(e)
}
func (h handle) Close() Err {
return Err(C.FT_Close(h.toH()))
}
func (h handle) ResetDevice() Err {
return Err(C.FT_ResetDevice(h.toH()))
}
func (h handle) GetDeviceInfo() (uint32, uint16, uint16, Err) {
var dev C.FT_DEVICE
var id C.DWORD
if e := C.FT_GetDeviceInfo(h.toH(), &dev, &id, nil, nil, nil); e != 0 {
return unknown, 0, 0, Err(e)
}
return uint32(dev), uint16(id >> 16), uint16(id), 0
}
func (h handle) EEPROMRead(devType uint32, ee *EEPROM) Err {
var manufacturer [64]C.char
var manufacturerID [64]C.char
var desc [64]C.char
var serial [64]C.char
eepromVoid := unsafe.Pointer(&ee.Raw[0])
hdr := ee.asHeader()
// There something odd going on here.
//
// On a ft232h, we observed that hdr.DeviceType MUST NOT be set, but on a
// ft232r, it MUST be set. Since we can't know in advance what we must use,
// just try both. ¯\_(ツ)_/¯
hdr.DeviceType = devType
if e := C.FT_EEPROM_Read(h.toH(), eepromVoid, C.DWORD(len(ee.Raw)), &manufacturer[0], &manufacturerID[0], &desc[0], &serial[0]); e != 0 {
// FT_INVALID_PARAMETER
if e == 6 {
hdr.DeviceType = 0
e = C.FT_EEPROM_Read(h.toH(), eepromVoid, C.DWORD(len(ee.Raw)), &manufacturer[0], &manufacturerID[0], &desc[0], &serial[0])
}
if e != 0 {
return Err(e)
}
}
ee.Manufacturer = C.GoString(&manufacturer[0])
ee.ManufacturerID = C.GoString(&manufacturerID[0])
ee.Desc = C.GoString(&desc[0])
ee.Serial = C.GoString(&serial[0])
return 0
}
func (h handle) EEPROMProgram(ee *EEPROM) Err {
// len(manufacturer) + len(desc) <= 40.
/*
var cmanu [64]byte
copy(cmanu[:], ee.manufacturer)
var cmanuID [64]byte
copy(cmanuID[:], ee.manufacturerID)
var cdesc [64]byte
copy(cdesc[:], ee.desc)
var cserial [64]byte
copy(cserial[:], ee.serial)
*/
cmanu := C.CString(ee.Manufacturer)
defer C.free(unsafe.Pointer(cmanu))
cmanuID := C.CString(ee.ManufacturerID)
defer C.free(unsafe.Pointer(cmanuID))
cdesc := C.CString(ee.Desc)
defer C.free(unsafe.Pointer(cdesc))
cserial := C.CString(ee.Serial)
defer C.free(unsafe.Pointer(cserial))
if len(ee.Raw) == 0 {
return Err(C.FT_EEPROM_Program(h.toH(), unsafe.Pointer(uintptr(0)), 0, cmanu, cmanuID, cdesc, cserial))
}
return Err(C.FT_EEPROM_Program(h.toH(), unsafe.Pointer(&ee.Raw[0]), C.DWORD(len(ee.Raw)), cmanu, cmanuID, cdesc, cserial))
}
func (h handle) EraseEE() Err {
return Err(C.FT_EraseEE(h.toH()))
}
func (h handle) WriteEE(offset uint8, value uint16) Err {
return Err(C.FT_WriteEE(h.toH(), C.DWORD(offset), C.WORD(value)))
}
func (h handle) EEUASize() (int, Err) {
var size C.DWORD
if e := C.FT_EE_UASize(h.toH(), &size); e != 0 {
return 0, Err(e)
}
return int(size), 0
}
func (h handle) EEUARead(ua []byte) Err {
var size C.DWORD
if e := C.FT_EE_UARead(h.toH(), (*C.UCHAR)(unsafe.Pointer(&ua[0])), C.DWORD(len(ua)), &size); e != 0 {
return Err(e)
}
if int(size) != len(ua) {
return 6 // FT_INVALID_PARAMETER
}
return 0
}
func (h handle) EEUAWrite(ua []byte) Err {
if e := C.FT_EE_UAWrite(h.toH(), (*C.UCHAR)(&ua[0]), C.DWORD(len(ua))); e != 0 {
return Err(e)
}
return 0
}
func (h handle) SetChars(eventChar byte, eventEn bool, errorChar byte, errorEn bool) Err {
v := C.UCHAR(0)
if eventEn {
v = 1
}
w := C.UCHAR(0)
if errorEn {
w = 1
}
return Err(C.FT_SetChars(h.toH(), C.UCHAR(eventChar), v, C.UCHAR(errorChar), w))
}
func (h handle) SetUSBParameters(in, out int) Err {
return Err(C.FT_SetUSBParameters(h.toH(), C.DWORD(in), C.DWORD(out)))
}
func (h handle) SetFlowControl() Err {
return Err(C.FT_SetFlowControl(h.toH(), C.FT_FLOW_RTS_CTS, 0, 0))
}
func (h handle) SetTimeouts(readMS, writeMS int) Err {
return Err(C.FT_SetTimeouts(h.toH(), C.DWORD(readMS), C.DWORD(writeMS)))
}
func (h handle) SetLatencyTimer(delayMS uint8) Err {
return Err(C.FT_SetLatencyTimer(h.toH(), C.UCHAR(delayMS)))
}
func (h handle) SetBaudRate(hz uint32) Err {
return Err(C.FT_SetBaudRate(h.toH(), C.DWORD(hz)))
}
func (h handle) GetQueueStatus() (uint32, Err) {
var v C.DWORD
e := C.FT_GetQueueStatus(h.toH(), &v)
return uint32(v), Err(e)
}
func (h handle) Read(b []byte) (int, Err) {
var bytesRead C.DWORD
e := C.FT_Read(h.toH(), C.LPVOID(unsafe.Pointer(&b[0])), C.DWORD(len(b)), &bytesRead)
return int(bytesRead), Err(e)
}
func (h handle) Write(b []byte) (int, Err) {
var bytesSent C.DWORD
e := C.FT_Write(h.toH(), C.LPVOID(unsafe.Pointer(&b[0])), C.DWORD(len(b)), &bytesSent)
return int(bytesSent), Err(e)
}
func (h handle) GetBitMode() (byte, Err) {
var s C.UCHAR
e := C.FT_GetBitMode(h.toH(), &s)
return uint8(s), Err(e)
}
func (h handle) SetBitMode(mask, mode byte) Err {
return Err(C.FT_SetBitMode(h.toH(), C.UCHAR(mask), C.UCHAR(mode)))
}
func (h handle) toH() C.FT_HANDLE {
return C.FT_HANDLE(h)
}

109
vendor/periph.io/x/d2xx/d2xx_posix_no_cgo.go generated vendored Normal file
View File

@ -0,0 +1,109 @@
// Copyright 2017 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// +build !cgo
// +build !windows
package d2xx
// Available is true if the library is available on this system.
const Available = false
// Library functions.
func version() (uint8, uint8, uint8) {
return 0, 0, 0
}
func createDeviceInfoList() (int, Err) {
return 0, NoCGO
}
func open(i int) (Handle, Err) {
return handle(0), NoCGO
}
func (h handle) Close() Err {
return NoCGO
}
func (h handle) ResetDevice() Err {
return NoCGO
}
func (h handle) GetDeviceInfo() (uint32, uint16, uint16, Err) {
return unknown, 0, 0, NoCGO
}
func (h handle) EEPROMRead(devType uint32, ee *EEPROM) Err {
return NoCGO
}
func (h handle) EEPROMProgram(e *EEPROM) Err {
return NoCGO
}
func (h handle) EraseEE() Err {
return NoCGO
}
func (h handle) WriteEE(offset uint8, value uint16) Err {
return NoCGO
}
func (h handle) EEUASize() (int, Err) {
return 0, NoCGO
}
func (h handle) EEUARead(ua []byte) Err {
return NoCGO
}
func (h handle) EEUAWrite(ua []byte) Err {
return NoCGO
}
func (h handle) SetChars(eventChar byte, eventEn bool, errorChar byte, errorEn bool) Err {
return NoCGO
}
func (h handle) SetUSBParameters(in, out int) Err {
return NoCGO
}
func (h handle) SetFlowControl() Err {
return NoCGO
}
func (h handle) SetTimeouts(readMS, writeMS int) Err {
return NoCGO
}
func (h handle) SetLatencyTimer(delayMS uint8) Err {
return NoCGO
}
func (h handle) SetBaudRate(hz uint32) Err {
return NoCGO
}
func (h handle) GetQueueStatus() (uint32, Err) {
return 0, NoCGO
}
func (h handle) Read(b []byte) (int, Err) {
return 0, NoCGO
}
func (h handle) Write(b []byte) (int, Err) {
return 0, NoCGO
}
func (h handle) GetBitMode() (byte, Err) {
return 0, NoCGO
}
func (h handle) SetBitMode(mask, mode byte) Err {
return NoCGO
}

16
vendor/periph.io/x/d2xx/d2xx_posix_other.go generated vendored Normal file
View File

@ -0,0 +1,16 @@
// Copyright 2017 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// +build cgo
// +build !darwin,!amd64
// +build !linux,!amd64
// +build !linux,!arm
// +build !windows
package d2xx
/*
#cgo LDFLAGS: -lftd2xx
*/
import "C"

273
vendor/periph.io/x/d2xx/d2xx_windows.go generated vendored Normal file
View File

@ -0,0 +1,273 @@
// Copyright 2017 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
package d2xx
import (
"bytes"
"syscall"
"unsafe"
)
// Available is true if the library is available on this system.
var Available = false
func version() (uint8, uint8, uint8) {
var v uint32
if pGetLibraryVersion != nil {
_, _, _ = pGetLibraryVersion.Call(uintptr(unsafe.Pointer(&v)))
}
return uint8(v >> 16), uint8(v >> 8), uint8(v)
}
func createDeviceInfoList() (int, Err) {
var num uint32
r1, _, _ := pCreateDeviceInfoList.Call(uintptr(unsafe.Pointer(&num)))
return int(num), Err(r1)
}
func open(i int) (Handle, Err) {
var h handle
r1, _, _ := pOpen.Call(uintptr(i), uintptr(unsafe.Pointer(&h)))
return h, Err(r1)
}
func (h handle) Close() Err {
r1, _, _ := pClose.Call(h.toH())
return Err(r1)
}
func (h handle) ResetDevice() Err {
r1, _, _ := pResetDevice.Call(h.toH())
return Err(r1)
}
func (h handle) GetDeviceInfo() (uint32, uint16, uint16, Err) {
var d uint32
var id uint32
if r1, _, _ := pGetDeviceInfo.Call(h.toH(), uintptr(unsafe.Pointer(&d)), uintptr(unsafe.Pointer(&id)), 0, 0, 0); r1 != 0 {
return unknown, 0, 0, Err(r1)
}
return d, uint16(id >> 16), uint16(id), 0
}
func (h handle) EEPROMRead(devType uint32, ee *EEPROM) Err {
var manufacturer [64]byte
var manufacturerID [64]byte
var desc [64]byte
var serial [64]byte
// Shortcuts.
m := uintptr(unsafe.Pointer(&manufacturer[0]))
mi := uintptr(unsafe.Pointer(&manufacturerID[0]))
de := uintptr(unsafe.Pointer(&desc[0]))
s := uintptr(unsafe.Pointer(&serial[0]))
eepromVoid := unsafe.Pointer(&ee.Raw[0])
hdr := ee.asHeader()
// It MUST be set here. This is not always the case on posix.
hdr.DeviceType = devType
if r1, _, _ := pEEPROMRead.Call(h.toH(), uintptr(eepromVoid), uintptr(len(ee.Raw)), m, mi, de, s); r1 != 0 {
return Err(r1)
}
ee.Manufacturer = toStr(manufacturer[:])
ee.ManufacturerID = toStr(manufacturerID[:])
ee.Desc = toStr(desc[:])
ee.Serial = toStr(serial[:])
return 0
}
func (h handle) EEPROMProgram(ee *EEPROM) Err {
var cmanu [64]byte
copy(cmanu[:], ee.Manufacturer)
var cmanuID [64]byte
copy(cmanuID[:], ee.ManufacturerID)
var cdesc [64]byte
copy(cdesc[:], ee.Desc)
var cserial [64]byte
copy(cserial[:], ee.Serial)
r1, _, _ := pEEPROMProgram.Call(h.toH(), uintptr(unsafe.Pointer(&ee.Raw[0])), uintptr(len(ee.Raw)), uintptr(unsafe.Pointer(&cmanu[0])), uintptr(unsafe.Pointer(&cmanuID[0])), uintptr(unsafe.Pointer(&cdesc[0])), uintptr(unsafe.Pointer(&cserial[0])))
return Err(r1)
}
func (h handle) EraseEE() Err {
r1, _, _ := pEraseEE.Call(h.toH())
return Err(r1)
}
func (h handle) WriteEE(offset uint8, value uint16) Err {
r1, _, _ := pWriteEE.Call(h.toH(), uintptr(offset), uintptr(value))
return Err(r1)
}
func (h handle) EEUASize() (int, Err) {
var size uint32
if r1, _, _ := pEEUASize.Call(h.toH(), uintptr(unsafe.Pointer(&size))); r1 != 0 {
return 0, Err(r1)
}
return int(size), 0
}
func (h handle) EEUARead(ua []byte) Err {
var size uint32
if r1, _, _ := pEEUARead.Call(h.toH(), uintptr(unsafe.Pointer(&ua[0])), uintptr(len(ua)), uintptr(unsafe.Pointer(&size))); r1 != 0 {
return Err(r1)
}
if int(size) != len(ua) {
return 6 // FT_INVALID_PARAMETER
}
return 0
}
func (h handle) EEUAWrite(ua []byte) Err {
r1, _, _ := pEEUAWrite.Call(h.toH(), uintptr(unsafe.Pointer(&ua[0])), uintptr(len(ua)))
return Err(r1)
}
func (h handle) SetChars(eventChar byte, eventEn bool, errorChar byte, errorEn bool) Err {
v := uintptr(0)
if eventEn {
v = 1
}
w := uintptr(0)
if errorEn {
w = 1
}
r1, _, _ := pSetChars.Call(h.toH(), uintptr(eventChar), v, uintptr(errorChar), w)
return Err(r1)
}
func (h handle) SetUSBParameters(in, out int) Err {
r1, _, _ := pSetUSBParameters.Call(h.toH(), uintptr(in), uintptr(out))
return Err(r1)
}
func (h handle) SetFlowControl() Err {
// FT_FLOW_RTS_CTS
r1, _, _ := pSetFlowControl.Call(h.toH(), 0x0100, 0, 0)
return Err(r1)
}
func (h handle) SetTimeouts(readMS, writeMS int) Err {
r1, _, _ := pSetTimeouts.Call(h.toH(), uintptr(readMS), uintptr(writeMS))
return Err(r1)
}
func (h handle) SetLatencyTimer(delayMS uint8) Err {
r1, _, _ := pSetLatencyTimer.Call(h.toH(), uintptr(delayMS))
return Err(r1)
}
func (h handle) SetBaudRate(hz uint32) Err {
r1, _, _ := pSetBaudRate.Call(h.toH(), uintptr(hz))
return Err(r1)
}
func (h handle) GetQueueStatus() (uint32, Err) {
var v uint32
r1, _, _ := pGetQueueStatus.Call(h.toH(), uintptr(unsafe.Pointer(&v)))
return v, Err(r1)
}
func (h handle) Read(b []byte) (int, Err) {
var bytesRead uint32
r1, _, _ := pRead.Call(h.toH(), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), uintptr(unsafe.Pointer(&bytesRead)))
return int(bytesRead), Err(r1)
}
func (h handle) Write(b []byte) (int, Err) {
var bytesSent uint32
r1, _, _ := pWrite.Call(h.toH(), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), uintptr(unsafe.Pointer(&bytesSent)))
return int(bytesSent), Err(r1)
}
func (h handle) GetBitMode() (byte, Err) {
var s uint8
r1, _, _ := pGetBitMode.Call(h.toH(), uintptr(unsafe.Pointer(&s)))
return s, Err(r1)
}
func (h handle) SetBitMode(mask, mode byte) Err {
r1, _, _ := pSetBitMode.Call(h.toH(), uintptr(mask), uintptr(mode))
return Err(r1)
}
func (h handle) toH() uintptr {
return uintptr(h)
}
//
var (
pClose *syscall.Proc
pCreateDeviceInfoList *syscall.Proc
pEEPROMRead *syscall.Proc
pEEPROMProgram *syscall.Proc
pEraseEE *syscall.Proc
pWriteEE *syscall.Proc
pEEUASize *syscall.Proc
pEEUARead *syscall.Proc
pEEUAWrite *syscall.Proc
pGetBitMode *syscall.Proc
pGetDeviceInfo *syscall.Proc
pGetLibraryVersion *syscall.Proc
pGetQueueStatus *syscall.Proc
pOpen *syscall.Proc
pRead *syscall.Proc
pResetDevice *syscall.Proc
pSetBaudRate *syscall.Proc
pSetBitMode *syscall.Proc
pSetChars *syscall.Proc
pSetFlowControl *syscall.Proc
pSetLatencyTimer *syscall.Proc
pSetTimeouts *syscall.Proc
pSetUSBParameters *syscall.Proc
pWrite *syscall.Proc
)
func init() {
if dll, _ := syscall.LoadDLL("ftd2xx.dll"); dll != nil {
// If any function is not found, disable the support.
Available = true
find := func(n string) *syscall.Proc {
s, _ := dll.FindProc(n)
if s == nil {
Available = false
}
return s
}
pClose = find("FT_Close")
pCreateDeviceInfoList = find("FT_CreateDeviceInfoList")
pEEPROMRead = find("FT_EEPROM_Read")
pEEPROMProgram = find("FT_EEPROM_Program")
pEraseEE = find("FT_EraseEE")
pWriteEE = find("FT_WriteEE")
pEEUASize = find("FT_EE_UASize")
pEEUARead = find("FT_EE_UARead")
pEEUAWrite = find("FT_EE_UAWrite")
pGetBitMode = find("FT_GetBitMode")
pGetDeviceInfo = find("FT_GetDeviceInfo")
pGetLibraryVersion = find("FT_GetLibraryVersion")
pGetQueueStatus = find("FT_GetQueueStatus")
pOpen = find("FT_Open")
pRead = find("FT_Read")
pResetDevice = find("FT_ResetDevice")
pSetBaudRate = find("FT_SetBaudRate")
pSetBitMode = find("FT_SetBitMode")
pSetChars = find("FT_SetChars")
pSetFlowControl = find("FT_SetFlowControl")
pSetLatencyTimer = find("FT_SetLatencyTimer")
pSetTimeouts = find("FT_SetTimeouts")
pSetUSBParameters = find("FT_SetUSBParameters")
pWrite = find("FT_Write")
}
}
func toStr(c []byte) string {
i := bytes.IndexByte(c, 0)
if i != -1 {
return string(c[:i])
}
return string(c)
}

21
vendor/periph.io/x/d2xx/doc.go generated vendored Normal file
View File

@ -0,0 +1,21 @@
// Copyright 2017 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// Package d2xx is a thin Go wrapper for the Future Technology "D2XX" driver.
//
// This package is not Go idiomatic. You want to use
// https://periph.io/x/host/v3/ftdi instead.
//
// A binary copy of the d2xx driver is included for linux and macOS. They are
// from https://ftdichip.com/drivers/d2xx-drivers/. See third_party/README.md
// for more details.
//
// Configuration
//
// See https://periph.io/device/ftdi/ for more details, and how to configure
// the host to be able to use this driver.
//
// Windows 10 automatically fetches the driver from Windows Update upon
// connecting a FTDI device on the firt time, so no need to download a driver.
package d2xx

39
vendor/periph.io/x/d2xx/eeprom.go generated vendored Normal file
View File

@ -0,0 +1,39 @@
// Copyright 2018 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
package d2xx
import (
"unsafe"
)
// EEPROM is the unprocessed EEPROM content.
//
// The EEPROM is in 3 parts: the defined struct, the 4 strings and the rest
// which is used as an 'user area'. The size of the user area depends on the
// length of the strings. The user area content is not included in this struct.
type EEPROM struct {
// Raw is the raw EEPROM content. It excludes the strings.
Raw []byte
// The following condition must be true: len(Manufacturer) + len(Desc) <= 40.
Manufacturer string
ManufacturerID string
Desc string
Serial string
}
func (e *EEPROM) asHeader() *eepromHeader {
// sizeof(EEPROMHeader)
if len(e.Raw) < 16 {
return nil
}
return (*eepromHeader)(unsafe.Pointer(&e.Raw[0]))
}
// eepromHeader is the common 16 bytes header.
type eepromHeader struct {
DeviceType uint32
// The rest is not necessary here so it is skipped.
}

25
vendor/periph.io/x/d2xx/test.sh generated vendored Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# Copyright 2017 The Periph Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
# Builds the package on multiple OSes to confirm it builds fine.
#
# It is recommended to use the -i flag so subsequent runs are much faster.
set -eu
cd `dirname $0`
OPT=$*
function build {
echo "Testing on $1/$2"
GOOS=$1 GOARCH=$2 go build $OPT
}
build darwin amd64
build linux amd64
build linux arm
build linux 386
build windows amd64

433
vendor/periph.io/x/host/v3/.gohci.yml generated vendored Normal file
View File

@ -0,0 +1,433 @@
# Copyright 2021 The Periph Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
# See https://github.com/periph/gohci
version: 1
workers:
# BeagleBone Green Wireles by SeedStudio.
# https://beagleboard.org/green-wireless
- name: beaglebone-1860
checks:
- cmd:
- go
- test
- -cover
- -bench=.
- -benchtime=1000ms
- -benchmem
- ./...
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/devices
dir: ..
- cmd:
- go
- get
- periph.io/x/host/v3@${GIT_SHA}
dir: ../devices
- cmd:
- go
- test
- ./...
dir: ../devices
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/cmd
dir: ..
- cmd:
- go
- get
- periph.io/x/host/v3@${GIT_SHA}
dir: ../cmd
- cmd:
- go
- test
- ./...
dir: ../cmd
# Test commands.
- cmd:
- go
- install
- -v
- ./headers-list
- ./i2c-list
- ./periph-info
- ./periph-smoketest
- ./spi-list
dir: ../cmd
- cmd:
- periph-info
- cmd:
- headers-list
- -f
- cmd:
- i2c-list
- cmd:
- spi-list
- cmd:
- periph-smoketest
- gpio
- -pin1
- P8_45
- -pin2
- P8_46
# ODROID-C1+ by HardKernel
# https://www.hardkernel.com/shop/odroid-c1/
- name: odroid-483d
checks:
- cmd:
- go
- test
- -cover
- -bench=.
- -benchtime=1000ms
- -benchmem
- ./...
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/devices
dir: ..
- cmd:
- go
- get
- periph.io/x/host/v3@${GIT_SHA}
dir: ../devices
- cmd:
- go
- test
- ./...
dir: ../devices
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/cmd
dir: ..
- cmd:
- go
- get
- periph.io/x/host/v3@${GIT_SHA}
dir: ../cmd
- cmd:
- go
- test
- ./...
dir: ../cmd
# Test commands.
- cmd:
- go
- install
- -v
- ./gpio-list
- ./headers-list
- ./i2c-list
- ./periph-info
- ./periph-smoketest
- ./spi-list
dir: ../cmd
- cmd:
- periph-info
- cmd:
- gpio-list
- -f
- cmd:
- headers-list
- -f
- cmd:
- i2c-list
- cmd:
- spi-list
- cmd:
- periph-smoketest
- odroid-c1
- cmd:
- periph-smoketest
- i2c-testboard
- cmd:
- periph-smoketest
- onewire-testboard
- cmd:
- periph-smoketest
- spi-testboard
- cmd:
- periph-smoketest
- sysfs-benchmark
- -p
- 97
- -short
# Raspberry Pi 3
- name: raspberrypi-2f34
checks:
- cmd:
- go
- test
- -cover
- -bench=.
- -benchtime=1000ms
- -benchmem
- ./...
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/devices
dir: ..
- cmd:
- go
- get
- periph.io/x/host/v3@${GIT_SHA}
dir: ../devices
- cmd:
- go
- test
- ./...
dir: ../devices
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/cmd
dir: ..
- cmd:
- go
- get
- periph.io/x/host/v3@${GIT_SHA}
dir: ../cmd
- cmd:
- go
- test
- ./...
dir: ../cmd
# Test commands.
- cmd:
- go
- install
- -v
- ./gpio-list
- ./headers-list
- ./i2c-list
- ./periph-info
- ./periph-smoketest
- ./spi-list
dir: ../cmd
- cmd:
- periph-info
- cmd:
- gpio-list
- -f
- cmd:
- headers-list
- -f
- cmd:
- i2c-list
- cmd:
- spi-list
- cmd:
- periph-smoketest
- i2c-testboard
- cmd:
- periph-smoketest
- onewire-testboard
- -i2cbus
- 1
- cmd:
- periph-smoketest
- spi-testboard
- cmd:
- periph-smoketest
- sysfs-benchmark
- -p
- 12
- -short
- cmd:
- periph-smoketest
- bcm283x-benchmark
- -p
- 12
- -short
- cmd:
- periph-smoketest
- gpio
- -pin1
- P1_15
- -pin2
- P1_16
- cmd:
- periph-smoketest
- bcm283x
- -quick
# Old MacBook Pro on 10.9.
- name: mbp
checks:
- cmd:
- go
- test
- -cover
- -bench=.
- -benchtime=1000ms
- -benchmem
- ./...
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/devices
dir: ..
- cmd:
- go
- get
- periph.io/x/host/v3@${GIT_SHA}
dir: ../devices
- cmd:
- go
- test
- ./...
dir: ../devices
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/cmd
dir: ..
- cmd:
- go
- get
- periph.io/x/host/v3@${GIT_SHA}
dir: ../cmd
- cmd:
- go
- test
- ./...
dir: ../cmd
# Test commands.
- cmd:
- go
- install
- -v
- ./gpio-list
- ./headers-list
- ./i2c-list
- ./periph-info
- ./periph-smoketest
- ./spi-list
dir: ../cmd
- cmd:
- periph-info
- cmd:
- gpio-list
- -f
- cmd:
- headers-list
- -f
- cmd:
- i2c-list
- cmd:
- spi-list
# - cmd:
# - periph-smoketest
# - ftdi
# - -type
# - ft232r
# Laptop on Windows 10.
- name: win10
checks:
- cmd:
- go
- test
- -cover
- -bench=.
- -benchtime=1000ms
- -benchmem
- ./...
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/devices
dir: ..
- cmd:
- go
- get
- periph.io/x/host/v3@${GIT_SHA}
dir: ../devices
- cmd:
- go
- test
- ./...
dir: ../devices
# Test in advance.
- cmd:
- git
- clone
- --depth
- 1
- https://github.com/periph/cmd
dir: ..
- cmd:
- go
- get
- periph.io/x/host/v3@${GIT_SHA}
dir: ../cmd
- cmd:
- go
- test
- ./...
dir: ../cmd
# Test commands.
- cmd:
- go
- install
- -v
- ./gpio-list
- ./headers-list
- ./i2c-list
- ./periph-info
- ./periph-smoketest
- ./spi-list
dir: ../cmd
- cmd:
- periph-info
- cmd:
- gpio-list
- -f
- cmd:
- headers-list
- -f
- cmd:
- i2c-list
- cmd:
- spi-list
# - cmd:
# - periph-smoketest
# - ftdi
# - -type
# - ft232h

15
vendor/periph.io/x/host/v3/AUTHORS generated vendored Normal file
View File

@ -0,0 +1,15 @@
# This is the list of The Periph Authors for copyright purposes.
#
# This does not necessarily list everyone who has contributed code, since in
# some cases, their employer may be the copyright holder. To see the full list
# of contributors, see the revision history in source control.
Cássio Botaro <cassiobotaro@gmail.com>
Fractal Industries, Inc
Google Inc.
Josh Gardiner
Matt Aimonetti <mattaimonetti@gmail.com>
Max Ekman <max@looplab.se>
Rifiniti, Inc
Stephan Sperber
Thorsten von Eicken <tve@voneicken.com>

4
vendor/periph.io/x/host/v3/CONTRIBUTING.md generated vendored Normal file
View File

@ -0,0 +1,4 @@
# Contributing
Thanks for contributing to the project! Please look at [the periph contribution
guidelines](https://periph.io/project/contributing/) first.

41
vendor/periph.io/x/host/v3/CONTRIBUTORS generated vendored Normal file
View File

@ -0,0 +1,41 @@
# This is the official list of people who can contribute
# (and typically have contributed) code to the periph repository.
# The AUTHORS file lists the copyright holders; this file
# lists people. For example, Google employees are listed here
# but not in AUTHORS, because Google holds the copyright.
#
# Names should be added to this file only after verifying that
# the individual or the individual's organization has agreed to
# the appropriate Contributor License Agreement, found here:
#
# https://cla.developers.google.com/
#
# When adding J Random Contributor's name to this file,
# either J's name or J's organization's name should be
# added to the AUTHORS file, depending on whether the
# individual or corporate CLA was used.
# Names should be added to this file like so:
# Individual's name <submission email address>
# Individual's name <submission email address> <email2> <emailN>
#
# An entry with multiple email addresses specifies that the
# first address should be used in the submit logs and
# that the other addresses should be recognized as the
# same person when interacting with Gerrit.
# Please keep the list sorted.
Cássio Botaro <cassiobotaro@gmail.com>
Eugene Dzhurynsky <jdevelop@gmail.com>
Hidetoshi Shimokawa <smkwhdts@gmail.com>
John Maguire <john.maguire@gmail.com>
Josh Gardiner <josh@zool.com>
Marc-Antoine Ruel <maruel@chromium.org> <maruel@gmail.com>
Matt Aimonetti <mattaimonetti@gmail.com>
Max Ekman <max@looplab.se>
Matias Insaurralde <matias@insaurral.de>
Seán C McCord <ulexus@gmail.com> <scm@cycoresys.com>
Stephan Sperber <sperberstephan@googlemail.com>
Thorsten von Eicken <tve@voneicken.com>

202
vendor/periph.io/x/host/v3/LICENSE generated vendored Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

57
vendor/periph.io/x/host/v3/README.md generated vendored Normal file
View File

@ -0,0 +1,57 @@
# periph - Peripherals I/O in Go
Documentation is at https://periph.io
Join us for a chat on
[gophers.slack.com/messages/periph](https://gophers.slack.com/messages/periph),
get an [invite here](https://invite.slack.golangbridge.org/).
[![mascot](https://raw.githubusercontent.com/periph/website/master/site/static/img/periph-mascot-280.png)](https://periph.io/)
[![PkgGoDev](https://pkg.go.dev/badge/periph.io/x/host/v3)](https://pkg.go.dev/periph.io/x/host/v3)
[![Coverage
Status](https://codecov.io/gh/periph/host/graph/badge.svg)](https://codecov.io/gh/periph/host)
## Example
Blink a LED:
~~~go
package main
import (
"time"
"periph.io/x/conn/v3/gpio"
"periph.io/x/host/v3"
"periph.io/x/host/v3/rpi"
)
func main() {
host.Init()
t := time.NewTicker(500 * time.Millisecond)
for l := gpio.Low; ; l = !l {
rpi.P1_33.Out(l)
<-t.C
}
}
~~~
Curious? Look at [supported devices](https://periph.io/device/) for more
examples!
## Authors
`periph` was initiated with ❤️️ and passion by [Marc-Antoine
Ruel](https://github.com/maruel). The full list of contributors is in
[AUTHORS](https://github.com/periph/host/blob/main/AUTHORS) and
[CONTRIBUTORS](https://github.com/periph/host/blob/main/CONTRIBUTORS).
## Disclaimer
This is not an official Google product (experimental or otherwise), it
is just code that happens to be owned by Google.
This project is not affiliated with the Go project.

View File

@ -10,8 +10,8 @@ package allwinner
import ( import (
"strings" "strings"
"periph.io/x/periph/conn/pin" "periph.io/x/conn/v3/pin"
"periph.io/x/periph/host/sysfs" "periph.io/x/host/v3/sysfs"
) )
// mappingA20 describes the mapping of the A20 processor gpios to their // mappingA20 describes the mapping of the A20 processor gpios to their

View File

@ -10,8 +10,8 @@ package allwinner
import ( import (
"strings" "strings"
"periph.io/x/periph/conn/pin" "periph.io/x/conn/v3/pin"
"periph.io/x/periph/host/sysfs" "periph.io/x/host/v3/sysfs"
) )
// A64 specific pins. // A64 specific pins.

View File

@ -8,7 +8,7 @@ import (
"strings" "strings"
"sync" "sync"
"periph.io/x/periph/host/distro" "periph.io/x/host/v3/distro"
) )
// Present detects whether the host CPU is an Allwinner CPU. // Present detects whether the host CPU is an Allwinner CPU.

View File

@ -21,8 +21,8 @@ import (
"log" "log"
"os" "os"
"periph.io/x/periph" "periph.io/x/conn/v3/driver/driverreg"
"periph.io/x/periph/host/pmem" "periph.io/x/host/v3/pmem"
) )
// dmaMap represents the DMA memory mapped CPU registers. // dmaMap represents the DMA memory mapped CPU registers.
@ -467,7 +467,7 @@ func (d *driverDMA) Close() error {
func init() { func init() {
if false && isArm { if false && isArm {
// TODO(maruel): This is intense, wait to be sure it works. // TODO(maruel): This is intense, wait to be sure it works.
periph.MustRegister(&drvDMA) driverreg.MustRegister(&drvDMA)
} }
} }

View File

@ -16,13 +16,13 @@ import (
"strings" "strings"
"time" "time"
"periph.io/x/periph" "periph.io/x/conn/v3/driver/driverreg"
"periph.io/x/periph/conn/gpio" "periph.io/x/conn/v3/gpio"
"periph.io/x/periph/conn/gpio/gpioreg" "periph.io/x/conn/v3/gpio/gpioreg"
"periph.io/x/periph/conn/physic" "periph.io/x/conn/v3/physic"
"periph.io/x/periph/conn/pin" "periph.io/x/conn/v3/pin"
"periph.io/x/periph/host/pmem" "periph.io/x/host/v3/pmem"
"periph.io/x/periph/host/sysfs" "periph.io/x/host/v3/sysfs"
) )
// List of all known pins. These global variables can be used directly. // List of all known pins. These global variables can be used directly.
@ -1030,7 +1030,7 @@ func (d *driverGPIO) Init() (bool, error) {
func init() { func init() {
if isArm { if isArm {
periph.MustRegister(&drvGPIO) driverreg.MustRegister(&drvGPIO)
} }
} }

View File

@ -13,13 +13,13 @@ import (
"strings" "strings"
"time" "time"
"periph.io/x/periph" "periph.io/x/conn/v3/driver/driverreg"
"periph.io/x/periph/conn/gpio" "periph.io/x/conn/v3/gpio"
"periph.io/x/periph/conn/gpio/gpioreg" "periph.io/x/conn/v3/gpio/gpioreg"
"periph.io/x/periph/conn/physic" "periph.io/x/conn/v3/physic"
"periph.io/x/periph/conn/pin" "periph.io/x/conn/v3/pin"
"periph.io/x/periph/host/pmem" "periph.io/x/host/v3/pmem"
"periph.io/x/periph/host/sysfs" "periph.io/x/host/v3/sysfs"
) )
// All the pins in the PL group. // All the pins in the PL group.
@ -551,7 +551,7 @@ func (d *driverGPIOPL) Init() (bool, error) {
func init() { func init() {
if isArm { if isArm {
periph.MustRegister(&drvGPIOPL) driverreg.MustRegister(&drvGPIOPL)
} }
} }

View File

@ -10,8 +10,8 @@ package allwinner
import ( import (
"strings" "strings"
"periph.io/x/periph/conn/pin" "periph.io/x/conn/v3/pin"
"periph.io/x/periph/host/sysfs" "periph.io/x/host/v3/sysfs"
) )
// R8 specific pins. // R8 specific pins.

View File

@ -7,7 +7,7 @@ package allwinner
import ( import (
"time" "time"
"periph.io/x/periph/host/cpu" "periph.io/x/host/v3/cpu"
) )
// ReadTime returns the time on a monotonic timer. // ReadTime returns the time on a monotonic timer.

View File

@ -8,8 +8,8 @@ import (
"errors" "errors"
"strings" "strings"
"periph.io/x/periph" "periph.io/x/conn/v3/driver/driverreg"
"periph.io/x/periph/host/distro" "periph.io/x/host/v3/distro"
) )
// Present returns true if a TM AM335x processor is detected. // Present returns true if a TM AM335x processor is detected.
@ -45,7 +45,7 @@ func (d *driver) Init() (bool, error) {
func init() { func init() {
if isArm { if isArm {
periph.MustRegister(&drv) driverreg.MustRegister(&drv)
} }
} }

View File

@ -10,7 +10,7 @@ import (
"strings" "strings"
"time" "time"
"periph.io/x/periph/conn/physic" "periph.io/x/conn/v3/physic"
) )
// errClockRegister is returned in a situation where the clock memory is not // errClockRegister is returned in a situation where the clock memory is not

View File

@ -70,11 +70,11 @@ import (
"strings" "strings"
"time" "time"
"periph.io/x/periph" "periph.io/x/conn/v3/driver/driverreg"
"periph.io/x/periph/conn/gpio/gpiostream" "periph.io/x/conn/v3/gpio/gpiostream"
"periph.io/x/periph/conn/physic" "periph.io/x/conn/v3/physic"
"periph.io/x/periph/host/pmem" "periph.io/x/host/v3/pmem"
"periph.io/x/periph/host/videocore" "periph.io/x/host/v3/videocore"
) )
const ( const (
@ -711,7 +711,7 @@ func dmaWriteStreamPCM(p *Pin, w gpiostream.Stream) error {
return err return err
} }
defer buf.Close() defer buf.Close()
if err := copyStreamToDMABuf(w, buf.Uint32()); err != nil { if err = copyStreamToDMABuf(w, buf.Uint32()); err != nil {
return err return err
} }
@ -845,7 +845,7 @@ func dmaReadStream(p *Pin, b *gpiostream.BitStream) error {
if err != nil { if err != nil {
return err return err
} }
if _, err := setPWMClockSource(); err != nil { if _, err = setPWMClockSource(); err != nil {
return err return err
} }
@ -867,7 +867,7 @@ func dmaReadStream(p *Pin, b *gpiostream.BitStream) error {
defer pCB.Close() defer pCB.Close()
reg := drvGPIO.gpioBaseAddr + 0x34 + uint32Size*uint32(p.number/32) // GPIO Pin Level 0 reg := drvGPIO.gpioBaseAddr + 0x34 + uint32Size*uint32(p.number/32) // GPIO Pin Level 0
if err := cb[0].initBlock(reg, uint32(buf.PhysAddr()), uint32(l), true, false, false, true, dmaPWM); err != nil { if err = cb[0].initBlock(reg, uint32(buf.PhysAddr()), uint32(l), true, false, false, true, dmaPWM); err != nil {
return err return err
} }
err = runIO(pCB, l <= maxLite) err = runIO(pCB, l <= maxLite)
@ -953,7 +953,7 @@ func dmaWriteStreamEdges(p *Pin, w gpiostream.Stream) error {
stride = uint32(skip) stride = uint32(skip)
for i := 1; i < l; i++ { for i := 1; i < l; i++ {
if v := getBit(bits[i/8], i%8, msb); v != last || stride == maxLite { if v := getBit(bits[i/8], i%8, msb); v != last || stride == maxLite {
if err := cb[index].initBlock(physBit, dest[last], stride*uint32Size, false, true, false, false, dmaPWM); err != nil { if err = cb[index].initBlock(physBit, dest[last], stride*uint32Size, false, true, false, false, dmaPWM); err != nil {
return err return err
} }
// It is not necessary to use physToUncachedPhys() here. // It is not necessary to use physToUncachedPhys() here.
@ -964,13 +964,12 @@ func dmaWriteStreamEdges(p *Pin, w gpiostream.Stream) error {
} }
stride += uint32(skip) stride += uint32(skip)
} }
if err := cb[index].initBlock(physBit, dest[last], stride*uint32Size, false, true, false, false, dmaPWM); err != nil { if err = cb[index].initBlock(physBit, dest[last], stride*uint32Size, false, true, false, false, dmaPWM); err != nil {
return err return err
} }
// Start clock before DMA // Start clock before DMA
_, err = setPWMClockSource() if _, err = setPWMClockSource(); err != nil {
if err != nil {
return err return err
} }
return runIO(buf, true) return runIO(buf, true)
@ -1010,13 +1009,12 @@ func dmaWriteStreamDualChannel(p *Pin, w gpiostream.Stream) error {
// Needs 64x the memory since each write is 2 full uint32. On the other // Needs 64x the memory since each write is 2 full uint32. On the other
// hand one could write 32 contiguous pins simultaneously at no cost. // hand one could write 32 contiguous pins simultaneously at no cost.
mask := uint32(1) << uint(p.number&31) mask := uint32(1) << uint(p.number&31)
if err := raster32(w, skip, bufClear.Uint32(), bufSet.Uint32(), mask); err != nil { if err = raster32(w, skip, bufClear.Uint32(), bufSet.Uint32(), mask); err != nil {
return err return err
} }
// Start clock before DMA start // Start clock before DMA start
_, err = setPWMClockSource() if _, err = setPWMClockSource(); err != nil {
if err != nil {
return err return err
} }
@ -1253,7 +1251,7 @@ func resetDMA(ch int) error {
func init() { func init() {
if isArm { if isArm {
periph.MustRegister(&drvDMA) driverreg.MustRegister(&drvDMA)
} }
} }

View File

@ -12,16 +12,16 @@ import (
"strings" "strings"
"time" "time"
"periph.io/x/periph" "periph.io/x/conn/v3/driver/driverreg"
"periph.io/x/periph/conn/gpio" "periph.io/x/conn/v3/gpio"
"periph.io/x/periph/conn/gpio/gpioreg" "periph.io/x/conn/v3/gpio/gpioreg"
"periph.io/x/periph/conn/gpio/gpiostream" "periph.io/x/conn/v3/gpio/gpiostream"
"periph.io/x/periph/conn/physic" "periph.io/x/conn/v3/physic"
"periph.io/x/periph/conn/pin" "periph.io/x/conn/v3/pin"
"periph.io/x/periph/host/distro" "periph.io/x/host/v3/distro"
"periph.io/x/periph/host/pmem" "periph.io/x/host/v3/pmem"
"periph.io/x/periph/host/sysfs" "periph.io/x/host/v3/sysfs"
"periph.io/x/periph/host/videocore" "periph.io/x/host/v3/videocore"
) )
// All the pins supported by the CPU. // All the pins supported by the CPU.
@ -1429,7 +1429,7 @@ func setSpeed(f physic.Frequency) error {
func init() { func init() {
if isArm { if isArm {
periph.MustRegister(&drvGPIO) driverreg.MustRegister(&drvGPIO)
} }
} }

View File

@ -11,7 +11,7 @@ import (
"fmt" "fmt"
"time" "time"
"periph.io/x/periph/conn/physic" "periph.io/x/conn/v3/physic"
) )
type pcmCS uint32 type pcmCS uint32

View File

@ -9,7 +9,7 @@ import (
"fmt" "fmt"
"time" "time"
"periph.io/x/periph/conn/physic" "periph.io/x/conn/v3/physic"
) )
// PWENi is used to enable/disable the corresponding channel. Setting this bit // PWENi is used to enable/disable the corresponding channel. Setting this bit

View File

@ -9,7 +9,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"periph.io/x/periph/conn/gpio/gpiostream" "periph.io/x/conn/v3/gpio/gpiostream"
) )
// uint32ToBitLSBF packs a bit offset found on slice `d` (that is actually // uint32ToBitLSBF packs a bit offset found on slice `d` (that is actually

View File

@ -7,7 +7,7 @@ package bcm283x
import ( import (
"time" "time"
"periph.io/x/periph/host/cpu" "periph.io/x/host/v3/cpu"
) )
// ReadTime returns the time on a monotonic 1Mhz clock (1µs resolution). // ReadTime returns the time on a monotonic 1Mhz clock (1µs resolution).

View File

@ -21,7 +21,7 @@ package black
import ( import (
"strings" "strings"
"periph.io/x/periph/host/distro" "periph.io/x/host/v3/distro"
) )
// Present returns true if the host is a BeagleBone Black or BeagleBone Black // Present returns true if the host is a BeagleBone Black or BeagleBone Black

View File

@ -16,13 +16,13 @@ package bone
import ( import (
"errors" "errors"
"periph.io/x/periph" "periph.io/x/conn/v3/driver/driverreg"
"periph.io/x/periph/conn/gpio" "periph.io/x/conn/v3/gpio"
"periph.io/x/periph/conn/pin" "periph.io/x/conn/v3/pin"
"periph.io/x/periph/conn/pin/pinreg" "periph.io/x/conn/v3/pin/pinreg"
"periph.io/x/periph/host/beagle/black" "periph.io/x/host/v3/beagle/black"
"periph.io/x/periph/host/beagle/green" "periph.io/x/host/v3/beagle/green"
"periph.io/x/periph/host/sysfs" "periph.io/x/host/v3/sysfs"
) )
// TODO(maruel): Use specialized am335x or pru implementation once available. // TODO(maruel): Use specialized am335x or pru implementation once available.
@ -311,7 +311,7 @@ func (d *driver) Init() (bool, error) {
func init() { func init() {
if isArm { if isArm {
periph.MustRegister(&drv) driverreg.MustRegister(&drv)
} }
} }

View File

@ -20,12 +20,12 @@ import (
"errors" "errors"
"strings" "strings"
"periph.io/x/periph" "periph.io/x/conn/v3/driver/driverreg"
"periph.io/x/periph/conn/gpio" "periph.io/x/conn/v3/gpio"
"periph.io/x/periph/conn/pin" "periph.io/x/conn/v3/pin"
"periph.io/x/periph/conn/pin/pinreg" "periph.io/x/conn/v3/pin/pinreg"
"periph.io/x/periph/host/distro" "periph.io/x/host/v3/distro"
"periph.io/x/periph/host/sysfs" "periph.io/x/host/v3/sysfs"
) )
// Headers found on BeagleBone Green. // Headers found on BeagleBone Green.
@ -88,7 +88,7 @@ func (d *driver) Init() (bool, error) {
func init() { func init() {
if isArm { if isArm {
periph.MustRegister(&drv) driverreg.MustRegister(&drv)
} }
} }

View File

@ -13,14 +13,14 @@ import (
"strconv" "strconv"
"strings" "strings"
"periph.io/x/periph" "periph.io/x/conn/v3/driver/driverreg"
"periph.io/x/periph/conn/gpio" "periph.io/x/conn/v3/gpio"
"periph.io/x/periph/conn/gpio/gpioreg" "periph.io/x/conn/v3/gpio/gpioreg"
"periph.io/x/periph/conn/pin" "periph.io/x/conn/v3/pin"
"periph.io/x/periph/conn/pin/pinreg" "periph.io/x/conn/v3/pin/pinreg"
"periph.io/x/periph/host/allwinner" "periph.io/x/host/v3/allwinner"
"periph.io/x/periph/host/distro" "periph.io/x/host/v3/distro"
"periph.io/x/periph/host/fs" "periph.io/x/host/v3/fs"
) )
// C.H.I.P. hardware pins. // C.H.I.P. hardware pins.
@ -351,7 +351,7 @@ func (d *driver) Init() (bool, error) {
func init() { func init() {
if isArm { if isArm {
periph.MustRegister(&drv) driverreg.MustRegister(&drv)
} }
} }

20
vendor/periph.io/x/host/v3/codecov.yml generated vendored Normal file
View File

@ -0,0 +1,20 @@
# Copyright 2020 The Periph Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
# https://docs.codecov.io/docs/codecovyml-reference
# and
# https://docs.codecov.io/docs/coverage-configuration
coverage:
precision: 1
range: "40...80"
round: nearest
status:
patch:
default:
target: 60%
threshold: 10%
project:
default:
target: 60%
threshold: 10%

Some files were not shown because too many files have changed in this diff Show More