Add CYW43 guards to more things

This commit is contained in:
Jeff Epler 2022-09-28 14:17:27 -05:00
parent e100981d90
commit edf1efd728
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
2 changed files with 13 additions and 11 deletions

View File

@ -28,19 +28,23 @@
#include "common-hal/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "bindings/cyw43/__init__.h"
#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h"
#if CIRCUITPY_CYW43
#include "bindings/cyw43/__init__.h"
#include "pico/cyw43_arch.h"
#endif
STATIC uint32_t never_reset_pins;
bool cyw_ever_init;
static uint32_t cyw_pin_claimed;
void reset_pin_number_cyw(uint8_t pin_no) {
cyw_pin_claimed &= ~(1 << pin_no);
}
#endif
STATIC uint32_t never_reset_pins;
void reset_all_pins(void) {
for (size_t i = 0; i < TOTAL_GPIO_COUNT; i++) {
if ((never_reset_pins & (1 << i)) != 0) {
@ -82,10 +86,6 @@ void reset_pin_number(uint8_t pin_number) {
hw_set_bits(&padsbank0_hw->io[pin_number], PADS_BANK0_GPIO0_OD_BITS);
}
void reset_pin_number_cyw(uint8_t pin_no) {
cyw_pin_claimed &= ~(1 << pin_no);
}
void common_hal_never_reset_pin(const mcu_pin_obj_t *pin) {
never_reset_pin_number(pin->number);
}

View File

@ -34,15 +34,17 @@
#include "peripherals/pins.h"
extern bool cyw_ever_init;
void reset_all_pins(void);
// reset_pin_number takes the pin number instead of the pointer so that objects don't
// need to store a full pointer.
void reset_pin_number(uint8_t pin_number);
void reset_pin_number_cyw(uint8_t pin_number);
void never_reset_pin_number(uint8_t pin_number);
void claim_pin(const mcu_pin_obj_t *pin);
bool pin_number_is_free(uint8_t pin_number);
#if CIRCUITPY_CYW43
extern bool cyw_ever_init;
void reset_pin_number_cyw(uint8_t pin_number);
#endif
#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MICROCONTROLLER_PIN_H