Skip to content

Commit e6cc748

Browse files
committed
[nrf fromlist] samples: subsys: usb: implicit_feedback: Use new GPPI API
Convert to use the new GPPI API. Upstream PR #: 98327 Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 4007b3a commit e6cc748

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

samples/subsys/usb/uac2_implicit_feedback/src/feedback_nrf.c

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#include <stdlib.h>
88
#include <zephyr/logging/log.h>
99
#include "feedback.h"
10-
11-
#include <nrfx_dppi.h>
1210
#include <nrfx_timer.h>
1311
#include <helpers/nrfx_gppi.h>
1412

@@ -78,8 +76,8 @@ static struct feedback_ctx {
7876
struct feedback_ctx *feedback_init(void)
7977
{
8078
nrfx_err_t err;
81-
uint8_t usbd_sof_gppi_channel;
82-
uint8_t i2s_framestart_gppi_channel;
79+
nrfx_gppi_handle_t usbd_sof_gppi_handle;
80+
uint8_t i2s_framestart_gppi_handle;
8381
const nrfx_timer_config_t cfg = {
8482
.frequency = NRFX_MHZ_TO_HZ(16UL),
8583
.mode = NRF_TIMER_MODE_TIMER,
@@ -99,35 +97,31 @@ struct feedback_ctx *feedback_init(void)
9997
}
10098

10199
/* Subscribe TIMER CAPTURE task to USBD SOF event */
102-
err = nrfx_gppi_channel_alloc(&usbd_sof_gppi_channel);
103-
if (err != NRFX_SUCCESS) {
104-
LOG_ERR("gppi_channel_alloc failed with: %d\n", err);
100+
rv = nrfx_gppi_conn_alloc(USB_SOF_EVENT_ADDRESS,
101+
nrfx_timer_capture_task_address_get(&feedback_timer_instance,
102+
FEEDBACK_TIMER_USBD_SOF_CAPTURE),
103+
&usbd_sof_gppi_handle);
104+
if (rv < 0) {
105+
LOG_ERR("gppi_channel_alloc failed with: %d\n", rv);
105106
return &fb_ctx;
106107
}
107108

108-
nrfx_gppi_channel_endpoints_setup(usbd_sof_gppi_channel,
109-
USB_SOF_EVENT_ADDRESS,
110-
nrfx_timer_capture_task_address_get(&feedback_timer_instance,
111-
FEEDBACK_TIMER_USBD_SOF_CAPTURE));
112-
nrfx_gppi_fork_endpoint_setup(usbd_sof_gppi_channel,
113-
nrfx_timer_task_address_get(&feedback_timer_instance,
114-
NRF_TIMER_TASK_CLEAR));
109+
nrfx_gppi_ep_attach(usbd_sof_gppi_handle,
110+
nrfx_timer_task_address_get(&feedback_timer_instance, NRF_TIMER_TASK_CLEAR));
115111

116-
nrfx_gppi_channels_enable(BIT(usbd_sof_gppi_channel));
112+
nrfx_gppi_conn_enable(usbd_sof_gppi_handle);
117113

118114
/* Subscribe TIMER CAPTURE task to I2S FRAMESTART event */
119-
err = nrfx_gppi_channel_alloc(&i2s_framestart_gppi_channel);
120-
if (err != NRFX_SUCCESS) {
121-
LOG_ERR("gppi_channel_alloc failed with: %d\n", err);
115+
rv = nrfx_gppi_conn_alloc(I2S_FRAMESTART_EVENT_ADDRESS,
116+
nrfx_timer_capture_task_address_get(&feedback_timer_instance,
117+
FEEDBACK_TIMER_I2S_FRAMESTART_CAPTURE),
118+
&i2s_framestart_gppi_handle);
119+
if (rv < 0) {
120+
LOG_ERR("gppi_conn_alloc failed with: %d\n", rv);
122121
return &fb_ctx;
123122
}
124123

125-
nrfx_gppi_channel_endpoints_setup(i2s_framestart_gppi_channel,
126-
I2S_FRAMESTART_EVENT_ADDRESS,
127-
nrfx_timer_capture_task_address_get(&feedback_timer_instance,
128-
FEEDBACK_TIMER_I2S_FRAMESTART_CAPTURE));
129-
130-
nrfx_gppi_channels_enable(BIT(i2s_framestart_gppi_channel));
124+
nrfx_gppi_conn_enable(i2s_framestart_gppi_handle);
131125

132126
/* Enable feedback timer */
133127
nrfx_timer_enable(&feedback_timer_instance);

0 commit comments

Comments
 (0)