chore: bump periph.io dependencies
This commit is contained in:
parent
3393931a05
commit
c21ba54784
@ -1,4 +1,4 @@
|
||||
FROM --platform=$BUILDPLATFORM golang:1.17-alpine AS builder
|
||||
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.17-alpine AS builder
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
ARG BUILDPLATFORM
|
||||
@ -9,7 +9,7 @@ ADD . .
|
||||
RUN GOOS=$(echo $TARGETPLATFORM | cut -f1 -d/) && \
|
||||
GOARCH=$(echo $TARGETPLATFORM | cut -f2 -d/) && \
|
||||
GOARM=$(echo $TARGETPLATFORM | cut -f3 -d/ | sed "s/v//" ) && \
|
||||
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -mod vendor -tags netgo ./cmd/rc-led/
|
||||
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -mod vendor -tags netgo,no_d2xx ./cmd/rc-led/
|
||||
|
||||
|
||||
#ARG GOOS=linux
|
||||
|
6
Makefile
6
Makefile
@ -1,9 +1,11 @@
|
||||
.PHONY: test docker
|
||||
|
||||
DOCKER_IMG = cyrilix/robocar-led
|
||||
DOCKER_IMG = docker.io/cyrilix/robocar-led
|
||||
|
||||
rc-led: binary-amd64
|
||||
|
||||
test:
|
||||
go test -race -mod vendor ./cmd/rc-led ./part ./led
|
||||
go test -race -tags no_d2xx ./cmd/rc-led ./part ./led
|
||||
|
||||
docker:
|
||||
docker buildx build . --platform linux/arm/7,linux/arm64,linux/amd64 -t ${DOCKER_IMG} --push
|
||||
|
0
build-docker.sh
Normal file
0
build-docker.sh
Normal file
2
go.mod
2
go.mod
@ -18,5 +18,5 @@ require (
|
||||
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 // indirect
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect
|
||||
google.golang.org/protobuf v1.26.0 // indirect
|
||||
periph.io/x/d2xx v0.0.1 // indirect
|
||||
periph.io/x/d2xx v0.0.3 // indirect
|
||||
)
|
||||
|
3
go.sum
3
go.sum
@ -126,7 +126,8 @@ gotest.tools v0.0.0-20181223230014-1083505acf35/go.mod h1:R//lfYlUuTOTfblYI3lGoA
|
||||
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
periph.io/x/conn/v3 v3.6.8 h1:fnNSwSoKPzpoLOSxml70EInaP6YrrqcucP3KDfNxpmU=
|
||||
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/d2xx v0.0.3 h1:BE8XcIdxabu9ZzAr1UXxSz88T9Txki6Xyo8aJ1qZvks=
|
||||
periph.io/x/d2xx v0.0.3/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=
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
"periph.io/x/conn/v3/gpio"
|
||||
"periph.io/x/host/v3"
|
||||
"periph.io/x/host/v3/bcm283x"
|
||||
"periph.io/x/host/v3/rpi"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
@ -19,9 +19,9 @@ func init() {
|
||||
|
||||
func New() *PiColorLed {
|
||||
led := PiColorLed{
|
||||
pinRed: bcm283x.GPIO23,
|
||||
pinGreen: bcm283x.GPIO24,
|
||||
pinBlue: bcm283x.GPIO25,
|
||||
pinRed: rpi.P1_16,
|
||||
pinGreen: rpi.P1_18,
|
||||
pinBlue: rpi.P1_22,
|
||||
redValue: 0,
|
||||
greenValue: 0,
|
||||
blueValue: 0,
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -75,7 +75,7 @@ periph.io/x/conn/v3/pin
|
||||
periph.io/x/conn/v3/pin/pinreg
|
||||
periph.io/x/conn/v3/spi
|
||||
periph.io/x/conn/v3/spi/spireg
|
||||
# periph.io/x/d2xx v0.0.1
|
||||
# periph.io/x/d2xx v0.0.3
|
||||
## explicit; go 1.13
|
||||
periph.io/x/d2xx
|
||||
# periph.io/x/host/v3 v3.7.0
|
||||
|
34
vendor/periph.io/x/d2xx/README.md
generated
vendored
34
vendor/periph.io/x/d2xx/README.md
generated
vendored
@ -3,9 +3,6 @@
|
||||
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.
|
||||
|
||||
@ -14,3 +11,34 @@ But if you really want, here it goes:
|
||||
|
||||
This Go package includes third party software. See
|
||||
[third_party/README.md](third_party/README.md).
|
||||
|
||||
## Configuration
|
||||
|
||||
See https://periph.io/device/ftdi/ to configure the host to be able to use this
|
||||
driver.
|
||||
|
||||
## Availability
|
||||
|
||||
On darwin_amd64, linux_amd64 linux_arm (v6, v7 compatible) and linux_arm64 (v8),
|
||||
cgo is required. If cgo is disabled (via `CGO_ENABLED=0`), all functions in this
|
||||
driver return error [NoCGO](https://periph.io/x/d2xx#NoCGO).
|
||||
|
||||
On Windows, cgo is not required. If the dynamic library is not found at runtime,
|
||||
[Missing](https://periph.io/x/d2xx#Missing) is returned.
|
||||
|
||||
## bcm2385
|
||||
|
||||
On linux_arm (v6), hard-float is required. For cross compilation, this
|
||||
means arm-linux-gnueabihf-gcc is preferred to arm-linux-gnueabi-gcc. Using
|
||||
hardfloat causes a segfault on Raspberry Pi 1, Zero and Zero Wireless. It is
|
||||
recommended to disable this driver if targeting these hosts, see below.
|
||||
|
||||
## Disabling
|
||||
|
||||
To disable this driver, build with tag `no_d2xx`, e.g.
|
||||
|
||||
```
|
||||
go install -tags no_d2xx periph.io/x/cmd/gpio-list@latest
|
||||
```
|
||||
|
||||
This will behave has if cgo was disabled, even on Windows.
|
||||
|
19
vendor/periph.io/x/d2xx/d2xx.go
generated
vendored
19
vendor/periph.io/x/d2xx/d2xx.go
generated
vendored
@ -14,9 +14,8 @@ 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.
|
||||
// library is unavailable or the library was disabled via the `no_d2xx` build
|
||||
// tag.
|
||||
NoCGO Err = -2
|
||||
// Missing is returned when the dynamic library is not available.
|
||||
Missing Err = -1
|
||||
@ -117,16 +116,30 @@ type Handle interface {
|
||||
var _ Handle = handle(0)
|
||||
|
||||
// Version returns the library's version.
|
||||
//
|
||||
// 0, 0, 0 is returned if the library is unavailable.
|
||||
func Version() (uint8, uint8, uint8) {
|
||||
return version()
|
||||
}
|
||||
|
||||
// CreateDeviceInfoList discovers the currently found devices.
|
||||
//
|
||||
// If the driver is disabled via build tag `no_d2xx`, or on posix
|
||||
// `CGO_ENABLED=0` environment variable, NoCGO is returned.
|
||||
//
|
||||
// On Windows, Missing is returned if the dynamic library is not found at
|
||||
// runtime.
|
||||
func CreateDeviceInfoList() (int, Err) {
|
||||
return createDeviceInfoList()
|
||||
}
|
||||
|
||||
// Open opens the ith device discovered.
|
||||
//
|
||||
// If the driver is disabled via build tag `no_d2xx`, or on posix
|
||||
// `CGO_ENABLED=0` environment variable, NoCGO is returned.
|
||||
//
|
||||
// On Windows, Missing is returned if the dynamic library is not found at
|
||||
// runtime.
|
||||
func Open(i int) (Handle, Err) {
|
||||
return open(i)
|
||||
}
|
||||
|
1
vendor/periph.io/x/d2xx/d2xx_darwin_amd64.go
generated
vendored
1
vendor/periph.io/x/d2xx/d2xx_darwin_amd64.go
generated
vendored
@ -3,6 +3,7 @@
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
// +build cgo
|
||||
// +build !no_d2xx
|
||||
|
||||
package d2xx
|
||||
|
||||
|
3
vendor/periph.io/x/d2xx/d2xx_linux_amd64.go
generated
vendored
3
vendor/periph.io/x/d2xx/d2xx_linux_amd64.go
generated
vendored
@ -3,10 +3,11 @@
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
// +build cgo
|
||||
// +build !no_d2xx
|
||||
|
||||
package d2xx
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: ${SRCDIR}/third_party/libftd2xx_linux_amd64_v1.4.6.a
|
||||
#cgo LDFLAGS: ${SRCDIR}/third_party/libftd2xx_linux_amd64_v1.4.24.a
|
||||
*/
|
||||
import "C"
|
||||
|
3
vendor/periph.io/x/d2xx/d2xx_linux_arm.go
generated
vendored
3
vendor/periph.io/x/d2xx/d2xx_linux_arm.go
generated
vendored
@ -3,6 +3,7 @@
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
// +build cgo
|
||||
// +build !no_d2xx
|
||||
|
||||
package d2xx
|
||||
|
||||
@ -10,6 +11,6 @@ package d2xx
|
||||
// optimal ARM architecture.
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: ${SRCDIR}/third_party/libftd2xx_linux_arm6hf_v1.4.6.a
|
||||
#cgo LDFLAGS: ${SRCDIR}/third_party/libftd2xx_linux_arm6hf_v1.4.24.a
|
||||
*/
|
||||
import "C"
|
||||
|
13
vendor/periph.io/x/d2xx/d2xx_linux_arm64.go
generated
vendored
Normal file
13
vendor/periph.io/x/d2xx/d2xx_linux_arm64.go
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// 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.
|
||||
|
||||
// +build cgo
|
||||
// +build !no_d2xx
|
||||
|
||||
package d2xx
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: ${SRCDIR}/third_party/libftd2xx_linux_arm64_v1.4.24.a
|
||||
*/
|
||||
import "C"
|
2
vendor/periph.io/x/d2xx/d2xx_posix.go
generated
vendored
2
vendor/periph.io/x/d2xx/d2xx_posix.go
generated
vendored
@ -2,7 +2,9 @@
|
||||
// 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
|
||||
// +build !no_d2xx
|
||||
|
||||
package d2xx
|
||||
|
||||
|
4
vendor/periph.io/x/d2xx/d2xx_posix_no_cgo.go
generated
vendored
4
vendor/periph.io/x/d2xx/d2xx_posix_no_cgo.go
generated
vendored
@ -2,8 +2,8 @@
|
||||
// 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
|
||||
// +build !cgo no_d2xx
|
||||
// +build !windows no_d2xx
|
||||
|
||||
package d2xx
|
||||
|
||||
|
3
vendor/periph.io/x/d2xx/d2xx_posix_other.go
generated
vendored
3
vendor/periph.io/x/d2xx/d2xx_posix_other.go
generated
vendored
@ -7,9 +7,12 @@
|
||||
// +build !linux,!amd64
|
||||
// +build !linux,!arm
|
||||
// +build !windows
|
||||
// +build !no_d2xx
|
||||
|
||||
package d2xx
|
||||
|
||||
// This assumes the library is installed and available for linking.
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lftd2xx
|
||||
*/
|
||||
|
18
vendor/periph.io/x/d2xx/d2xx_windows.go
generated
vendored
18
vendor/periph.io/x/d2xx/d2xx_windows.go
generated
vendored
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed under the Apache License, Version 2.0
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
// +build !no_d2xx
|
||||
|
||||
package d2xx
|
||||
|
||||
import (
|
||||
@ -22,15 +24,21 @@ func version() (uint8, uint8, uint8) {
|
||||
}
|
||||
|
||||
func createDeviceInfoList() (int, Err) {
|
||||
var num uint32
|
||||
r1, _, _ := pCreateDeviceInfoList.Call(uintptr(unsafe.Pointer(&num)))
|
||||
return int(num), Err(r1)
|
||||
if pCreateDeviceInfoList != nil {
|
||||
var num uint32
|
||||
r1, _, _ := pCreateDeviceInfoList.Call(uintptr(unsafe.Pointer(&num)))
|
||||
return int(num), Err(r1)
|
||||
}
|
||||
return 0, Missing
|
||||
}
|
||||
|
||||
func open(i int) (Handle, Err) {
|
||||
var h handle
|
||||
r1, _, _ := pOpen.Call(uintptr(i), uintptr(unsafe.Pointer(&h)))
|
||||
return h, Err(r1)
|
||||
if pOpen != nil {
|
||||
r1, _, _ := pOpen.Call(uintptr(i), uintptr(unsafe.Pointer(&h)))
|
||||
return h, Err(r1)
|
||||
}
|
||||
return h, Missing
|
||||
}
|
||||
|
||||
func (h handle) Close() Err {
|
||||
|
7
vendor/periph.io/x/d2xx/doc.go
generated
vendored
7
vendor/periph.io/x/d2xx/doc.go
generated
vendored
@ -5,9 +5,9 @@
|
||||
// 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.
|
||||
// https://periph.io/x/host/v3/ftdi (or later) instead.
|
||||
//
|
||||
// A binary copy of the d2xx driver is included for linux and macOS. They are
|
||||
// A static library 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.
|
||||
//
|
||||
@ -15,7 +15,4 @@
|
||||
//
|
||||
// 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
|
||||
|
32
vendor/periph.io/x/d2xx/test.sh
generated
vendored
32
vendor/periph.io/x/d2xx/test.sh
generated
vendored
@ -4,8 +4,6 @@
|
||||
# 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
|
||||
|
||||
@ -13,13 +11,33 @@ cd `dirname $0`
|
||||
|
||||
OPT=$*
|
||||
|
||||
# Do not set CGO_ENABLED, as we want the default behavior when cross compiling,
|
||||
# which is different from when CGO_ENABLED=1.
|
||||
export -n CGO_ENABLED
|
||||
|
||||
# Cleanup.
|
||||
export -n GOOS
|
||||
export -n GOARCH
|
||||
|
||||
function build {
|
||||
echo "Testing on $1/$2"
|
||||
GOOS=$1 GOARCH=$2 go build $OPT
|
||||
export GOOS=$1
|
||||
export GOARCH=$2
|
||||
echo "Building on $GOOS/$GOARCH"
|
||||
go build $OPT
|
||||
echo "Building on $GOOS/$GOARCH - no_d2xx"
|
||||
go build -tags no_d2xx $OPT
|
||||
echo "Building on $GOOS/$GOARCH - no cgo"
|
||||
CGO_ENABLED=0 go build $OPT
|
||||
echo "Building on $GOOS/$GOARCH - no cgo, no_d2xx"
|
||||
CGO_ENABLED=0 go build -tags no_d2xx $OPT
|
||||
}
|
||||
|
||||
build darwin amd64
|
||||
build linux amd64
|
||||
build linux arm
|
||||
CGO_ENABLED=1 CC=x86_64-linux-gnu-gcc build linux amd64
|
||||
# Requires: sudo apt install gcc-arm-linux-gnueabihf
|
||||
CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc build linux arm
|
||||
# Requires: sudo apt install gcc-aarch64-linux-gnu
|
||||
CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc build linux arm64
|
||||
|
||||
build linux 386
|
||||
build windows amd64
|
||||
build darwin amd64
|
||||
|
Loading…
Reference in New Issue
Block a user