aethaniel / ExperimentalCore-sam

Experimental new core for Arduino Due and other Atmel SAM boards
GNU Lesser General Public License v2.1
16 stars 10 forks source link

Reading pin configured as output returns wrong value #61

Closed jlbirccyn closed 6 years ago

jlbirccyn commented 6 years ago

(tested on Arduino DUE)

digitalRead does:

  if ( (Ports[g_aPinMap[ulPin].iPort].pGPIO->PIO_PDSR & g_aPinMap[ulPin].ulPin) != 0 )
  {
    return HIGH ;
  }

However if the pin is programmed as output, PIO_PDSR seems not to get the pin state. I discover the ATMEL peripherals but maybe PIO_ODSR should be read instead when the pin is programmed as output.

aethaniel commented 6 years ago

Thanks for the report @jlbirccyn ! Sorry for late answer, I receive notification mails from github only when I'm cited.