From 7c4e83f5c0738f56816786ad1a776a7c77801b83 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Wed, 4 Nov 2020 01:43:34 +0100 Subject: [PATCH] machine: clarify caller's responsibility in SetInterrupt --- src/machine/machine_atsamd21.go | 3 ++- src/machine/machine_atsamd51.go | 3 ++- src/machine/machine_k210.go | 3 ++- src/machine/machine_nrf.go | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/machine/machine_atsamd21.go b/src/machine/machine_atsamd21.go index 3db0eb6e..8db95722 100644 --- a/src/machine/machine_atsamd21.go +++ b/src/machine/machine_atsamd21.go @@ -165,7 +165,8 @@ func findPinPadMapping(sercom uint8, pin Pin) (pinMode PinMode, pad uint32, ok b } // SetInterrupt sets an interrupt to be executed when a particular pin changes -// state. +// state. The pin should already be configured as an input, including a pull up +// or down if no external pull is provided. // // This call will replace a previously set callback on this pin. You can pass a // nil func to unset the pin change interrupt. If you do so, the change diff --git a/src/machine/machine_atsamd51.go b/src/machine/machine_atsamd51.go index b3abe6d2..4cb36366 100644 --- a/src/machine/machine_atsamd51.go +++ b/src/machine/machine_atsamd51.go @@ -353,7 +353,8 @@ func findPinPadMapping(sercom uint8, pin Pin) (pinMode PinMode, pad uint32, ok b } // SetInterrupt sets an interrupt to be executed when a particular pin changes -// state. +// state. The pin should already be configured as an input, including a pull up +// or down if no external pull is provided. // // This call will replace a previously set callback on this pin. You can pass a // nil func to unset the pin change interrupt. If you do so, the change diff --git a/src/machine/machine_k210.go b/src/machine/machine_k210.go index 794aecc9..9171450a 100644 --- a/src/machine/machine_k210.go +++ b/src/machine/machine_k210.go @@ -172,7 +172,8 @@ func (p Pin) Get() bool { var pinCallbacks [32]func(Pin) // SetInterrupt sets an interrupt to be executed when a particular pin changes -// state. +// state. The pin should already be configured as an input, including a pull up +// or down if no external pull is provided. // // You can pass a nil func to unset the pin change interrupt. If you do so, // the change parameter is ignored and can be set to any value (such as 0). diff --git a/src/machine/machine_nrf.go b/src/machine/machine_nrf.go index e6109e99..ac01fd0b 100644 --- a/src/machine/machine_nrf.go +++ b/src/machine/machine_nrf.go @@ -72,7 +72,8 @@ func (p Pin) Get() bool { } // SetInterrupt sets an interrupt to be executed when a particular pin changes -// state. +// state. The pin should already be configured as an input, including a pull up +// or down if no external pull is provided. // // This call will replace a previously set callback on this pin. You can pass a // nil func to unset the pin change interrupt. If you do so, the change