blob: c9c7e06a6cfae6f798cb2de84debdd5cdaece365 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#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);
}
|