I configured a Pin port as output in FSP interface, but I need to change to input in run time I used the following statements
option 1
R_IOPORT_PortDirectionSet(&g_ioport_ctrl, BSP_IO_PORT_01, 0x08, 0xFFFF); //pin103 as input
option 2
R_IOPORT_PortDirectionSet(&g_ioport_ctrl, BSP_IO_PORT_01, 0x01, 0x08);//pin103 as input
my question is, what is the correct way to change a configuration port?, I tested both option and both are working
my other question is if I require to change for example 4 pins of the port1 only i need to change 0x08?
Per the FSP documentation:
When the mask value is 0xFFFF you are changing all 16-bits of the port with the API call, assigning as input or output based on the 0x08 value. This would be undesirable to potentially impact other port pins.
When the mask value is 0x08, only the 1-bit of the port is changed with the API call. This would be the preferred method.