user25974: What is the fastest way to read a digital pin status in an Arduino Due? Is it possible to achieve speed in the Nanosecond area?
With which type of code I can achieve this?
Edit: This question is not a duplicate please see my comment.

user28359: If the pin is declared as input, let's say pin 13:
uint32_t pin_status;
pin_status = PIOB->PIO_PDSR & PIO_PDSR_P27;

If the pin is declared as output, let's say pin 13:
uint32_t pin_status;
pin_status = PIOB->PIO_ODSR & PIO_ODSR_P27;


25974: <p>What is the <strong><em>fastest</em></strong> way to read a digital pin status in an Arduino Due? Is it possible to achieve speed in the Nanosecond area?</p>

<p>With which type of code I can achieve this?</p>

<p>Edit: This question is not a duplicate please see my comment.</p>
 28359: <p>If the pin is declared as input, let's say pin 13:</p>

<pre><code>uint32_t pin_status;
pin_status = PIOB-&gt;PIO_PDSR &amp; PIO_PDSR_P27;
</code></pre>

<p>If the pin is declared as output, let's say pin 13:</p>

<pre><code>uint32_t pin_status;
pin_status = PIOB-&gt;PIO_ODSR &amp; PIO_ODSR_P27;
</code></pre>
