2929#define  SPI_DEV_NODE  DT_NODELABEL(spi1)
3030
3131static  nrfx_spim_t  spim  =  NRFX_SPIM_INSTANCE (2 );
32- static  nrfx_uarte_t  uarte  =  NRFX_UARTE_INSTANCE (2 );
32+ static  nrfx_uarte_t  uarte  =  NRFX_UARTE_INSTANCE (NRF_UARTE2 );
3333static  bool  spim_initialized ;
3434static  bool  uarte_initialized ;
3535static  volatile  size_t  received ;
@@ -213,7 +213,6 @@ static void uarte_handler(const nrfx_uarte_event_t *p_event, void *p_context)
213213static  bool  switch_to_uarte (void )
214214{
215215	int  ret ;
216- 	nrfx_err_t  err ;
217216
218217	PINCTRL_DT_DEFINE (UARTE_NODE );
219218
@@ -244,9 +243,9 @@ static bool switch_to_uarte(void)
244243		return  ret ;
245244	}
246245
247- 	err  =  nrfx_uarte_init (& uarte , & uarte_config , uarte_handler );
248- 	if  (err  !=  NRFX_SUCCESS ) {
249- 		printk ("nrfx_uarte_init() failed: 0x%08x \n" , err );
246+ 	ret  =  nrfx_uarte_init (& uarte , & uarte_config , uarte_handler );
247+ 	if  (err  !=  0 ) {
248+ 		printk ("nrfx_uarte_init() failed: %d \n" , ret );
250249		return  false;
251250	}
252251
@@ -258,23 +257,23 @@ static bool switch_to_uarte(void)
258257static  bool  uarte_transfer (const  uint8_t  * tx_data , size_t  tx_data_len ,
259258			   uint8_t  * rx_buf , size_t  rx_buf_size )
260259{
261- 	nrfx_err_t  err ;
260+ 	int  err ;
262261
263262	err  =  nrfx_uarte_rx_buffer_set (& uarte , rx_buf , rx_buf_size );
264- 	if  (err  !=  NRFX_SUCCESS ) {
265- 		printk ("nrfx_uarte_rx_buffer_set() failed: 0x%08x \n" , err );
263+ 	if  (err  !=  0 ) {
264+ 		printk ("nrfx_uarte_rx_buffer_set() failed: %d \n" , err );
266265		return  false;
267266	}
268267
269268	err  =  nrfx_uarte_rx_enable (& uarte , NRFX_UARTE_RX_ENABLE_STOP_ON_END );
270- 	if  (err  !=  NRFX_SUCCESS ) {
271- 		printk ("nrfx_uarte_rx_enable() failed: 0x%08x \n" , err );
269+ 	if  (err  !=  0 ) {
270+ 		printk ("nrfx_uarte_rx_enable() failed: %d \n" , err );
272271		return  false;
273272	}
274273
275274	err  =  nrfx_uarte_tx (& uarte , tx_data , tx_data_len , 0 );
276- 	if  (err  !=  NRFX_SUCCESS ) {
277- 		printk ("nrfx_uarte_tx() failed: 0x%08x \n" , err );
275+ 	if  (err  !=  0 ) {
276+ 		printk ("nrfx_uarte_tx() failed: %d \n" , err );
278277		return  false;
279278	}
280279
0 commit comments