28
28
*/
29
29
#define SPI_DEV_NODE DT_NODELABEL(spi1)
30
30
31
- static nrfx_spim_t spim = NRFX_SPIM_INSTANCE (2 );
31
+ static nrfx_spim_t spim = NRFX_SPIM_INSTANCE (NRF_SPIM2 );
32
32
static nrfx_uarte_t uarte = NRFX_UARTE_INSTANCE (2 );
33
33
static bool spim_initialized ;
34
34
static bool uarte_initialized ;
@@ -121,7 +121,6 @@ static void spim_handler(const nrfx_spim_evt_t *p_event, void *p_context)
121
121
static bool switch_to_spim (void )
122
122
{
123
123
int ret ;
124
- nrfx_err_t err ;
125
124
uint32_t sck_pin ;
126
125
127
126
PINCTRL_DT_DEFINE (SPIM_NODE );
@@ -162,9 +161,9 @@ static bool switch_to_spim(void)
162
161
nrfy_gpio_pin_write (sck_pin , (spim_config .mode <= NRF_SPIM_MODE_1 ) ? 0 : 1 );
163
162
}
164
163
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 );
168
167
return false;
169
168
}
170
169
@@ -176,7 +175,7 @@ static bool switch_to_spim(void)
176
175
static bool spim_transfer (const uint8_t * tx_data , size_t tx_data_len ,
177
176
uint8_t * rx_buf , size_t rx_buf_size )
178
177
{
179
- nrfx_err_t err ;
178
+ int err ;
180
179
nrfx_spim_xfer_desc_t xfer_desc = {
181
180
.p_tx_buffer = tx_data ,
182
181
.tx_length = tx_data_len ,
@@ -185,8 +184,8 @@ static bool spim_transfer(const uint8_t *tx_data, size_t tx_data_len,
185
184
};
186
185
187
186
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 );
190
189
return false;
191
190
}
192
191
0 commit comments