3.8 External Interrupt Driver

Overview

Interrupt gets generated on an external event like a positive edge or a negative edge pulse on a selected input pin, these interrupts are named as INT0, INT1 and so on.

Features

  • Selecting the input pin for external interrupt enables the user to configure the edge detect type i,e either positive or negative edge event for which the interrupt gets triggered.
  • Custom name can be added for each external interrupt.

3.8.1 Module Documentation

3.8.1.1 External Interrupt Driver

External Interrupt Driver is used to configure the dedicated INTx pin to interrupt on negative or positive edge using dsPIC MCUs.

3.8.1.1.1 Module description

External Interrupt Driver is used to configure the dedicated INTx pin to interrupt on negative or positive edge using dsPIC MCUs.

Data structures
Definitions
Enumerations
  • enum EXT_INT { INT0, INT2, INT3, INT4 }

    Defines the list of custom names for the External Interrupt Pins selected in MCC Melody user interface.

Functions
  • void EXT_INT_Initialize (void)

    Initializes EXT_INT module.

  • void EXT_INT_Deinitialize (void)

    Deinitializes the EXT_INT to POR values.

  • void EXT_INT_PositiveEdgeSet (enum EXT_INT interruptNum)

    Sets the external interrupt to positive edge detect.

  • void EXT_INT_NegativeEdgeSet (enum EXT_INT interruptNum)

    Sets the external interrupt to negative edge detect.

  • void EXT_INT_InterruptEnable (enum EXT_INT interruptNum)

    Enable the external interrupt for pins.

  • void EXT_INT_InterruptDisable (enum EXT_INT interruptNum)

    Disable the external interrupt for pins.

  • void EXT_INT_InterruptFlagClear (enum EXT_INT interruptNum)

    Clear the external interrupt flag for pins.

  • void EXT_INT_CallbackRegister (enum EXT_INT interruptNum, void(*handler)(void))

    This function can be used to override default callback and to define custom callback for EXT_INT event.

  • void EXT_INT0_Callback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using EXT_INT_CallbackRegister.

  • void EXT_INT2_Callback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using EXT_INT_CallbackRegister.

  • void EXT_INT3_Callback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using EXT_INT_CallbackRegister.

  • void EXT_INT4_Callback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using EXT_INT_CallbackRegister.

Variables
  • const struct EXT_INTERRUPT_INTERFACE External_Interrupt

    Structure object of type EXT_INTERRUPT_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. External_Interrupt can be changed by the user in the EXT_INTERRUPT user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

3.8.1.1.2 Definition Documentation

External_Interrupt_CallbackRegister

#define External_Interrupt_CallbackRegister EXT_INT_CallbackRegister

This macro defines the Custom Name for EXT_INT_CallbackRegister API.

External_Interrupt_Deinitialize

#define External_Interrupt_Deinitialize EXT_INT_Deinitialize

This macro defines the Custom Name for EXT_INT_Deinitialize API.

External_Interrupt_Initialize

#define External_Interrupt_Initialize EXT_INT_Initialize

This macro defines the Custom Name for EXT_INT_Initialize API.

External_Interrupt_InterruptDisable

#define External_Interrupt_InterruptDisable EXT_INT_InterruptDisable

This macro defines the Custom Name for EXT_INT_InterruptDisable API.

External_Interrupt_InterruptEnable

#define External_Interrupt_InterruptEnable EXT_INT_InterruptEnable

This macro defines the Custom Name for EXT_INT_InterruptEnable API.

External_Interrupt_InterruptFlagClear

#define External_Interrupt_InterruptFlagClear EXT_INT_InterruptFlagClear

This macro defines the Custom Name for EXT_INT_InterruptFlagClear API.

External_Interrupt_NegativeEdgeSet

#define External_Interrupt_NegativeEdgeSet EXT_INT_NegativeEdgeSet

This macro defines the Custom Name for EXT_INT_NegativeEdgeSet API.

External_Interrupt_PositiveEdgeSet

#define External_Interrupt_PositiveEdgeSet EXT_INT_PositiveEdgeSet

This macro defines the Custom Name for EXT_INT_PositiveEdgeSet API.

3.8.1.1.3 Function Documentation

EXT_INT0_Callback()

void EXT_INT0_Callback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using EXT_INT_CallbackRegister.

Precondition:

EXT_INT_Initialize() must be called for the associated function to work.

Parameters:
none
Returns:

none  

EXT_INT2_Callback()

void EXT_INT2_Callback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using EXT_INT_CallbackRegister.

Precondition:

EXT_INT_Initialize() must be called for the associated function to work.

Parameters:
none
Returns:

none  

EXT_INT3_Callback()

void EXT_INT3_Callback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using EXT_INT_CallbackRegister.

Precondition:

EXT_INT_Initialize() must be called for the associated function to work.

Parameters:
none
Returns:

none  

EXT_INT4_Callback()

void EXT_INT4_Callback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using EXT_INT_CallbackRegister.

Precondition:

EXT_INT_Initialize() must be called for the associated function to work.

Parameters:
none
Returns:

none  

EXT_INT_CallbackRegister()

void EXT_INT_CallbackRegister (enum EXT_INT interruptNum, void(*)(void) handler)

This function can be used to override default callback and to define custom callback for EXT_INT event.

Precondition:

EXT_INT_Initialize() must be called for the associated function to work.

Parameters:
in interruptNum

- External interrupt number

in handler

- Address of the callback function

Returns:

none  

EXT_INT_Deinitialize()

void EXT_INT_Deinitialize (void )

Deinitializes the EXT_INT to POR values.

Parameters:
none
Returns:

none  

EXT_INT_Initialize()

void EXT_INT_Initialize (void )

Initializes EXT_INT module.

Parameters:
none
Returns:

none  

EXT_INT_InterruptDisable()

void EXT_INT_InterruptDisable (enum EXT_INT interruptNum)

Disable the external interrupt for pins.

Parameters:
in interruptNum

- External interrupt number

Returns:

none  

EXT_INT_InterruptEnable()

void EXT_INT_InterruptEnable (enum EXT_INT interruptNum)

Enable the external interrupt for pins.

Parameters:
in interruptNum

- External interrupt number

Returns:

none  

EXT_INT_InterruptFlagClear()

void EXT_INT_InterruptFlagClear (enum EXT_INT interruptNum)

Clear the external interrupt flag for pins.

Parameters:
in interruptNum

- External interrupt number

Returns:

none  

EXT_INT_NegativeEdgeSet()

void EXT_INT_NegativeEdgeSet (enum EXT_INT interruptNum)

Sets the external interrupt to negative edge detect.

Parameters:
in interruptNum

- External interrupt number

Returns:

none  

EXT_INT_PositiveEdgeSet()

void EXT_INT_PositiveEdgeSet (enum EXT_INT interruptNum)

Sets the external interrupt to positive edge detect.

Parameters:
in interruptNum

- External interrupt number

Returns:

none  

3.8.1.1.4 Enumeration Type Documentation

EXT_INT

enum EXT_INT

Defines the list of custom names for the External Interrupt Pins selected in MCC Melody user interface.

INT0

External Interrupt - INT0.

INT2

External Interrupt - INT2.

INT3

External Interrupt - INT3.

INT4

External Interrupt - INT4.

3.8.1.1.5 Variable Documentation

External_Interrupt

const struct EXT_INTERRUPT_INTERFACE External_Interrupt

Structure object of type EXT_INTERRUPT_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. External_Interrupt can be changed by the user in the EXT_INTERRUPT user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

3.8.2 Data Structure Documentation

3.8.2.1 EXT_INTERRUPT_INTERFACE Struct Reference

Structure containing the function pointers of EXT_INTERRUPT driver.

3.8.2.1.1 Detailed Description

Structure containing the function pointers of EXT_INTERRUPT driver.

#include <ext_int_interface.h>

Data Fields

3.8.2.1.2 Field Documentation

The documentation for this struct was generated from the following file:

source/

ext_int_interface.h

CallbackRegister

void(* CallbackRegister) (enum EXT_INT interruptNum, void(*CallbackHandler)(void))

Pointer to EXT_INT_CallbackRegister.

3.8.3 File Documentation

3.8.3.1 source/ext_int.h File Reference

This is the generated driver header file for the EXT_INT driver.

#include <xc.h>
#include "ext_int_types.h"
#include "ext_int_interface.h"

3.8.3.1.1 Functions

  • void EXT_INT_Initialize (void)

    Initializes EXT_INT module.

  • void EXT_INT_Deinitialize (void)

    Deinitializes the EXT_INT to POR values.

  • void EXT_INT_PositiveEdgeSet (enum EXT_INT interruptNum)

    Sets the external interrupt to positive edge detect.

  • void EXT_INT_NegativeEdgeSet (enum EXT_INT interruptNum)

    Sets the external interrupt to negative edge detect.

  • void EXT_INT_InterruptEnable (enum EXT_INT interruptNum)

    Enable the external interrupt for pins.

  • void EXT_INT_InterruptDisable (enum EXT_INT interruptNum)

    Disable the external interrupt for pins.

  • void EXT_INT_InterruptFlagClear (enum EXT_INT interruptNum)

    Clear the external interrupt flag for pins.

  • void EXT_INT_CallbackRegister (enum EXT_INT interruptNum, void(*handler)(void))

    This function can be used to override default callback and to define custom callback for EXT_INT event.

  • void EXT_INT0_Callback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using EXT_INT_CallbackRegister.

  • void EXT_INT2_Callback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using EXT_INT_CallbackRegister.

  • void EXT_INT3_Callback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using EXT_INT_CallbackRegister.

  • void EXT_INT4_Callback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using EXT_INT_CallbackRegister.

3.8.3.1.2 Macros

3.8.3.1.3 Variables

  • const struct EXT_INTERRUPT_INTERFACE External_Interrupt

    Structure object of type EXT_INTERRUPT_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. External_Interrupt can be changed by the user in the EXT_INTERRUPT user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

3.8.3.1.4 Detailed Description

This is the generated driver header file for the EXT_INT driver.

EXT_INT Generated Driver Header File

3.8.3.2 source/ext_int_interface.h File Reference

#include "ext_int_types.h"

3.8.3.2.1 Data structures

3.8.3.2.2 Detailed Description

EXT_INTERRUPT Generated Driver Interface Header File

3.8.3.3 source/ext_int_types.h File Reference

This is the generated driver types header file for the EXT_INTERRUPT driver.

3.8.3.3.1 Enumerations

  • enum EXT_INT { INT0, INT2, INT3, INT4 }

    Defines the list of custom names for the External Interrupt Pins selected in MCC Melody user interface.

3.8.3.3.2 Detailed Description

This is the generated driver types header file for the EXT_INTERRUPT driver.

EXT_INTERRUPT Generated Driver Types Header File