There is an array struct called g_APinDescription which contains the port and mask for each Arduino pin number. You use it like this for example:
g_APinDescription[pin].pPort -> PIO_SODR = g_APinDescription[pin].ulPin; // equivalent to digitalWrite(pin,HIGH)
Replace 'PIOx ->' with 'g_APinDescription[pin].pPort ->' and '1<<yy' with 'g_APinDescription[pin].ulPin'
So for example PIOB->PIO_DIFSR |= 1<<26 would become:
g_APinDescription.pPort -> PIO_DIFSR |= g_APinDescription.ulPin;
from a quick read of the data sheet I think the filter can go as slow as 1 second
At 0xff it's about 16ms.