PSoC GPIO type switch

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
zhenning_zhu
Level 2
Level 2
10 sign-ins 10 replies posted 5 replies posted

Hi, Would you tell ,me how to switch GPIO type between digital output mode strong and input mode high impedance or input&output mode Open drain hi?

0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

ZhZh,

Set the pin with the drive mode you want to have at power or reset.  This is the default mode the pin will have if you do nothing else.

Look into the pins Datasheet.   You will find an API call Pin_SetDriveMode (uint8 drivemode)

Here is where you can change the output drive characteristics or even change it to an input or have it as an input and an output (open-collector of course).

Drive mode constants

Constants to be passed as "mode" parameter in the Pin_SetDriveMode() function.

Pins PSoC® Creator™ Component Datasheet

Page 34 of 48 Document Number: 001-98278 Rev. *D

Macros

• #define Pin_DM_ALG_HIZ (0x00u)   // High Impedance Analog.

• #define Pin_DM_DIG_HIZ (0x01u)   // High Impedance Digital.

• #define Pin_DM_RES_UP (0x02u)   // Resistive Pull Up.

• #define Pin_DM_RES_DWN (0x03u)  // Resistive Pull Down.

• #define Pin_DM_OD_LO (0x04u)    // Open Drain, Drives Low.

• #define Pin_DM_OD_HI (0x05u)     // Open Drain, Drives High.

• #define Pin_DM_STRONG (0x06u)   // Strong Drive.

• #define Pin_DM_RES_UPDWN (0x07u)    // Resistive Pull Up/Down.

Len

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

1 Reply