GPIOTE HAL

group nrf_gpiote_hal

Hardware access layer (HAL) for managing the GPIOTE peripheral.

Defines

NRF_GPIOTE_INST_GET(idx)

Macro for getting a pointer to the structure of registers of the GPIOTE peripheral.

Parameters:
  • idx[in] GPIOTE instance index.

Returns:

Pointer to the structure of registers of the GPIOTE peripheral.

GPIOTE_CONFIG_PORT_PIN_Msk

Mask for covering port and pin bits in registers.

NRF_GPIOTE_HAS_LATENCY

Presence of the latency setting.

NRF_GPIOTE_HAS_INT_GROUPS

Symbol indicating whether GPIOTE interrupt groups are present.

NRF_GPIOTE_IRQ_GROUP

Symbol indicating which interrupt group to use. Empty if there are no groups.

NRF_GPIOTE_SECURE_SUFFIX

Symbol indicating a TrustZone suffix added to the register name.

NRF_GPIOTE_EVENTS_PORT_REG

Symbol indicating a name of PORT event register to be used.

NRF_GPIOTE_INT_PORT_MASK_NAME

Symbol specifying interrupt bitmask associated with the PORT event.

NRF_GPIOTE_INT_IN_MASK

Symbol specifying bitmask collecting all IN events interrupts.

Enums

enum nrf_gpiote_polarity_t

Polarity for the GPIOTE channel.

Values:

enumerator NRF_GPIOTE_POLARITY_NONE

None.

enumerator NRF_GPIOTE_POLARITY_LOTOHI

Low to high.

enumerator NRF_GPIOTE_POLARITY_HITOLO

High to low.

enumerator NRF_GPIOTE_POLARITY_TOGGLE

Toggle.

enum nrf_gpiote_outinit_t

Initial output value for the GPIOTE channel.

Values:

enumerator NRF_GPIOTE_INITIAL_VALUE_LOW

Low to high.

enumerator NRF_GPIOTE_INITIAL_VALUE_HIGH

High to low.

enum nrf_gpiote_latency_t

Latency setting.

Values:

enumerator NRF_GPIOTE_LATENCY_LOWPOWER

Low Power.

enumerator NRF_GPIOTE_LATENCY_LOWLATENCY

Low Latency.

enum nrf_gpiote_task_t

GPIOTE tasks.

Values:

enumerator NRF_GPIOTE_TASK_OUT_0

Out task 0.

enumerator NRF_GPIOTE_TASK_OUT_1

Out task 1.

enumerator NRF_GPIOTE_TASK_OUT_2

Out task 2.

enumerator NRF_GPIOTE_TASK_OUT_3

Out task 3.

enumerator NRF_GPIOTE_TASK_OUT_4

Out task 4.

enumerator NRF_GPIOTE_TASK_OUT_5

Out task 5.

enumerator NRF_GPIOTE_TASK_OUT_6

Out task 6.

enumerator NRF_GPIOTE_TASK_OUT_7

Out task 7.

enumerator NRF_GPIOTE_TASK_SET_0

Set task 0.

enumerator NRF_GPIOTE_TASK_SET_1

Set task 1.

enumerator NRF_GPIOTE_TASK_SET_2

Set task 2.

enumerator NRF_GPIOTE_TASK_SET_3

Set task 3.

enumerator NRF_GPIOTE_TASK_SET_4

Set task 4.

enumerator NRF_GPIOTE_TASK_SET_5

Set task 5.

enumerator NRF_GPIOTE_TASK_SET_6

Set task 6.

enumerator NRF_GPIOTE_TASK_SET_7

Set task 7.

enumerator NRF_GPIOTE_TASK_CLR_0

Clear task 0.

enumerator NRF_GPIOTE_TASK_CLR_1

Clear task 1.

enumerator NRF_GPIOTE_TASK_CLR_2

Clear task 2.

enumerator NRF_GPIOTE_TASK_CLR_3

Clear task 3.

enumerator NRF_GPIOTE_TASK_CLR_4

Clear task 4.

enumerator NRF_GPIOTE_TASK_CLR_5

Clear task 5.

enumerator NRF_GPIOTE_TASK_CLR_6

Clear task 6.

enumerator NRF_GPIOTE_TASK_CLR_7

Clear task 7.

enum nrf_gpiote_event_t

GPIOTE events.

Values:

enumerator NRF_GPIOTE_EVENT_IN_0

In event 0.

enumerator NRF_GPIOTE_EVENT_IN_1

In event 1.

enumerator NRF_GPIOTE_EVENT_IN_2

In event 2.

enumerator NRF_GPIOTE_EVENT_IN_3

In event 3.

enumerator NRF_GPIOTE_EVENT_IN_4

In event 4.

enumerator NRF_GPIOTE_EVENT_IN_5

In event 5.

enumerator NRF_GPIOTE_EVENT_IN_6

In event 6.

enumerator NRF_GPIOTE_EVENT_IN_7

In event 7.

enumerator NRF_GPIOTE_EVENT_PORT

Port event.

enum nrf_gpiote_int_t

GPIOTE interrupts.

Values:

enumerator NRF_GPIOTE_INT_IN0_MASK

GPIOTE interrupt from IN0.

enumerator NRF_GPIOTE_INT_IN1_MASK

GPIOTE interrupt from IN1.

enumerator NRF_GPIOTE_INT_IN2_MASK

GPIOTE interrupt from IN2.

enumerator NRF_GPIOTE_INT_IN3_MASK

GPIOTE interrupt from IN3.

enumerator NRF_GPIOTE_INT_IN4_MASK

GPIOTE interrupt from IN4.

enumerator NRF_GPIOTE_INT_IN5_MASK

GPIOTE interrupt from IN5.

enumerator NRF_GPIOTE_INT_IN6_MASK

GPIOTE interrupt from IN6.

enumerator NRF_GPIOTE_INT_IN7_MASK

GPIOTE interrupt from IN7.

enumerator NRF_GPIOTE_INT_PORT_MASK

GPIOTE interrupt from PORT event.

Functions

NRF_STATIC_INLINE void nrf_gpiote_task_trigger(NRF_GPIOTE_Type *p_reg, nrf_gpiote_task_t task)

Function for activating the specified GPIOTE task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task.

NRF_STATIC_INLINE uint32_t nrf_gpiote_task_address_get(NRF_GPIOTE_Type const *p_reg, nrf_gpiote_task_t task)

Function for getting the address of the specified GPIOTE task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task.

Returns:

Address of the specified task.

NRF_STATIC_INLINE bool nrf_gpiote_event_check(NRF_GPIOTE_Type const *p_reg, nrf_gpiote_event_t event)

Function for getting the state of the specified GPIOTE event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event.

Return values:
  • true – The event is set.

  • false – The event is not set.

NRF_STATIC_INLINE void nrf_gpiote_event_clear(NRF_GPIOTE_Type *p_reg, nrf_gpiote_event_t event)

Function for clearing the specified GPIOTE event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event.

NRF_STATIC_INLINE uint32_t nrf_gpiote_event_address_get(NRF_GPIOTE_Type const *p_reg, nrf_gpiote_event_t event)

Function for getting the address of the specified GPIOTE event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event.

Returns:

Address of the specified event.

NRF_STATIC_INLINE void nrf_gpiote_int_enable(NRF_GPIOTE_Type *p_reg, uint32_t mask)

Function for enabling interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be enabled. Use nrf_gpiote_int_t values for bit masking.

NRF_STATIC_INLINE void nrf_gpiote_int_disable(NRF_GPIOTE_Type *p_reg, uint32_t mask)

Function for disabling interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be disabled. Use nrf_gpiote_int_t values for bit masking.

NRF_STATIC_INLINE uint32_t nrf_gpiote_int_enable_check(NRF_GPIOTE_Type const *p_reg, uint32_t mask)

Function for checking if the specified interrupts are enabled.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be checked. Use nrf_gpiote_int_t values for bit masking.

Returns:

Mask of enabled interrupts.

NRF_STATIC_INLINE void nrf_gpiote_int_group_enable(NRF_GPIOTE_Type *p_reg, uint8_t group_idx, uint32_t mask)

Function for enabling interrupts in the specified group.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • group_idx[in] Index of interrupt group to be enabled.

  • mask[in] Mask of interrupts to be enabled. Use nrf_gpiote_int_t values for bit masking.

NRF_STATIC_INLINE void nrf_gpiote_int_group_disable(NRF_GPIOTE_Type *p_reg, uint8_t group_idx, uint32_t mask)

Function for disabling interrupts in the specified group.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • group_idx[in] Index of interrupt group to be disabled.

  • mask[in] Mask of interrupts to be disabled. Use nrf_gpiote_int_t values for bit masking.

NRF_STATIC_INLINE uint32_t nrf_gpiote_int_group_enable_check(NRF_GPIOTE_Type const *p_reg, uint8_t group_idx, uint32_t mask)

Function for checking if the specified interrupts from a given group are enabled.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • group_idx[in] Index of interrupt group to be checked.

  • mask[in] Mask of interrupts to be checked. Use nrf_gpiote_int_t values for bit masking.

Returns:

Mask of enabled interrupts.

NRF_STATIC_INLINE void nrf_gpiote_subscribe_set(NRF_GPIOTE_Type *p_reg, nrf_gpiote_task_t task, uint8_t channel)

Function for setting the subscribe configuration for a given GPIOTE task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task for which to set the configuration.

  • channel[in] Channel through which to subscribe events.

NRF_STATIC_INLINE void nrf_gpiote_subscribe_clear(NRF_GPIOTE_Type *p_reg, nrf_gpiote_task_t task)

Function for clearing the subscribe configuration for a given GPIOTE task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task for which to clear the configuration.

NRF_STATIC_INLINE void nrf_gpiote_publish_set(NRF_GPIOTE_Type *p_reg, nrf_gpiote_event_t event, uint8_t channel)

Function for setting the publish configuration for a given GPIOTE event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event for which to set the configuration.

  • channel[in] Channel through which to publish the event.

NRF_STATIC_INLINE void nrf_gpiote_publish_clear(NRF_GPIOTE_Type *p_reg, nrf_gpiote_event_t event)

Function for clearing the publish configuration for a given GPIOTE event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event for which to clear the configuration.

NRF_STATIC_INLINE void nrf_gpiote_event_enable(NRF_GPIOTE_Type *p_reg, uint32_t idx)

Function for enabling a GPIOTE event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • idx[in] Task-Event index.

NRF_STATIC_INLINE void nrf_gpiote_event_disable(NRF_GPIOTE_Type *p_reg, uint32_t idx)

Function for disabling a GPIOTE event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • idx[in] Task-Event index.

NRF_STATIC_INLINE void nrf_gpiote_event_configure(NRF_GPIOTE_Type *p_reg, uint32_t idx, uint32_t pin, nrf_gpiote_polarity_t polarity)

Function for configuring a GPIOTE event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • idx[in] Task-Event index.

  • pin[in] Pin associated with event.

  • polarity[in] Transition that should generate an event.

NRF_STATIC_INLINE uint32_t nrf_gpiote_event_pin_get(NRF_GPIOTE_Type const *p_reg, uint32_t idx)

Function for getting the pin associated with a GPIOTE event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • idx[in] Task-Event index.

Returns:

Pin number.

NRF_STATIC_INLINE nrf_gpiote_polarity_t nrf_gpiote_event_polarity_get(NRF_GPIOTE_Type const *p_reg, uint32_t idx)

Function for getting the polarity associated with a GPIOTE event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • idx[in] Task-Event index.

Returns:

Polarity.

NRF_STATIC_INLINE void nrf_gpiote_task_enable(NRF_GPIOTE_Type *p_reg, uint32_t idx)

Function for enabling a GPIOTE task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • idx[in] Task-Event index.

NRF_STATIC_INLINE void nrf_gpiote_task_disable(NRF_GPIOTE_Type *p_reg, uint32_t idx)

Function for disabling a GPIOTE task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • idx[in] Task-Event index.

NRF_STATIC_INLINE void nrf_gpiote_task_configure(NRF_GPIOTE_Type *p_reg, uint32_t idx, uint32_t pin, nrf_gpiote_polarity_t polarity, nrf_gpiote_outinit_t init_val)

Function for configuring a GPIOTE task.

Note

Function is not configuring mode field so task is disabled after this function is called.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • idx[in] Task-Event index.

  • pin[in] Pin associated with event.

  • polarity[in] Transition that should generate an event.

  • init_val[in] Initial value of the pin.

NRF_STATIC_INLINE void nrf_gpiote_task_force(NRF_GPIOTE_Type *p_reg, uint32_t idx, nrf_gpiote_outinit_t init_val)

Function for forcing the specified state on the pin connected to GPIOTE.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • idx[in] Task-Event index.

  • init_val[in] Pin state.

NRF_STATIC_INLINE void nrf_gpiote_te_default(NRF_GPIOTE_Type *p_reg, uint32_t idx)

Function for resetting a GPIOTE task event configuration to the default state.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • idx[in] Task-Event index.

NRF_STATIC_INLINE bool nrf_gpiote_te_is_enabled(NRF_GPIOTE_Type const *p_reg, uint32_t idx)

Function for checking if particular Task-Event is enabled.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • idx[in] Task-Event index.

Return values:
  • true – The Task-Event mode is set to Task or Event.

  • false – The Task-Event mode is set to Disabled.

NRF_STATIC_INLINE nrf_gpiote_task_t nrf_gpiote_out_task_get(uint8_t index)

Function for getting the OUT task associated with the specified GPIOTE channel.

Parameters:
  • index[in] Channel index.

Returns:

Requested OUT task.

NRF_STATIC_INLINE nrf_gpiote_task_t nrf_gpiote_set_task_get(uint8_t index)

Function for getting the SET task associated with the specified GPIOTE channel.

Parameters:
  • index[in] Channel index.

Returns:

Requested SET task.

NRF_STATIC_INLINE nrf_gpiote_task_t nrf_gpiote_clr_task_get(uint8_t index)

Function for getting the CLR task associated with the specified GPIOTE channel.

Parameters:
  • index[in] Channel index.

Returns:

Requested CLR task.

NRF_STATIC_INLINE nrf_gpiote_event_t nrf_gpiote_in_event_get(uint8_t index)

Function for getting the IN event associated with the specified GPIOTE channel.

Parameters:
  • index[in] Channel index.

Returns:

Requested IN event.

NRF_STATIC_INLINE void nrf_gpiote_latency_set(NRF_GPIOTE_Type *p_reg, nrf_gpiote_latency_t latency)

Function for setting the latency setting.

Note

Available for event mode with rising or falling edge detection on the pin. Toggle task mode can only be used with low latency setting.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • latency[in] Latency setting to be set.

NRF_STATIC_INLINE nrf_gpiote_latency_t nrf_gpiote_latency_get(NRF_GPIOTE_Type const *p_reg)

Function for retrieving the latency setting.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Latency setting.