nrfx 2.10
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions
GPIOTE driver

GPIO Task Event (GPIOTE) peripheral driver. More...

Modules

 GPIOTE peripheral driver configuration
 

Data Structures

struct  nrfx_gpiote_task_config_t
 Structure for configuring a GPIOTE task. More...
 
struct  nrfx_gpiote_output_config_t
 Structure for configuring an output pin. More...
 
struct  nrfx_gpiote_input_config_t
 Structure for configuring an input pin. More...
 
struct  nrfx_gpiote_trigger_config_t
 Structure for configuring pin interrupt/event. More...
 
struct  nrfx_gpiote_handler_config_t
 Structure for configuring a pin interrupt handler. More...
 
struct  nrfx_gpiote_in_config_t
 Input pin configuration. More...
 
struct  nrfx_gpiote_out_config_t
 Output pin configuration. More...
 

Macros

#define NRFX_GPIOTE_DEFAULT_OUTPUT_CONFIG
 Output pin default configuration. More...
 
#define NRFX_GPIOTE_DEFAULT_INPUT_CONFIG
 Input pin default configuration. More...
 
#define NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(hi_accu)
 Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect low-to-high transition. More...
 
#define NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO(hi_accu)
 Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect high-to-low transition. More...
 
#define NRFX_GPIOTE_CONFIG_IN_SENSE_TOGGLE(hi_accu)
 Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect any change on the pin. More...
 
#define NRFX_GPIOTE_RAW_CONFIG_IN_SENSE_LOTOHI(hi_accu)
 Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect low-to-high transition. More...
 
#define NRFX_GPIOTE_RAW_CONFIG_IN_SENSE_HITOLO(hi_accu)
 Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect high-to-low transition. More...
 
#define NRFX_GPIOTE_RAW_CONFIG_IN_SENSE_TOGGLE(hi_accu)
 Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect any change on the pin. More...
 
#define NRFX_GPIOTE_CONFIG_OUT_SIMPLE(init_high)
 Macro for configuring a pin to use as output. GPIOTE is not used for the pin. More...
 
#define NRFX_GPIOTE_CONFIG_OUT_TASK_LOW
 Macro for configuring a pin to use the GPIO OUT TASK to change the state from high to low. More...
 
#define NRFX_GPIOTE_CONFIG_OUT_TASK_HIGH
 Macro for configuring a pin to use the GPIO OUT TASK to change the state from low to high. More...
 
#define NRFX_GPIOTE_CONFIG_OUT_TASK_TOGGLE(init_high)
 Macro for configuring a pin to use the GPIO OUT TASK to toggle the pin state. More...
 
#define NRFX_GPIOTE_APP_CHANNELS_MASK   (NRFX_BIT_MASK(GPIOTE_CH_NUM) & ~NRFX_GPIOTE_CHANNELS_USED)
 Bitfield representing all GPIOTE channels available to the application.
 

Typedefs

typedef uint32_t nrfx_gpiote_pin_t
 Pin.
 
typedef void(* nrfx_gpiote_interrupt_handler_t) (nrfx_gpiote_pin_t pin, nrfx_gpiote_trigger_t trigger, void *p_context)
 Pin interrupt handler prototype. More...
 
typedef void(* nrfx_gpiote_evt_handler_t) (nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
 Legacy pin event handler prototype. More...
 

Enumerations

enum  nrfx_gpiote_trigger_t {
  NRFX_GPIOTE_TRIGGER_NONE ,
  NRFX_GPIOTE_TRIGGER_LOTOHI = GPIOTE_CONFIG_POLARITY_LoToHi ,
  NRFX_GPIOTE_TRIGGER_HITOLO ,
  NRFX_GPIOTE_TRIGGER_TOGGLE ,
  NRFX_GPIOTE_TRIGGER_LOW ,
  NRFX_GPIOTE_TRIGGER_HIGH ,
  NRFX_GPIOTE_TRIGGER_MAX
}
 Triggering options. More...
 

Functions

nrfx_err_t nrfx_gpiote_init (uint8_t interrupt_priority)
 Function for initializing the GPIOTE module. More...
 
bool nrfx_gpiote_is_init (void)
 Function for checking if the GPIOTE module is initialized. More...
 
void nrfx_gpiote_uninit (void)
 Function for uninitializing the GPIOTE module.
 
nrfx_err_t nrfx_gpiote_channel_alloc (uint8_t *p_channel)
 Function for allocating a GPIOTE channel. More...
 
nrfx_err_t nrfx_gpiote_channel_free (uint8_t channel)
 Function for freeing a GPIOTE channel. More...
 
nrfx_err_t nrfx_gpiote_input_configure (nrfx_gpiote_pin_t pin, nrfx_gpiote_input_config_t const *p_input_config, nrfx_gpiote_trigger_config_t const *p_trigger_config, nrfx_gpiote_handler_config_t const *p_handler_config)
 Function for configuring the specified input pin and input event/interrupt. More...
 
nrfx_err_t nrfx_gpiote_output_configure (nrfx_gpiote_pin_t pin, nrfx_gpiote_output_config_t const *p_config, nrfx_gpiote_task_config_t const *p_task_config)
 Function for configuring the specified output pin to be used by the driver. More...
 
nrfx_err_t nrfx_gpiote_pin_uninit (nrfx_gpiote_pin_t pin)
 Function for deinitializing the specified pin. More...
 
void nrfx_gpiote_trigger_enable (nrfx_gpiote_pin_t pin, bool int_enable)
 Function for enabling trigger for the given pin. More...
 
void nrfx_gpiote_trigger_disable (nrfx_gpiote_pin_t pin)
 Function for disabling trigger for the given pin. More...
 
void nrfx_gpiote_global_callback_set (nrfx_gpiote_interrupt_handler_t handler, void *p_context)
 Set global callback called for each event. More...
 
nrfx_err_t nrfx_gpiote_channel_get (nrfx_gpiote_pin_t pin, uint8_t *p_channel)
 Function for retrieving Task/Event channel index associated with the given pin. More...
 
nrfx_err_t nrfx_gpiote_out_init (nrfx_gpiote_pin_t pin, nrfx_gpiote_out_config_t const *p_config)
 Function for initializing a GPIOTE output pin. More...
 
nrfx_err_t nrfx_gpiote_out_prealloc_init (nrfx_gpiote_pin_t pin, nrfx_gpiote_out_config_t const *p_config, uint8_t channel)
 Function for initializing a GPIOTE output pin with preallocated channel. More...
 
void nrfx_gpiote_out_uninit (nrfx_gpiote_pin_t pin)
 Function for uninitializing a GPIOTE output pin. More...
 
void nrfx_gpiote_out_set (nrfx_gpiote_pin_t pin)
 Function for setting a GPIOTE output pin. More...
 
void nrfx_gpiote_out_clear (nrfx_gpiote_pin_t pin)
 Function for clearing a GPIOTE output pin. More...
 
void nrfx_gpiote_out_toggle (nrfx_gpiote_pin_t pin)
 Function for toggling a GPIOTE output pin. More...
 
void nrfx_gpiote_out_task_enable (nrfx_gpiote_pin_t pin)
 Function for enabling a GPIOTE output pin task. More...
 
void nrfx_gpiote_out_task_disable (nrfx_gpiote_pin_t pin)
 Function for disabling a GPIOTE output pin task. More...
 
nrf_gpiote_task_t nrfx_gpiote_out_task_get (nrfx_gpiote_pin_t pin)
 Function for getting the OUT task for the specified output pin. More...
 
uint32_t nrfx_gpiote_out_task_addr_get (nrfx_gpiote_pin_t pin)
 Function for getting the address of the OUT task for the specified output pin. More...
 
nrf_gpiote_task_t nrfx_gpiote_set_task_get (nrfx_gpiote_pin_t pin)
 Function for getting the SET task for the specified output pin. More...
 
uint32_t nrfx_gpiote_set_task_addr_get (nrfx_gpiote_pin_t pin)
 Function for getting the address of the SET task for the specified output pin. More...
 
nrf_gpiote_task_t nrfx_gpiote_clr_task_get (nrfx_gpiote_pin_t pin)
 Function for getting the CLR task for the specified output pin. More...
 
uint32_t nrfx_gpiote_clr_task_addr_get (nrfx_gpiote_pin_t pin)
 Function for getting the address of the SET task for the specified output pin. More...
 
nrfx_err_t nrfx_gpiote_in_init (nrfx_gpiote_pin_t pin, nrfx_gpiote_in_config_t const *p_config, nrfx_gpiote_evt_handler_t evt_handler)
 Function for initializing a GPIOTE input pin. More...
 
nrfx_err_t nrfx_gpiote_in_prealloc_init (nrfx_gpiote_pin_t pin, nrfx_gpiote_in_config_t const *p_config, uint8_t channel, nrfx_gpiote_evt_handler_t evt_handler)
 Function for initializing a GPIOTE input pin with preallocated channel. More...
 
void nrfx_gpiote_in_uninit (nrfx_gpiote_pin_t pin)
 Function for uninitializing a GPIOTE input pin. More...
 
NRFX_STATIC_INLINE void nrfx_gpiote_in_event_enable (nrfx_gpiote_pin_t pin, bool int_enable)
 Function for enabling sensing of a GPIOTE input pin. More...
 
NRFX_STATIC_INLINE void nrfx_gpiote_in_event_disable (nrfx_gpiote_pin_t pin)
 Function for disabling a GPIOTE input pin. More...
 
bool nrfx_gpiote_in_is_set (nrfx_gpiote_pin_t pin)
 Function for checking if a GPIOTE input pin is set. More...
 
nrf_gpiote_event_t nrfx_gpiote_in_event_get (nrfx_gpiote_pin_t pin)
 Function for getting the GPIOTE event for the specified input pin. More...
 
uint32_t nrfx_gpiote_in_event_addr_get (nrfx_gpiote_pin_t pin)
 Function for getting the address of a GPIOTE input pin event. More...
 
void nrfx_gpiote_out_task_force (nrfx_gpiote_pin_t pin, uint8_t state)
 Function for forcing a specific state on the pin configured as task. More...
 
void nrfx_gpiote_out_task_trigger (nrfx_gpiote_pin_t pin)
 Function for triggering the task OUT manually. More...
 
void nrfx_gpiote_set_task_trigger (nrfx_gpiote_pin_t pin)
 Function for triggering the task SET manually. More...
 
void nrfx_gpiote_clr_task_trigger (nrfx_gpiote_pin_t pin)
 Function for triggering the task CLR manually. More...
 

Detailed Description

GPIO Task Event (GPIOTE) peripheral driver.

Macro Definition Documentation

◆ NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO

#define NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO (   hi_accu)
Value:
{ \
.is_watcher = false, \
.hi_accuracy = hi_accu, \
.skip_gpio_setup = false, \
}
@ NRF_GPIO_PIN_NOPULL
Pin pull-up resistor disabled.
Definition: nrf_gpio.h:73
@ NRF_GPIOTE_POLARITY_HITOLO
Definition: nrf_gpiote.h:38

Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect high-to-low transition.

Set hi_accu to true to use IN_EVENT.

◆ NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI

#define NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI (   hi_accu)
Value:
{ \
.is_watcher = false, \
.hi_accuracy = hi_accu, \
.skip_gpio_setup = false, \
}
@ NRF_GPIOTE_POLARITY_LOTOHI
Definition: nrf_gpiote.h:37

Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect low-to-high transition.

Set hi_accu to true to use IN_EVENT.

◆ NRFX_GPIOTE_CONFIG_IN_SENSE_TOGGLE

#define NRFX_GPIOTE_CONFIG_IN_SENSE_TOGGLE (   hi_accu)
Value:
{ \
.is_watcher = false, \
.hi_accuracy = hi_accu, \
.skip_gpio_setup = false, \
}
@ NRF_GPIOTE_POLARITY_TOGGLE
Definition: nrf_gpiote.h:39

Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect any change on the pin.

Set hi_accu to true to use IN_EVENT.

◆ NRFX_GPIOTE_CONFIG_OUT_SIMPLE

#define NRFX_GPIOTE_CONFIG_OUT_SIMPLE (   init_high)
Value:
{ \
.task_pin = false, \
}
@ NRF_GPIOTE_INITIAL_VALUE_HIGH
Definition: nrf_gpiote.h:46
@ NRF_GPIOTE_INITIAL_VALUE_LOW
Definition: nrf_gpiote.h:45

Macro for configuring a pin to use as output. GPIOTE is not used for the pin.

◆ NRFX_GPIOTE_CONFIG_OUT_TASK_HIGH

#define NRFX_GPIOTE_CONFIG_OUT_TASK_HIGH
Value:
{ \
.task_pin = true, \
}

Macro for configuring a pin to use the GPIO OUT TASK to change the state from low to high.

The task will set the pin. Therefore, the pin is cleared initially.

◆ NRFX_GPIOTE_CONFIG_OUT_TASK_LOW

#define NRFX_GPIOTE_CONFIG_OUT_TASK_LOW
Value:
{ \
.task_pin = true, \
}

Macro for configuring a pin to use the GPIO OUT TASK to change the state from high to low.

The task will clear the pin. Therefore, the pin is set initially.

◆ NRFX_GPIOTE_CONFIG_OUT_TASK_TOGGLE

#define NRFX_GPIOTE_CONFIG_OUT_TASK_TOGGLE (   init_high)
Value:
{ \
.task_pin = true, \
}

Macro for configuring a pin to use the GPIO OUT TASK to toggle the pin state.

The initial pin state must be provided.

◆ NRFX_GPIOTE_DEFAULT_INPUT_CONFIG

#define NRFX_GPIOTE_DEFAULT_INPUT_CONFIG
Value:
{ \
}

Input pin default configuration.

◆ NRFX_GPIOTE_DEFAULT_OUTPUT_CONFIG

#define NRFX_GPIOTE_DEFAULT_OUTPUT_CONFIG
Value:
{ \
.drive = NRF_GPIO_PIN_S0S1, \
.input_connect = NRF_GPIO_PIN_INPUT_DISCONNECT, \
}
@ NRF_GPIO_PIN_INPUT_DISCONNECT
Disconnect input buffer.
Definition: nrf_gpio.h:64
@ NRF_GPIO_PIN_S0S1
Standard '0', standard '1'.
Definition: nrf_gpio.h:81

Output pin default configuration.

◆ NRFX_GPIOTE_RAW_CONFIG_IN_SENSE_HITOLO

#define NRFX_GPIOTE_RAW_CONFIG_IN_SENSE_HITOLO (   hi_accu)
Value:
{ \
.is_watcher = false, \
.hi_accuracy = hi_accu, \
.skip_gpio_setup = true, \
}

Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect high-to-low transition.

Set hi_accu to true to use IN_EVENT.

Note
This macro prepares configuration that skips the GPIO setup.

◆ NRFX_GPIOTE_RAW_CONFIG_IN_SENSE_LOTOHI

#define NRFX_GPIOTE_RAW_CONFIG_IN_SENSE_LOTOHI (   hi_accu)
Value:
{ \
.is_watcher = false, \
.hi_accuracy = hi_accu, \
.skip_gpio_setup = true, \
}

Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect low-to-high transition.

Set hi_accu to true to use IN_EVENT.

Note
This macro prepares configuration that skips the GPIO setup.

◆ NRFX_GPIOTE_RAW_CONFIG_IN_SENSE_TOGGLE

#define NRFX_GPIOTE_RAW_CONFIG_IN_SENSE_TOGGLE (   hi_accu)
Value:
{ \
.is_watcher = false, \
.hi_accuracy = hi_accu, \
.skip_gpio_setup = true, \
}

Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect any change on the pin.

Set hi_accu to true to use IN_EVENT.

Note
This macro prepares configuration that skips the GPIO setup.

Typedef Documentation

◆ nrfx_gpiote_evt_handler_t

typedef void(* nrfx_gpiote_evt_handler_t) (nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action)

Legacy pin event handler prototype.

Parameters
[in]pinPin that triggered this event.
[in]actionAction that led to triggering this event.

◆ nrfx_gpiote_interrupt_handler_t

typedef void(* nrfx_gpiote_interrupt_handler_t) (nrfx_gpiote_pin_t pin, nrfx_gpiote_trigger_t trigger, void *p_context)

Pin interrupt handler prototype.

Parameters
[in]pinPin that triggered this event.
[in]triggerTrigger that led to this event.
[in]p_contextUser context.

Enumeration Type Documentation

◆ nrfx_gpiote_trigger_t

Triggering options.

Enumerator
NRFX_GPIOTE_TRIGGER_NONE 

No trigger on a pin.

NRFX_GPIOTE_TRIGGER_LOTOHI 

Low to high edge trigger.

NRFX_GPIOTE_TRIGGER_HITOLO 

High to low edge trigger.

NRFX_GPIOTE_TRIGGER_TOGGLE 

Edge toggle trigger.

NRFX_GPIOTE_TRIGGER_LOW 

Level low trigger.

NRFX_GPIOTE_TRIGGER_HIGH 

Level high trigger.

NRFX_GPIOTE_TRIGGER_MAX 

Triggering options count.

Function Documentation

◆ nrfx_gpiote_channel_alloc()

nrfx_err_t nrfx_gpiote_channel_alloc ( uint8_t *  p_channel)

Function for allocating a GPIOTE channel.

This function allocates the first unused GPIOTE channel from pool defined in NRFX_GPIOTE_APP_CHANNELS_MASK.

Note
Function is thread safe as it uses nrfx_flag32_alloc.
Routines that allocate and free the GPIOTE channels are independent from the rest of the driver. In particular, the driver does not need to be initialized when this function is called.
Parameters
[out]p_channelPointer to the GPIOTE channel that has been allocated.
Return values
NRFX_SUCCESSThe channel was successfully allocated.
NRFX_ERROR_NO_MEMThere is no available channel to be used.

◆ nrfx_gpiote_channel_free()

nrfx_err_t nrfx_gpiote_channel_free ( uint8_t  channel)

Function for freeing a GPIOTE channel.

This function frees a GPIOTE channel that was allocated using nrfx_gpiote_channel_alloc.

Note
Function is thread safe as it uses nrfx_flag32_free.
Routines that allocate and free the GPIOTE channels are independent from the rest of the driver. In particular, the driver does not need to be initialized when this function is called.
Parameters
[in]channelGPIOTE channel to be freed.
Return values
NRFX_SUCCESSThe channel was successfully freed.
NRFX_ERROR_INVALID_PARAMThe channel is not user-configurable.

◆ nrfx_gpiote_channel_get()

nrfx_err_t nrfx_gpiote_channel_get ( nrfx_gpiote_pin_t  pin,
uint8_t *  p_channel 
)

Function for retrieving Task/Event channel index associated with the given pin.

Parameters
[in]pinAbsolute pin number.
[out]p_channelLocation to write the channel index.
Return values
NRFX_SUCCESSChannel successfully written.
NRFX_ERROR_INVALID_PARAMPin is not configured or not using Task or Event.

◆ nrfx_gpiote_clr_task_addr_get()

uint32_t nrfx_gpiote_clr_task_addr_get ( nrfx_gpiote_pin_t  pin)

Function for getting the address of the SET task for the specified output pin.

Parameters
[in]pinPin.
Returns
Address of CLR task.

◆ nrfx_gpiote_clr_task_get()

nrf_gpiote_task_t nrfx_gpiote_clr_task_get ( nrfx_gpiote_pin_t  pin)

Function for getting the CLR task for the specified output pin.

The returned task identifier can be used within GPIOTE HAL, for example, to configure a DPPI channel.

Parameters
[in]pinPin.
Returns
CLR task associated with the specified output pin.

◆ nrfx_gpiote_clr_task_trigger()

void nrfx_gpiote_clr_task_trigger ( nrfx_gpiote_pin_t  pin)

Function for triggering the task CLR manually.

Parameters
[in]pinPin.

◆ nrfx_gpiote_global_callback_set()

void nrfx_gpiote_global_callback_set ( nrfx_gpiote_interrupt_handler_t  handler,
void *  p_context 
)

Set global callback called for each event.

Parameters
[in]handlerGlobal handler.
[in]p_contextContext passed to the handler.

◆ nrfx_gpiote_in_event_addr_get()

uint32_t nrfx_gpiote_in_event_addr_get ( nrfx_gpiote_pin_t  pin)

Function for getting the address of a GPIOTE input pin event.

If the pin is configured to use low-accuracy mode, the address of the PORT event is returned.

Parameters
[in]pinPin.
Returns
Address of the specified input pin event.

◆ nrfx_gpiote_in_event_disable()

NRFX_STATIC_INLINE void nrfx_gpiote_in_event_disable ( nrfx_gpiote_pin_t  pin)

Function for disabling a GPIOTE input pin.

Note
This function is deprecated. Use nrfx_gpiote_trigger_disable instead.
Parameters
[in]pinPin.

◆ nrfx_gpiote_in_event_enable()

NRFX_STATIC_INLINE void nrfx_gpiote_in_event_enable ( nrfx_gpiote_pin_t  pin,
bool  int_enable 
)

Function for enabling sensing of a GPIOTE input pin.

If the input pin is configured as high-accuracy pin, the function enables an IN_EVENT. Otherwise, the function enables the GPIO sense mechanism. The PORT event is shared between multiple pins, therefore the interrupt is always enabled.

Note
This function is deprecated. Use nrfx_gpiote_trigger_enable instead.
Parameters
[in]pinPin.
[in]int_enableTrue to enable the interrupt. Always valid for a high-accuracy pin.

◆ nrfx_gpiote_in_event_get()

nrf_gpiote_event_t nrfx_gpiote_in_event_get ( nrfx_gpiote_pin_t  pin)

Function for getting the GPIOTE event for the specified input pin.

The returned event identifier can be used within GPIOTE HAL, for example, to configure a DPPI channel. If the pin is configured to use low-accuracy mode, the PORT event is returned.

Parameters
[in]pinPin.
Returns
Event associated with the specified input pin.

◆ nrfx_gpiote_in_init()

nrfx_err_t nrfx_gpiote_in_init ( nrfx_gpiote_pin_t  pin,
nrfx_gpiote_in_config_t const *  p_config,
nrfx_gpiote_evt_handler_t  evt_handler 
)

Function for initializing a GPIOTE input pin.

The input pin can act in two ways:

  • lower accuracy but low power (high frequency clock not needed)
  • higher accuracy (high frequency clock required)

The initial configuration specifies which mode is used. If high-accuracy mode is used, the driver attempts to allocate one of the available GPIOTE channels. If no channel is available, an error is returned. In low accuracy mode SENSE feature is used. In this case, only one active pin can be detected at a time. It can be worked around by setting all of the used low accuracy pins to toggle mode. For more information about SENSE functionality, refer to Product Specification.

Note
This function is deprecated. Use nrfx_gpiote_input_configure preceded by nrfx_gpiote_channel_alloc (provided that IN event is to be utilized) instead.
Parameters
[in]pinPin.
[in]p_configInitial configuration.
[in]evt_handlerUser function to be called when the configured transition occurs.
Return values
NRFX_SUCCESSInitialization was successful.
NRFX_ERROR_BUSYThe pin is already used.
NRFX_ERROR_NO_MEMNo GPIOTE channel is available.

◆ nrfx_gpiote_in_is_set()

bool nrfx_gpiote_in_is_set ( nrfx_gpiote_pin_t  pin)

Function for checking if a GPIOTE input pin is set.

Parameters
[in]pinPin.
Return values
trueThe input pin is set.
falseThe input pin is not set.

◆ nrfx_gpiote_in_prealloc_init()

nrfx_err_t nrfx_gpiote_in_prealloc_init ( nrfx_gpiote_pin_t  pin,
nrfx_gpiote_in_config_t const *  p_config,
uint8_t  channel,
nrfx_gpiote_evt_handler_t  evt_handler 
)

Function for initializing a GPIOTE input pin with preallocated channel.

The input pin can act in higher accuracy (high frequency clock required) mode.

Parameters
[in]pinPin.
[in]p_configInitial configuration.
[in]channelGPIOTE channel allocated with nrfx_gpiote_channel_alloc.
[in]evt_handlerUser function to be called when the configured transition occurs.
Note
This function is deprecated. Use nrfx_gpiote_input_configure instead.
Return values
NRFX_SUCCESSInitialization was successful.
NRFX_ERROR_BUSYThe pin is already used.
NRFX_ERROR_INVALID_PARAMPin is configured to not be controlled by the GPIOTE task and cannot be used with preallocated channel. Use nrfx_gpiote_in_init instead.

◆ nrfx_gpiote_in_uninit()

void nrfx_gpiote_in_uninit ( nrfx_gpiote_pin_t  pin)

Function for uninitializing a GPIOTE input pin.

The driver frees the GPIOTE channel if the input pin was using one.

Note
This function is deprecated. Use nrfx_gpiote_pin_uninit, followed by nrfx_gpiote_channel_free (provided that IN event was utilized) instead.
Parameters
[in]pinPin.

◆ nrfx_gpiote_init()

nrfx_err_t nrfx_gpiote_init ( uint8_t  interrupt_priority)

Function for initializing the GPIOTE module.

Parameters
[in]interrupt_priorityInterrupt priority.
Return values
NRFX_SUCCESSInitialization was successful.
NRFX_ERROR_INVALID_STATEThe driver was already initialized.

◆ nrfx_gpiote_input_configure()

nrfx_err_t nrfx_gpiote_input_configure ( nrfx_gpiote_pin_t  pin,
nrfx_gpiote_input_config_t const *  p_input_config,
nrfx_gpiote_trigger_config_t const *  p_trigger_config,
nrfx_gpiote_handler_config_t const *  p_handler_config 
)

Function for configuring the specified input pin and input event/interrupt.

Prior to calling this function pin can be uninitialized or configured as input or output. However, following transitions and configurations are invalid and result in error returned by the function:

  • Setting level trigger (e.g. NRFX_GPIOTE_TRIGGER_HIGH) and using GPIOTE channel for the same pin.
  • Reconfiguring pin to input (p_input_config not NULL) when pin was configured to use GPIOTE task. Prior to that, task must be disabled by configuring it with polarity set to NRF_GPIOTE_POLARITY_NONE.
  • Configuring trigger using GPIOTE channel for pin previously configured as output pin. Only sensing can be used for an output pin.

Function can be used to configure trigger and handler for sensing input changes on an output pin. In that case, prior to that output pin must be configured with input buffer connected. In that case p_input_config is NULL to avoid reconfiguration of the pin.

Parameters
[in]pinAbsolute pin number.
[in]p_input_configPin configuration. If NULL, the current configuration is untouched.
[in]p_trigger_configInterrupt/event configuration. If NULL, the current configuration is untouched.
[in]p_handler_configHandler configuration. If NULL it is untouched.
Return values
NRFX_SUCCESSConfiguration was successful.
NRFX_ERROR_INVALID_PARAMInvalid configuration.

◆ nrfx_gpiote_is_init()

bool nrfx_gpiote_is_init ( void  )

Function for checking if the GPIOTE module is initialized.

The GPIOTE module is a shared module. Therefore, check if the module is already initialized and skip initialization if it is.

Return values
trueThe module is already initialized.
falseThe module is not initialized.

◆ nrfx_gpiote_out_clear()

void nrfx_gpiote_out_clear ( nrfx_gpiote_pin_t  pin)

Function for clearing a GPIOTE output pin.

Parameters
[in]pinPin.

◆ nrfx_gpiote_out_init()

nrfx_err_t nrfx_gpiote_out_init ( nrfx_gpiote_pin_t  pin,
nrfx_gpiote_out_config_t const *  p_config 
)

Function for initializing a GPIOTE output pin.

The output pin can be controlled by the CPU or by PPI. The initial configuration specifies which mode is used. If PPI mode is used, the driver attempts to allocate one of the available GPIOTE channels. If no channel is available, an error is returned.

Note
This function is deprecated. Use nrfx_gpiote_output_configure preceded by nrfx_gpiote_channel_alloc (provided that GPIOTE task is to be utilized) instead.
Parameters
[in]pinPin.
[in]p_configInitial configuration.
Return values
NRFX_SUCCESSInitialization was successful.
NRFX_ERROR_BUSYThe pin is already used.
NRFX_ERROR_NO_MEMNo GPIOTE channel is available.

◆ nrfx_gpiote_out_prealloc_init()

nrfx_err_t nrfx_gpiote_out_prealloc_init ( nrfx_gpiote_pin_t  pin,
nrfx_gpiote_out_config_t const *  p_config,
uint8_t  channel 
)

Function for initializing a GPIOTE output pin with preallocated channel.

The output pin can be controlled by PPI.

Parameters
[in]pinPin.
[in]p_configInitial configuration.
[in]channelGPIOTE channel allocated with nrfx_gpiote_channel_alloc.
Note
This function is deprecated. Use nrfx_gpiote_output_configure instead.
Return values
NRFX_SUCCESSInitialization was successful.
NRFX_ERROR_BUSYThe pin is already used.
NRFX_ERROR_INVALID_PARAMPin is configured to not be controlled by the GPIOTE task and cannot be used with preallocated channel. Use nrfx_gpiote_out_init instead.

◆ nrfx_gpiote_out_set()

void nrfx_gpiote_out_set ( nrfx_gpiote_pin_t  pin)

Function for setting a GPIOTE output pin.

Parameters
[in]pinPin.

◆ nrfx_gpiote_out_task_addr_get()

uint32_t nrfx_gpiote_out_task_addr_get ( nrfx_gpiote_pin_t  pin)

Function for getting the address of the OUT task for the specified output pin.

Parameters
[in]pinPin.
Returns
Address of OUT task.

◆ nrfx_gpiote_out_task_disable()

void nrfx_gpiote_out_task_disable ( nrfx_gpiote_pin_t  pin)

Function for disabling a GPIOTE output pin task.

Parameters
[in]pinPin.

◆ nrfx_gpiote_out_task_enable()

void nrfx_gpiote_out_task_enable ( nrfx_gpiote_pin_t  pin)

Function for enabling a GPIOTE output pin task.

Parameters
[in]pinPin.

◆ nrfx_gpiote_out_task_force()

void nrfx_gpiote_out_task_force ( nrfx_gpiote_pin_t  pin,
uint8_t  state 
)

Function for forcing a specific state on the pin configured as task.

Parameters
[in]pinPin.
[in]statePin state.

◆ nrfx_gpiote_out_task_get()

nrf_gpiote_task_t nrfx_gpiote_out_task_get ( nrfx_gpiote_pin_t  pin)

Function for getting the OUT task for the specified output pin.

The returned task identifier can be used within GPIOTE HAL, for example, to configure a DPPI channel.

Parameters
[in]pinPin.
Returns
OUT task associated with the specified output pin.

◆ nrfx_gpiote_out_task_trigger()

void nrfx_gpiote_out_task_trigger ( nrfx_gpiote_pin_t  pin)

Function for triggering the task OUT manually.

Parameters
[in]pinPin.

◆ nrfx_gpiote_out_toggle()

void nrfx_gpiote_out_toggle ( nrfx_gpiote_pin_t  pin)

Function for toggling a GPIOTE output pin.

Parameters
[in]pinPin.

◆ nrfx_gpiote_out_uninit()

void nrfx_gpiote_out_uninit ( nrfx_gpiote_pin_t  pin)

Function for uninitializing a GPIOTE output pin.

The driver frees the GPIOTE channel if the output pin was using one.

Note
This function is deprecated. Use nrfx_gpiote_pin_uninit, followed by nrfx_gpiote_channel_free (provided that GPIOTE task was utilized) instead.
Parameters
[in]pinPin.

◆ nrfx_gpiote_output_configure()

nrfx_err_t nrfx_gpiote_output_configure ( nrfx_gpiote_pin_t  pin,
nrfx_gpiote_output_config_t const *  p_config,
nrfx_gpiote_task_config_t const *  p_task_config 
)

Function for configuring the specified output pin to be used by the driver.

Prior to calling this function pin can be uninitialized or configured as input or output. However, following transitions and configurations are invalid and result in error returned by the function:

  • Reconfiguring pin to output when pin was configured as input with trigger using GPIOTE channel. Prior to that, trigger must be disabled by configuring it as NRFX_GPIOTE_TRIGGER_NONE.
  • Configuring pin as output without input buffer connected when prior to that trigger was configured. In that case input buffer must be connected.
  • Configuring GPIOTE task for pin which was previously configured as input. Before using GPIOTE task pin must be configured as output by providing p_config.
Parameters
[in]pinAbsolute pin number.
[in]p_configPin configuration. If NULL pin configuration is not applied.
[in]p_task_configGPIOTE task configuration. If NULL task is not used.
Return values
NRFX_SUCCESSConfiguration was successful.
NRFX_ERROR_INVALID_PARAMInvalid configuration.

◆ nrfx_gpiote_pin_uninit()

nrfx_err_t nrfx_gpiote_pin_uninit ( nrfx_gpiote_pin_t  pin)

Function for deinitializing the specified pin.

Specified pin and associated GPIOTE channel are restored to the default configuration.

Warning
GPIOTE channel used by the pin is not freed.
Parameters
[in]pinAbsolute pin number.
Return values
NRFX_SUCCESSUninitialization was successful.
NRFX_ERROR_INVALID_PARAMPin not used by the driver.

◆ nrfx_gpiote_set_task_addr_get()

uint32_t nrfx_gpiote_set_task_addr_get ( nrfx_gpiote_pin_t  pin)

Function for getting the address of the SET task for the specified output pin.

Parameters
[in]pinPin.
Returns
Address of SET task.

◆ nrfx_gpiote_set_task_get()

nrf_gpiote_task_t nrfx_gpiote_set_task_get ( nrfx_gpiote_pin_t  pin)

Function for getting the SET task for the specified output pin.

The returned task identifier can be used within GPIOTE HAL, for example, to configure a DPPI channel.

Parameters
[in]pinPin.
Returns
SET task associated with the specified output pin.

◆ nrfx_gpiote_set_task_trigger()

void nrfx_gpiote_set_task_trigger ( nrfx_gpiote_pin_t  pin)

Function for triggering the task SET manually.

Parameters
[in]pinPin.

◆ nrfx_gpiote_trigger_disable()

void nrfx_gpiote_trigger_disable ( nrfx_gpiote_pin_t  pin)

Function for disabling trigger for the given pin.

Parameters
[in]pinAbsolute pin number.

◆ nrfx_gpiote_trigger_enable()

void nrfx_gpiote_trigger_enable ( nrfx_gpiote_pin_t  pin,
bool  int_enable 
)

Function for enabling trigger for the given pin.

When GPIOTE event is used trigger can be enabled without enabling interrupt, e.g. for PPI.

Parameters
[in]pinAbsolute pin number.
[in]int_enableTrue to enable the interrupt. Must be true when sensing is used.

Documentation feedback | Developer Zone | Subscribe | Updated