@@ -12,6 +12,7 @@ LOG_MODULE_REGISTER(spim_mosi_toggles, LOG_LEVEL_INF);
1212#include <helpers/nrfx_gppi.h>
1313#include <nrfx_timer.h>
1414#include <nrfx_gpiote.h>
15+ #include <gpiote_nrfx.h>
1516#include <zephyr/drivers/spi.h>
1617#include <zephyr/linker/devicetree_regions.h>
1718
@@ -33,14 +34,10 @@ static uint8_t spim_buffer[2 * TEST_DATA_SIZE] MEMORY_SECTION(DT_BUS(DT_NODELABE
3334/* Variables used to count edges on SPI MOSI line. */
3435#define CLOCK_INPUT_PIN NRF_DT_GPIOS_TO_PSEL(DT_PATH(zephyr_user), test_gpios)
3536
36- static const nrfx_gpiote_t gpiote_instance = NRFX_GPIOTE_INSTANCE (
37- NRF_DT_GPIOTE_INST (
38- DT_PATH (zephyr_user ), test_gpios ));
39-
40- #if CONFIG_NRFX_TIMER00
41- static const nrfx_timer_t timer_instance = NRFX_TIMER_INSTANCE (00 );
42- #elif CONFIG_NRFX_TIMER130
43- static const nrfx_timer_t timer_instance = NRFX_TIMER_INSTANCE (130 );
37+ #if defined(NRF_TIMER00 )
38+ static nrfx_timer_t timer_instance = NRFX_TIMER_INSTANCE (NRF_TIMER00 );
39+ #elif defined(NRF_TIMER130 )
40+ static nrfx_timer_t timer_instance = NRFX_TIMER_INSTANCE (NRF_TIMER130 );
4441#else
4542#error "No timer instance found"
4643#endif
@@ -87,9 +84,11 @@ int main(void)
8784
8885 /* Configure GPIOTE. */
8986 uint8_t gpiote_channel ;
87+ nrfx_gpiote_t gpiote_instance =
88+ GPIOTE_NRFX_INST_BY_NODE (NRF_DT_GPIOTE_NODE (DT_PATH (zephyr_user ), test_gpios ));
9089
9190 ret = nrfx_gpiote_channel_alloc (& gpiote_instance , & gpiote_channel );
92- if (ret != NRFX_SUCCESS ) {
91+ if (ret != 0 ) {
9392 LOG_ERR ("nrfx_gpiote_channel_alloc(), err: %d" , ret );
9493 }
9594
@@ -106,7 +105,7 @@ int main(void)
106105 };
107106
108107 ret = nrfx_gpiote_input_configure (& gpiote_instance , CLOCK_INPUT_PIN , & gpiote_cfg );
109- if (ret != NRFX_SUCCESS ) {
108+ if (ret != 0 ) {
110109 LOG_ERR ("nrfx_gpiote_input_configure(), err: %d" , ret );
111110 }
112111
@@ -119,25 +118,22 @@ int main(void)
119118 timer_config .mode = NRF_TIMER_MODE_COUNTER ;
120119
121120 ret = nrfx_timer_init (& timer_instance , & timer_config , timer_handler );
122- if (ret != NRFX_SUCCESS ) {
121+ if (ret != 0 ) {
123122 LOG_ERR ("nrfx_timer_init(), err: %d" , ret );
124123 }
125124
126125 nrfx_timer_enable (& timer_instance );
127126
128127 /* Configure GPPI from GPIOTE to Timer. */
129- uint8_t gppi_channel ;
128+ nrfx_gppi_handle_t gppi_handle ;
129+ uint32_t eep = nrfx_gpiote_in_event_address_get (& gpiote_instance , CLOCK_INPUT_PIN );
130+ uint32_t tep = nrfx_timer_task_address_get (& timer_instance , NRF_TIMER_TASK_COUNT );
130131
131- ret = nrfx_gppi_channel_alloc ( & gppi_channel );
132- if (ret != NRFX_SUCCESS ) {
133- LOG_ERR ("nrfx_gppi_channel_alloc() , err: %d" , ret );
132+ ret = nrfx_gppi_conn_alloc ( eep , tep , & gppi_handle );
133+ if (ret != 0 ) {
134+ LOG_ERR ("GPPI channel allocation failed , err: %d" , ret );
134135 }
135-
136- nrfx_gppi_channel_endpoints_setup (gppi_channel ,
137- nrfx_gpiote_in_event_address_get (& gpiote_instance , CLOCK_INPUT_PIN ),
138- nrfx_timer_task_address_get (& timer_instance , NRF_TIMER_TASK_COUNT )
139- );
140- nrfx_gppi_channels_enable (BIT (gppi_channel ));
136+ nrfx_gppi_conn_enable (gppi_handle );
141137
142138 /* Set tx_data for current test. Test scenario reqires:
143139 * The first transmitted bit in the final byte is 1.
0 commit comments