EVE 1.0
irq.h
Go to the documentation of this file.
1 #ifndef DRIVER_IRQ_H
2 #define DRIVER_IRQ_H
3 
4 /**********************************************************************/
5 /**
6  * @file
7  * @brief External IRQ abstraction
8  *
9  * @author DT, Jetro AS
10  ***********************************************************************/
11 
12 /**
13  * \defgroup irqext External IRQ
14  * \ingroup irq
15  * \{
16  *
17  */
18 
19 /* external from gpio-ext.h*/
20 struct gpio_ext_t;
21 
22 /**
23  * IRQ handler callback function prototype.
24  *
25  * \param Module User-defined data
26  * \param IoExpander Pointer to the instance of system IO expanders which has triggered the interrupt. NULL for built-in MCU GPIO.
27  * \param Pin Pin number which has triggered the interrupt.
28  */
29 typedef void (*irq_handler_cb_t)(void *Module, const struct gpio_ext_t *GpioExt, uint8_t Pin);
30 
31 /**
32  * IRQ configuration database entry
33  *
34  * \param Callback IRQ handler callback
35  * \param Module User-defined data passed to the callback
36  */
38 {
39  irq_handler_cb_t Callback;
40  void *Module;
41 };
42 
43 /**
44  * IRQ mode
45  */
47 {
48  IRQ_MODE_DISABLED = 0, /**< IRQ is disabled */
49  IRQ_MODE_RISING, /**< Rising edge sense */
50  IRQ_MODE_FALLING, /**< Falling edge sense */
51 };
52 
53 /**
54  * IRQ configuration database index for built-in MCU GPIO interrupts
55  * Each entry in the table should represent an offset in the \ref IrqConfig table plus one
56  */
57 extern const uint8_t IntIrqDispatch[32];
58 
59 /**
60  * IRQ configuration database index for IO expanders interrupts
61  * Each entry in the table should represent an offset in the \ref IrqConfig table plus one
62  *
63  */
64 extern const uint8_t ExtIrqDispatch[];
65 
66 /**
67  * IRQ configuration database.
68  */
69 extern const struct irq_config_t IrqConfig[];
70 
71 /**
72  * NULL-terminated array of GPIO expanders
73 */
74 extern const struct gpio_ext_t* GpioExpanders[];
75 
76 /**
77  * Trigger an internal IRQ for the pin
78  *
79  * \param Pin Pin number
80  */
81 extern void IrqTriggerInternal(uint8_t Pin);
82 
83 /**
84  * Trigger an external interrupt
85  */
86 extern void IrqTriggerExternal(void);
87 
88 /**
89  * Enables or disables internal interrupt for the selected pin
90  */
91 void IrqEnableInternal(uint8_t Pin, enum irq_mode_t Mode);
92 
93 /**
94  * Mark an interrrupt pin as an external interrupt trigger
95  *
96  * \param Pin Pin number
97  */
98 void IrqRegisterExternal(uint8_t Pin);
99 
100 /**********************************************************************/
101 /**
102  * @brief Name: GpioInterruptHandler\n
103  * GPIO interrupt handler
104  * Must be called from GPIOTE_Handler.
105  ***********************************************************************/
106 void GpioInterruptHandler(void);
107 
108 /** \} */
109 
110 #endif // DRIVER_IRQ_H
irq_mode_t
Definition: irq.h:46
const struct gpio_ext_t * GpioExpanders[]
const uint8_t ExtIrqDispatch[]
void IrqTriggerInternal(uint8_t Pin)
void IrqTriggerExternal(void)
const uint8_t IntIrqDispatch[32]
void(* irq_handler_cb_t)(void *Module, const struct gpio_ext_t *GpioExt, uint8_t Pin)
Definition: irq.h:29
void IrqEnableInternal(uint8_t Pin, enum irq_mode_t Mode)
const struct irq_config_t IrqConfig[]
void GpioInterruptHandler(void)
Name: GpioInterruptHandler GPIO interrupt handler Must be called from GPIOTE_Handler.
void IrqRegisterExternal(uint8_t Pin)