nRF51 SDK - S110 SoftDevice
|
GPIOTE driver for managing input and output pins. More...
Data Structures | |
struct | nrf_drv_gpiote_in_config_t |
Input pin configuration. More... | |
struct | nrf_drv_gpiote_out_config_t |
Output pin configuration. More... | |
Macros | |
#define | 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 | 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 | 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 | GPIOTE_CONFIG_OUT_SIMPLE(init_high) |
Macro for configuring a pin to use as output. GPIOTE is not used for the pin. More... | |
#define | 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 | 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 | GPIOTE_CONFIG_OUT_TASK_TOGGLE(init_high) |
Macro for configuring a pin to use the GPIO OUT TASK to toggle the pin state. More... | |
Typedefs | |
typedef uint32_t | nrf_drv_gpiote_pin_t |
Pin. | |
typedef void(* | nrf_drv_gpiote_evt_handler_t )(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) |
Pin event handler prototype. More... | |
Functions | |
ret_code_t | nrf_drv_gpiote_init (void) |
Function for initializing the GPIOTE module. More... | |
bool | nrf_drv_gpiote_is_init (void) |
Function for checking if the GPIOTE module is initialized. More... | |
void | nrf_drv_gpiote_uninit (void) |
Function for uninitializing the GPIOTE module. | |
ret_code_t | nrf_drv_gpiote_out_init (nrf_drv_gpiote_pin_t pin, nrf_drv_gpiote_out_config_t *p_config) |
Function for initializing a GPIOTE output pin. More... | |
void | nrf_drv_gpiote_out_uninit (nrf_drv_gpiote_pin_t pin) |
Function for uninitializing a GPIOTE output pin. More... | |
void | nrf_drv_gpiote_out_set (nrf_drv_gpiote_pin_t pin) |
Function for setting a GPIOTE output pin. More... | |
void | nrf_drv_gpiote_out_clear (nrf_drv_gpiote_pin_t pin) |
Function for clearing a GPIOTE output pin. More... | |
void | nrf_drv_gpiote_out_toggle (nrf_drv_gpiote_pin_t pin) |
Function for toggling a GPIOTE output pin. More... | |
void | nrf_drv_gpiote_out_task_enable (nrf_drv_gpiote_pin_t pin) |
Function for enabling a GPIOTE output pin task. More... | |
void | nrf_drv_gpiote_out_task_disable (nrf_drv_gpiote_pin_t pin) |
Function for disabling a GPIOTE output pin task. More... | |
uint32_t | nrf_drv_gpiote_out_task_addr_get (nrf_drv_gpiote_pin_t pin) |
Function for getting the address of a configurable GPIOTE task. More... | |
ret_code_t | nrf_drv_gpiote_in_init (nrf_drv_gpiote_pin_t pin, nrf_drv_gpiote_in_config_t *p_config, nrf_drv_gpiote_evt_handler_t evt_handler) |
Function for initializing a GPIOTE input pin. More... | |
void | nrf_drv_gpiote_in_uninit (nrf_drv_gpiote_pin_t pin) |
Function for uninitializing a GPIOTE input pin. More... | |
void | nrf_drv_gpiote_in_event_enable (nrf_drv_gpiote_pin_t pin, bool int_enable) |
Function for enabling sensing of a GPIOTE input pin. More... | |
void | nrf_drv_gpiote_in_event_disable (nrf_drv_gpiote_pin_t pin) |
Function for disabling a GPIOTE input pin. More... | |
bool | nrf_drv_gpiote_in_is_set (nrf_drv_gpiote_pin_t pin) |
Function for checking if a GPIOTE input pin is set. More... | |
uint32_t | nrf_drv_gpiote_in_event_addr_get (nrf_drv_gpiote_pin_t pin) |
Function for getting the address of a GPIOTE input pin event. More... | |
void | nrf_drv_gpiote_out_task_force (nrf_drv_gpiote_pin_t pin, uint8_t state) |
Function for forcing a specific state on the pin configured as task. More... | |
void | nrf_drv_gpiote_out_task_trigger (nrf_drv_gpiote_pin_t pin) |
Function for triggering the task manually. More... | |
GPIOTE driver for managing input and output pins.
#define 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.
Set hi_accu to true to use IN_EVENT.
#define 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.
Set hi_accu to true to use IN_EVENT.
#define 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.
Set hi_accu to true to use IN_EVENT.
#define GPIOTE_CONFIG_OUT_SIMPLE | ( | init_high | ) |
Macro for configuring a pin to use as output. GPIOTE is not used for the pin.
#define GPIOTE_CONFIG_OUT_TASK_HIGH |
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.
#define GPIOTE_CONFIG_OUT_TASK_LOW |
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.
#define GPIOTE_CONFIG_OUT_TASK_TOGGLE | ( | init_high | ) |
Macro for configuring a pin to use the GPIO OUT TASK to toggle the pin state.
The initial pin state must be provided.
typedef void(* nrf_drv_gpiote_evt_handler_t)(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) |
Pin event handler prototype.
pin | Pin that triggered this event. |
action | Action that lead to triggering this event. |
uint32_t nrf_drv_gpiote_in_event_addr_get | ( | nrf_drv_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] | pin | Pin. |
void nrf_drv_gpiote_in_event_disable | ( | nrf_drv_gpiote_pin_t | pin | ) |
Function for disabling a GPIOTE input pin.
[in] | pin | Pin. |
void nrf_drv_gpiote_in_event_enable | ( | nrf_drv_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. Note that a PORT event is shared between multiple pins, therefore the interrupt is always enabled.
[in] | pin | Pin. |
[in] | int_enable | True to enable the interrupt. Always valid for a high-accuracy pin. |
ret_code_t nrf_drv_gpiote_in_init | ( | nrf_drv_gpiote_pin_t | pin, |
nrf_drv_gpiote_in_config_t * | p_config, | ||
nrf_drv_gpiote_evt_handler_t | evt_handler | ||
) |
Function for initializing a GPIOTE input pin.
The input pin can act in two ways:
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] | pin | Pin. |
[in] | p_config | Initial configuration. |
[in] | evt_handler | User function to be called when the configured transition occurs. |
NRF_SUCCESS | If initialization was successful. |
NRF_ERROR_INVALID_STATE | If the driver is not initialized or the pin is already used. |
NRF_ERROR_NO_MEM | If no GPIOTE channel is available. |
bool nrf_drv_gpiote_in_is_set | ( | nrf_drv_gpiote_pin_t | pin | ) |
Function for checking if a GPIOTE input pin is set.
[in] | pin | Pin. |
true | If the input pin is set. |
false | If the input pin is not set. |
void nrf_drv_gpiote_in_uninit | ( | nrf_drv_gpiote_pin_t | pin | ) |
Function for uninitializing a GPIOTE input pin.
The driver frees the GPIOTE channel if the input pin was using one.
[in] | pin | Pin. |
ret_code_t nrf_drv_gpiote_init | ( | void | ) |
Function for initializing the GPIOTE module.
Only static configuration is supported to prevent the shared resource being customized by the initiator.
NRF_SUCCESS | If initialization was successful. |
NRF_ERROR_INVALID_STATE | If the driver was already initialized. |
bool nrf_drv_gpiote_is_init | ( | void | ) |
Function for checking if the GPIOTE module is initialized.
The GPIOTE module is a shared module. Therefore, you should check if the module is already initialized and skip initialization if it is.
true | If the module is already initialized. |
false | If the module is not initialized. |
void nrf_drv_gpiote_out_clear | ( | nrf_drv_gpiote_pin_t | pin | ) |
Function for clearing a GPIOTE output pin.
[in] | pin | Pin. |
ret_code_t nrf_drv_gpiote_out_init | ( | nrf_drv_gpiote_pin_t | pin, |
nrf_drv_gpiote_out_config_t * | 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.
[in] | pin | Pin. |
[in] | p_config | Initial configuration. |
NRF_SUCCESS | If initialization was successful. |
NRF_ERROR_INVALID_STATE | If the driver is not initialized or the pin is already used. |
NRF_ERROR_NO_MEM | If no GPIOTE channel is available. |
void nrf_drv_gpiote_out_set | ( | nrf_drv_gpiote_pin_t | pin | ) |
Function for setting a GPIOTE output pin.
[in] | pin | Pin. |
uint32_t nrf_drv_gpiote_out_task_addr_get | ( | nrf_drv_gpiote_pin_t | pin | ) |
Function for getting the address of a configurable GPIOTE task.
[in] | pin | Pin. |
void nrf_drv_gpiote_out_task_disable | ( | nrf_drv_gpiote_pin_t | pin | ) |
Function for disabling a GPIOTE output pin task.
[in] | pin | Pin. |
void nrf_drv_gpiote_out_task_enable | ( | nrf_drv_gpiote_pin_t | pin | ) |
Function for enabling a GPIOTE output pin task.
[in] | pin | Pin. |
void nrf_drv_gpiote_out_task_force | ( | nrf_drv_gpiote_pin_t | pin, |
uint8_t | state | ||
) |
Function for forcing a specific state on the pin configured as task.
[in] | pin | Pin. |
[in] | state | Pin state. |
void nrf_drv_gpiote_out_task_trigger | ( | nrf_drv_gpiote_pin_t | pin | ) |
Function for triggering the task manually.
[in] | pin | Pin. |
void nrf_drv_gpiote_out_toggle | ( | nrf_drv_gpiote_pin_t | pin | ) |
Function for toggling a GPIOTE output pin.
[in] | pin | Pin. |
void nrf_drv_gpiote_out_uninit | ( | nrf_drv_gpiote_pin_t | pin | ) |
Function for uninitializing a GPIOTE output pin.
The driver frees the GPIOTE channel if the output pin was using one.
[in] | pin | Pin. |