MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / attach_interrupt

Method attach_interrupt

libraries/AP_HAL_ChibiOS/GPIO.cpp:309–328  ·  view source on GitHub ↗

Attach an interrupt handler to a GPIO pin number. The pin number must be one specified with a GPIO() marker in hwdef.dat */

Source from the content-addressed store, hash-verified

307 must be one specified with a GPIO() marker in hwdef.dat
308 */
309bool GPIO::attach_interrupt(uint8_t pin,
310 irq_handler_fn_t fn,
311 INTERRUPT_TRIGGER_TYPE mode)
312{
313 struct gpio_entry *g = gpio_by_pin_num(pin, false);
314 if (!g) {
315 return false;
316 }
317 g->isr_disabled_ticks = 0;
318 g->isr_quota = 0;
319 if (!_attach_interrupt(g->pal_line,
320 palcallback_t(fn?pal_interrupt_cb_functor:nullptr),
321 g,
322 mode)) {
323 return false;
324 }
325 g->fn = fn;
326 g->isr_mode = mode;
327 return true;
328}
329
330/*
331 Attach an interrupt handler to ioline_t

Callers 10

set_pinMethod · 0.45
radio_initMethod · 0.45
radio_initMethod · 0.45
radio_initMethod · 0.45
updateMethod · 0.45
_parse_gpsMethod · 0.45
update_pinMethod · 0.45
readMethod · 0.45
pwm_hardpoint_initMethod · 0.45

Calls 1

gpio_by_pin_numFunction · 0.70

Tested by

no test coverage detected