Skip to content

Commit 9ef75f1

Browse files
sago35deadprogram
authored andcommitted
atsamd51, atsame5x: unify samd51 and same5x
1 parent c3992bd commit 9ef75f1

File tree

4 files changed

+17
-3036
lines changed

4 files changed

+17
-3036
lines changed

src/machine/machine_atsamd51.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build sam,atsamd51
1+
// +build sam,atsamd51 sam,atsame5x
22

33
// Peripheral abstraction layer for the atsamd51.
44
//
@@ -44,6 +44,9 @@ const (
4444
PinTCCF PinMode = PinTimerAlt
4545
PinTCCG PinMode = PinTCCPDEC
4646
PinInputPulldown PinMode = 18
47+
PinCAN PinMode = 19
48+
PinCAN0 PinMode = PinSDHC
49+
PinCAN1 PinMode = PinCom
4750
)
4851

4952
type PinChange uint8
@@ -627,6 +630,18 @@ func (p Pin) Configure(config PinConfig) {
627630
}
628631
// enable port config
629632
p.setPinCfg(sam.PORT_GROUP_PINCFG_PMUXEN | sam.PORT_GROUP_PINCFG_DRVSTR)
633+
case PinSDHC:
634+
if p&1 > 0 {
635+
// odd pin, so save the even pins
636+
val := p.getPMux() & sam.PORT_GROUP_PMUX_PMUXE_Msk
637+
p.setPMux(val | (uint8(PinSDHC) << sam.PORT_GROUP_PMUX_PMUXO_Pos))
638+
} else {
639+
// even pin, so save the odd pins
640+
val := p.getPMux() & sam.PORT_GROUP_PMUX_PMUXO_Msk
641+
p.setPMux(val | (uint8(PinSDHC) << sam.PORT_GROUP_PMUX_PMUXE_Pos))
642+
}
643+
// enable port config
644+
p.setPinCfg(sam.PORT_GROUP_PINCFG_PMUXEN)
630645
}
631646
}
632647

0 commit comments

Comments
 (0)