Yes it is possible to do what you ask.
There are two ways to implement this. One is a design-time schematic implementation the other is purely in SW.
Here is a schematic snip for TopDesign:
In your application:
Write a '0' to CR_OE_cntrl and Pin_IO1 is an input and Pin_IO2 is an output PP. Ie:
Write a '1' to CR_OE_cntrl and Pin_IO1 is an output PP and Pin_IO2 is an input.
This method is straight-forward and is visually obvious. However it does consume one Control Register and one UDB block.
Let's assume yo have two pins allocated in your TopDesign => Pin_IO1 and Pin_IO2 .
To change the drive mode of Pin_IO1 to input, issue the API call:
To set it to output Strong make the API call:
To change the drive mode of Pin_IO2, just change the API calls above to substitute Pin_IO2 instead of Pin_IO1.
The design-time schematic method requires a few more PSoC resources but is simpler in the code since both IOs can be switched with one API call.
The SW only method saves the resources but requires two API calls.
Because you want Push-Pull (PP) strong drive you have to be careful the the external sources of outputs (ext_in_out1 and ext_in_out2) are open drain with pull up/downs.
If you are getting a command via USB to change the Pin_IO1 and Pin_IO2 drive mode, how do you guarantee that the output sources of ext_in_out1 or ext_in_out2 are not strong driving their signal in the opposite direction of Pin_IO1 or Pin_IO2?
For example if Pin_IO1 is being driven by ext_in_out1 to 5V and you switch Pin_IO1 to output strong with a signal of 0 (ie 0V), then you can potentially damage the PSoC pin.
If you cannot afford to use open drains on ext_in_out1 and ext_in_out2, then consider at least placing a 1K series resistance in the signal. This will limit the current to 5mA in the case where one is driven to 5V and the other to 0V.