-
Notifications
You must be signed in to change notification settings - Fork 17
3. API Changes for XMega
A few APIs have changed, out of necessity, to support the XMega.
port is the I/O port and int number
example: PORTC_INT0, PORTD_INT0, PORTR_INT1, etc.
callback is a pointer to a user callback function
mode (new) is a bit-flag indicating the following:
trigger mode - LOW, HIGH, RISING, FALLING, CHANGE
interrupt pin - INT_MODE_PIN_DEFAULT, INT_MODE_PIN0, etc.
priority - INT_MODE_PRI_DEFAULT, INT_MODE_PRI_HIGH, etc.
typical usage:
attachInterrupt(PORTD_INT0,
my_callback,
RISING
| INT_MODE_PIN_DEFAULT
| INT_MODE_PRI_DEFAULT);
The port (formerly 'interrupt number') is passed to 'detachInterrupt' and detaches ALL interrupts for that particular port and interrupt combination. Some CPUs have 2 interrupts per port, some only one. The first will be labeled 'INT0', and subsequent interrupts 'INT1', etc. Each port+interrupt combination can only have a single callback, so you should assign the callback and all of the interrupt pins at the same time. It will be up to the callback functino to determine which pins is responsible for the interrupt.
There is a small exception with hardware flow control, which manages its interrupts separately, in conjuction with 'attachInterrupt()' and 'detachInterrupt()' calls. It is possible to assign an interrupt on the same port as the hardware flow control pins, without interfering. However, its priority will not be lowered from 'HIGH'.
iIndex is the index within the 'calibration data' to be read
This function reads the 'calibration data', which is assigned by the manufacturer to contain the calibration data necessary for certain functions. This also includes CPU identification information that can be used to uniquely identify the processor. One practical use is found in setting up the A:D converter, by reading the calibration data and assigning it to the 'CAL' register for the A:D converter during setup.
© 2015-2019 (and later) by S.F.T. Inc.
You may freely use this documentation as you see fit, provided that appropriate credit is made, similar to a BSD or MIT license.