Hello,

The current implementation of HAL_ARM_AT91_GPIO_GET in hal/arm/at91/../var_io.h uses the AT91_PIO_PDSR register. But, "Reading the I/O line levels requires the clock of the PIO Controller to be enabled". So if you forget to enable the related PIO clock, this HAL_ARM_AT91_GPIO_GET always fails!
Therefore, I propose to use the AT91_PIO_ODSR register.
Anyhow, the added value of PDSR over ODSR is small I think:
-with ODSR you read the value you want this pin to be
-with PDSR you read the actual (physical) value of this pin
They are only different if there is a hardware problem..

So, to remove the burden of enabling also the relevant PIO clock, and to save power, I propose to use ODSR.
If you agree, I will add a patch.

Kind regards,
Jürgen

Reply via email to