Skip to content

Commit efe5bce

Browse files
committed
samples: peripheral: radio_test: Adapt to the new GPPI
Adapt radio_test sample to the new GPPI API. Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 28a4417 commit efe5bce

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

samples/peripheral/radio_test/src/radio_test.c

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -432,57 +432,56 @@ static void radio_power_set(nrf_radio_mode_t mode, uint8_t channel, int8_t power
432432
static void endpoints_clear(void)
433433
{
434434
if (atomic_test_and_clear_bit(&endpoint_state, ENDPOINT_FORK_EGU_TIMER)) {
435-
nrfx_gppi_fork_endpoint_clear(ppi_radio_start,
436-
nrf_timer_task_address_get(timer.p_reg, NRF_TIMER_TASK_START));
435+
nrfx_gppi_ep_clear(nrf_timer_task_address_get(timer.p_reg, NRF_TIMER_TASK_START));
437436
}
438437
if (atomic_test_and_clear_bit(&endpoint_state, ENDPOINT_EGU_RADIO_TX)) {
439-
nrfx_gppi_channel_endpoints_clear(ppi_radio_start,
440-
nrf_egu_event_address_get(RADIO_TEST_EGU, RADIO_TEST_EGU_EVENT),
441-
nrf_radio_task_address_get(NRF_RADIO, NRF_RADIO_TASK_TXEN));
438+
nrfx_gppi_ep_clear(
439+
nrf_egu_event_address_get(RADIO_TEST_EGU, RADIO_TEST_EGU_EVENT));
440+
nrfx_gppi_ep_clear(nrf_radio_task_address_get(NRF_RADIO, NRF_RADIO_TASK_TXEN));
442441
}
443442
if (atomic_test_and_clear_bit(&endpoint_state, ENDPOINT_EGU_RADIO_RX)) {
444-
nrfx_gppi_channel_endpoints_clear(ppi_radio_start,
445-
nrf_egu_event_address_get(RADIO_TEST_EGU, RADIO_TEST_EGU_EVENT),
446-
nrf_radio_task_address_get(NRF_RADIO, NRF_RADIO_TASK_RXEN));
443+
nrfx_gppi_ep_clear(
444+
nrf_egu_event_address_get(RADIO_TEST_EGU, RADIO_TEST_EGU_EVENT));
445+
nrfx_gppi_ep_clear(nrf_radio_task_address_get(NRF_RADIO, NRF_RADIO_TASK_RXEN));
447446
}
448447
if (atomic_test_and_clear_bit(&endpoint_state, ENDPOINT_TIMER_RADIO_TX)) {
449-
nrfx_gppi_channel_endpoints_clear(ppi_radio_start,
450-
nrf_timer_event_address_get(timer.p_reg, NRF_TIMER_EVENT_COMPARE0),
451-
nrf_radio_task_address_get(NRF_RADIO, NRF_RADIO_TASK_TXEN));
448+
nrfx_gppi_ep_clear(
449+
nrf_timer_event_address_get(timer.p_reg, NRF_TIMER_EVENT_COMPARE0));
450+
nrfx_gppi_ep_clear(nrf_radio_task_address_get(NRF_RADIO, NRF_RADIO_TASK_TXEN));
452451
}
453452
}
454453

455454
static void radio_ppi_config(bool rx)
456455
{
457456
endpoints_clear();
458457

459-
nrfx_gppi_channel_endpoints_setup(ppi_radio_start,
460-
nrf_egu_event_address_get(RADIO_TEST_EGU, RADIO_TEST_EGU_EVENT),
458+
nrfx_gppi_ep_attach(ppi_radio_start,
459+
nrf_egu_event_address_get(RADIO_TEST_EGU, RADIO_TEST_EGU_EVENT));
460+
nrfx_gppi_ep_attach(ppi_radio_start,
461461
nrf_radio_task_address_get(NRF_RADIO,
462462
rx ? NRF_RADIO_TASK_RXEN : NRF_RADIO_TASK_TXEN));
463463
atomic_set_bit(&endpoint_state, (rx ? ENDPOINT_EGU_RADIO_RX : ENDPOINT_EGU_RADIO_TX));
464464

465-
nrfx_gppi_fork_endpoint_setup(ppi_radio_start,
465+
nrfx_gppi_ep_attach(ppi_radio_start,
466466
nrf_timer_task_address_get(timer.p_reg, NRF_TIMER_TASK_START));
467467
atomic_set_bit(&endpoint_state, ENDPOINT_FORK_EGU_TIMER);
468468

469-
nrfx_gppi_channels_enable(BIT(ppi_radio_start));
469+
nrfx_gppi_conn_enable(ppi_radio_start);
470470
}
471471

472472
static void radio_ppi_tx_reconfigure(void)
473473
{
474-
if (nrfx_gppi_channel_check(ppi_radio_start)) {
475-
nrfx_gppi_channels_disable(BIT(ppi_radio_start));
476-
}
474+
nrfx_gppi_conn_disable(ppi_radio_start);
477475

478476
endpoints_clear();
479477

480-
nrfx_gppi_channel_endpoints_setup(ppi_radio_start,
481-
nrf_timer_event_address_get(timer.p_reg, NRF_TIMER_EVENT_COMPARE1),
478+
nrfx_gppi_ep_attach(ppi_radio_start,
479+
nrf_timer_event_address_get(timer.p_reg, NRF_TIMER_EVENT_COMPARE1));
480+
nrfx_gppi_ep_attach(ppi_radio_start,
482481
nrf_radio_task_address_get(NRF_RADIO, NRF_RADIO_TASK_TXEN));
483482
atomic_set_bit(&endpoint_state, ENDPOINT_TIMER_RADIO_TX);
484483

485-
nrfx_gppi_channels_enable(BIT(ppi_radio_start));
484+
nrfx_gppi_conn_enable(ppi_radio_start);
486485
}
487486

488487
#if CONFIG_FEM
@@ -1106,10 +1105,7 @@ static void cancel(void)
11061105

11071106
sweep_processing = false;
11081107

1109-
if (nrfx_gppi_channel_check(ppi_radio_start)) {
1110-
nrfx_gppi_channels_disable(BIT(ppi_radio_start));
1111-
}
1112-
1108+
nrfx_gppi_conn_disable(ppi_radio_start);
11131109
endpoints_clear();
11141110
radio_disable();
11151111

@@ -1301,6 +1297,7 @@ void radio_handler(const void *context)
13011297
int radio_test_init(struct radio_test_config *config)
13021298
{
13031299
nrfx_err_t nrfx_err;
1300+
uint32_t rad_domain = nrfx_gppi_domain_id_get((uint32_t)NRF_RADIO);
13041301

13051302
timer_init(config);
13061303
IRQ_CONNECT(RADIO_TEST_TIMER_IRQn, IRQ_PRIO_LOWEST,
@@ -1309,7 +1306,7 @@ int radio_test_init(struct radio_test_config *config)
13091306
irq_connect_dynamic(RADIO_TEST_RADIO_IRQn, IRQ_PRIO_LOWEST, radio_handler, config, 0);
13101307
irq_enable(RADIO_TEST_RADIO_IRQn);
13111308

1312-
nrfx_err = nrfx_gppi_channel_alloc(&ppi_radio_start);
1309+
nrfx_err = nrfx_gppi_domain_conn_alloc(rad_domain, rad_domain, &ppi_radio_start);
13131310
if (nrfx_err != NRFX_SUCCESS) {
13141311
printk("Failed to allocate gppi channel.\n");
13151312
return -EFAULT;

0 commit comments

Comments
 (0)