CMSIS-Driver_PIC32CM-PL  
Peripheral Library (PLIB) Documentation
 
Loading...
Searching...
No Matches
EIC Interface

Driver API for EIC (plib_eic.h) More...

Macros

#define EIC_NUM_EXTINT_LINES   EIC_EXTINT_NUM
 

Typedefs

typedef void(* EIC_NMI_CALLBACK_HANDLER) (void)
 NMI callback function type.
 
typedef void(* EIC_CALLBACK_HANDLER) (void)
 External interrupt callback function type.
 

Enumerations

enum  EIC_EXTINT_LINES {
  EIC_EXTINT_0 = 0 , EIC_EXTINT_1 = 1 , EIC_EXTINT_2 = 2 , EIC_EXTINT_3 = 3 ,
  EIC_EXTINT_4 = 4 , EIC_EXTINT_5 = 5 , EIC_EXTINT_6 = 6 , EIC_EXTINT_7 = 7 ,
  EIC_EXTINT_8 = 8 , EIC_EXTINT_9 = 9 , EIC_EXTINT_10 = 10 , EIC_EXTINT_11 = 11 ,
  EIC_EXTINT_12 = 12 , EIC_EXTINT_13 = 13 , EIC_EXTINT_14 = 14 , EIC_EXTINT_15 = 15
}
 External interrupt line. More...
 

Functions

void EIC_Enable (void)
 Enables the External Interrupt Controller (EIC).
 
void EIC_Disable (void)
 Disables the External Interrupt Controller (EIC).
 
void EIC_ResetSoftware (void)
 Performs a software reset of the External Interrupt Controller (EIC).
 
void EIC_SelectClock (uint32_t clk_sel)
 Selects the clock source for the EIC. EIC should be disabled before calling this function.
 
void EIC_ConfigureExtIntSense (EIC_EXTINT_LINES extint, uint32_t sense)
 Configures the sense type for a specific external interrupt line. EIC should be disabled before calling this function.
 
void EIC_EnableExtIntFilter (EIC_EXTINT_LINES extint)
 Enables the filter for a specific external interrupt line. EIC should be disabled before calling this function.
 
void EIC_DisableExtIntFilter (EIC_EXTINT_LINES extint)
 Disables the filter for a specific external interrupt line. EIC should be disabled before calling this function.
 
void EIC_EnableExtIntAsync (EIC_EXTINT_LINES extint)
 Enables asynchronous mode for a specific external interrupt line. EIC should be disabled before calling this function.
 
void EIC_DisableExtIntAsync (EIC_EXTINT_LINES extint)
 Disables asynchronous mode for a specific external interrupt line. EIC should be disabled before calling this function.
 
void EIC_EnableExtIntEventOutput (EIC_EXTINT_LINES extint)
 Enables event output for a specific external interrupt line. EIC should be disabled before calling this function.
 
void EIC_DisableExtIntEventOutput (EIC_EXTINT_LINES extint)
 Disables event output for a specific external interrupt line. EIC should be disabled before calling this function.
 
void EIC_EnableExtInt (EIC_EXTINT_LINES extint)
 Enables a specific external interrupt line.
 
void EIC_DisableExtInt (EIC_EXTINT_LINES extint)
 Disables a specific external interrupt line.
 
bool EIC_ExtIntLineHasInterrupt (EIC_EXTINT_LINES extint)
 Checks if a specific external interrupt line has triggered an interrupt.
 
void EIC_ClearExtIntFlag (EIC_EXTINT_LINES extint)
 Clears the interrupt flag for a specific external interrupt line.
 
void EIC_SetExtIntCallbackHandler (EIC_EXTINT_LINES extint_line, EIC_CALLBACK_HANDLER callback)
 Registers a callback function for a specific external interrupt line.
 
void EIC_ConfigureNMI (uint32_t sense, bool enable_filter, bool enable_async)
 Configures the Non-Maskable Interrupt (NMI) sense type and options.
 
void EIC_SetNMICallbackHandler (EIC_NMI_CALLBACK_HANDLER callback)
 Registers a callback function for the Non-Maskable Interrupt (NMI).
 

Description

Driver API for EIC (plib_eic.h)

Usage Example

The following example demonstrates typical usage of the EIC peripheral:

#include "plib_eic.h"
#include <stdint.h>
void Extint3_User_Callback(void)
{
//user operation(e.g., LED toggle, print message)
}
int32_t configure_eic_filter(void)
{
/* Disable EIC before making configuration changes */
/* Register callback handler for EXTINT3 */
EIC_SetExtIntCallbackHandler(EIC_EXTINT_3, &Extint3_User_Callback);
/* Select EIC clock source */
#if defined(EIC_CTRLA_CKSEL_CLK_OSC32K)
EIC_SelectClock(EIC_CTRLA_CKSEL_CLK_OSC32K);
#endif
#if defined(EIC_CTRLA_CKSEL_CLK_ULP32K)
EIC_SelectClock(EIC_CTRLA_CKSEL_CLK_ULP32K);
#endif
/* Configure EXTINT3 for rising edge detection */
EIC_ConfigureExtIntSense(EIC_EXTINT_3, EIC_CONFIG0_SENSE3_RISE_Val);
/* Enable input filter if debounce is not available */
/* Enable EXTINT3 interrupt */
/* Enable EIC after configuration */
return 0;
}
#if defined(EIC_DEBOUNCEN_Msk)
int32_t configure_eic_debounce(void)
{
/* Disable EIC before making configuration changes */
/* Register callback handler for EXTINT3 */
EIC_SetExtIntCallbackHandler(EIC_EXTINT_3, &Extint3_User_Callback);
/* Select EIC clock source */
EIC_SelectClock(EIC_CTRLA_CKSEL_CLK_ULP32K);
/* Configure EXTINT3 for rising edge detection */
EIC_ConfigureExtIntSense(EIC_EXTINT_3, EIC_CONFIG0_SENSE3_RISE_Val);
/* Disable input filter if debounce is used */
/* Enable debounce for EXTINT3 */
EIC_EnableDebounce(EIC_EXTINT_3);
/* Set debounce prescaler */
EIC_SetDebouncePrescaler(EIC_EXTINT_3, EIC_DPRESCALER_PRESCALER0_DIV8_Val);
/* Set debounce state */
EIC_SetDebounceStates(EIC_EXTINT_3, EIC_DPRESCALER_STATES0_LFREQ3_Val);
/* Select GCLK for debounce tick */
EIC_SetDebounceTickOn(EIC_CTRLA_CKSEL_CLK_GCLK_Val);
/* Enable EXTINT3 interrupt */
/* Enable EIC after configuration */
return 0;
}
#endif
void EIC_Disable(void)
Disables the External Interrupt Controller (EIC).
void EIC_DisableExtIntFilter(EIC_EXTINT_LINES extint)
Disables the filter for a specific external interrupt line. EIC should be disabled before calling thi...
void EIC_EnableExtInt(EIC_EXTINT_LINES extint)
Enables a specific external interrupt line.
void EIC_Enable(void)
Enables the External Interrupt Controller (EIC).
void EIC_EnableExtIntFilter(EIC_EXTINT_LINES extint)
Enables the filter for a specific external interrupt line. EIC should be disabled before calling this...
void EIC_SelectClock(uint32_t clk_sel)
Selects the clock source for the EIC. EIC should be disabled before calling this function.
void EIC_SetExtIntCallbackHandler(EIC_EXTINT_LINES extint_line, EIC_CALLBACK_HANDLER callback)
Registers a callback function for a specific external interrupt line.
void EIC_ConfigureExtIntSense(EIC_EXTINT_LINES extint, uint32_t sense)
Configures the sense type for a specific external interrupt line. EIC should be disabled before calli...
@ EIC_EXTINT_3
Definition plib_eic.h:67

Macro Definition Documentation

◆ EIC_NUM_EXTINT_LINES

#define EIC_NUM_EXTINT_LINES   EIC_EXTINT_NUM

Typedef Documentation

◆ EIC_CALLBACK_HANDLER

EIC_CALLBACK_HANDLER

External interrupt callback function type.

◆ EIC_NMI_CALLBACK_HANDLER

EIC_NMI_CALLBACK_HANDLER

NMI callback function type.

Enumeration Type Documentation

◆ EIC_EXTINT_LINES

External interrupt line.

Enumerator
EIC_EXTINT_0 

External interrupt line 0

EIC_EXTINT_1 

External interrupt line 1

EIC_EXTINT_2 

External interrupt line 2

EIC_EXTINT_3 

External interrupt line 3

EIC_EXTINT_4 

External interrupt line 4

EIC_EXTINT_5 

External interrupt line 5

EIC_EXTINT_6 

External interrupt line 6

EIC_EXTINT_7 

External interrupt line 7

EIC_EXTINT_8 

External interrupt line 8

EIC_EXTINT_9 

External interrupt line 9

EIC_EXTINT_10 

External interrupt line 10

EIC_EXTINT_11 

External interrupt line 11

EIC_EXTINT_12 

External interrupt line 12

EIC_EXTINT_13 

External interrupt line 13

EIC_EXTINT_14 

External interrupt line 14

EIC_EXTINT_15 

External interrupt line 15

Function Documentation

◆ EIC_ClearExtIntFlag()

void EIC_ClearExtIntFlag ( EIC_EXTINT_LINES extint)

Clears the interrupt flag for a specific external interrupt line.

Parameters
extintThe external interrupt line to clear the flag for.
Returns
None.

◆ EIC_ConfigureExtIntSense()

void EIC_ConfigureExtIntSense ( EIC_EXTINT_LINES extint,
uint32_t sense )

Configures the sense type for a specific external interrupt line. EIC should be disabled before calling this function.

Parameters
extintThe external interrupt line to configure.
senseThe sense type to set (e.g., rising edge, falling edge).
Returns
None.

◆ EIC_ConfigureNMI()

void EIC_ConfigureNMI ( uint32_t sense,
bool enable_filter,
bool enable_async )

Configures the Non-Maskable Interrupt (NMI) sense type and options.

Parameters
senseThe sense type to set for NMI.
enable_filterEnable or disable the filter for NMI.
enable_asyncEnable or disable asynchronous mode for NMI.
Returns
None.

◆ EIC_Disable()

void EIC_Disable ( void )

Disables the External Interrupt Controller (EIC).

Parameters
None.
Returns
None.

◆ EIC_DisableExtInt()

void EIC_DisableExtInt ( EIC_EXTINT_LINES extint)

Disables a specific external interrupt line.

Parameters
extintThe external interrupt line to disable.
Returns
None.

◆ EIC_DisableExtIntAsync()

void EIC_DisableExtIntAsync ( EIC_EXTINT_LINES extint)

Disables asynchronous mode for a specific external interrupt line. EIC should be disabled before calling this function.

Parameters
extintThe external interrupt line to disable asynchronous mode for.
Returns
None.

◆ EIC_DisableExtIntEventOutput()

void EIC_DisableExtIntEventOutput ( EIC_EXTINT_LINES extint)

Disables event output for a specific external interrupt line. EIC should be disabled before calling this function.

Parameters
extintThe external interrupt line to disable event output for.
Returns
None.

◆ EIC_DisableExtIntFilter()

void EIC_DisableExtIntFilter ( EIC_EXTINT_LINES extint)

Disables the filter for a specific external interrupt line. EIC should be disabled before calling this function.

Parameters
extintThe external interrupt line to disable the filter for.
Returns
None.

◆ EIC_Enable()

void EIC_Enable ( void )

Enables the External Interrupt Controller (EIC).

Parameters
None.
Returns
None.

◆ EIC_EnableExtInt()

void EIC_EnableExtInt ( EIC_EXTINT_LINES extint)

Enables a specific external interrupt line.

Parameters
extintThe external interrupt line to enable.
Returns
None.

◆ EIC_EnableExtIntAsync()

void EIC_EnableExtIntAsync ( EIC_EXTINT_LINES extint)

Enables asynchronous mode for a specific external interrupt line. EIC should be disabled before calling this function.

Parameters
extintThe external interrupt line to enable asynchronous mode for.
Returns
None.

◆ EIC_EnableExtIntEventOutput()

void EIC_EnableExtIntEventOutput ( EIC_EXTINT_LINES extint)

Enables event output for a specific external interrupt line. EIC should be disabled before calling this function.

Parameters
extintThe external interrupt line to enable event output for.
Returns
None.

◆ EIC_EnableExtIntFilter()

void EIC_EnableExtIntFilter ( EIC_EXTINT_LINES extint)

Enables the filter for a specific external interrupt line. EIC should be disabled before calling this function.

Parameters
extintThe external interrupt line to enable the filter for.
Returns
None.

◆ EIC_ExtIntLineHasInterrupt()

bool EIC_ExtIntLineHasInterrupt ( EIC_EXTINT_LINES extint)

Checks if a specific external interrupt line has triggered an interrupt.

Parameters
extintThe external interrupt line to check.
Returns
true if the interrupt line has triggered, false otherwise.

◆ EIC_ResetSoftware()

void EIC_ResetSoftware ( void )

Performs a software reset of the External Interrupt Controller (EIC).

Parameters
None.
Returns
None.

◆ EIC_SelectClock()

void EIC_SelectClock ( uint32_t clk_sel)

Selects the clock source for the EIC. EIC should be disabled before calling this function.

Parameters
clk_selThe clock source to select.
Returns
None.

◆ EIC_SetExtIntCallbackHandler()

void EIC_SetExtIntCallbackHandler ( EIC_EXTINT_LINES extint_line,
EIC_CALLBACK_HANDLER callback )

Registers a callback function for a specific external interrupt line.

Parameters
extint_lineThe external interrupt line to register the callback for.
callbackThe callback function to register.
Returns
None.

◆ EIC_SetNMICallbackHandler()

void EIC_SetNMICallbackHandler ( EIC_NMI_CALLBACK_HANDLER callback)

Registers a callback function for the Non-Maskable Interrupt (NMI).

Parameters
callbackThe callback function to register for NMI.
Returns
None.