diff --git a/src/machine/machine_esp32c3.go b/src/machine/machine_esp32c3.go index b57898b8..44c273df 100644 --- a/src/machine/machine_esp32c3.go +++ b/src/machine/machine_esp32c3.go @@ -59,12 +59,9 @@ type PinChange uint8 // Pin change interrupt constants for SetInterrupt. const ( - PinNoInterrupt PinChange = iota - PinRising + PinRising PinChange = iota + 1 PinFalling PinToggle - PinLowLevel - PinHighLevel ) // Configure this pin with the given configuration. @@ -190,7 +187,7 @@ func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) (err error) { return ErrInvalidInputPin } - if callback == nil || change == PinNoInterrupt { + if callback == nil { // Disable this pin interrupt p.pin().ClearBits(esp.GPIO_PIN_PIN_INT_TYPE_Msk | esp.GPIO_PIN_PIN_INT_ENA_Msk) diff --git a/src/machine/machine_mimxrt1062.go b/src/machine/machine_mimxrt1062.go index acac9501..5fd3199f 100644 --- a/src/machine/machine_mimxrt1062.go +++ b/src/machine/machine_mimxrt1062.go @@ -54,9 +54,7 @@ const ( type PinChange uint8 const ( - PinLow PinChange = iota - PinHigh - PinRising + PinRising PinChange = iota + 2 PinFalling PinToggle ) @@ -393,7 +391,7 @@ func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error { mask := p.getMask() if nil != callback { switch change { - case PinLow, PinHigh, PinRising, PinFalling: + case PinRising, PinFalling: gpio.EDGE_SEL.ClearBits(mask) var reg *volatile.Register32 var pos uint8 diff --git a/src/machine/machine_rp2040_gpio.go b/src/machine/machine_rp2040_gpio.go index b19014b9..e60f2c3a 100644 --- a/src/machine/machine_rp2040_gpio.go +++ b/src/machine/machine_rp2040_gpio.go @@ -226,12 +226,8 @@ type PinChange uint8 // Pin change interrupt constants for SetInterrupt. const ( - // PinLevelLow triggers whenever pin is at a low (around 0V) logic level. - PinLevelLow PinChange = 1 << iota - // PinLevelLow triggers whenever pin is at a high (around 3V) logic level. - PinLevelHigh // Edge falling - PinFalling + PinFalling PinChange = 4 << iota // Edge rising PinRising )