This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration and management of the on-chip General-Purpose Input/Output (GPIO) controller with both interrupt and event support.
Devices from the following series can use this module:
The outline of this documentation is as follows:
The GPIO module depends on the following modules:
The General Purpose Input/Output Controller (GPIO) controls the I/O pins of the microcontroller. Each GPIO pin may be used as a general-purpose I/O or be assigned to a function of an embedded peripheral.
The GPIO is configured using the Peripheral Bus (PB).
There are no special considerations for this module.
For extra information, see Extra Information for GPIO. This includes:
For a list of examples related to this driver, see Examples for GPIO.
Modules | |
Related Project(s) | |
In this section you can find all the projects related to the SAM4L General-Purpose Input/Output (GPIO) Driver. | |
Quick Start Guide(s) | |
In this section you can find a list of all Quick Start guides related to the SAM4L General-Purpose Input/Output (GPIO) Driver. | |
Typedefs | |
typedef void(* | gpio_pin_callback_t )(void) |
Interrupt callback function type for a GPIO pin. More... | |
Interrupt Support | |
The GPIO can be configured to generate an interrupt when it detects a change on a GPIO pin. | |
bool | gpio_set_pin_callback (ioport_pin_t pin, gpio_pin_callback_t callback, uint8_t irq_level) |
Set callback for given GPIO pin. More... | |
static void | gpio_enable_pin_interrupt (ioport_pin_t pin) |
Enable the interrupt of a pin. More... | |
static void | gpio_disable_pin_interrupt (ioport_pin_t pin) |
Disable the interrupt of a pin. More... | |
static uint32_t | gpio_get_pin_interrupt_flag (ioport_pin_t pin) |
Get the interrupt flag of a pin. More... | |
static void | gpio_clear_pin_interrupt_flag (ioport_pin_t pin) |
Clear the interrupt flag of a pin. More... | |
Peripheral Event System Support | |
The GPIO can be programmed to output peripheral events whenever an interrupt condition is detected, such as pin value change, or only when a rising or falling edge is detected. | |
static void | gpio_enable_pin_periph_event (ioport_pin_t pin) |
Enable the peripheral event generation of a pin. More... | |
static void | gpio_disable_pin_periph_event (ioport_pin_t pin) |
Disable the peripheral event generation of a pin. More... | |
typedef void(* gpio_pin_callback_t)(void) |
Interrupt callback function type for a GPIO pin.
The interrupt handler can be configured to do a function callback, the callback function must match the gpio_pin_callback_t type.
|
inlinestatic |
Clear the interrupt flag of a pin.
[in] | pin | The pin number |
References ioport_pin_to_mask(), and ioport_pin_to_port_id().
|
inlinestatic |
Disable the interrupt of a pin.
[in] | pin | The pin number |
References ioport_pin_to_mask(), and ioport_pin_to_port_id().
Referenced by io_pad_init().
|
inlinestatic |
Disable the peripheral event generation of a pin.
[in] | pin | The pin number |
References ioport_pin_to_mask(), and ioport_pin_to_port_id().
|
inlinestatic |
Enable the interrupt of a pin.
[in] | pin | The pin number |
References ioport_pin_to_mask(), and ioport_pin_to_port_id().
Referenced by io_pad_init(), main(), and run_gpio_int_test().
|
inlinestatic |
Enable the peripheral event generation of a pin.
[in] | pin | The pin number |
References ioport_pin_to_mask(), and ioport_pin_to_port_id().
Referenced by main().
|
inlinestatic |
Get the interrupt flag of a pin.
[in] | pin | The pin number |
uint32_t | The pin interrupt flag (0/1) |
References ioport_pin_to_mask(), and ioport_pin_to_port_id().
bool gpio_set_pin_callback | ( | ioport_pin_t | pin, |
gpio_pin_callback_t | callback, | ||
uint8_t | irq_level | ||
) |
Set callback for given GPIO pin.
[in] | pin | The pin number |
[in] | callback | callback function pointer |
[in] | irq_level | interrupt level |
true | Set successfully |
false | Wrong parameters or maximum number of interrupt sources has been exceeding |
References gpio_interrupt_source::callback, callback, GPIO_INT_GROUP_MASK, gpio_int_sources, GPIO_MAX_INTERRUPT_SOURCES, gpio_nb_sources, ioport_pin_to_mask(), ioport_pin_to_port_id(), and gpio_interrupt_source::pin.
Referenced by io_pad_init(), main(), and run_gpio_int_test().