3.1 Port Access for Button
For this example, PF6 of PORTF is used to sense if a button press has occurred. Examining the board schematics shows that the internal port pull-up will need to be enabled so that the PF6 will go from ‘1’ to ‘0’ when the button is pressed.
While you could use DIRCLR to set PF6 as an input pin, the reset value of PORTx is 0x00 which sets all pins to inputs.
PINCTRL enables the pull-up and configures the input/sense on PF6. The sense configuration determines how a port interrupt can be triggered.
PORTF.PIN6CTRL = PORT_PULLUPEN_bm | PORT_ISC_FALLING_gc;