GPIO_READ() issue with Arduino Due

Hi guys,

we wanted to use the gpio functions on the Arduino Due board and it seems the gpio_read() function doesn't use the right register.

For example, for GPIO_0, the function returns: GPIO_0_DEV->PIO_PDSR & GPIO_0_PIN

PIO_PDSR corresponds to Pin Data Status Register, so we tried with PIO_ODSR which is Output Data Status Register:

Now for GPIO_0, the gpio_read function returns: GPIO_0_DEV->PIO_ODSR & GPIO_0_PIN

And it seems to fix our problem.

Did anyone already notice this ?

Cheers,

Maxime

Hi Maxime,

to my knowledge the original code should be working, as the PDSR should always contain the pins current value. But if that is not the case and your code does the job, please create a PR for it, so it can be fixed and we can test against it.

Cheers, Hauke