Level-triggered w6300 interrupt, drain until empty, rearm after drain
This commit is contained in:
@@ -77,8 +77,11 @@ void pio_init() {
|
||||
gpio_init(PIN_INT);
|
||||
gpio_set_dir(PIN_INT, GPIO_IN);
|
||||
gpio_pull_up(PIN_INT);
|
||||
gpio_set_irq_enabled_with_callback(PIN_INT, GPIO_IRQ_EDGE_FALL, true,
|
||||
[](uint, uint32_t){ irq_pending = true; });
|
||||
gpio_set_irq_enabled_with_callback(PIN_INT, GPIO_IRQ_LEVEL_LOW, true,
|
||||
[](uint gpio, uint32_t){
|
||||
irq_pending = true;
|
||||
gpio_set_irq_enabled(gpio, GPIO_IRQ_LEVEL_LOW, false);
|
||||
});
|
||||
|
||||
pio_hw_t *pios[2] = {pio0, pio1};
|
||||
uint pio_index = 1;
|
||||
@@ -500,6 +503,10 @@ void clear_interrupt(intr_kind intr) {
|
||||
set_slirclr((uint8_t)((uint32_t)intr >> 16));
|
||||
}
|
||||
|
||||
void rearm_gpio_irq() {
|
||||
gpio_set_irq_enabled(PIN_INT, GPIO_IRQ_LEVEL_LOW, true);
|
||||
}
|
||||
|
||||
void set_interrupt_mask(intr_kind intr) {
|
||||
set_imr((uint8_t)intr);
|
||||
set_simr((uint8_t)((uint16_t)intr >> 8));
|
||||
|
||||
@@ -41,6 +41,7 @@ extern volatile bool irq_pending;
|
||||
|
||||
void clear_interrupt(intr_kind intr);
|
||||
void set_interrupt_mask(intr_kind intr);
|
||||
void rearm_gpio_irq();
|
||||
|
||||
std::expected<socket_id, sock_error> open_socket(socket_id sn, protocol proto, sock_flag flag);
|
||||
std::expected<uint16_t, sock_error> send(socket_id sn, std::span<const uint8_t> buf);
|
||||
|
||||
Reference in New Issue
Block a user