2828 */
2929#define SPI_DEV_NODE DT_NODELABEL(spi1)
3030
31- static nrfx_spim_t spim = NRFX_SPIM_INSTANCE (2 );
31+ static nrfx_spim_t spim = NRFX_SPIM_INSTANCE (NRF_SPIM2 );
3232static nrfx_uarte_t uarte = NRFX_UARTE_INSTANCE (2 );
3333static bool spim_initialized ;
3434static bool uarte_initialized ;
@@ -121,7 +121,6 @@ static void spim_handler(const nrfx_spim_evt_t *p_event, void *p_context)
121121static bool switch_to_spim (void )
122122{
123123 int ret ;
124- nrfx_err_t err ;
125124 uint32_t sck_pin ;
126125
127126 PINCTRL_DT_DEFINE (SPIM_NODE );
@@ -162,9 +161,9 @@ static bool switch_to_spim(void)
162161 nrfy_gpio_pin_write (sck_pin , (spim_config .mode <= NRF_SPIM_MODE_1 ) ? 0 : 1 );
163162 }
164163
165- err = nrfx_spim_init (& spim , & spim_config , spim_handler , NULL );
166- if (err != NRFX_SUCCESS ) {
167- printk ("nrfx_spim_init() failed: 0x%08x\n " , err );
164+ ret = nrfx_spim_init (& spim , & spim_config , spim_handler , NULL );
165+ if (ret != 0 ) {
166+ printk ("nrfx_spim_init() failed: %d " , ret );
168167 return false;
169168 }
170169
@@ -176,7 +175,7 @@ static bool switch_to_spim(void)
176175static bool spim_transfer (const uint8_t * tx_data , size_t tx_data_len ,
177176 uint8_t * rx_buf , size_t rx_buf_size )
178177{
179- nrfx_err_t err ;
178+ int err ;
180179 nrfx_spim_xfer_desc_t xfer_desc = {
181180 .p_tx_buffer = tx_data ,
182181 .tx_length = tx_data_len ,
@@ -185,8 +184,8 @@ static bool spim_transfer(const uint8_t *tx_data, size_t tx_data_len,
185184 };
186185
187186 err = nrfx_spim_xfer (& spim , & xfer_desc , 0 );
188- if (err != NRFX_SUCCESS ) {
189- printk ("nrfx_spim_xfer() failed: 0x%08x \n" , err );
187+ if (err != 0 ) {
188+ printk ("nrfx_spim_xfer() failed: %d \n" , err );
190189 return false;
191190 }
192191
0 commit comments