Functions for interrupt handling.
An example of using this library
int main (void)
{
while(1) {
printf("interrupt on IO_BTN0, turning on IO_LD0\n");
} else {
printf("interrupt on pin %d\n",interruptPin[0]);
}
}
return EXIT_SUCCESS;
}
void gpio_set_direction(const io_t pin, const gpio_direction_t dir)
Set the IO pin as in input or output.
void gpio_reset(void)
Reset all IO pins.
void gpio_set_level(const io_t pin, const gpio_level_t level)
Set the level of the output IO pin. If the pin is configured as input, this function does nothing.
uint8_t * gpio_get_interrupt_pins(uint8_t *positions)
Gets all pins on which an interrupt occurred.
int gpio_interrupt_init(void)
Enables interrupts to be set and read.
void gpio_wait_for_interrupt(const io_t pin)
Waits untill an interrupt occurs on the specified pin or if the value of pin is larger than 63,...
void gpio_enable_interrupt(const io_t pin)
enables a specific pin to raise interrupts.
void gpio_ack_interrupt(void)
acknowledges the raised interrupts and resets the interrupt word. Allows new interrupts to occur on t...
@ IO_BTN0
Button input pins.
void switchbox_destroy(void)
Resets all pins of the switch box to be input.
void switchbox_reset(void)
Resets all pins of the switch box to be input.
void switchbox_init(void)
Initializes the switch box.
◆ gpio_ack_interrupt()
void gpio_ack_interrupt |
( |
void |
| ) |
|
|
extern |
acknowledges the raised interrupts and resets the interrupt word. Allows new interrupts to occur on the previously triggered pins.
Definition at line 91 of file interrupt.c.
◆ gpio_disable_all_interrupts()
void gpio_disable_all_interrupts |
( |
void |
| ) |
|
|
extern |
Disables all interrupts from being raised.
Definition at line 77 of file interrupt.c.
◆ gpio_disable_interrupt()
void gpio_disable_interrupt |
( |
const io_t |
pin | ) |
|
|
extern |
Disables interrupts from occuring on the specific pin. Hereafter, the pin will not trigger an interrupt.
- Parameters
-
pin | to be disabled from obtianing interrupts |
Definition at line 72 of file interrupt.c.
◆ gpio_enable_interrupt()
void gpio_enable_interrupt |
( |
const io_t |
pin | ) |
|
|
extern |
enables a specific pin to raise interrupts.
- Parameters
-
Definition at line 59 of file interrupt.c.
◆ gpio_get_interrupt()
uint64_t gpio_get_interrupt |
( |
void |
| ) |
|
|
extern |
- Returns
- the 64 bits on which interrupts are indicated by a one. The bits are in accordance with the pins described in pinmap.h
Definition at line 83 of file interrupt.c.
◆ gpio_get_interrupt_pins()
uint8_t * gpio_get_interrupt_pins |
( |
uint8_t * |
positions | ) |
|
|
extern |
Gets all pins on which an interrupt occurred.
- Returns
- a pointer to an array of maximum 64 intergers. The integers correspond to pins with a pending interrupt.
Definition at line 160 of file interrupt.c.
◆ gpio_interrupt_init()
int gpio_interrupt_init |
( |
void |
| ) |
|
|
extern |
Enables interrupts to be set and read.
Definition at line 48 of file interrupt.c.
◆ gpio_print_interrupt()
void gpio_print_interrupt |
( |
void |
| ) |
|
|
extern |
prints the current interrupt word
Definition at line 117 of file interrupt.c.
◆ gpio_wait_for_interrupt()
void gpio_wait_for_interrupt |
( |
const io_t |
pin | ) |
|
|
extern |
Waits untill an interrupt occurs on the specified pin or if the value of pin is larger than 63, if any interrupt has occurred.
- Parameters
-
pin | The pin on which an interrupt should occur |
Definition at line 138 of file interrupt.c.
◆ verify_interrupt_request()
void verify_interrupt_request |
( |
const io_t |
pin | ) |
|
|
extern |
Checks for error in enabled pin. Terminates the process if the pin is not enabled.
- Parameters
-
pin | indicates a specific pin or if larger than 63, if any interrupt pin is enabled |
Definition at line 96 of file interrupt.c.