aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/machine/machine_atsamd51.go
diff options
context:
space:
mode:
authorsago35 <[email protected]>2021-04-29 09:14:46 +0900
committerRon Evans <[email protected]>2021-04-29 09:20:44 +0200
commit9ef75f17bf920362f672d60397d0e1d2bb8430d0 (patch)
treeb9b8bf6673688308f59b3c94c3bb20b2896bf2b8 /src/machine/machine_atsamd51.go
parentc3992bd77b1e0b64c56065d9d32b8b920eb0efb2 (diff)
downloadtinygo-9ef75f17bf920362f672d60397d0e1d2bb8430d0.tar.gz
tinygo-9ef75f17bf920362f672d60397d0e1d2bb8430d0.zip
atsamd51, atsame5x: unify samd51 and same5x
Diffstat (limited to 'src/machine/machine_atsamd51.go')
-rw-r--r--src/machine/machine_atsamd51.go17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/machine/machine_atsamd51.go b/src/machine/machine_atsamd51.go
index fa2dd0ec5..a251f6704 100644
--- a/src/machine/machine_atsamd51.go
+++ b/src/machine/machine_atsamd51.go
@@ -1,4 +1,4 @@
-// +build sam,atsamd51
+// +build sam,atsamd51 sam,atsame5x
// Peripheral abstraction layer for the atsamd51.
//
@@ -44,6 +44,9 @@ const (
PinTCCF PinMode = PinTimerAlt
PinTCCG PinMode = PinTCCPDEC
PinInputPulldown PinMode = 18
+ PinCAN PinMode = 19
+ PinCAN0 PinMode = PinSDHC
+ PinCAN1 PinMode = PinCom
)
type PinChange uint8
@@ -627,6 +630,18 @@ func (p Pin) Configure(config PinConfig) {
}
// enable port config
p.setPinCfg(sam.PORT_GROUP_PINCFG_PMUXEN | sam.PORT_GROUP_PINCFG_DRVSTR)
+ case PinSDHC:
+ if p&1 > 0 {
+ // odd pin, so save the even pins
+ val := p.getPMux() & sam.PORT_GROUP_PMUX_PMUXE_Msk
+ p.setPMux(val | (uint8(PinSDHC) << sam.PORT_GROUP_PMUX_PMUXO_Pos))
+ } else {
+ // even pin, so save the odd pins
+ val := p.getPMux() & sam.PORT_GROUP_PMUX_PMUXO_Msk
+ p.setPMux(val | (uint8(PinSDHC) << sam.PORT_GROUP_PMUX_PMUXE_Pos))
+ }
+ // enable port config
+ p.setPinCfg(sam.PORT_GROUP_PINCFG_PMUXEN)
}
}