Go Down

Topic: How to read PA30 and PA31? (Read 498 times) previous topic - next topic

x-giorgio-x

How can I disable debugging in SWD and read as PA31 (SWDIO) and PA30 (SWCLK) inputs?

x-giorgio-x

How to read IO using register ?

MartinL

#2
May 22, 2018, 12:44 pm Last Edit: May 22, 2018, 12:44 pm by MartinL
Hi giorgio,

To check if a given input pin is high:

Code: [Select]
if (REG_PORT_IN0 & PORT_PA30)
{
  // Add your code here...
}

Where the "0" suffix of the REG_PORT_IN0 register denotes port A.

An identical, but alternative syntax is:

Code: [Select]

if (PORT->Group[PORTA].IN.reg & PORT_PA30)
{
  // Add your code here...
}

Go Up