RA Flexible Software Package Documentation  Release v5.4.0

 
External IRQ Interface

Detailed Description

Interface for detecting external interrupts.

Summary

The External IRQ Interface is for configuring interrupts to fire when a trigger condition is detected on an external IRQ pin.

Data Structures

struct  external_irq_callback_args_t
 
struct  external_irq_cfg_t
 
struct  external_irq_api_t
 
struct  external_irq_instance_t
 

Typedefs

typedef void external_irq_ctrl_t
 

Enumerations

enum  external_irq_trigger_t
 
enum  external_irq_clock_source_div_t
 

Data Structure Documentation

◆ external_irq_callback_args_t

struct external_irq_callback_args_t

Callback function parameter data

Data Fields
void const * p_context

Placeholder for user data. Set in external_irq_api_t::open function in external_irq_cfg_t.

uint32_t channel The physical hardware channel that caused the interrupt.

◆ external_irq_cfg_t

struct external_irq_cfg_t

User configuration structure, used in open function

Data Fields

uint8_t channel
 Hardware channel used.
 
uint8_t ipl
 Interrupt priority.
 
IRQn_Type irq
 Interrupt number assigned to this instance.
 
external_irq_trigger_t trigger
 Trigger setting.
 
external_irq_clock_source_div_t clock_source_div
 Digital filter clock divisor setting.
 
bool filter_enable
 Digital filter enable/disable setting.
 
void(* p_callback )(external_irq_callback_args_t *p_args)
 
void const * p_context
 
void const * p_extend
 External IRQ hardware dependent configuration.
 

Field Documentation

◆ p_callback

void(* external_irq_cfg_t::p_callback) (external_irq_callback_args_t *p_args)

Callback provided external input trigger occurs.

◆ p_context

void const* external_irq_cfg_t::p_context

Placeholder for user data. Passed to the user callback in external_irq_callback_args_t.

◆ external_irq_api_t

struct external_irq_api_t

External interrupt driver structure. External interrupt functions implemented at the HAL layer will follow this API.

Data Fields

fsp_err_t(* open )(external_irq_ctrl_t *const p_ctrl, external_irq_cfg_t const *const p_cfg)
 
fsp_err_t(* enable )(external_irq_ctrl_t *const p_ctrl)
 
fsp_err_t(* disable )(external_irq_ctrl_t *const p_ctrl)
 
fsp_err_t(* callbackSet )(external_irq_ctrl_t *const p_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(* close )(external_irq_ctrl_t *const p_ctrl)
 

Field Documentation

◆ open

fsp_err_t(* external_irq_api_t::open) (external_irq_ctrl_t *const p_ctrl, external_irq_cfg_t const *const p_cfg)

Initial configuration.

Parameters
[out]p_ctrlPointer to control block. Must be declared by user. Value set here.
[in]p_cfgPointer to configuration structure. All elements of the structure must be set by user.

◆ enable

fsp_err_t(* external_irq_api_t::enable) (external_irq_ctrl_t *const p_ctrl)

Enable callback when an external trigger condition occurs.

Parameters
[in]p_ctrlControl block set in Open call for this external interrupt.

◆ disable

fsp_err_t(* external_irq_api_t::disable) (external_irq_ctrl_t *const p_ctrl)

Disable callback when external trigger condition occurs.

Parameters
[in]p_ctrlControl block set in Open call for this external interrupt.

◆ callbackSet

fsp_err_t(* external_irq_api_t::callbackSet) (external_irq_ctrl_t *const p_ctrl, void(*p_callback)(external_irq_callback_args_t *), void const *const p_context, external_irq_callback_args_t *const p_callback_memory)

Specify callback function and optional context pointer and working memory pointer.

Parameters
[in]p_ctrlPointer to the External IRQ control block.
[in]p_callbackCallback function
[in]p_contextPointer to send to callback function
[in]p_working_memoryPointer to volatile memory where callback structure can be allocated. Callback arguments allocated here are only valid during the callback.

◆ close

fsp_err_t(* external_irq_api_t::close) (external_irq_ctrl_t *const p_ctrl)

Allow driver to be reconfigured. May reduce power consumption.

Parameters
[in]p_ctrlControl block set in Open call for this external interrupt.

◆ external_irq_instance_t

struct external_irq_instance_t

This structure encompasses everything that is needed to use an instance of this interface.

Data Fields
external_irq_ctrl_t * p_ctrl Pointer to the control structure for this instance.
external_irq_cfg_t const * p_cfg Pointer to the configuration structure for this instance.
external_irq_api_t const * p_api Pointer to the API structure for this instance.

Typedef Documentation

◆ external_irq_ctrl_t

typedef void external_irq_ctrl_t

External IRQ control block. Allocate an instance specific control block to pass into the external IRQ API calls.

Enumeration Type Documentation

◆ external_irq_trigger_t

Condition that will trigger an interrupt when detected.

Enumerator
EXTERNAL_IRQ_TRIG_FALLING 

Falling edge trigger.

EXTERNAL_IRQ_TRIG_RISING 

Rising edge trigger.

EXTERNAL_IRQ_TRIG_BOTH_EDGE 

Both edges trigger.

EXTERNAL_IRQ_TRIG_LEVEL_LOW 

Low level trigger.

EXTERNAL_IRQ_TRIG_LEVEL_HIGH 

High level trigger.

◆ external_irq_clock_source_div_t

External IRQ input pin digital filtering sample clock divisor settings. The digital filter rejects trigger conditions that are shorter than 3 periods of the filter clock.

Enumerator
EXTERNAL_IRQ_CLOCK_SOURCE_DIV_1 

Filter using clock source divided by 1.

EXTERNAL_IRQ_CLOCK_SOURCE_DIV_8 

Filter using clock source divided by 8.

EXTERNAL_IRQ_CLOCK_SOURCE_DIV_32 

Filter using clock source divided by 32.

EXTERNAL_IRQ_CLOCK_SOURCE_DIV_64 

Filter using clock source divided by 64.