The architecture’s completely different in the SAM3X series.
There are 5 ports, A/B/C/D/E, each 32 bit, mapped to the pins as documented in variant.cpp.
There are several registers for each port that read and write it, and each pin can
be updated atomically so no special interrupt handling is needed:
PIO_PER - write 1’s here to override other peripherals and allow GPIO use for pins
PIO_OER - write 1’s here to set pins as OUTPUT
PIO_ODR - write 1’s here to set pins as INPUT
- PIO_SODR - write 1’s here to set output pins HIGH
- PIO_CODR - write 1’s here to set output pins LOW
- PIO_PDSR - read’s actual state of the pins on the port.
PIO_PUDR - write 1’s here to switch off internal pull-up for pins
PIO_PUER - write 1’s here to switch on internal pull-up for pins
There are other registers to do with input filtering, interrupts, etc etc,
but I think these are the main ones. If you call pinMode() to setup the
pin you only need the one’s marked ‘*’ to do I/O
#define pinnum 2
#define pinport PIOB
#define pinmask (1<<25) // Arduino pin 2 is port B pin 25.
pinMode (pinnum, OUTPUT) ;
pinport -> PIO_SODR = pinmask ; // set pin
delay (1) ;
pinport -> PIO_CODR = pinmask ; // clear pin