Skip to content

Commit 3eafacc

Browse files
committed
samples: peripheral: 802154_phy_test: Align to the new GPPI API
Align sample to the new GPPI API. Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 11c62e9 commit 3eafacc

File tree

2 files changed

+14
-24
lines changed

2 files changed

+14
-24
lines changed

samples/peripheral/802154_phy_test/src/periph_proc.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static const struct device *gpio_port1_dev = DEVICE_DT_GET(DT_NODELABEL(gpio1));
8484
#endif
8585

8686
#if IS_ENABLED(CONFIG_PTT_CLK_OUT)
87-
uint8_t ppi_channel;
87+
nrfx_gppi_handle_t ppi_handle;
8888
uint8_t task_channel;
8989
#endif /* IS_ENABLED(CONFIG_PTT_CLK_OUT) */
9090

@@ -143,6 +143,7 @@ bool ptt_clk_out_ext(uint8_t pin, bool mode)
143143
{
144144
#if IS_ENABLED(CONFIG_PTT_CLK_OUT)
145145
uint32_t compare_evt_addr;
146+
uint32_t tep;
146147
nrfx_err_t err;
147148
const nrfx_gpiote_t *gpiote = NRF_GPIOTE_FOR_PSEL(pin);
148149

@@ -178,35 +179,30 @@ bool ptt_clk_out_ext(uint8_t pin, bool mode)
178179

179180
compare_evt_addr =
180181
nrfx_timer_event_address_get(&clk_timer, NRF_TIMER_EVENT_COMPARE0);
181-
182+
tep = nrfx_gpiote_out_task_address_get(gpiote, pin);
182183
nrfx_gpiote_out_task_enable(gpiote, pin);
183184

184185
/* Allocate a (D)PPI channel. */
185-
err = nrfx_gppi_channel_alloc(&ppi_channel);
186-
187-
if (err != NRFX_SUCCESS) {
186+
err = nrfx_gppi_conn_alloc(compare_evt_addr, tep, &ppi_handle);
187+
if (err < 0) {
188188
LOG_ERR("(D)PPI channel allocation error: %08x", err);
189189
return false;
190190
}
191191

192-
nrfx_gppi_channel_endpoints_setup(
193-
ppi_channel, compare_evt_addr,
194-
nrf_gpiote_task_address_get(gpiote->p_reg,
195-
nrfx_gpiote_in_event_get(gpiote, pin)));
196-
197192
/* Enable (D)PPI channel. */
198-
nrfx_gppi_channels_enable(BIT(ppi_channel));
193+
nrfx_gppi_conn_enable(ppi_handle);
199194

200195
nrfx_timer_enable(&clk_timer);
201196
} else {
202197
nrfx_timer_disable(&clk_timer);
203198
nrfx_gpiote_out_task_disable(gpiote, pin);
204-
err = nrfx_gppi_channel_free(ppi_channel);
205199

206-
if (err != NRFX_SUCCESS) {
207-
LOG_ERR("Failed to disable (D)PPI channel, error: %08x", err);
208-
return false;
209-
}
200+
compare_evt_addr =
201+
nrfx_timer_event_address_get(&clk_timer, NRF_TIMER_EVENT_COMPARE0);
202+
tep = nrfx_gpiote_out_task_address_get(gpiote, pin);
203+
nrfx_gppi_conn_disable(ppi_handle);
204+
nrfx_gppi_conn_free(compare_evt_addr, tep, ppi_handle);
205+
210206
nrfx_gpiote_pin_uninit(gpiote, pin);
211207
err = nrfx_gpiote_channel_free(gpiote, task_channel);
212208

samples/peripheral/802154_phy_test/src/rf_proc.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515
#include <nrfx_gpiote.h>
1616
#endif /* IS_ENABLED(CONFIG_PTT_ANTENNA_DIVERSITY) */
1717

18-
#if defined(DPPI_PRESENT)
19-
#include <nrfx_dppi.h>
20-
#else
21-
#include <nrfx_ppi.h>
22-
#endif
18+
#include <helpers/nrfx_gppi.h>
2319

2420
#include "nrf_802154.h"
2521
#include "nrf_802154_sl_ant_div.h"
@@ -145,7 +141,6 @@ void rf_uninit(void)
145141
#if CONFIG_PTT_ANTENNA_DIVERSITY
146142
static void configure_antenna_diversity(void)
147143
{
148-
nrf_ppi_channel_t ppi_channel;
149144
uint8_t gpiote_channel;
150145
NRF_TIMER_Type *ad_timer = NRF_TIMER3;
151146

@@ -155,8 +150,7 @@ static void configure_antenna_diversity(void)
155150
.p_timer = ad_timer
156151
};
157152

158-
nrfx_ppi_channel_alloc(&ppi_channel);
159-
cfg.ppi_ch = (uint8_t)ppi_channel;
153+
(void)nrfx_gppi_channel_alloc(0 ,&cfg.ppi_ch);
160154
nrfx_gpiote_channel_alloc(&gpiote, &gpiote_channel);
161155
cfg.gpiote_ch = gpiote_channel;
162156
nrf_802154_sl_ant_div_mode_t ant_div_auto = 0x02;

0 commit comments

Comments
 (0)