Skip to content

3. API Changes for XMega

bombasticbob edited this page Oct 27, 2014 · 34 revisions

A few APIs have changed, out of necessity, to support the XMega.

attachInterrupt(port, callback, mode);

  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);

Clone this wiki locally