From 7014f90120093eb600fed45bcafc02239e1e23fa Mon Sep 17 00:00:00 2001 From: Ron Evans Date: Sat, 26 Oct 2019 18:48:55 +0200 Subject: [PATCH] machine/samd21: correct handling of pins > 32 based on bugfix for samd51 submitted by @Infinoid Signed-off-by: Ron Evans --- src/machine/machine_atsamd21g18.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/machine/machine_atsamd21g18.go b/src/machine/machine_atsamd21g18.go index 907d88a2..86410af1 100644 --- a/src/machine/machine_atsamd21g18.go +++ b/src/machine/machine_atsamd21g18.go @@ -54,7 +54,7 @@ func (p Pin) Get() bool { if p < 32 { return (sam.PORT.IN0.Get()>>uint8(p))&1 > 0 } else { - return (sam.PORT.IN1.Get()>>(uint8(p)-32))&1 > 0 + return (sam.PORT.IN1.Get()>>uint8(p-32))&1 > 0 } } @@ -77,7 +77,7 @@ func (p Pin) Configure(config PinConfig) { sam.PORT.DIRCLR0.Set(1 << uint8(p)) p.setPinCfg(sam.PORT_PINCFG0_INEN) } else { - sam.PORT.DIRCLR1.Set(1<