1212#include <helpers/nrfx_gppi.h>
1313#include <nrfx_timer.h>
1414#include <nrfx_gpiote.h>
15+ #include <gpiote_nrfx.h>
1516#if defined(CONFIG_HAS_NORDIC_DMM )
1617#include <dmm.h>
1718#endif
@@ -42,9 +43,6 @@ K_MEM_SLAB_DEFINE_STATIC(mem_slab, MAX_BLOCK_SIZE, BLOCK_COUNT, 4);
4243#define CLOCK_INPUT_PIN NRF_DT_GPIOS_TO_PSEL(DT_NODELABEL(pulse_counter), gpios)
4344
4445static const struct device * const pdm_dev = DEVICE_DT_GET (DT_NODELABEL (pdm_dev ));
45- static const nrfx_gpiote_t gpiote_instance = NRFX_GPIOTE_INSTANCE (
46- NRF_DT_GPIOTE_INST (
47- DT_NODELABEL (pulse_counter ), gpios ));
4846static struct pcm_stream_cfg stream_config ;
4947static struct dmic_cfg pdm_cfg ;
5048
@@ -217,12 +215,12 @@ ZTEST(pdm_loopback, test_start_trigger)
217215ZTEST (pdm_loopback , test_pdm_clk_frequency )
218216{
219217 int ret ;
220-
221218 uint8_t gpiote_channel ;
219+ nrfx_gpiote_t * gpiote_instance =
220+ & GPIOTE_NRFX_INST_BY_NODE (NRF_DT_GPIOTE_NODE (DT_NODELABEL (pulse_counter ), gpios ));
222221
223- ret = nrfx_gpiote_channel_alloc (& gpiote_instance , & gpiote_channel );
224- zassert_true (ret == NRFX_SUCCESS ,
225- "GPIOTE channel allocation failed, return code = 0x%08X" , ret );
222+ ret = nrfx_gpiote_channel_alloc (gpiote_instance , & gpiote_channel );
223+ zassert_true (ret == 0 , "GPIOTE channel allocation failed, return code = %d" , ret );
226224
227225 nrfx_gpiote_trigger_config_t trigger_cfg = {
228226 .p_in_channel = & gpiote_channel ,
@@ -236,11 +234,10 @@ ZTEST(pdm_loopback, test_pdm_clk_frequency)
236234 .p_trigger_config = & trigger_cfg ,
237235 };
238236
239- ret = nrfx_gpiote_input_configure (& gpiote_instance , CLOCK_INPUT_PIN , & gpiote_cfg );
240- zassert_true (ret == NRFX_SUCCESS ,
241- "GPIOTE input configuration failed, return code = 0x%08X" , ret );
237+ ret = nrfx_gpiote_input_configure (gpiote_instance , CLOCK_INPUT_PIN , & gpiote_cfg );
238+ zassert_true (ret == 0 , "GPIOTE input configuration failed, return code = %d" , ret );
242239
243- nrfx_gpiote_trigger_enable (& gpiote_instance , CLOCK_INPUT_PIN , false);
240+ nrfx_gpiote_trigger_enable (gpiote_instance , CLOCK_INPUT_PIN , false);
244241
245242 nrfx_timer_config_t timer_config = NRFX_TIMER_DEFAULT_CONFIG (
246243 NRFX_TIMER_BASE_FREQUENCY_GET (& timer_instance ));
@@ -254,7 +251,7 @@ ZTEST(pdm_loopback, test_pdm_clk_frequency)
254251 nrfx_timer_enable (& timer_instance );
255252
256253 nrfx_gppi_handle_t gppi_handle ;
257- uint32_t eep = nrfx_gpiote_in_event_address_get (& gpiote_instance , CLOCK_INPUT_PIN );
254+ uint32_t eep = nrfx_gpiote_in_event_address_get (gpiote_instance , CLOCK_INPUT_PIN );
258255 uint32_t tep = nrfx_timer_task_address_get (& timer_instance , NRF_TIMER_TASK_COUNT );
259256
260257 ret = nrfx_gppi_conn_alloc (eep , tep , & gppi_handle );
0 commit comments