Synopsis
CTL_STATUS_t platform_hook_pin_edge(int pin,
PLATFORM_EDGE_t edge,
PLATFORM_HOOK_t *hook);
Description
platform_hook_pin_edge hooks the function hook so that it is activated
by an edge on pin pin. The edge parameter requests that the
hook be triggered on a rising edge, a falling edge, or either edge.
The activated hook is executed in an interrupt context,
not a task context, and without any surrounding calls to
ctl_enter_isr and ctl_exit_isr. If your hook requires CTL
facilities, you must ensure that you call ctl_enter_isr and
ctl_exit_isr as you would in a standard CTL interrupt handler.
Return Value
platform_hook_pin_edge returns a standard status code. Hooking an interrupt
is inherently platform-dependent and may fail for any of the
following reasons:
- A hook is already established for the pin. Some platforms
may support more than one hook per pin and chain them, whereas
others may support exactly one hook per pin. It is typically not
possible to establish distinct hooks for rising and falling edges
of a pin, but the platform supports a single hook for both edges.
- The platform is out of resources when associating interrupts
with pins. For instance, STM32 devices can hook an interrupt to
bits 0 through 31 of any port, but cannot simultaneously establish
hooks for the same bit on different ports, i.e. you cannot establish
hooks for interrupts on both PORTA[4] and PORTC[4] as they share
the same internal resource, but you can establish hooks for PORTA[4]
and PORTC[5] as they use different pins.
- The port pin cannot generate interrupts.
- The port pin does not support the requested edge trigger.
See Also
PLATFORM_HOOK_t, PLATFORM_EDGE_t