PPI driver¶
-
group
nrfx_ppi
Programmable Peripheral Interconnect (PPI) allocator.
Defines
-
NRFX_PPI_ALL_APP_CHANNELS_MASK
¶ Bitfield representing all PPI channels available to the application.
-
NRFX_PPI_PROG_APP_CHANNELS_MASK
¶ Bitfield representing programmable PPI channels available to the application.
-
NRFX_PPI_ALL_APP_GROUPS_MASK
¶ Bitfield representing all PPI groups available to the application.
Functions
-
void
nrfx_ppi_free_all
(void)¶ Function for uninitializing the PPI module.
This function disables all channels and clears the channel groups.
-
nrfx_err_t
nrfx_ppi_channel_alloc
(nrf_ppi_channel_t *p_channel)¶ Function for allocating a PPI channel.
This function allocates the first unused PPI channel.
Note
To ensure the thread safety of the operation, this function uses the NRFX_CRITICAL_SECTION_ENTER and NRFX_CRITICAL_SECTION_EXIT macros. No further synchronization mechanism is needed, provided the macros are properly implemented (see nrfx_glue.h).
- Parameters
p_channel – [out] Pointer to the PPI channel that has been allocated.
- Returns NRFX_SUCCESS
The channel was successfully allocated.
- Returns NRFX_ERROR_NO_MEM
There is no available channel to be used.
-
nrfx_err_t
nrfx_ppi_channel_free
(nrf_ppi_channel_t channel)¶ Function for freeing a PPI channel.
This function also disables the chosen channel.
Note
To ensure the thread safety of the operation, this function uses the NRFX_CRITICAL_SECTION_ENTER and NRFX_CRITICAL_SECTION_EXIT macros. No further synchronization mechanism is needed, provided the macros are properly implemented (see nrfx_glue.h).
- Parameters
channel – [in] PPI channel to be freed.
- Returns NRFX_SUCCESS
The channel was successfully freed.
- Returns NRFX_ERROR_INVALID_PARAM
The channel is not user-configurable.
-
nrfx_err_t
nrfx_ppi_channel_assign
(nrf_ppi_channel_t channel, uint32_t eep, uint32_t tep)¶ Function for assigning task and event endpoints to the PPI channel.
- Parameters
channel – [in] PPI channel to be assigned endpoints.
eep – [in] Event endpoint address.
tep – [in] Task endpoint address.
- Returns NRFX_SUCCESS
The channel was successfully assigned.
- Returns NRFX_ERROR_INVALID_STATE
The channel is not allocated for the user.
- Returns NRFX_ERROR_INVALID_PARAM
The channel is not user-configurable.
-
nrfx_err_t
nrfx_ppi_channel_fork_assign
(nrf_ppi_channel_t channel, uint32_t fork_tep)¶ Function for assigning fork endpoint to the PPI channel or clearing it.
- Parameters
channel – [in] PPI channel to be assigned endpoints.
fork_tep – [in] Fork task endpoint address or 0 to clear.
- Returns NRFX_SUCCESS
The channel was successfully assigned.
- Returns NRFX_ERROR_INVALID_STATE
The channel is not allocated for the user.
- Returns NRFX_ERROR_NOT_SUPPORTED
Function is not supported.
-
nrfx_err_t
nrfx_ppi_channel_enable
(nrf_ppi_channel_t channel)¶ Function for enabling a PPI channel.
- Parameters
channel – [in] PPI channel to be enabled.
- Returns NRFX_SUCCESS
The channel was successfully enabled.
- Returns NRFX_ERROR_INVALID_STATE
The user-configurable channel is not allocated.
- Returns NRFX_ERROR_INVALID_PARAM
The channel cannot be enabled by the user.
-
nrfx_err_t
nrfx_ppi_channel_disable
(nrf_ppi_channel_t channel)¶ Function for disabling a PPI channel.
- Parameters
channel – [in] PPI channel to be disabled.
- Returns NRFX_SUCCESS
The channel was successfully disabled.
- Returns NRFX_ERROR_INVALID_STATE
The user-configurable channel is not allocated.
- Returns NRFX_ERROR_INVALID_PARAM
The channel cannot be disabled by the user.
-
nrfx_err_t
nrfx_ppi_group_alloc
(nrf_ppi_channel_group_t *p_group)¶ Function for allocating a PPI channel group.
This function allocates the first unused PPI group.
Note
To ensure the thread safety of the operation, this function uses the NRFX_CRITICAL_SECTION_ENTER and NRFX_CRITICAL_SECTION_EXIT macros. No further synchronization mechanism is needed, provided the macros are properly implemented (see nrfx_glue.h).
- Parameters
p_group – [out] Pointer to the PPI channel group that has been allocated.
- Returns NRFX_SUCCESS
The channel group was successfully allocated.
- Returns NRFX_ERROR_NO_MEM
There is no available channel group to be used.
-
nrfx_err_t
nrfx_ppi_group_free
(nrf_ppi_channel_group_t group)¶ Function for freeing a PPI channel group.
This function also disables the chosen group.
Note
To ensure the thread safety of the operation, this function uses the NRFX_CRITICAL_SECTION_ENTER and NRFX_CRITICAL_SECTION_EXIT macros. No further synchronization mechanism is needed, provided the macros are properly implemented (see nrfx_glue.h).
- Parameters
group – [in] PPI channel group to be freed.
- Returns NRFX_SUCCESS
The channel group was successfully freed.
- Returns NRFX_ERROR_INVALID_PARAM
The channel group is not user-configurable.
-
NRFX_STATIC_INLINE uint32_t
nrfx_ppi_channel_to_mask
(nrf_ppi_channel_t channel)¶ Compute a channel mask for NRF_PPI registers.
- Parameters
channel – [in] Channel number to transform to a mask.
- Returns
Channel mask.
-
nrfx_err_t
nrfx_ppi_channels_include_in_group
(uint32_t channel_mask, nrf_ppi_channel_group_t group)¶ Function for including multiple PPI channels in a channel group.
- Parameters
channel_mask – [in] PPI channels to be added.
group – [in] Channel group in which to include the channels.
- Returns NRFX_SUCCESS
The channels was successfully included.
- Returns NRFX_ERROR_INVALID_PARAM
Group is not an application group or channels are not an application channels.
- Returns NRFX_ERROR_INVALID_STATE
Group is not an allocated group.
-
NRFX_STATIC_INLINE nrfx_err_t
nrfx_ppi_channel_include_in_group
(nrf_ppi_channel_t channel, nrf_ppi_channel_group_t group)¶ Function for including a PPI channel in a channel group.
- Parameters
channel – [in] PPI channel to be added.
group – [in] Channel group in which to include the channel.
- Returns NRFX_SUCCESS
The channel was successfully included.
- Returns NRFX_ERROR_INVALID_PARAM
Group is not an application group or channel is not an application channel.
- Returns NRFX_ERROR_INVALID_STATE
Group is not an allocated group.
-
nrfx_err_t
nrfx_ppi_channels_remove_from_group
(uint32_t channel_mask, nrf_ppi_channel_group_t group)¶ Function for removing multiple PPI channels from a channel group.
- Parameters
channel_mask – [in] PPI channels to be removed.
group – [in] Channel group from which to remove the channels.
- Returns NRFX_SUCCESS
The channel was successfully removed.
- Returns NRFX_ERROR_INVALID_PARAM
Group is not an application group or channels are not an application channels.
- Returns NRFX_ERROR_INVALID_STATE
Group is not an allocated group.
-
NRFX_STATIC_INLINE nrfx_err_t
nrfx_ppi_channel_remove_from_group
(nrf_ppi_channel_t channel, nrf_ppi_channel_group_t group)¶ Function for removing a single PPI channel from a channel group.
- Parameters
channel – [in] PPI channel to be removed.
group – [in] Channel group from which to remove the channel.
- Returns NRFX_SUCCESS
The channel was successfully removed.
- Returns NRFX_ERROR_INVALID_PARAM
Group is not an application group or channel is not an application channel.
- Returns NRFX_ERROR_INVALID_STATE
Group is not an allocated group.
-
NRFX_STATIC_INLINE nrfx_err_t
nrfx_ppi_group_clear
(nrf_ppi_channel_group_t group)¶ Function for clearing a PPI channel group.
- Parameters
group – [in] Channel group to be cleared.
- Returns NRFX_SUCCESS
The group was successfully cleared.
- Returns NRFX_ERROR_INVALID_PARAM
Group is not an application group.
- Returns NRFX_ERROR_INVALID_STATE
Group is not an allocated group.
-
nrfx_err_t
nrfx_ppi_group_enable
(nrf_ppi_channel_group_t group)¶ Function for enabling a PPI channel group.
- Parameters
group – [in] Channel group to be enabled.
- Returns NRFX_SUCCESS
The group was successfully enabled.
- Returns NRFX_ERROR_INVALID_PARAM
Group is not an application group.
- Returns NRFX_ERROR_INVALID_STATE
Group is not an allocated group.
-
nrfx_err_t
nrfx_ppi_group_disable
(nrf_ppi_channel_group_t group)¶ Function for disabling a PPI channel group.
- Parameters
group – [in] Channel group to be disabled.
- Returns NRFX_SUCCESS
The group was successfully disabled.
- Returns NRFX_ERROR_INVALID_PARAM
Group is not an application group.
- Returns NRFX_ERROR_INVALID_STATE
Group is not an allocated group.
-
NRFX_STATIC_INLINE uint32_t
nrfx_ppi_task_addr_get
(nrf_ppi_task_t task)¶ Function for getting the address of a PPI task.
- Parameters
task – [in] Task.
- Returns
Task address.
-
NRFX_STATIC_INLINE uint32_t
nrfx_ppi_task_addr_group_enable_get
(nrf_ppi_channel_group_t group)¶ Function for getting the address of the enable task of a PPI group.
- Parameters
group – [in] PPI channel group
- Returns
Task address.
-
NRFX_STATIC_INLINE uint32_t
nrfx_ppi_task_addr_group_disable_get
(nrf_ppi_channel_group_t group)¶ Function for getting the address of the enable task of a PPI group.
- Parameters
group – [in] PPI channel group
- Returns
Task address.
-