2929#define  SPI_DEV_NODE  DT_NODELABEL(spi1)
3030
3131static  nrfx_spim_t  spim  =  NRFX_SPIM_INSTANCE (NRF_SPIM2 );
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 ;
@@ -212,7 +212,6 @@ static void uarte_handler(const nrfx_uarte_event_t *p_event, void *p_context)
212212static  bool  switch_to_uarte (void )
213213{
214214	int  ret ;
215- 	nrfx_err_t  err ;
216215
217216	PINCTRL_DT_DEFINE (UARTE_NODE );
218217
@@ -243,9 +242,9 @@ static bool switch_to_uarte(void)
243242		return  ret ;
244243	}
245244
246- 	err  =  nrfx_uarte_init (& uarte , & uarte_config , uarte_handler );
247- 	if  (err  !=  NRFX_SUCCESS ) {
248- 		printk ("nrfx_uarte_init() failed: 0x%08x \n" , err );
245+ 	ret  =  nrfx_uarte_init (& uarte , & uarte_config , uarte_handler );
246+ 	if  (err  !=  0 ) {
247+ 		printk ("nrfx_uarte_init() failed: %d \n" , ret );
249248		return  false;
250249	}
251250
@@ -257,23 +256,23 @@ static bool switch_to_uarte(void)
257256static  bool  uarte_transfer (const  uint8_t  * tx_data , size_t  tx_data_len ,
258257			   uint8_t  * rx_buf , size_t  rx_buf_size )
259258{
260- 	nrfx_err_t  err ;
259+ 	int  err ;
261260
262261	err  =  nrfx_uarte_rx_buffer_set (& uarte , rx_buf , rx_buf_size );
263- 	if  (err  !=  NRFX_SUCCESS ) {
264- 		printk ("nrfx_uarte_rx_buffer_set() failed: 0x%08x \n" , err );
262+ 	if  (err  !=  0 ) {
263+ 		printk ("nrfx_uarte_rx_buffer_set() failed: %d \n" , err );
265264		return  false;
266265	}
267266
268267	err  =  nrfx_uarte_rx_enable (& uarte , NRFX_UARTE_RX_ENABLE_STOP_ON_END );
269- 	if  (err  !=  NRFX_SUCCESS ) {
270- 		printk ("nrfx_uarte_rx_enable() failed: 0x%08x \n" , err );
268+ 	if  (err  !=  0 ) {
269+ 		printk ("nrfx_uarte_rx_enable() failed: %d \n" , err );
271270		return  false;
272271	}
273272
274273	err  =  nrfx_uarte_tx (& uarte , tx_data , tx_data_len , 0 );
275- 	if  (err  !=  NRFX_SUCCESS ) {
276- 		printk ("nrfx_uarte_tx() failed: 0x%08x \n" , err );
274+ 	if  (err  !=  0 ) {
275+ 		printk ("nrfx_uarte_tx() failed: %d \n" , err );
277276		return  false;
278277	}
279278
0 commit comments