![]() |
nrfx 4.5.0
|
GPIO Task Event (GPIOTE) peripheral driver. More...
Topics | |
| GPIOTE peripheral driver configuration | |
Data Structures | |
| struct | nrfx_gpiote_handler_config_t |
| Structure for configuring a pin interrupt handler. More... | |
| struct | nrfx_gpiote_t |
| Data structure of the GPIO tasks and events (GPIOTE) driver instance. More... | |
| 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_trigger_config_t |
| Structure for configuring pin interrupt/event. More... | |
| struct | nrfx_gpiote_input_pin_config_t |
| Structure for configuring an input pin. More... | |
Macros | |
| #define | NRFX_GPIOTE_INSTANCE(reg) |
| Macro for creating an instance of the GPIOTE driver. | |
| #define | NRFX_GPIOTE_DEFAULT_OUTPUT_CONFIG |
| Output pin default configuration. | |
| #define | NRFX_GPIOTE_APP_CHANNELS_MASK(idx) |
| Bitfield representing all GPIOTE channels available to the application for the specified GPIOTE instance. | |
| #define | NRFX_GPIOTE_DEFAULT_PULL_CONFIG NRF_GPIO_PIN_NOPULL |
| Input pin pull default configuration. | |
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. | |
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 | |
| bool | nrfx_gpiote_in_is_set (nrfx_gpiote_pin_t pin) |
| Function for checking if a GPIOTE input pin is set. | |
| int | nrfx_gpiote_init (nrfx_gpiote_t *p_instance, uint8_t interrupt_priority) |
| Function for initializing the GPIOTE driver instance. | |
| bool | nrfx_gpiote_init_check (nrfx_gpiote_t const *p_instance) |
| Function for checking if the GPIOTE driver instance is initialized. | |
| void | nrfx_gpiote_uninit (nrfx_gpiote_t *p_instance) |
| Function for uninitializing the GPIOTE driver instance. | |
| int | nrfx_gpiote_channel_alloc (nrfx_gpiote_t *p_instance, uint8_t *p_channel) |
| Function for allocating a GPIOTE channel. | |
| int | nrfx_gpiote_channel_free (nrfx_gpiote_t *p_instance, uint8_t channel) |
| Function for freeing a GPIOTE channel. | |
| int | nrfx_gpiote_input_configure (nrfx_gpiote_t *p_instance, nrfx_gpiote_pin_t pin, nrfx_gpiote_input_pin_config_t const *p_config) |
| Function for configuring the specified input pin and input event/interrupt. | |
| int | nrfx_gpiote_output_configure (nrfx_gpiote_t *p_instance, 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. | |
| int | nrfx_gpiote_pin_uninit (nrfx_gpiote_t *p_instance, nrfx_gpiote_pin_t pin) |
| Function for deinitializing the specified pin. | |
| void | nrfx_gpiote_trigger_enable (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin, bool int_enable) |
| Function for enabling trigger for the given pin. | |
| void | nrfx_gpiote_trigger_disable (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for disabling trigger for the given pin. | |
| void | nrfx_gpiote_global_callback_set (nrfx_gpiote_t *p_instance, nrfx_gpiote_interrupt_handler_t handler, void *p_context) |
| Set global callback called for each event. | |
| int | nrfx_gpiote_channel_get (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin, uint8_t *p_channel) |
| Function for retrieving Task/Event channel index associated with the given pin. | |
| uint32_t | nrfx_gpiote_channels_number_get (nrfx_gpiote_t const *p_instance) |
| Function for retrieving number of channels for specified GPIOTE instance. | |
| void | nrfx_gpiote_out_set (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for setting a GPIOTE output pin. | |
| void | nrfx_gpiote_out_clear (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for clearing a GPIOTE output pin. | |
| void | nrfx_gpiote_out_toggle (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for toggling a GPIOTE output pin. | |
| void | nrfx_gpiote_out_task_enable (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for enabling a GPIOTE output pin task. | |
| void | nrfx_gpiote_out_task_disable (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for disabling a GPIOTE output pin task. | |
| nrf_gpiote_task_t | nrfx_gpiote_out_task_get (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for getting the OUT task for the specified output pin. | |
| uint32_t | nrfx_gpiote_out_task_address_get (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for getting the address of the OUT task for the specified output pin. | |
| nrf_gpiote_task_t | nrfx_gpiote_set_task_get (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for getting the SET task for the specified output pin. | |
| uint32_t | nrfx_gpiote_set_task_address_get (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for getting the address of the SET task for the specified output pin. | |
| nrf_gpiote_task_t | nrfx_gpiote_clr_task_get (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for getting the CLR task for the specified output pin. | |
| uint32_t | nrfx_gpiote_clr_task_address_get (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for getting the address of the CLR task for the specified output pin. | |
| nrf_gpiote_event_t | nrfx_gpiote_in_event_get (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for getting the GPIOTE event for the specified input pin. | |
| uint32_t | nrfx_gpiote_in_event_address_get (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for getting the address of a GPIOTE input pin event. | |
| void | nrfx_gpiote_out_task_force (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin, uint8_t state) |
| Function for forcing a specific state on the pin configured as task. | |
| void | nrfx_gpiote_out_task_trigger (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for triggering the task OUT manually. | |
| void | nrfx_gpiote_set_task_trigger (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for triggering the task SET manually. | |
| void | nrfx_gpiote_clr_task_trigger (nrfx_gpiote_t const *p_instance, nrfx_gpiote_pin_t pin) |
| Function for triggering the task CLR manually. | |
| NRFX_STATIC_INLINE void | nrfx_gpiote_latency_set (nrfx_gpiote_t const *p_instance, nrf_gpiote_latency_t latency) |
| Function for setting the latency mode for a given GPIOTE instance. | |
| NRFX_STATIC_INLINE nrf_gpiote_latency_t | nrfx_gpiote_latency_get (nrfx_gpiote_t const *p_instance) |
| Function for getting the latency mode for a given GPIOTE instance. | |
| void | nrfx_gpiote_irq_handler (nrfx_gpiote_t *p_instance) |
| Driver interrupt handler. | |
GPIO Task Event (GPIOTE) peripheral driver.
| #define NRFX_GPIOTE_APP_CHANNELS_MASK | ( | idx | ) |
Bitfield representing all GPIOTE channels available to the application for the specified GPIOTE instance.
| [in] | idx | GPIOTE instance index. |
| #define NRFX_GPIOTE_DEFAULT_OUTPUT_CONFIG |
Output pin default configuration.
| #define NRFX_GPIOTE_INSTANCE | ( | reg | ) |
Macro for creating an instance of the GPIOTE driver.
| typedef void(* nrfx_gpiote_interrupt_handler_t) (nrfx_gpiote_pin_t pin, nrfx_gpiote_trigger_t trigger, void *p_context) |
Pin interrupt handler prototype.
| [in] | pin | Pin that triggered this event. |
| [in] | trigger | Trigger that led to this event. |
| [in] | p_context | User context. |
Triggering options.
| int nrfx_gpiote_channel_alloc | ( | nrfx_gpiote_t * | p_instance, |
| 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.
| [in] | p_instance | Pointer to the driver instance structure. |
| [out] | p_channel | Pointer to the GPIOTE channel that has been allocated. |
| 0 | The channel was successfully allocated. |
| -ENOMEM | There is no available channel to be used. |
| int nrfx_gpiote_channel_free | ( | nrfx_gpiote_t * | p_instance, |
| uint8_t | channel ) |
Function for freeing a GPIOTE channel.
This function frees a GPIOTE channel that was allocated using nrfx_gpiote_channel_alloc.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | channel | GPIOTE channel to be freed. |
| 0 | The channel was successfully freed. |
| -EINVAL | The channel is not user-configurable. |
| int nrfx_gpiote_channel_get | ( | nrfx_gpiote_t const * | p_instance, |
| nrfx_gpiote_pin_t | pin, | ||
| uint8_t * | p_channel ) |
Function for retrieving Task/Event channel index associated with the given pin.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Absolute pin number. |
| [out] | p_channel | Location to write the channel index. |
| 0 | Channel successfully written. |
| -EINVAL | Pin is not configured or not using Task or Event. |
| uint32_t nrfx_gpiote_channels_number_get | ( | nrfx_gpiote_t const * | p_instance | ) |
Function for retrieving number of channels for specified GPIOTE instance.
| [in] | p_instance | Pointer to the driver instance structure. |
| uint32_t nrfx_gpiote_clr_task_address_get | ( | nrfx_gpiote_t const * | p_instance, |
| nrfx_gpiote_pin_t | pin ) |
Function for getting the address of the CLR task for the specified output pin.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| nrf_gpiote_task_t nrfx_gpiote_clr_task_get | ( | nrfx_gpiote_t const * | p_instance, |
| 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.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| void nrfx_gpiote_clr_task_trigger | ( | nrfx_gpiote_t const * | p_instance, |
| nrfx_gpiote_pin_t | pin ) |
Function for triggering the task CLR manually.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| void nrfx_gpiote_global_callback_set | ( | nrfx_gpiote_t * | p_instance, |
| nrfx_gpiote_interrupt_handler_t | handler, | ||
| void * | p_context ) |
Set global callback called for each event.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | handler | Global handler. Can be NULL. |
| [in] | p_context | Context passed to the handler. |
| uint32_t nrfx_gpiote_in_event_address_get | ( | nrfx_gpiote_t const * | p_instance, |
| 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.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| nrf_gpiote_event_t nrfx_gpiote_in_event_get | ( | nrfx_gpiote_t const * | p_instance, |
| 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.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| bool nrfx_gpiote_in_is_set | ( | nrfx_gpiote_pin_t | pin | ) |
Function for checking if a GPIOTE input pin is set.
| [in] | pin | Pin. |
| true | The input pin is set. |
| false | The input pin is not set. |
| int nrfx_gpiote_init | ( | nrfx_gpiote_t * | p_instance, |
| uint8_t | interrupt_priority ) |
Function for initializing the GPIOTE driver instance.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | interrupt_priority | Interrupt priority. |
| 0 | Initialization was successful. |
| -EALREADY | The driver is already initialized. |
| bool nrfx_gpiote_init_check | ( | nrfx_gpiote_t const * | p_instance | ) |
Function for checking if the GPIOTE driver instance is initialized.
The GPIOTE driver instance is a shared module. Therefore, check if the module is already initialized and skip initialization if it is.
| [in] | p_instance | Pointer to the driver instance structure. |
| true | The module is already initialized. |
| false | The module is not initialized. |
| int nrfx_gpiote_input_configure | ( | nrfx_gpiote_t * | p_instance, |
| nrfx_gpiote_pin_t | pin, | ||
| nrfx_gpiote_input_pin_config_t const * | p_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:
p_config->p_pull_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.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_config->p_pull_config is NULL to avoid reconfiguration of the pin.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Absolute pin number. |
| [in] | p_config | Pointer to the structure with input pin configuration. |
| 0 | Configuration was successful. |
| -EINVAL | Invalid configuration. |
| void nrfx_gpiote_irq_handler | ( | nrfx_gpiote_t * | p_instance | ) |
Driver interrupt handler.
| [in] | p_instance | Pointer to the driver instance structure. |
| NRFX_STATIC_INLINE nrf_gpiote_latency_t nrfx_gpiote_latency_get | ( | nrfx_gpiote_t const * | p_instance | ) |
Function for getting the latency mode for a given GPIOTE instance.
| [in] | p_instance | Pointer to the driver instance structure. |
| NRFX_STATIC_INLINE void nrfx_gpiote_latency_set | ( | nrfx_gpiote_t const * | p_instance, |
| nrf_gpiote_latency_t | latency ) |
Function for setting the latency mode for a given GPIOTE instance.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | latency | Latency mode to be set. |
| void nrfx_gpiote_out_clear | ( | nrfx_gpiote_t const * | p_instance, |
| nrfx_gpiote_pin_t | pin ) |
Function for clearing a GPIOTE output pin.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| void nrfx_gpiote_out_set | ( | nrfx_gpiote_t const * | p_instance, |
| nrfx_gpiote_pin_t | pin ) |
Function for setting a GPIOTE output pin.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| uint32_t nrfx_gpiote_out_task_address_get | ( | nrfx_gpiote_t const * | p_instance, |
| nrfx_gpiote_pin_t | pin ) |
Function for getting the address of the OUT task for the specified output pin.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| void nrfx_gpiote_out_task_disable | ( | nrfx_gpiote_t const * | p_instance, |
| nrfx_gpiote_pin_t | pin ) |
Function for disabling a GPIOTE output pin task.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| void nrfx_gpiote_out_task_enable | ( | nrfx_gpiote_t const * | p_instance, |
| nrfx_gpiote_pin_t | pin ) |
Function for enabling a GPIOTE output pin task.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| void nrfx_gpiote_out_task_force | ( | nrfx_gpiote_t const * | p_instance, |
| nrfx_gpiote_pin_t | pin, | ||
| uint8_t | state ) |
Function for forcing a specific state on the pin configured as task.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| [in] | state | Pin state. |
| nrf_gpiote_task_t nrfx_gpiote_out_task_get | ( | nrfx_gpiote_t const * | p_instance, |
| 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.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| void nrfx_gpiote_out_task_trigger | ( | nrfx_gpiote_t const * | p_instance, |
| nrfx_gpiote_pin_t | pin ) |
Function for triggering the task OUT manually.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| void nrfx_gpiote_out_toggle | ( | nrfx_gpiote_t const * | p_instance, |
| nrfx_gpiote_pin_t | pin ) |
Function for toggling a GPIOTE output pin.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| int nrfx_gpiote_output_configure | ( | nrfx_gpiote_t * | p_instance, |
| 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:
p_config.| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Absolute pin number. |
| [in] | p_config | Pin configuration. If NULL pin configuration is not applied. |
| [in] | p_task_config | GPIOTE task configuration. If NULL task is not used. |
| 0 | Configuration was successful. |
| -EINVAL | Invalid configuration. |
| int nrfx_gpiote_pin_uninit | ( | nrfx_gpiote_t * | p_instance, |
| nrfx_gpiote_pin_t | pin ) |
Function for deinitializing the specified pin.
Specified pin and associated GPIOTE channel are restored to the default configuration.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Absolute pin number. |
| 0 | Uninitialization was successful. |
| -EINVAL | Pin not used by the driver. |
| uint32_t nrfx_gpiote_set_task_address_get | ( | nrfx_gpiote_t const * | p_instance, |
| nrfx_gpiote_pin_t | pin ) |
Function for getting the address of the SET task for the specified output pin.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| nrf_gpiote_task_t nrfx_gpiote_set_task_get | ( | nrfx_gpiote_t const * | p_instance, |
| 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.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| void nrfx_gpiote_set_task_trigger | ( | nrfx_gpiote_t const * | p_instance, |
| nrfx_gpiote_pin_t | pin ) |
Function for triggering the task SET manually.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Pin number. |
| void nrfx_gpiote_trigger_disable | ( | nrfx_gpiote_t const * | p_instance, |
| nrfx_gpiote_pin_t | pin ) |
Function for disabling trigger for the given pin.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Absolute pin number. |
| void nrfx_gpiote_trigger_enable | ( | nrfx_gpiote_t const * | p_instance, |
| 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.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | pin | Absolute pin number. |
| [in] | int_enable | True to enable the interrupt. Must be true when sensing is used. |
| void nrfx_gpiote_uninit | ( | nrfx_gpiote_t * | p_instance | ) |
Function for uninitializing the GPIOTE driver instance.
| [in] | p_instance | Pointer to the driver instance structure. |