Say I have connection to digital pin20 on my Nano Every (ATMega4809). I can look at the Every pinout and see the port and pin designations. Then do things like:
VPORTF.DIR |= PIN4_bm; or,
VPORTB.OUT |= PIN4_bm;
Which are very fast.
I know you can use these functions:
bit = digitalPinToBitMask(pin);
port = digitalPinToPort(pin);
reg = portModeRegister(port);
out = portOutputRegister(port);
then:
*reg &= ~bit;
*out &= ~bit;
or similar.
But these are not as fast as the VPORT methods. Is there a way access VPORTx from pin numbers in a similar manner??