Skip to content

Commit 4543515

Browse files
committed
[nrf fromlist] samples: boards: nordic: nrfx: Align to the new GPPI API
Align use of GPPI API. Upstream PR #: 98327 Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent d8df561 commit 4543515

File tree

1 file changed

+8
-12
lines changed
  • samples/boards/nordic/nrfx/src

1 file changed

+8
-12
lines changed

samples/boards/nordic/nrfx/src/main.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ int main(void)
3838

3939
nrfx_err_t err;
4040
uint8_t in_channel, out_channel;
41-
uint8_t ppi_channel;
41+
nrfx_gppi_handle_t ppi_handle;
4242
const nrfx_gpiote_t gpiote = NRFX_GPIOTE_INSTANCE(GPIOTE_INST);
4343

4444
/* Connect GPIOTE instance IRQ to irq handler */
@@ -116,23 +116,19 @@ int main(void)
116116

117117
LOG_INF("nrfx_gpiote initialized");
118118

119-
/* Allocate a (D)PPI channel. */
120-
err = nrfx_gppi_channel_alloc(&ppi_channel);
121-
if (err != NRFX_SUCCESS) {
122-
LOG_ERR("nrfx_gppi_channel_alloc error: 0x%08X", err);
123-
return 0;
124-
}
125-
126119
/* Configure endpoints of the channel so that the input pin event is
127120
* connected with the output pin OUT task. This means that each time
128121
* the button is pressed, the LED pin will be toggled.
129122
*/
130-
nrfx_gppi_channel_endpoints_setup(ppi_channel,
131-
nrfx_gpiote_in_event_address_get(&gpiote, INPUT_PIN),
132-
nrfx_gpiote_out_task_address_get(&gpiote, OUTPUT_PIN));
123+
err = nrfx_gppi_conn_alloc(nrfx_gpiote_in_event_address_get(&gpiote, INPUT_PIN),
124+
nrfx_gpiote_out_task_address_get(&gpiote, OUTPUT_PIN),&ppi_handle);
125+
if (err != NRFX_SUCCESS) {
126+
LOG_ERR("nrfx_gppi_conn_alloc error: 0x%08X", err);
127+
return 0;
128+
}
133129

134130
/* Enable the channel. */
135-
nrfx_gppi_channels_enable(BIT(ppi_channel));
131+
nrfx_gppi_conn_enable(ppi_handle);
136132

137133
LOG_INF("(D)PPI configured, leaving main()");
138134
return 0;

0 commit comments

Comments
 (0)