2.10 External Interrupt Driver
2.10.1 Introduction
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.
2.10.2 Module Documentation
2.10.2.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.
2.10.2.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.
2.10.2.1.1.1 Data structures
struct EXT_INTERRUPT_INTERFACE
Structure containing the function pointers of EXT_INTERRUPT driver.
2.10.2.1.1.2 Enumerations
2.10.2.1.1.3 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.
2.10.2.1.1.4 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.
2.10.2.1.2 Function Documentation
2.10.2.1.2.1 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.
EXT_INT_Initialize() must be called for the associated function to work. |
none |
none |
2.10.2.1.2.2 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.
EXT_INT_Initialize() must be called for the associated function to work. |
in | interruptNum |
- External interrupt number |
in | handler |
- Address of the callback function |
none |
2.10.2.1.2.3 EXT_INT_Deinitialize()
void EXT_INT_Deinitialize (void )
Deinitializes the EXT_INT to POR values.
none |
none |
2.10.2.1.2.4 EXT_INT_Initialize()
void EXT_INT_Initialize (void )
Initializes EXT_INT module.
none |
none |
2.10.2.1.2.5 EXT_INT_InterruptDisable()
void EXT_INT_InterruptDisable (enum EXT_INT interruptNum)
Disable the external interrupt for pins.
in | interruptNum |
- External interrupt number |
none |
2.10.2.1.2.6 EXT_INT_InterruptEnable()
void EXT_INT_InterruptEnable (enum EXT_INT interruptNum)
Enable the external interrupt for pins.
in | interruptNum |
- External interrupt number |
none |
2.10.2.1.2.7 EXT_INT_InterruptFlagClear()
void EXT_INT_InterruptFlagClear (enum EXT_INT interruptNum)
Clear the external interrupt flag for pins.
in | interruptNum |
- External interrupt number |
none |
2.10.2.1.2.8 EXT_INT_NegativeEdgeSet()
void EXT_INT_NegativeEdgeSet (enum EXT_INT interruptNum)
Sets the external interrupt to negative edge detect.
in | interruptNum |
- External interrupt number |
none |
2.10.2.1.2.9 EXT_INT_PositiveEdgeSet()
void EXT_INT_PositiveEdgeSet (enum EXT_INT interruptNum)
Sets the external interrupt to positive edge detect.
in | interruptNum |
- External interrupt number |
none |
2.10.2.1.3 Enumeration Type Documentation
2.10.2.1.3.1 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. |
2.10.2.1.4 Variable Documentation
2.10.2.1.4.1 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.
2.10.3 Class Documentation
2.10.3.1 EXT_INTERRUPT_INTERFACE Struct Reference
Structure containing the function pointers of EXT_INTERRUPT driver.
2.10.3.1.1 Detailed Description
Structure containing the function pointers of EXT_INTERRUPT driver.
#include <ext_int_interface.h>
2.10.3.1.1.1 Public Attributes
void(* Initialize )(void)
Pointer to EXT_INT_Initialize.
void(* Deinitialize )(void)
Pointer to EXT_INT_Deinitialize.
void(* PositiveEdgeSet )(enum EXT_INT interruptNum)
Pointer to EXT_INT_PositiveEdgeSet.
void(* NegativeEdgeSet )(enum EXT_INT interruptNum)
Pointer to EXT_INT_NegativeEdgeSet.
void(* InterruptEnable )(enum EXT_INT interruptNum)
Pointer to EXT_INT_InterruptEnable.
void(* InterruptDisable )(enum EXT_INT interruptNum)
Pointer to EXT_INT_InterruptDisable.
void(* InterruptFlagClear )(enum EXT_INT interruptNum)
Pointer to EXT_INT_InterruptFlagClear.
void(* CallbackRegister )(enum EXT_INT interruptNum, void(*CallbackHandler)(void))
Pointer to EXT_INT_CallbackRegister.
2.10.3.1.2 Member Data Documentation
2.10.3.1.2.1 CallbackRegister
void(* CallbackRegister) (enum EXT_INT interruptNum, void(*CallbackHandler)(void))
Pointer to EXT_INT_CallbackRegister.
2.10.3.1.2.2 Deinitialize
void(* Deinitialize) (void)
Pointer to EXT_INT_Deinitialize.
2.10.3.1.2.3 Initialize
void(* Initialize) (void)
Pointer to EXT_INT_Initialize.
2.10.3.1.2.4 InterruptDisable
void(* InterruptDisable) (enum EXT_INT interruptNum)
Pointer to EXT_INT_InterruptDisable.
2.10.3.1.2.5 InterruptEnable
void(* InterruptEnable) (enum EXT_INT interruptNum)
Pointer to EXT_INT_InterruptEnable.
2.10.3.1.2.6 InterruptFlagClear
void(* InterruptFlagClear) (enum EXT_INT interruptNum)
Pointer to EXT_INT_InterruptFlagClear.
2.10.3.1.2.7 NegativeEdgeSet
void(* NegativeEdgeSet) (enum EXT_INT interruptNum)
Pointer to EXT_INT_NegativeEdgeSet.
2.10.3.1.2.8 PositiveEdgeSet
void(* PositiveEdgeSet) (enum EXT_INT interruptNum)
Pointer to EXT_INT_PositiveEdgeSet.
2.10.4 File Documentation
2.10.4.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"
2.10.4.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.
2.10.4.1.2 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.
2.10.4.1.3 Detailed Description
This is the generated driver header file for the EXT_INT driver.
EXT_INT Generated Driver Header File
2.10.4.2 source/ext_int_interface.h File Reference
#include "ext_int_types.h"
2.10.4.2.1 Data structures
struct EXT_INTERRUPT_INTERFACE
Structure containing the function pointers of EXT_INTERRUPT driver.
2.10.4.2.2 Detailed Description
EXT_INTERRUPT Generated Driver Interface Header File
2.10.4.3 source/ext_int_types.h File Reference
This is the generated driver types header file for the EXT_INTERRUPT driver.
2.10.4.3.1 Enumerations
2.10.4.3.2 Detailed Description
This is the generated driver types header file for the EXT_INTERRUPT driver.
EXT_INTERRUPT Generated Driver Types Header File