machine: rename PinInputPullUp/PinInputPullDown

Some targets used capital PullUp/PullDown, while the documented standard
is Pullup/Pulldown. This commit fixes this mismatch, while preserving
compatibility with aliases that are marked deprecated.
This commit is contained in:
Ayke van Laethem
2022-09-18 18:11:54 +02:00
committed by Ron Evans
parent 6e6666519c
commit bc946f346d
5 changed files with 35 additions and 17 deletions
+11 -5
View File
@@ -21,8 +21,8 @@ func CPUFrequency() uint32 {
const (
// GPIO
PinInput PinMode = iota
PinInputPullUp
PinInputPullDown
PinInputPullup
PinInputPulldown
PinOutput
PinOutputOpenDrain
PinDisable
@@ -45,6 +45,12 @@ const (
PinModeI2CSCL
)
// Deprecated: use PinInputPullup and PinInputPulldown instead.
const (
PinInputPullUp = PinInputPullup
PinInputPullDown = PinInputPulldown
)
type PinChange uint8
const (
@@ -259,11 +265,11 @@ func (p Pin) Configure(config PinConfig) {
gpio.GDIR.ClearBits(p.getMask())
pad.Set(dse(7))
case PinInputPullUp:
case PinInputPullup:
gpio.GDIR.ClearBits(p.getMask())
pad.Set(dse(7) | pke | pue | pup(3) | hys)
case PinInputPullDown:
case PinInputPulldown:
gpio.GDIR.ClearBits(p.getMask())
pad.Set(dse(7) | pke | pue | hys)
@@ -746,7 +752,7 @@ func (p Pin) getMuxMode(config PinConfig) uint32 {
switch config.Mode {
// GPIO
case PinInput, PinInputPullUp, PinInputPullDown,
case PinInput, PinInputPullup, PinInputPulldown,
PinOutput, PinOutputOpenDrain, PinDisable:
mode := uint32(0x5) // GPIO is always alternate function 5
if forcePath {