See Quick Start Guide for the MEGARF ext int Driver.
This is a driver for the AVR MEGARF external interrupt. It provides functions for enabling, disabling and configuring the external interrupt modules.
This driver depends on the following modules:
Modules | |
Related Project(s) | |
In this section you can find all the projects related to the External Interrupt Driver. | |
Quick Start Guide(s) | |
In this section you can find a list of all Quick Start guides related to the External Interrupt Driver. | |
Macros | |
#define | CLEAR_INT_FLAG(pin) EIFR |= (1 << (pin & EXT_INT_PORT_MASK)) |
Clears the int flag. More... | |
#define | CLEAR_PCINT_FLAG0() PCIFR |= (1 << PCIF0) |
#define | CLEAR_PCINT_FLAG1() PCIFR |= (1 << PCIF1) |
#define | EXT_INT_PORT_MASK 0x07 |
#define | INT_PIN_MASK(pin) (1 << (pin & EXT_INT_PORT_MASK)) |
Masks the required interrupt pin. More... | |
Typedefs | |
typedef void(* | ext_int_callback_t )(void) |
Interrupt event callback function type. More... | |
Enumerations | |
enum | ext_int_pins { EXT_INT0_PIN = IOPORT_CREATE_PIN(PORTD,0), EXT_INT1_PIN = IOPORT_CREATE_PIN(PORTD,1), EXT_INT2_PIN = IOPORT_CREATE_PIN(PORTD,2), EXT_INT3_PIN = IOPORT_CREATE_PIN(PORTD,3), EXT_INT4_PIN = IOPORT_CREATE_PIN(PORTE,4), EXT_INT5_PIN = IOPORT_CREATE_PIN(PORTE,5), EXT_INT6_PIN = IOPORT_CREATE_PIN(PORTE,6), EXT_INT7_PIN = IOPORT_CREATE_PIN(PORTE,7) } |
enum | ext_pcint_pins { PC_INT0_PIN = IOPORT_CREATE_PIN(PORTB,0), PC_INT1_PIN = IOPORT_CREATE_PIN(PORTB,1), PC_INT2_PIN = IOPORT_CREATE_PIN(PORTB,2), PC_INT3_PIN = IOPORT_CREATE_PIN(PORTB,3), PC_INT4_PIN = IOPORT_CREATE_PIN(PORTB,4), PC_INT5_PIN = IOPORT_CREATE_PIN(PORTB,5), PC_INT6_PIN = IOPORT_CREATE_PIN(PORTB,6), PC_INT7_PIN = IOPORT_CREATE_PIN(PORTB,7), PC_INT8_PIN = IOPORT_CREATE_PIN(PORTE,0) } |
Functions | |
void | ext_int_clear_flag (ioport_pin_t pin) |
Clear ext Interrupt flag. More... | |
void | ext_int_disable (ioport_pin_t pin) |
Disable ext Interrupt. More... | |
void | ext_int_enable (ioport_pin_t pin) |
Enable ext Interrupt. More... | |
void | ext_int_init (ioport_pin_t pin, enum ioport_sense trigmode) |
Initializes ext Interrupt for the required interrupt Pin and trigger level Configures the interrupt pin as input pin, enables the pull of the pin, set the trigger mode clears the interrupt flag before enabling and enables the interrupt. More... | |
void | ext_int_pcint_clear_flag (ioport_pin_t pin) |
Clear ext Interrupt flag. More... | |
void | ext_int_pcint_disable (ioport_pin_t pin) |
Disable ext PC Interrupt. More... | |
void | ext_int_pcint_enable (ioport_pin_t pin) |
Enable ext PC Interrupt. More... | |
void | ext_int_pcint_init (ioport_pin_t pin) |
Initializes ext pin change Interrupt for the required interrupt Pin Configures the interrupt pin as input pin, enables the pull of the pin, clears the interrupt flag before enabling and enables the interrupt. More... | |
void | ext_int_set_interrupt_callback (ioport_pin_t ext_int, ext_int_callback_t callback) |
Set external interrupt callback function. More... | |
#define CLEAR_INT_FLAG | ( | pin | ) | EIFR |= (1 << (pin & EXT_INT_PORT_MASK)) |
Clears the int flag.
Referenced by ext_int_clear_flag().
#define CLEAR_PCINT_FLAG0 | ( | ) | PCIFR |= (1 << PCIF0) |
Referenced by ext_int_pcint_clear_flag().
#define CLEAR_PCINT_FLAG1 | ( | ) | PCIFR |= (1 << PCIF1) |
Referenced by ext_int_pcint_clear_flag().
#define EXT_INT_PORT_MASK 0x07 |
Referenced by run_set_functions_test().
#define INT_PIN_MASK | ( | pin | ) | (1 << (pin & EXT_INT_PORT_MASK)) |
Masks the required interrupt pin.
Referenced by ext_int_disable(), ext_int_enable(), ext_int_pcint_disable(), ext_int_pcint_enable(), and run_set_functions_test().
typedef void(* ext_int_callback_t)(void) |
Interrupt event callback function type.
The interrupt handler can be configured to do a function callback, the callback function must match the ext_int_callback_t type.
enum ext_int_pins |
enum ext_pcint_pins |
void ext_int_clear_flag | ( | ioport_pin_t | pin | ) |
Clear ext Interrupt flag.
pin | input External Interrupt Pin |
References CLEAR_INT_FLAG.
Referenced by ext_int_init(), and run_set_functions_test().
void ext_int_disable | ( | ioport_pin_t | pin | ) |
Disable ext Interrupt.
pin | input External Interrupt Pin |
References INT_PIN_MASK.
Referenced by ext_int_init(), and run_set_functions_test().
void ext_int_enable | ( | ioport_pin_t | pin | ) |
Enable ext Interrupt.
pin | input External Interrupt Pin |
References INT_PIN_MASK.
Referenced by ext_int_init(), and run_set_functions_test().
void ext_int_init | ( | ioport_pin_t | pin, |
enum ioport_sense | trigmode | ||
) |
Initializes ext Interrupt for the required interrupt Pin and trigger level Configures the interrupt pin as input pin, enables the pull of the pin, set the trigger mode clears the interrupt flag before enabling and enables the interrupt.
pin,trigmode | External Interrupt Pin and trigmode |
References ext_int_clear_flag(), ext_int_disable(), ext_int_enable(), ioport_configure_pin(), IOPORT_DIR_INPUT, IOPORT_PULL_UP, and ioport_set_pin_sense_mode().
Referenced by main().
void ext_int_pcint_clear_flag | ( | ioport_pin_t | pin | ) |
Clear ext Interrupt flag.
pin | External Interrupt Pin |
References CLEAR_PCINT_FLAG0, CLEAR_PCINT_FLAG1, and PC_INT8_PIN.
Referenced by ext_int_pcint_init(), and run_set_functions_test().
void ext_int_pcint_disable | ( | ioport_pin_t | pin | ) |
Disable ext PC Interrupt.
pin | External PC Interrupt Pin |
References INT_PIN_MASK, and PC_INT8_PIN.
Referenced by ext_int_pcint_init(), and run_set_functions_test().
void ext_int_pcint_enable | ( | ioport_pin_t | pin | ) |
Enable ext PC Interrupt.
pin | External PC Interrupt Pin |
References INT_PIN_MASK, and PC_INT8_PIN.
Referenced by ext_int_pcint_init(), and run_set_functions_test().
void ext_int_pcint_init | ( | ioport_pin_t | pin | ) |
Initializes ext pin change Interrupt for the required interrupt Pin Configures the interrupt pin as input pin, enables the pull of the pin, clears the interrupt flag before enabling and enables the interrupt.
pin | External Interrupt Pin and trigmode |
References ext_int_pcint_clear_flag(), ext_int_pcint_disable(), ext_int_pcint_enable(), ioport_configure_pin(), IOPORT_DIR_INPUT, and IOPORT_PULL_UP.
Referenced by run_interrupt_trigger_test().
void ext_int_set_interrupt_callback | ( | ioport_pin_t | ext_int, |
ext_int_callback_t | callback | ||
) |
Set external interrupt callback function.
This function allows the caller to set and change the interrupt callback function. Without setting a callback function the interrupt handler in the driver will only clear the interrupt flags.
ext_int | interrupt number |
callback | Reference to a callback function |
References EXT_INT0_PIN, EXT_INT1_PIN, EXT_INT2_PIN, EXT_INT3_PIN, EXT_INT4_PIN, EXT_INT5_PIN, EXT_INT6_PIN, EXT_INT7_PIN, ext_int_int0_callback, ext_int_int1_callback, ext_int_int2_callback, ext_int_int3_callback, ext_int_int4_callback, ext_int_int5_callback, ext_int_int6_callback, ext_int_int7_callback, ext_int_pcint0_callback, ext_int_pcint1_callback, PC_INT0_PIN, PC_INT7_PIN, and PC_INT8_PIN.
Referenced by main(), and run_interrupt_trigger_test().