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

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 {