Question: How do I change the drive mode of a PSoC 1 GPIO on the fly?
Answer: The drive mode of the GPIO pin can be changed on the fly by changing the PRTxDMx registers. There are three drive mode registers for each port that control the drive mode of the pins in a particular port. These are the PRTxDM0, PRTxDM1 and PRTxDM2 registers. The combination of the bits of these three registers decide the drive mode of a particular pin. The following table shows the various combinations of the PRTxDMx bits and the corresponding drive modes.

For example, to control the drive mode of P2[3] Bit3 of PRT2DM0, PRT2DM1 and PRT2DM2 registers should be modified. Below are some code examples to change the drive mode of the GPIO.
// Change P2[3] to Strong drive
// The DM2:DM1:DM0 combination is 001
PRT2DM2 &= ~0x08;
PRT2DM1 &= ~0x08;
PRT2DM0 |= 0x08;
// Change P1[5] to Open Drain Low
// The DM2:DM1:DM0 combination is 111
PRT1DM2 |= 0x20;
PRT1DM1 |= 0x20;
PRT1DM0 |= 0x20;



