Fast DigitalWrite for Arduino Due

Is there a method for increasing the speed of setting a digital pin to High or Low? I tried the following on the Due unsuccessfully - unfortunately it was made for the 8-bit boards:

http://skpang.co.uk/blog/archives/323

Why? Maybe if you described your actual problem or posted some code we could help with that.

There are various threads on here for direct port manipulation on the Due - have
you searched for them?

MarkT:
There are various threads on here for direct port manipulation on the Due - have
you searched for them?

One such thread is http://forum.arduino.cc/index.php?topic=129868.15.
Essentially you just have a pointer to a structure, which has to long members, one that clears and one that turns on the pin. Here is the quote of the post that shows how this works.

stimmer:
The other way of doing direct port manipulation looks like this:

PIOx->register=value;   

long r = PIOx->register;



where x is A,B,C or D and register is as in the data sheet

For example: 


PIOB->PIO_SODR=1<<27; //lights the LED
PIOB->PIO_CODR=1<<27; //clears it
boolean p12=!!(PIOD->PIO_PDSR & (1<<8)); //read pin 12




I had a go at writing some digitalReadDirect/digitalWriteDirect functions but you might want to give them some more thorough testing as I only checked if it worked with the LED :)



inline void digitalWriteDirect(int pin, boolean val){
  if(val) g_APinDescription[pin].pPort → PIO_SODR = g_APinDescription[pin].ulPin;
  else    g_APinDescription[pin].pPort → PIO_CODR = g_APinDescription[pin].ulPin;
}

inline int digitalReadDirect(int pin){
  return !!(g_APinDescription[pin].pPort → PIO_PDSR & g_APinDescription[pin].ulPin);
}

void setup() {               
  pinMode(13, OUTPUT);   
  pinMode(12, INPUT);   
  Serial.begin(9600);
}

void loop() {
  digitalWriteDirect(13, HIGH); 
  delay(1000);         
  digitalWriteDirect(13, LOW);   
  delay(1000);         
  Serial.println(digitalReadDirect(12));
}