Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
nordic-nrf-gpio.h File Reference

Go to the source code of this file.

Macros

nRF GPIO drive flags

nRF GPIO drive flags

Standard (S) or High (H) drive modes can be applied to both pin levels, 0 or

  1. High drive mode will increase current capabilities of the pin (refer to each SoC reference manual).

When the pin is configured to operate in open-drain mode (wired-and), the drive mode can only be selected for the 0 level (1 is disconnected). Similarly, when the pin is configured to operate in open-source mode (wired-or), the drive mode can only be set for the 1 level (0 is disconnected).

The drive flags are encoded in the 8 upper bits of gpio_dt_flags_t as follows:

  • Bit 8: Drive mode for '0' (0=Standard, 1=High)
  • Bit 9: Drive mode for '1' (0=Standard, 1=High)
#define NRF_GPIO_DRIVE_S0   (0U << 8U)
 Standard drive for '0' (default, used with GPIO_OPEN_DRAIN)
 
#define NRF_GPIO_DRIVE_H0   (1U << 8U)
 High drive for '0' (used with GPIO_OPEN_DRAIN)
 
#define NRF_GPIO_DRIVE_S1   (0U << 9U)
 Standard drive for '1' (default, used with GPIO_OPEN_SOURCE)
 
#define NRF_GPIO_DRIVE_H1   (1U << 9U)
 High drive for '1' (used with GPIO_OPEN_SOURCE)
 
#define NRF_GPIO_DRIVE_S0S1   (NRF_GPIO_DRIVE_S0 | NRF_GPIO_DRIVE_S1)
 Standard drive for '0' and '1' (default)
 
#define NRF_GPIO_DRIVE_S0H1   (NRF_GPIO_DRIVE_S0 | NRF_GPIO_DRIVE_H1)
 Standard drive for '0' and high for '1'.
 
#define NRF_GPIO_DRIVE_H0S1   (NRF_GPIO_DRIVE_H0 | NRF_GPIO_DRIVE_S1)
 High drive for '0' and standard for '1'.
 
#define NRF_GPIO_DRIVE_H0H1   (NRF_GPIO_DRIVE_H0 | NRF_GPIO_DRIVE_H1)
 High drive for '0' and '1'.