Skip to content

Commit

Permalink
Much faster: 200ns / 25 cycles (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
graeme-winter committed Jan 2, 2023
1 parent 85215fa commit b610b54
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions irq-timer/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

// IRQ handler

void __not_in_flash_func(irq_callback)(uint32_t gpio, uint32_t event) {
void __not_in_flash_func(irq_callback)(void) {
gpio_xor_mask(1 << OUT);
gpio_acknowledge_irq(IN, IO_IRQ_BANK0);
}

int main() {
Expand All @@ -31,7 +32,9 @@ int main() {
gpio_pull_down(IN);

uint32_t mask = GPIO_IRQ_EDGE_RISE;
gpio_set_irq_enabled_with_callback(IN, mask, true, &irq_callback);
irq_set_exclusive_handler(IO_IRQ_BANK0, irq_callback);
gpio_set_irq_enabled(IN, mask, true);
irq_set_enabled(IO_IRQ_BANK0, true);

uint32_t offset = pio_add_program(pio0, &count_program);
count_program_init(pio0, 0, offset, PIO);
Expand Down

0 comments on commit b610b54

Please sign in to comment.