32
32
#include "shared-bindings/microcontroller/Pin.h"
33
33
#include "supervisor/shared/rgb_led_status.h"
34
34
35
- #include "esp_log.h"
36
-
37
- static const char * TAG = "CircuitPython SPI" ;
38
-
39
35
static bool spi_never_reset [SOC_SPI_PERIPH_NUM ];
40
36
41
37
// Store one lock handle per device so that we can free it.
@@ -101,8 +97,7 @@ static bool spi_bus_is_free(spi_host_device_t host_id) {
101
97
}
102
98
103
99
static void spi_interrupt_handler (void * arg ) {
104
- busio_spi_obj_t * self = arg ;
105
- ESP_LOGE (TAG , "SPI interrupt %p" , self );
100
+ // busio_spi_obj_t *self = arg;
106
101
}
107
102
108
103
// The interrupt may get invoked by the bus lock.
@@ -197,8 +192,8 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
197
192
// hal->cs_hold = 0;
198
193
// hal->cs_pin_id = 0;
199
194
200
- hal -> sio = 1 ;
201
- // hal->half_duplex = 0;
195
+ hal -> sio = 0 ;
196
+ hal -> half_duplex = 0 ;
202
197
// hal->tx_lsbfirst = 0;
203
198
// hal->rx_lsbfirst = 0;
204
199
hal -> dma_enabled = 1 ;
@@ -216,9 +211,6 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
216
211
217
212
// This must be set after spi_hal_init.
218
213
hal -> timing_conf = & self -> timing_conf ;
219
- if (hal -> hw == NULL ) {
220
- ESP_LOGE (TAG , "SPI error %p" , hal -> hw );
221
- }
222
214
223
215
common_hal_busio_spi_configure (self , 250000 , 0 , 0 , 8 );
224
216
}
@@ -280,11 +272,7 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
280
272
return false;
281
273
}
282
274
283
- ESP_LOGI (TAG , "configure" );
284
- ESP_LOGI (TAG , "real frequency %d" , self -> real_frequency );
285
- ESP_LOGI (TAG , "timing_conf %p" , self -> hal_context .timing_conf );
286
275
spi_hal_setup_device (& self -> hal_context );
287
- ESP_LOGI (TAG , "setup done" );
288
276
return true;
289
277
}
290
278
@@ -351,6 +339,7 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou
351
339
while (!spi_hal_usr_is_done (hal )) {
352
340
RUN_BACKGROUND_TASKS ;
353
341
}
342
+ spi_hal_fetch_result (hal );
354
343
}
355
344
356
345
return true;
0 commit comments