Hello Kris,
The default data of PORTB_PCR5 ->MUX is 011 :

So if you simple use PORTB_PCR5 |= PORT_PCR_MUX(1); the MUX still "011".
We need first clear it , then set it to "001".
Please pay attention that in your code, there is a negation ,

(PORTB_PCR5 & (uint32_t)~(uint32_t)PORT_PCR_MUX(0x06)) this code is clear the [9:8] of PORTB_PCR5 .
In a word , if you do not care about the interrupt status flag, you can only use the below code to configure PTB5 to GPIO function :
PORTB_PCR5 = (uint32_t)((PORTB_PCR5 & (uint32_t)~(uint32_t)(
PORT_PCR_MUX(0x06)
)) | (uint32_t)(
PORT_PCR_MUX(0x01)
));
Hope it helps
Have a great day,
Alice Yang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------