|
@@ -339,10 +339,16 @@ static void pmw_irq_stop(void) {
|
339
|
339
|
}
|
340
|
340
|
|
341
|
341
|
static void pmw_irq_init(void) {
|
342
|
|
- // setup MOTION pin interrupt to handle reading data
|
343
|
|
- gpio_add_raw_irq_handler(PMW_MOTION_PIN, pmw_motion_irq);
|
|
342
|
+ static bool first_init = false;
|
|
343
|
+
|
|
344
|
+ if (!first_init) {
|
|
345
|
+ // setup MOTION pin interrupt to handle reading data
|
|
346
|
+ gpio_add_raw_irq_handler(PMW_MOTION_PIN, pmw_motion_irq);
|
|
347
|
+ irq_set_enabled(IO_IRQ_BANK0, true);
|
|
348
|
+ first_init = true;
|
|
349
|
+ }
|
|
350
|
+
|
344
|
351
|
pmw_irq_start();
|
345
|
|
- irq_set_enabled(IO_IRQ_BANK0, true);
|
346
|
352
|
|
347
|
353
|
// make MOTION pin available to picotool
|
348
|
354
|
bi_decl(bi_1pin_with_name(PMW_MOTION_PIN, "PMW3360 MOTION"));
|