build: upgrade to go 1.17 and dependencies
This commit is contained in:
62
vendor/periph.io/x/periph/conn/physic/units.go
generated
vendored
62
vendor/periph.io/x/periph/conn/physic/units.go
generated
vendored
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user