rp2/mphalport: Add mp_hal_is_pin_reserved() function.
As cyw43 pins might be dynamic, add a function that returns if a pin is reserved. This is used by `MICROPY_HW_PIN_RESERVED` to prevent the pin IRQ from being reset across a soft-reset. Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
This commit is contained in:
parent
30163e0ae4
commit
4a6c246008
3 changed files with 12 additions and 1 deletions
|
|
@ -20,4 +20,6 @@
|
|||
|
||||
#define MICROPY_HW_PIN_EXT_COUNT CYW43_WL_GPIO_COUNT
|
||||
|
||||
#define MICROPY_HW_PIN_RESERVED(i) ((i) == CYW43_PIN_WL_HOST_WAKE || (i) == CYW43_PIN_WL_REG_ON)
|
||||
// If this returns true for a pin then its irq will not be disabled on a soft reboot
|
||||
int mp_hal_is_pin_reserved(int n);
|
||||
#define MICROPY_HW_PIN_RESERVED(i) mp_hal_is_pin_reserved(i)
|
||||
|
|
|
|||
|
|
@ -278,3 +278,11 @@ void mp_wfe_or_timeout(uint32_t timeout_ms) {
|
|||
// Clean up the timer node if it's not already
|
||||
soft_timer_remove(&timer);
|
||||
}
|
||||
|
||||
int mp_hal_is_pin_reserved(int n) {
|
||||
#if MICROPY_PY_NETWORK_CYW43
|
||||
return n == CYW43_PIN_WL_HOST_WAKE;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,5 +210,6 @@ enum {
|
|||
void mp_hal_get_mac(int idx, uint8_t buf[6]);
|
||||
void mp_hal_get_mac_ascii(int idx, size_t chr_off, size_t chr_len, char *dest);
|
||||
void mp_hal_generate_laa_mac(int idx, uint8_t buf[6]);
|
||||
int mp_hal_is_pin_reserved(int n);
|
||||
|
||||
#endif // MICROPY_INCLUDED_RP2_MPHALPORT_H
|
||||
|
|
|
|||
Loading…
Reference in a new issue