mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-17 03:03:27 +00:00
machine/atsamd21: fix analog pin mode
This commit is contained in:
committed by
Ron Evans
parent
3bf4c06c99
commit
3568254593
@@ -106,7 +106,7 @@ func (p GPIO) Configure(config GPIOConfig) {
|
|||||||
} else {
|
} else {
|
||||||
// even pin, so save the odd pins
|
// even pin, so save the odd pins
|
||||||
val := p.getPMux() & sam.PORT_PMUX0_PMUXO_Msk
|
val := p.getPMux() & sam.PORT_PMUX0_PMUXO_Msk
|
||||||
p.setPMux(val | (GPIO_COM << sam.PORT_PMUX0_PMUXE_Pos))
|
p.setPMux(val | (GPIO_ANALOG << sam.PORT_PMUX0_PMUXE_Pos))
|
||||||
}
|
}
|
||||||
// enable port config
|
// enable port config
|
||||||
p.setPinCfg(sam.PORT_PINCFG0_PMUXEN | sam.PORT_PINCFG0_DRVSTR)
|
p.setPinCfg(sam.PORT_PINCFG0_PMUXEN | sam.PORT_PINCFG0_DRVSTR)
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ func (p GPIO) Configure(config GPIOConfig) {
|
|||||||
} else {
|
} else {
|
||||||
// even pin, so save the odd pins
|
// even pin, so save the odd pins
|
||||||
val := p.getPMux() & sam.PORT_PMUX0_PMUXO_Msk
|
val := p.getPMux() & sam.PORT_PMUX0_PMUXO_Msk
|
||||||
p.setPMux(val | (GPIO_COM << sam.PORT_PMUX0_PMUXE_Pos))
|
p.setPMux(val | (GPIO_ANALOG << sam.PORT_PMUX0_PMUXE_Pos))
|
||||||
}
|
}
|
||||||
// enable port config
|
// enable port config
|
||||||
p.setPinCfg(sam.PORT_PINCFG0_PMUXEN | sam.PORT_PINCFG0_DRVSTR)
|
p.setPinCfg(sam.PORT_PINCFG0_PMUXEN | sam.PORT_PINCFG0_DRVSTR)
|
||||||
|
|||||||
Reference in New Issue
Block a user