build: upgrade to go 1.17 and dependencies

This commit is contained in:
2021-09-01 21:01:28 +02:00
parent de6f39bddc
commit 8b5888ee1b
321 changed files with 41511 additions and 9444 deletions

35
vendor/periph.io/x/periph/README.md generated vendored
View File

@@ -4,43 +4,16 @@
Documentation is at https://periph.io
[![GoDoc](https://godoc.org/periph.io/x/periph?status.svg)](https://godoc.org/periph.io/x/periph)
[![Go Report Card](https://goreportcard.com/badge/periph.io/x/periph)](https://goreportcard.com/report/periph.io/x/periph)
[![Coverage Status](https://codecov.io/gh/google/periph/graph/badge.svg)](https://codecov.io/gh/google/periph)
[![Build Status](https://travis-ci.org/google/periph.svg)](https://travis-ci.org/google/periph)
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/).
## Example
## New home
Blink a LED:
~~~go
package main
import (
"time"
"periph.io/x/periph/conn/gpio"
"periph.io/x/periph/host"
"periph.io/x/periph/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!
The source code is now hosted in multiple repositories at
[github.com/periph](https://github.com/periph). See
https://periph.io/news/2020/a_new_start/ for more details.
## Authors

View File

@@ -4,60 +4,7 @@
// 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.
// Is it now superseded by https://periph.io/x/conn/v3 (or later).
//
// 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.
// See https://periph.io/news/2020/a_new_start/ for more details.
package conn

View File

@@ -1608,6 +1608,68 @@ const (
minLuminousFlux = -9223372036854775807 * NanoLumen
)
// MagneticFluxDensity is a measurement of magnetic flux density, stored in Tesla.
//
// The highest representable value is 9.2GT.
type MagneticFluxDensity int64
// String returns the energy formatted as a string in Farad.
func (c MagneticFluxDensity) String() string {
return nanoAsString(int64(c)) + "T"
}
// Set sets the MagneticFluxDensity to the value represented by s. Units are
// to be provided in "T" with an optional SI prefix: "p", "n", "u", "µ", "m",
// "k", "M", "G" or "T".
func (c *MagneticFluxDensity) Set(s string) error {
v, n, err := valueOfUnitString(s, pico)
if err != nil {
if e, ok := err.(*parseError); ok {
switch e.error {
case errNotANumber:
if found := hasSuffixes(s, "T", "t"); found != "" {
return err
}
return notNumberUnitErr("T")
case errOverflowsInt64:
return maxValueErr(maxMagneticFluxDensity.String())
case errOverflowsInt64Negative:
return minValueErr(minMagneticFluxDensity.String())
}
}
return err
}
switch s[n:] {
case "T", "t":
*c = (MagneticFluxDensity)(v)
case "":
return noUnitErr("T")
default:
if found := hasSuffixes(s[n:], "T", "t"); found != "" {
return unknownUnitPrefixErr(found, "p,n,u,µ,m,k,M,G or T")
}
return incorrectUnitErr("T")
}
return nil
}
// Well known MagneticFluxDensity constants.
const (
// Tesla is a unit of magnetic flux density.
NanoTesla MagneticFluxDensity = 1
MicroTesla MagneticFluxDensity = 1000 * NanoTesla
MilliTesla MagneticFluxDensity = 1000 * MicroTesla
Tesla MagneticFluxDensity = 1000 * MilliTesla
KiloTesla MagneticFluxDensity = 1000 * Tesla
MegaTesla MagneticFluxDensity = 1000 * KiloTesla
GigaTesla MagneticFluxDensity = 1000 * MegaTesla
maxMagneticFluxDensity = 9223372036854775807 * NanoTesla
minMagneticFluxDensity = -9223372036854775807 * NanoTesla
)
//
func prefixZeros(digits, v int) string {

View File

@@ -4,7 +4,7 @@
// Package host defines the host itself.
//
// The host is the machine where this code is running.
// Is it now superseded by https://periph.io/x/host/v3 (or later).
//
// Subpackages contain the drivers that are loaded automatically.
// See https://periph.io/news/2020/a_new_start/ for more details.
package host

View File

@@ -6,12 +6,13 @@ package pine64
import (
"errors"
"os"
"strings"
"periph.io/x/periph"
"periph.io/x/periph/conn/pin"
"periph.io/x/periph/conn/pin/pinreg"
"periph.io/x/periph/host/allwinner"
"periph.io/x/periph/host/distro"
)
// Present returns true if running on a Pine64 board.
@@ -19,9 +20,7 @@ import (
// https://www.pine64.org/
func Present() bool {
if isArm {
// This is iffy at best.
_, err := os.Stat("/boot/pine64.dtb")
return err == nil
return strings.HasPrefix(distro.DTModel(), "Pine64")
}
return false
}

53
vendor/periph.io/x/periph/periph.go generated vendored
View File

@@ -4,56 +4,11 @@
// Package periph is a peripheral I/O library.
//
// Package periph acts as a registry of drivers. It is focused on providing
// high quality host drivers that provide high-speed access to the hardware on
// the host computer itself.
// Is it now superseded by https://periph.io/x/conn/v3 (or later),
// https://periph.io/x/host/v3 (or later), https://periph.io/x/devices/v3 (or
// later) and https://periph.io/x/cmd.
//
// To learn more about the goals and design, visit https://periph.io/
//
// Every device driver should register itself in its package init() function by
// calling periph.MustRegister().
//
// User shall call either host.Init() or hostextra.Init() on startup to
// initialize all the registered drivers.
//
// Cmd
//
// cmd/ contains executable tools to communicate directly with the devices or
// the buses.
//
// cmd/ is allowed to import from conn/, devices/ and host/.
//
// Conn
//
// conn/ contains interfaces and registries for all the supported protocols and
// connections (I²C, SPI, GPIO, etc).
//
// conn/ is not allowed to import from any other package.
//
// Devices
//
// devices/ contains devices drivers that are connected to bus, port or
// connection (i.e I²C, SPI, 1-wire, GPIO) that can be controlled by the host,
// i.e. ssd1306 (display controller), bm280 (environmental sensor), etc.
//
// devices/ is allowed to import from conn/ and host/.
//
// Experimental
//
// experimental/ contains the drivers that are in the experimental area, not
// yet considered stable. See
// https://periph.io/project/#driver-lifetime-management for the process to
// move drivers out of this area.
//
// experimental/ is allowed to import from conn/, devices/ and host/.
//
// Host
//
// host/ contains all the implementations relating to the host itself, the CPU
// and buses that are exposed by the host onto which devices can be connected,
// i.e. I²C, SPI, GPIO, etc.
//
// host/ is allowed to import from conn/ only.
// See https://periph.io/news/2020/a_new_start/ for more details.
package periph // import "periph.io/x/periph"
import (