PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

Functions
GPIO Functions
PDL API Reference » GPIO (General Purpose Input Output) » Functions

## General Description

## Functions
void | Cy_GPIO_SetAmuxSplit (cy_en_amux_split_t switchCtrl, cy_en_gpio_amuxconnect_t amuxConnect, cy_en_gpio_amuxselect_t amuxBus)
| Configure a specific AMux bus splitter switch cell into a specific configuration. More...
cy_en_gpio_amuxconnect_t | Cy_GPIO_GetAmuxSplit (cy_en_amux_split_t switchCtrl, cy_en_gpio_amuxselect_t amuxBus)
| Returns the configuration of a specific AMux bus splitter switch cell. More...
__STATIC_INLINE uint32_t | Cy_GPIO_Read (GPIO_PRT_Type *base, uint32_t pinNum)
| Reads the current logic level on the input buffer of the pin. More...
__STATIC_INLINE void | Cy_GPIO_Write (GPIO_PRT_Type *base, uint32_t pinNum, uint32_t value)
| Write a logic 0 or logic 1 state to the output driver. More...
__STATIC_INLINE uint32_t | Cy_GPIO_ReadOut (GPIO_PRT_Type *base, uint32_t pinNum)
| Reads the current logic level on the pin output driver. More...
__STATIC_INLINE void | Cy_GPIO_Set (GPIO_PRT_Type *base, uint32_t pinNum)
| Set a pin output to logic state high. More...
__STATIC_INLINE void | Cy_GPIO_Clr (GPIO_PRT_Type *base, uint32_t pinNum)
| Set a pin output to logic state Low. More...
__STATIC_FORCEINLINE void | Cy_GPIO_Inv (GPIO_PRT_Type *base, uint32_t pinNum)
| Set a pin output logic state to the inverse of the current output logic state. More...
__STATIC_INLINE void | Cy_GPIO_SetDrivemode (GPIO_PRT_Type *base, uint32_t pinNum, uint32_t value)
| Configures the pin output buffer drive mode and input buffer enable. More...
__STATIC_INLINE uint32_t | Cy_GPIO_GetDrivemode (GPIO_PRT_Type *base, uint32_t pinNum)
| Returns the pin output buffer drive mode and input buffer enable state. More...
__STATIC_INLINE void | Cy_GPIO_SetVtrip (GPIO_PRT_Type *base, uint32_t pinNum, uint32_t value)
| Configures the GPIO pin input buffer voltage threshold mode. More...
__STATIC_INLINE uint32_t | Cy_GPIO_GetVtrip (GPIO_PRT_Type *base, uint32_t pinNum)
| Returns the pin input buffer voltage threshold mode. More...
void | Cy_GPIO_SetVtripAuto (GPIO_PRT_Type *base, uint32_t pinNum, uint32_t value)
uint32_t | Cy_GPIO_GetVtripAuto (GPIO_PRT_Type *base, uint32_t pinNum)
__STATIC_INLINE void | Cy_GPIO_SetSlewRate (GPIO_PRT_Type *base, uint32_t pinNum, uint32_t value)
| Configures the pin output buffer slew rate. More...
__STATIC_INLINE uint32_t | Cy_GPIO_GetSlewRate (GPIO_PRT_Type *base, uint32_t pinNum)
| Returns the pin output buffer slew rate. More...
__STATIC_INLINE void | Cy_GPIO_SetDriveSel (GPIO_PRT_Type *base, uint32_t pinNum, uint32_t value)
| Configures the pin output buffer drive strength. More...
__STATIC_INLINE uint32_t | Cy_GPIO_GetDriveSel (GPIO_PRT_Type *base, uint32_t pinNum)
| Returns the pin output buffer drive strength. More...
void | Cy_GPIO_SetPullupResistance (GPIO_PRT_Type *base, uint32_t pinNum, uint32_t value)
| Configures the GPIO pin Pull-up mode. More...
uint32_t | Cy_GPIO_GetPullupResistance (GPIO_PRT_Type *base, uint32_t pinNum)
| Returns the Pull-up mode of GPIO Pin. More...
__STATIC_INLINE void | Cy_GPIO_WritePort (GPIO_PRT_Type *base, uint32_t value)
| Write value to the whole GPIO port. More...

## Function Documentation

## ◆ Cy_GPIO_SetAmuxSplit()

void Cy_GPIO_SetAmuxSplit | ( | cy_en_amux_split_t | switchCtrl,
|  | cy_en_gpio_amuxconnect_t | amuxConnect,
|  | cy_en_gpio_amuxselect_t | amuxBus
| ) |  |

Configure a specific AMux bus splitter switch cell into a specific configuration.

Parameters

  switchCtrl | Selects specific AMux bus splitter cell between two segments. The cy_en_amux_split_t enumeration can be found in the GPIO header file for the device package.
  amuxConnect | Selects configuration of the three switches within the splitter cell
  amuxBus | Selects which AMux bus within the splitter is being configured

## ◆ Cy_GPIO_GetAmuxSplit()

cy_en_gpio_amuxconnect_t Cy_GPIO_GetAmuxSplit | ( | cy_en_amux_split_t | switchCtrl,
|  | cy_en_gpio_amuxselect_t | amuxBus
| ) |  |

Returns the configuration of a specific AMux bus splitter switch cell.

Parameters

  switchCtrl | Selects specific AMux bus splitter cell between two segments. The cy_en_amux_split_t enumeration can be found in the GPIO header file for the device package.
  amuxBus | Selects which AMux bus within the splitter is being configured

Returns
  Returns configuration of the three switches in the selected splitter cell

## ◆ Cy_GPIO_Read()

__STATIC_INLINE uint32_t Cy_GPIO_Read | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum
| ) |  |

Reads the current logic level on the input buffer of the pin.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register. Bit position 8 is the routed pin through the port glitch filter.

Returns
  Logic level present on the pin

Function Usage
  /* Scenario: P0.0 was initialized and input buffer enabled */
  /* Read the input state of P0.0 */
  if(1UL == Cy_GPIO_Read(P0_0_PORT, P0_0_NUM))
  {
  /* Insert logic for High pin state */
  }
  else
  {
  /* Insert logic for Low pin state */
  }
  Cy_GPIO_Read
  __STATIC_INLINE uint32_t Cy_GPIO_Read(GPIO_PRT_Type *base, uint32_t pinNum)
  Reads the current logic level on the input buffer of the pin.
  Definition: cy_gpio.h:1076

## ◆ Cy_GPIO_Write()

__STATIC_INLINE void Cy_GPIO_Write | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum,
|  | uint32_t | value
| ) |  |

Write a logic 0 or logic 1 state to the output driver.

This function should be used only for software driven pins. It does not have any effect on peripheral driven pins.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register
  value | Logic level to drive out on the pin

Function Usage
  uint32_t pinState = 0UL;
  /* Control P0.0 based on the pinState variable */
  Cy_GPIO_Write(P0_0_PORT, P0_0_NUM, pinState);
  Cy_GPIO_Write
  __STATIC_INLINE void Cy_GPIO_Write(GPIO_PRT_Type *base, uint32_t pinNum, uint32_t value)
  Write a logic 0 or logic 1 state to the output driver.
  Definition: cy_gpio.h:1106

## ◆ Cy_GPIO_ReadOut()

__STATIC_INLINE uint32_t Cy_GPIO_ReadOut | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum
| ) |  |

Reads the current logic level on the pin output driver.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register

Returns
  Logic level on the pin output driver

Function Usage
  /* Write logic low to P0.0 */
  Cy_GPIO_Write(P0_0_PORT, P0_0_NUM, 0UL);
  /* Get the output value of P0.0 */
  if(0UL != Cy_GPIO_ReadOut(P0_0_PORT, P0_0_NUM))
  {
  /* Insert error handling */
  }
  Cy_GPIO_ReadOut
  __STATIC_INLINE uint32_t Cy_GPIO_ReadOut(GPIO_PRT_Type *base, uint32_t pinNum)
  Reads the current logic level on the pin output driver.
  Definition: cy_gpio.h:1168

## ◆ Cy_GPIO_Set()

__STATIC_INLINE void Cy_GPIO_Set | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum
| ) |  |

Set a pin output to logic state high.

This function should be used only for software driven pins. It does not have any effect on peripheral driven pins.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register

Function Usage
  /* Set P0.0 (out value = High) */
  Cy_GPIO_Set(P0_0_PORT, P0_0_NUM);
  Cy_GPIO_Set
  __STATIC_INLINE void Cy_GPIO_Set(GPIO_PRT_Type *base, uint32_t pinNum)
  Set a pin output to logic state high.
  Definition: cy_gpio.h:1195

## ◆ Cy_GPIO_Clr()

__STATIC_INLINE void Cy_GPIO_Clr | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum
| ) |  |

Set a pin output to logic state Low.

This function should be used only for software driven pins. It does not have any effect on peripheral driven pins.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register

Function Usage
  /* Clear P0.0 (out value = Low) */
  Cy_GPIO_Clr(P0_0_PORT, P0_0_NUM);
  Cy_GPIO_Clr
  __STATIC_INLINE void Cy_GPIO_Clr(GPIO_PRT_Type *base, uint32_t pinNum)
  Set a pin output to logic state Low.
  Definition: cy_gpio.h:1223

## ◆ Cy_GPIO_Inv()

__STATIC_FORCEINLINE void Cy_GPIO_Inv | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum
| ) |  |

Set a pin output logic state to the inverse of the current output logic state.

This function should be used only for software driven pins. It does not have any effect on peripheral driven pins.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register

Function Usage
  /* Invert P0.0 (out value = ~(out value)) */
  Cy_GPIO_Inv(P0_0_PORT, P0_0_NUM);
  Cy_GPIO_Inv
  __STATIC_FORCEINLINE void Cy_GPIO_Inv(GPIO_PRT_Type *base, uint32_t pinNum)
  Set a pin output logic state to the inverse of the current output logic state.
  Definition: cy_gpio.h:1251

## ◆ Cy_GPIO_SetDrivemode()

__STATIC_INLINE void Cy_GPIO_SetDrivemode | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum,
|  | uint32_t | value
| ) |  |

Configures the pin output buffer drive mode and input buffer enable.

The output buffer drive mode and input buffer enable are combined into a single parameter. The drive mode controls the behavior of the pin in general. Enabling the input buffer allows the digital pin state to be read but also contributes to extra current consumption.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register
  value | Pin drive mode. Options are detailed in Pin drive mode macros

Note
  This function modifies a port register in a read-modify-write operation. It is not thread safe as the resource is shared among multiple pins on a port.

Function Usage
  /* Scenario: Enter deep-sleep with reduced leakage current on P0.0 */
  /* Get the drive mode of P0.0 */
  if(CY_GPIO_DM_STRONG== Cy_GPIO_GetDrivemode(P0_0_PORT, P0_0_NUM))
  {
  /* Change the drive mode of P0.0 to analog (hi-z, input buffer off) */
  Cy_GPIO_SetDrivemode(P0_0_PORT, P0_0_NUM, CY_GPIO_DM_ANALOG);
  }
  CY_GPIO_DM_STRONG
  #define CY_GPIO_DM_STRONG
  Strong Drive.
  Definition: cy_gpio.h:522
  CY_GPIO_DM_ANALOG
  #define CY_GPIO_DM_ANALOG
  Analog High-Z.
  Definition: cy_gpio.h:508
  Cy_GPIO_SetDrivemode
  __STATIC_INLINE void Cy_GPIO_SetDrivemode(GPIO_PRT_Type *base, uint32_t pinNum, uint32_t value)
  Configures the pin output buffer drive mode and input buffer enable.
  Definition: cy_gpio.h:1286
  Cy_GPIO_GetDrivemode
  __STATIC_INLINE uint32_t Cy_GPIO_GetDrivemode(GPIO_PRT_Type *base, uint32_t pinNum)
  Returns the pin output buffer drive mode and input buffer enable state.
  Definition: cy_gpio.h:1346

## ◆ Cy_GPIO_GetDrivemode()

__STATIC_INLINE uint32_t Cy_GPIO_GetDrivemode | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum
| ) |  |

Returns the pin output buffer drive mode and input buffer enable state.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register

Returns
  Pin drive mode. Options are detailed in Pin drive mode macros

Function Usage
  /* Scenario: Enter deep-sleep with reduced leakage current on P0.0 */
  /* Get the drive mode of P0.0 */
  if(CY_GPIO_DM_STRONG== Cy_GPIO_GetDrivemode(P0_0_PORT, P0_0_NUM))
  {
  /* Change the drive mode of P0.0 to analog (hi-z, input buffer off) */
  Cy_GPIO_SetDrivemode(P0_0_PORT, P0_0_NUM, CY_GPIO_DM_ANALOG);
  }

## ◆ Cy_GPIO_SetVtrip()

__STATIC_INLINE void Cy_GPIO_SetVtrip | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum,
|  | uint32_t | value
| ) |  |

Configures the GPIO pin input buffer voltage threshold mode.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register
  value | Pin voltage threshold mode. Options are detailed in Voltage trip mode macros

Note
  This function modifies a port register in a read-modify-write operation. It is not thread safe as the resource is shared among multiple pins on a port.

Function Usage
  /* Scenario: Connect the pin to a TTL hardware */
  /* Get the vtrip value of P0.0 */
  if(CY_GPIO_VTRIP_CMOS == Cy_GPIO_GetVtrip(P0_0_PORT, P0_0_NUM))
  {
  /* Change the vtrip of P0.0 to LVTTL */
  Cy_GPIO_SetVtrip(P0_0_PORT, P0_0_NUM, CY_GPIO_VTRIP_TTL);
  }
  Cy_GPIO_GetVtrip
  __STATIC_INLINE uint32_t Cy_GPIO_GetVtrip(GPIO_PRT_Type *base, uint32_t pinNum)
  Returns the pin input buffer voltage threshold mode.
  Definition: cy_gpio.h:1438
  Cy_GPIO_SetVtrip
  __STATIC_INLINE void Cy_GPIO_SetVtrip(GPIO_PRT_Type *base, uint32_t pinNum, uint32_t value)
  Configures the GPIO pin input buffer voltage threshold mode.
  Definition: cy_gpio.h:1407
  CY_GPIO_VTRIP_CMOS
  #define CY_GPIO_VTRIP_CMOS
  Input buffer compatible with CMOS and I2C interfaces.
  Definition: cy_gpio.h:534
  CY_GPIO_VTRIP_TTL
  #define CY_GPIO_VTRIP_TTL
  Input buffer compatible with TTL and MediaLB interfaces.
  Definition: cy_gpio.h:535

## ◆ Cy_GPIO_GetVtrip()

__STATIC_INLINE uint32_t Cy_GPIO_GetVtrip | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum
| ) |  |

Returns the pin input buffer voltage threshold mode.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register

Returns
  Pin voltage threshold mode. Options are detailed in Voltage trip mode macros

Function Usage
  /* Scenario: Connect the pin to a TTL hardware */
  /* Get the vtrip value of P0.0 */
  if(CY_GPIO_VTRIP_CMOS == Cy_GPIO_GetVtrip(P0_0_PORT, P0_0_NUM))
  {
  /* Change the vtrip of P0.0 to LVTTL */
  Cy_GPIO_SetVtrip(P0_0_PORT, P0_0_NUM, CY_GPIO_VTRIP_TTL);
  }

## ◆ Cy_GPIO_SetSlewRate()

__STATIC_INLINE void Cy_GPIO_SetSlewRate | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum,
|  | uint32_t | value
| ) |  |

Configures the pin output buffer slew rate.

GPIO pins have fast and slow output slew rate options for the strong drivers configured using this API. By default the port works in fast slew mode. Slower slew rate results in reduced EMI and crosstalk and are recommended for low-frequency signals or signals without strict timing constraints.

Note
  This function has no effect for the GPIO ports, where the slew rate configuration is not available. Refer to device datasheet for details.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register
  value | Pin slew rate. Options are detailed in Slew Rate Mode macros

Note
  This function modifies a port register in a read-modify-write operation. It is not thread safe as the resource is shared among multiple pins on a port.

Function Usage
  /* Scenario: Connect the pin to I2C (slow slew rate is preferred for low EMI) */
  /* Get the slew rate value of P0.0 */
  if(CY_GPIO_SLEW_FAST == Cy_GPIO_GetSlewRate(P0_0_PORT, P0_0_NUM))
  {
  /* Change the slew rate of P0.0 to Slow */
  Cy_GPIO_SetSlewRate(P0_0_PORT, P0_0_NUM, CY_GPIO_SLEW_SLOW);
  }
  Cy_GPIO_SetSlewRate
  __STATIC_INLINE void Cy_GPIO_SetSlewRate(GPIO_PRT_Type *base, uint32_t pinNum, uint32_t value)
  Configures the pin output buffer slew rate.
  Definition: cy_gpio.h:1477
  Cy_GPIO_GetSlewRate
  __STATIC_INLINE uint32_t Cy_GPIO_GetSlewRate(GPIO_PRT_Type *base, uint32_t pinNum)
  Returns the pin output buffer slew rate.
  Definition: cy_gpio.h:1513
  CY_GPIO_SLEW_SLOW
  #define CY_GPIO_SLEW_SLOW
  Slow slew rate.
  Definition: cy_gpio.h:545
  CY_GPIO_SLEW_FAST
  #define CY_GPIO_SLEW_FAST
  Fast slew rate.
  Definition: cy_gpio.h:544

## ◆ Cy_GPIO_GetSlewRate()

__STATIC_INLINE uint32_t Cy_GPIO_GetSlewRate | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum
| ) |  |

Returns the pin output buffer slew rate.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register

Returns
  Pin slew rate. Options are detailed in Slew Rate Mode macros

Function Usage
  /* Scenario: Connect the pin to I2C (slow slew rate is preferred for low EMI) */
  /* Get the slew rate value of P0.0 */
  if(CY_GPIO_SLEW_FAST == Cy_GPIO_GetSlewRate(P0_0_PORT, P0_0_NUM))
  {
  /* Change the slew rate of P0.0 to Slow */
  Cy_GPIO_SetSlewRate(P0_0_PORT, P0_0_NUM, CY_GPIO_SLEW_SLOW);
  }

## ◆ Cy_GPIO_SetDriveSel()

__STATIC_INLINE void Cy_GPIO_SetDriveSel | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum,
|  | uint32_t | value
| ) |  |

Configures the pin output buffer drive strength.

The drive strength field determines the active portion of the output drivers used and can affect the slew rate of output signals. Drive strength options are full drive strength (default), one-half strength, one-quarter strength, and oneeighth strength. Drive strength must be set to full drive strength when the slow slew rate bit (SLOW) is set.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register.
  value | Pin drive strength. Options are detailed in Pin drive strength macros

Note
  This function modifies a port register in a read-modify-write operation. It is not thread safe as the resource is shared among multiple pins on a port.

Function Usage
  /* Scenario: Reduce the drive current as part of power conservation strategy */
  /* Get the drive current capability of P0.0 */
  if(CY_GPIO_DRIVE_FULL == Cy_GPIO_GetDriveSel(P0_0_PORT, P0_0_NUM))
  {
  /* Change the drive current capability of P0.0 to 1/4 of full strength */
  Cy_GPIO_SetDriveSel(P0_0_PORT, P0_0_NUM, CY_GPIO_DRIVE_1_4);
  }
  CY_GPIO_DRIVE_FULL
  #define CY_GPIO_DRIVE_FULL
  Full drive strength: Max drive current.
  Definition: cy_gpio.h:563
  CY_GPIO_DRIVE_1_4
  #define CY_GPIO_DRIVE_1_4
  1/4 drive strength: 1/4 drive current
  Definition: cy_gpio.h:565
  Cy_GPIO_GetDriveSel
  __STATIC_INLINE uint32_t Cy_GPIO_GetDriveSel(GPIO_PRT_Type *base, uint32_t pinNum)
  Returns the pin output buffer drive strength.
  Definition: cy_gpio.h:1593
  Cy_GPIO_SetDriveSel
  __STATIC_INLINE void Cy_GPIO_SetDriveSel(GPIO_PRT_Type *base, uint32_t pinNum, uint32_t value)
  Configures the pin output buffer drive strength.
  Definition: cy_gpio.h:1551

## ◆ Cy_GPIO_GetDriveSel()

__STATIC_INLINE uint32_t Cy_GPIO_GetDriveSel | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum
| ) |  |

Returns the pin output buffer drive strength.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register

Returns
  Pin drive strength. Options are detailed in Pin drive strength macros

Function Usage
  /* Scenario: Reduce the drive current as part of power conservation strategy */
  /* Get the drive current capability of P0.0 */
  if(CY_GPIO_DRIVE_FULL == Cy_GPIO_GetDriveSel(P0_0_PORT, P0_0_NUM))
  {
  /* Change the drive current capability of P0.0 to 1/4 of full strength */
  Cy_GPIO_SetDriveSel(P0_0_PORT, P0_0_NUM, CY_GPIO_DRIVE_1_4);
  }

## ◆ Cy_GPIO_SetPullupResistance()

void Cy_GPIO_SetPullupResistance | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum,
|  | uint32_t | value
| ) |  |

Configures the GPIO pin Pull-up mode.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register
  value | Pull-up mode for a pin. Options are detailed in Pull-up mode macros

Note
  This API configures pull-up resistors only when CY_GPIO_DM_CFGOUT3_STRONG_PULLUP_HIGHZ is selected. For all other pin drive modes, it disables additional pull-up resistors.
  This API modifies a port register in a read-modify-write operation. It is not thread safe as the resource is shared among multiple pins on a port.

Function Usage
  /* Get the Pull-up mode of P1.0 */
  if(CY_GPIO_PULLUP_RES_DISABLE == Cy_GPIO_GetPullupResistance(P1_0_PORT, P1_0_NUM))
  {
  /* Change the Pull-up mode of P1.0 to 2800 ohms */
  Cy_GPIO_SetPullupResistance(P1_0_PORT, P1_0_NUM, CY_GPIO_PULLUP_RES_2800);
  }
  CY_GPIO_PULLUP_RES_2800
  #define CY_GPIO_PULLUP_RES_2800
  Pull-up 2800 ohms.
  Definition: cy_gpio.h:650
  CY_GPIO_PULLUP_RES_DISABLE
  #define CY_GPIO_PULLUP_RES_DISABLE
  Disable additional Pull-ups.
  Definition: cy_gpio.h:643
  Cy_GPIO_GetPullupResistance
  uint32_t Cy_GPIO_GetPullupResistance(GPIO_PRT_Type *base, uint32_t pinNum)
  Returns the Pull-up mode of GPIO Pin.
  Definition: cy_gpio.c:847
  Cy_GPIO_SetPullupResistance
  void Cy_GPIO_SetPullupResistance(GPIO_PRT_Type *base, uint32_t pinNum, uint32_t value)
  Configures the GPIO pin Pull-up mode.
  Definition: cy_gpio.c:809

## ◆ Cy_GPIO_GetPullupResistance()

uint32_t Cy_GPIO_GetPullupResistance | ( | GPIO_PRT_Type * | base,
|  | uint32_t | pinNum
| ) |  |

Returns the Pull-up mode of GPIO Pin.

Parameters

  base | Pointer to the pin's port register base address
  pinNum | Position of the pin bit-field within the port register

Returns
  Pull-up mode. Options are detailed in Pull-up mode macros

Function Usage
  /* Get the Pull-up mode of P1.0 */
  if(CY_GPIO_PULLUP_RES_DISABLE == Cy_GPIO_GetPullupResistance(P1_0_PORT, P1_0_NUM))
  {
  /* Change the Pull-up mode of P1.0 to 2800 ohms */
  Cy_GPIO_SetPullupResistance(P1_0_PORT, P1_0_NUM, CY_GPIO_PULLUP_RES_2800);
  }

## ◆ Cy_GPIO_WritePort()

__STATIC_INLINE void Cy_GPIO_WritePort | ( | GPIO_PRT_Type * | base,
|  | uint32_t | value
| ) |  |

Write value to the whole GPIO port.

This function should be used only for software driven pins. It does not have any effect on peripheral driven pins.

Parameters

  base | Pointer to the pin's port register base address
  value | Logic level to drive out on the each pin of the selected port

Function Usage
  uint32_t portState = 0x17UL;
  /* Quickly initialize pins on P0
  *
  * Cy_GPIO_Pin_FastInit(P0_0_PORT, P0_0_NUM, CY_GPIO_DM_STRONG, 1UL, P0_0_GPIO);
  * Cy_GPIO_Pin_FastInit(P0_1_PORT, P0_1_NUM, CY_GPIO_DM_STRONG, 1UL, P0_1_GPIO);
  * Cy_GPIO_Pin_FastInit(P0_2_PORT, P0_3_NUM, CY_GPIO_DM_STRONG, 1UL, P0_2_GPIO);
  * Cy_GPIO_Pin_FastInit(P0_3_PORT, P0_3_NUM, CY_GPIO_DM_STRONG, 1UL, P0_3_GPIO);
  *
  */
  /* Control P0 based on the portState variable
  * In current case when only the first 4 pins were configured, the Cy_GPIO_WritePort function will guarantee
  * that output values on P0.0 - P0.4 will have the same as in the portState variable.
  * For example, if portState = 0x17 values on pins will be as expected ('0111'), but if P0.5 wasn't
  * configured the value for this pin will not have any affect on the output.
  */
  Cy_GPIO_WritePort(GPIO_PRT0, portState);
  Cy_GPIO_WritePort
  __STATIC_INLINE void Cy_GPIO_WritePort(GPIO_PRT_Type *base, uint32_t value)
  Write value to the whole GPIO port.
  Definition: cy_gpio.h:1142