Skip to content

Commit af54df3

Browse files
committed
[nrf fromlist] samples: uac2_explicit_feedback: align to nrfx_gpiote with extracted cb
GPIOTE driver instances are no longer defined within nrfx. Upstream PR #: 98527 Signed-off-by: Nikodem Kastelik <[email protected]>
1 parent 8e10cd4 commit af54df3

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include <nrfx_dppi.h>
1212
#include <nrfx_gpiote.h>
13+
#include <gpiote_nrfx.h>
1314
#include <nrfx_timer.h>
1415
#include <hal/nrf_gpio.h>
1516
#include <helpers/nrfx_gppi.h>
@@ -60,8 +61,7 @@ static inline void feedback_target_init(void)
6061
#error "Unsupported target"
6162
#endif
6263

63-
static const nrfx_gpiote_t gpiote =
64-
NRFX_GPIOTE_INSTANCE(FEEDBACK_GPIOTE_INSTANCE_NUMBER);
64+
#define FEEDBACK_GPIOTE_NODE DT_NODELABEL(UTIL_CAT(gpiote, FEEDBACK_GPIOTE_INSTANCE_NUMBER))
6565

6666
static nrfx_timer_t feedback_timer_instance =
6767
NRFX_TIMER_INSTANCE(NRF_TIMER_INST_GET(FEEDBACK_TIMER_INSTANCE_NUMBER));
@@ -123,6 +123,7 @@ static nrfx_err_t feedback_edge_counter_setup(void)
123123
nrfx_err_t err;
124124
uint8_t feedback_gpiote_channel;
125125
uint8_t feedback_gppi_channel;
126+
nrfx_gpiote_t *gpiote = &GPIOTE_NRFX_INST_BY_NODE(FEEDBACK_GPIOTE_NODE);
126127
nrfx_gpiote_trigger_config_t trigger_config = {
127128
.trigger = NRFX_GPIOTE_TRIGGER_TOGGLE,
128129
.p_in_channel = &feedback_gpiote_channel,
@@ -133,13 +134,13 @@ static nrfx_err_t feedback_edge_counter_setup(void)
133134
.p_trigger_config = &trigger_config,
134135
};
135136

136-
err = nrfx_gpiote_channel_alloc(&gpiote, &feedback_gpiote_channel);
137-
if (err != NRFX_SUCCESS) {
138-
return err;
137+
err = nrfx_gpiote_channel_alloc(gpiote, &feedback_gpiote_channel);
138+
if (err != 0) {
139+
return NRFX_ERROR_NO_MEM;
139140
}
140141

141-
nrfx_gpiote_input_configure(&gpiote, FEEDBACK_PIN, &input_pin_config);
142-
nrfx_gpiote_trigger_enable(&gpiote, FEEDBACK_PIN, false);
142+
nrfx_gpiote_input_configure(gpiote, FEEDBACK_PIN, &input_pin_config);
143+
nrfx_gpiote_trigger_enable(gpiote, FEEDBACK_PIN, false);
143144

144145
/* Configure TIMER in COUNTER mode */
145146
const nrfx_timer_config_t cfg = {
@@ -164,7 +165,7 @@ static nrfx_err_t feedback_edge_counter_setup(void)
164165
}
165166

166167
nrfx_gppi_channel_endpoints_setup(feedback_gppi_channel,
167-
nrfx_gpiote_in_event_address_get(&gpiote, FEEDBACK_PIN),
168+
nrfx_gpiote_in_event_address_get(gpiote, FEEDBACK_PIN),
168169
nrfx_timer_task_address_get(&feedback_timer_instance, NRF_TIMER_TASK_COUNT));
169170

170171
nrfx_gppi_channels_enable(BIT(feedback_gppi_channel));

0 commit comments

Comments
 (0)