hsk_libs-dev
163:b63ae088cc97
High Speed Karlsruhe XC878 library collection
|
HSK External Interrupt Routing implementation. More...
Macros | |
#define | CNT_EXINT 2 |
EXICON0/1 External Interrupt Trigger Select bit count. More... | |
#define | BIT_EXINT0 0 |
EXICON0 External Interrupt 0 Trigger Select bits. More... | |
#define | BIT_EXINT1 2 |
EXICON0 External Interrupt 1 Trigger Select bits. More... | |
#define | BIT_EXINT2 4 |
EXICON0 External Interrupt 2 Trigger Select bits. More... | |
#define | BIT_EXINT3 6 |
EXICON0 External Interrupt 3 Trigger Select bits. More... | |
#define | BIT_EXINT4 0 |
EXICON1 External Interrupt 4 Trigger Select bits. More... | |
#define | BIT_EXINT5 2 |
EXICON1 External Interrupt 5 Trigger Select bits. More... | |
#define | BIT_EXINT6 4 |
EXICON1 External Interrupt 6 Trigger Select bits. More... | |
#define | BIT_IMODE 4 |
SYSCON0 Interrupt Structure 2 Mode Select bit. More... | |
#define | EX_EDGE_DISABLE 3 |
Deactivate external interrupt. More... | |
Functions | |
void | hsk_ex_channel_enable (const hsk_ex_channel channel, const ubyte edge, const void(*const callback)(void)) |
Enable an external interrupt channel. More... | |
void | hsk_ex_channel_disable (const hsk_ex_channel channel) |
Disables an external interrupt channel. More... | |
void | hsk_ex_port_open (const hsk_ex_port port) |
Opens an input port for an external interrupt. More... | |
void | hsk_ex_port_close (const hsk_ex_port port) |
Disconnects an input port from an external interrupt. More... | |
Variables | |
struct { | |
ubyte modpiselBit | |
The MODPISEL[n] bit(s) to select. More... | |
ubyte modpiselSel | |
The MODPISEL value. More... | |
ubyte portBit | |
The port bit. More... | |
ubyte portAltsel | |
The port ALTSEL (alternative select) setting. More... | |
} | hsk_ex_ports [] |
External input configuration structure. More... | |
HSK External Interrupt Routing implementation.
This file implements the methods necessary to route µC pins to external interrupts.
#define BIT_EXINT0 0 |
EXICON0 External Interrupt 0 Trigger Select bits.
#define BIT_EXINT1 2 |
EXICON0 External Interrupt 1 Trigger Select bits.
#define BIT_EXINT2 4 |
EXICON0 External Interrupt 2 Trigger Select bits.
#define BIT_EXINT3 6 |
EXICON0 External Interrupt 3 Trigger Select bits.
#define BIT_EXINT4 0 |
EXICON1 External Interrupt 4 Trigger Select bits.
#define BIT_EXINT5 2 |
EXICON1 External Interrupt 5 Trigger Select bits.
#define BIT_EXINT6 4 |
EXICON1 External Interrupt 6 Trigger Select bits.
#define BIT_IMODE 4 |
SYSCON0 Interrupt Structure 2 Mode Select bit.
#define CNT_EXINT 2 |
EXICON0/1 External Interrupt Trigger Select bit count.
void hsk_ex_channel_disable | ( | const hsk_ex_channel | channel | ) |
Disables an external interrupt channel.
channel | The channel to disable, one of External Interrupt Channels |
void hsk_ex_channel_enable | ( | const hsk_ex_channel | channel, |
const ubyte | edge, | ||
const void(*)(void) | callback | ||
) |
Enable an external interrupt channel.
It is good practice to enable a port for the channel first, because port changes on an active interrupt may cause an undesired interrupt.
The callback function can be set to 0 if a change of the function is not desired. For channels EXINT0 and EXINT1 the callback is ignored, implement interrupts 0 and 2 instead.
channel | The channel to activate, one of External Interrupt Channels |
edge | The triggering edge, one of External Interrupt Triggers |
callback | The callback function for an interrupt event |
Setting up EXINT0/1 is somewhat confusing. Refer to UM 1.1 section 5.6.2 to make sense of this.
void hsk_ex_port_close | ( | const hsk_ex_port | port | ) |
Disconnects an input port from an external interrupt.
port | The port to close, one of External Interrupt Input Ports |
void hsk_ex_port_open | ( | const hsk_ex_port | port | ) |
Opens an input port for an external interrupt.
port | The port to open, one of External Interrupt Input Ports |
hsk_ex_ports |
External input configuration structure.
ubyte modpiselBit |
The MODPISEL[n] bit(s) to select.
ubyte modpiselSel |
The MODPISEL value.
ubyte portAltsel |
The port ALTSEL (alternative select) setting.
ubyte portBit |
The port bit.