@@ -37,8 +37,9 @@ int main(void)
3737	LOG_INF ("nrfx_gpiote sample on %s" , CONFIG_BOARD );
3838
3939	nrfx_err_t  err ;
40+ 	int  rv ;
4041	uint8_t  in_channel , out_channel ;
41- 	uint8_t   ppi_channel ;
42+ 	nrfx_gppi_handle_t   ppi_handle ;
4243	const  nrfx_gpiote_t  gpiote  =  NRFX_GPIOTE_INSTANCE (GPIOTE_INST );
4344
4445	/* Connect GPIOTE instance IRQ to irq handler */ 
@@ -116,23 +117,20 @@ int main(void)
116117
117118	LOG_INF ("nrfx_gpiote initialized" );
118119
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- 
126120	/* Configure endpoints of the channel so that the input pin event is 
127121	 * connected with the output pin OUT task. This means that each time 
128122	 * the button is pressed, the LED pin will be toggled. 
129123	 */ 
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 ));
124+ 	rv  =  nrfx_gppi_conn_alloc (nrfx_gpiote_in_event_address_get (& gpiote , INPUT_PIN ),
125+ 				   nrfx_gpiote_out_task_address_get (& gpiote , OUTPUT_PIN ),
126+ 				   & ppi_handle );
127+ 	if  (rv  <  0 ) {
128+ 		LOG_ERR ("nrfx_gppi_conn_alloc error: 0x%08X" , rv );
129+ 		return  0 ;
130+ 	}
133131
134132	/* Enable the channel. */ 
135- 	nrfx_gppi_channels_enable ( BIT ( ppi_channel ) );
133+ 	nrfx_gppi_conn_enable ( ppi_handle );
136134
137135	LOG_INF ("(D)PPI configured, leaving main()" );
138136	return  0 ;
0 commit comments