PDL for FM0+  Version1.0
Peripheral Driverl Library for FM0+
External Interrupts (EXINT)

Defines

#define EXINT_CHANNEL_NUM   (8u)
#define EXINT_MAX_CH_INDEX   (31u)

Typedefs

typedef enum en_exint_level en_exint_level_t
typedef enum
en_exint_instance_index 
en_exint_instance_index_t
 Enumeration to define an index for each enabled EXINT instance.

Enumerations

enum  en_exint_level { ExIntLowLevel = 0, ExIntHighLevel = 1, ExIntRisingEdge = 2, ExIntFallingEdge = 3 }
enum  en_exint_instance_index {
  ExintInstanceIndexExint0, ExintInstanceIndexExint1, ExintInstanceIndexExint2, ExintInstanceIndexExint3,
  ExintInstanceIndexExint4, ExintInstanceIndexExint5, ExintInstanceIndexExint6, ExintInstanceIndexExint7,
  ExintInstanceIndexExint8, ExintInstanceIndexExint9, ExintInstanceIndexExint10, ExintInstanceIndexExint11,
  ExintInstanceIndexExint12, ExintInstanceIndexExint13, ExintInstanceIndexExint14, ExintInstanceIndexExint15,
  ExintInstanceIndexExint16, ExintInstanceIndexExint17, ExintInstanceIndexExint18, ExintInstanceIndexExint19,
  ExintInstanceIndexExint20, ExintInstanceIndexExint21, ExintInstanceIndexExint22, ExintInstanceIndexExint23,
  ExintInstanceIndexExint24, ExintInstanceIndexExint25, ExintInstanceIndexExint26, ExintInstanceIndexExint27,
  ExintInstanceIndexExint28, ExintInstanceIndexExint29, ExintInstanceIndexExint30, ExintInstanceIndexExint31,
  ExintInstanceIndexMax
}
 Enumeration to define an index for each enabled EXINT instance. More...

Functions

void Exint_IrqHandler (uint8_t u8Channel)
 Interrupt handlers for External interrupts.
en_result_t Exint_Enable (uint8_t u8Ch, func_ptr_t pfnIntCb)
 Enable external interrupt.
en_result_t Exint_Disable (uint8_t u8Ch)
 Dsiable external interrupt.
en_result_t Exint_SetIntDetectMode (uint8_t u8Ch, en_exint_level_t enLevel)
 Set external interrupt detect mode.
en_exint_level_t Exint_GetIntDetectMode (uint8_t u8Ch)
 Get the external interrupt detection mode.
void Nmi_IrqHandler (void)
 Interrupt handler for None-Maskable Interrupt (NMI)
en_result_t Exint_Nmi_SetIntCallback (func_ptr_t pfnIntCb)
 Set the interrupt callback function of NMI.

Variables

func_ptr_t pfnNMICallback
 NMI Callback pointer.
func_ptr_t apfnExintCallback [(8u)]

Detailed Description

Provided functions of EXINT module:

Exint_Enable() starts external interrupt detection and Exint_Disable() stops external interrupt detection.

Exint_SetIntDetectMode() sets the detection level of external interrupt.

Exint_GetIntDetectMode() gets the detection level of external interrupt.

Exint_IrqHandler() is external interrupt IRQ handler, which is called in the interrupts.c


Define Documentation

#define EXINT_CHANNEL_NUM   (8u)

Definition at line 95 of file exint.h.

#define EXINT_MAX_CH_INDEX   (31u)

Definition at line 96 of file exint.h.

Referenced by Exint_Disable(), Exint_Enable(), and Exint_SetIntDetectMode().


Typedef Documentation

Enumeration to define an index for each enabled EXINT instance.


Enumeration Type Documentation

Enumeration to define an index for each enabled EXINT instance.

Enumerator:
ExintInstanceIndexExint0 
ExintInstanceIndexExint1 
ExintInstanceIndexExint2 
ExintInstanceIndexExint3 
ExintInstanceIndexExint4 
ExintInstanceIndexExint5 
ExintInstanceIndexExint6 
ExintInstanceIndexExint7 
ExintInstanceIndexExint8 
ExintInstanceIndexExint9 
ExintInstanceIndexExint10 
ExintInstanceIndexExint11 
ExintInstanceIndexExint12 
ExintInstanceIndexExint13 
ExintInstanceIndexExint14 
ExintInstanceIndexExint15 
ExintInstanceIndexExint16 
ExintInstanceIndexExint17 
ExintInstanceIndexExint18 
ExintInstanceIndexExint19 
ExintInstanceIndexExint20 
ExintInstanceIndexExint21 
ExintInstanceIndexExint22 
ExintInstanceIndexExint23 
ExintInstanceIndexExint24 
ExintInstanceIndexExint25 
ExintInstanceIndexExint26 
ExintInstanceIndexExint27 
ExintInstanceIndexExint28 
ExintInstanceIndexExint29 
ExintInstanceIndexExint30 
ExintInstanceIndexExint31 
ExintInstanceIndexMax 

Definition at line 111 of file exint.h.

Enumerator:
ExIntLowLevel 

"L" level detection

ExIntHighLevel 

"H" level detection

ExIntRisingEdge 

Rising edge detection.

ExIntFallingEdge 

Falling edge detection.

Definition at line 102 of file exint.h.


Function Documentation

en_result_t Exint_Disable ( uint8_t  u8Ch)

Dsiable external interrupt.

Parameters:
u8Ch0~31
Return values:
OkInterreupt disabled normally
ErrorInvalidParameteru8Ch > EXINT_MAX_CH_INDEX

Definition at line 172 of file exint.c.

References apfnExintCallback, ErrorInvalidParameter, EXINT_MAX_CH_INDEX, Ok, and PDL_DEFAULT_INTERRUPT_LEVEL.

en_result_t Exint_Enable ( uint8_t  u8Ch,
func_ptr_t  pfnIntCb 
)

Enable external interrupt.

Parameters:
u8Ch0~31
pfnIntCbInterrupt callback function

Definition at line 133 of file exint.c.

References apfnExintCallback, ErrorInvalidParameter, EXINT_MAX_CH_INDEX, Ok, and PDL_IRQ_LEVEL_EXINT0_7.

Get the external interrupt detection mode.

Parameters:
u8Ch0~31
Return values:
ExIntLowLevelLow level is active edge for interrupt detection
ExIntHighLevelHigh level is active edge for interrupt detection
ExIntRisingEdgeRising edge is active edge for interrupt detection
ExIntFallingEdgeFalling edge is active edge for interrupt detection

Definition at line 253 of file exint.c.

void Exint_IrqHandler ( uint8_t  u8Channel)

Interrupt handlers for External interrupts.

This function clears the cause bit and calls the callback function

Definition at line 113 of file exint.c.

References apfnExintCallback.

Referenced by INT0_7_Handler(), and INT8_31_Handler().

Here is the caller graph for this function:

Set the interrupt callback function of NMI.

Parameters:
pfnIntCbpointer to interrupt callback function
Return values:
OkNMI callback function set normally
ErrorInvalidParameterpfnIntCb == NULL

Definition at line 296 of file exint.c.

References ErrorInvalidParameter, Ok, and pfnNMICallback.

en_result_t Exint_SetIntDetectMode ( uint8_t  u8Ch,
en_exint_level_t  enLevel 
)

Set external interrupt detect mode.

Parameters:
u8Ch0~31
enLevelExternal interrupt active level
  • ExIntLowLevel Low level is active edge for interrupt detection
  • ExIntHighLevel High level is active edge for interrupt detection
  • ExIntRisingEdge Rising edge is active edge for interrupt detection
  • ExIntFallingEdge Falling edge is active edge for interrupt detection
Return values:
OkInterrupt detection edge set normmally
ErrorInvalidParameteru8Ch > EXINT_MAX_CH_INDEX invalid setting for enLevel

Definition at line 217 of file exint.c.

References ErrorInvalidParameter, EXINT_MAX_CH_INDEX, ExIntFallingEdge, ExIntHighLevel, ExIntLowLevel, ExIntRisingEdge, and Ok.

void Nmi_IrqHandler ( void  )

Interrupt handler for None-Maskable Interrupt (NMI)

This function clears the cause bit and calls the NMI callback function, if specified.

Definition at line 271 of file exint.c.

References pfnNMICallback.

Referenced by NMI_Handler().

Here is the caller graph for this function:


Variable Documentation

Initial value:
 
{
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
}

Definition at line 79 of file exint.c.

Referenced by Exint_Disable(), Exint_Enable(), and Exint_IrqHandler().

NMI Callback pointer.

External interrupts callback pointer array

Definition at line 74 of file exint.c.

Referenced by Exint_Nmi_SetIntCallback(), and Nmi_IrqHandler().