RA Flexible Software Package Documentation
Release v5.6.0
|
|
Functions | |
fsp_err_t | R_ICU_ExternalIrqOpen (external_irq_ctrl_t *const p_api_ctrl, external_irq_cfg_t const *const p_cfg) |
fsp_err_t | R_ICU_ExternalIrqEnable (external_irq_ctrl_t *const p_api_ctrl) |
fsp_err_t | R_ICU_ExternalIrqDisable (external_irq_ctrl_t *const p_api_ctrl) |
fsp_err_t | R_ICU_ExternalIrqCallbackSet (external_irq_ctrl_t *const p_api_ctrl, void(*p_callback)(external_irq_callback_args_t *), void const *const p_context, external_irq_callback_args_t *const p_callback_memory) |
fsp_err_t | R_ICU_ExternalIrqClose (external_irq_ctrl_t *const p_api_ctrl) |
Driver for the ICU peripheral on RA MCUs. This module implements the External IRQ Interface.
The Interrupt Controller Unit (ICU) controls which event signals are linked to the NVIC, DTC, and DMAC modules. The R_ICU software module only implements the External IRQ Interface. The external_irq interface is for configuring interrupts to fire when a trigger condition is detected on an external IRQ pin.
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Configuration | Options | Default | Description |
---|---|---|---|
Name | Name must be a valid C symbol | g_external_irq0 | Module name. |
Channel | Value must be a non-negative integer | 0 | Specify the hardware channel. |
Trigger | MCU Specific Options | Select the signal edge or state that triggers an interrupt. | |
Digital Filtering | MCU Specific Options | Select if the digital noise filter should be enabled. | |
Digital Filtering Sample Clock (Only valid when Digital Filtering is Enabled) | MCU Specific Options | Select the clock divider for the digital noise filter. | |
Callback | Name must be a valid C symbol | NULL | A user callback function can be provided here. If this callback function is provided, it is called from the interrupt service routine (ISR) each time the IRQn triggers |
Pin Interrupt Priority | MCU Specific Options | Select the PIN interrupt priority. |
The ICU peripheral module doesn't require any specific clock settings.
The pin for the external interrupt channel must be configured as an input with IRQ Input Enabled.
Pin configuration does not show conflicts when same IRQ is used by multiple pins.
The digital filter is used to reject trigger conditions that are too short. The trigger condition must be longer than three periods of the filter clock. The filter clock frequency is determined by PCLKB and the external_irq_pclk_div_t setting.
MIN_PULSE_WIDTH = EXTERNAL_IRQ_PCLKB_DIV / PCLKB_FREQUENCY * 3
When using an External IRQ pin to trigger a DMAC/DTC transfer, the External IRQ pin must be opened before the transfer instance is opened.
This is a basic example of minimal use of the ICU in an application.
Data Structures | |
struct | icu_instance_ctrl_t |
struct icu_instance_ctrl_t |
ICU private control block. DO NOT MODIFY. Initialization occurs when R_ICU_ExternalIrqOpen is called.
Data Fields | |
uint32_t | open |
Used to determine if channel control block is in use. | |
IRQn_Type | irq |
NVIC interrupt number. | |
uint8_t | channel |
Channel. | |
void const * | p_context |
void const* icu_instance_ctrl_t::p_context |
Placeholder for user data. Passed to the user callback in external_irq_callback_args_t.
fsp_err_t R_ICU_ExternalIrqOpen | ( | external_irq_ctrl_t *const | p_api_ctrl, |
external_irq_cfg_t const *const | p_cfg | ||
) |
Configure an IRQ input pin for use with the external interrupt interface. Implements external_irq_api_t::open.
The Open function is responsible for preparing an external IRQ pin for operation.
FSP_SUCCESS | Open successful. |
FSP_ERR_ASSERTION | One of the following is invalid:
|
FSP_ERR_ALREADY_OPEN | The channel specified has already been opened. No configurations were changed. Call the associated Close function to reconfigure the channel. |
FSP_ERR_IP_CHANNEL_NOT_PRESENT | The channel requested in p_cfg is not available on the device selected in r_bsp_cfg.h. |
FSP_ERR_INVALID_ARGUMENT | p_cfg->p_callback is not NULL, but ISR is not enabled. ISR must be enabled to use callback function. |
FSP_ERR_UNSUPPORTED | An input argument is not supported by selected mode. |
fsp_err_t R_ICU_ExternalIrqEnable | ( | external_irq_ctrl_t *const | p_api_ctrl | ) |
Enable external interrupt for specified channel at NVIC. Implements external_irq_api_t::enable.
FSP_SUCCESS | Interrupt Enabled successfully. |
FSP_ERR_ASSERTION | The p_ctrl parameter was null. |
FSP_ERR_NOT_OPEN | The channel is not opened. |
FSP_ERR_IRQ_BSP_DISABLED | Requested IRQ is not defined in this system |
fsp_err_t R_ICU_ExternalIrqDisable | ( | external_irq_ctrl_t *const | p_api_ctrl | ) |
Disable external interrupt for specified channel at NVIC. Implements external_irq_api_t::disable.
FSP_SUCCESS | Interrupt disabled successfully. |
FSP_ERR_ASSERTION | The p_ctrl parameter was null. |
FSP_ERR_NOT_OPEN | The channel is not opened. |
FSP_ERR_IRQ_BSP_DISABLED | Requested IRQ is not defined in this system |
fsp_err_t R_ICU_ExternalIrqCallbackSet | ( | external_irq_ctrl_t *const | p_api_ctrl, |
void(*)(external_irq_callback_args_t *) | p_callback, | ||
void const *const | p_context, | ||
external_irq_callback_args_t *const | p_callback_memory | ||
) |
Updates the user callback and has option of providing memory for callback structure. Implements external_irq_api_t::callbackSet
FSP_SUCCESS | Callback updated successfully. |
FSP_ERR_ASSERTION | A required pointer is NULL. |
FSP_ERR_NOT_OPEN | The control block has not been opened. |
FSP_ERR_NO_CALLBACK_MEMORY | p_callback is non-secure and p_callback_memory is either secure or NULL. |
fsp_err_t R_ICU_ExternalIrqClose | ( | external_irq_ctrl_t *const | p_api_ctrl | ) |
Close the external interrupt channel. Implements external_irq_api_t::close.
FSP_SUCCESS | Successfully closed. |
FSP_ERR_ASSERTION | The parameter p_ctrl is NULL. |
FSP_ERR_NOT_OPEN | The channel is not opened. |