#include "btsel.h" #include "ch573/gpio.h" #include "isr_vector.h" #define GPIO ch573_gpio__gpio #define GPIO_I CH573_GPIO__GPIO_T_INTF #define GPIO_PORT CH573_GPIO__GPIO_PORT_T_INTF #define GPIO_PORT_A ch573_gpio__gpio_port_a #define GPIO_PORT_B ch573_gpio__gpio_port_b extern bootsel_cb_t BOOTSEL_LISTENERS_START; extern bootsel_cb_t BOOTSEL_LISTENERS_END; #define BOOTSEL_PIN 7 void enable_bootsel_button(void) { GPIO_PORT.dir.set(GPIO_PORT_B, DIR_IN, BOOTSEL_PIN); GPIO_PORT.pu.set(GPIO_PORT_B, ENABLED, BOOTSEL_PIN); // GPIO_PORT.pd_drv.set(GPIO_PORT_B, PD_DRV_OPEN_DRAIN, BOOTSEL_PIN); GPIO_PORT.out.set(GPIO_PORT_B, OFF, BOOTSEL_PIN); GPIO_PORT.clr.set(GPIO_PORT_B, 1 << BOOTSEL_PIN); GPIO_I.pb_interrupt_mode.set(GPIO, 1 << BOOTSEL_PIN); GPIO_I.pb_interrupt_flag.set(GPIO, 1 << BOOTSEL_PIN); GPIO_I.pb_interrupt_enable.set(GPIO, 1 << BOOTSEL_PIN); }