3232#include "shared-bindings/microcontroller/Pin.h"
3333#include "supervisor/shared/rgb_led_status.h"
3434
35- #include "esp_log.h"
36-
37- static const char * TAG = "CircuitPython SPI" ;
38-
3935static bool spi_never_reset [SOC_SPI_PERIPH_NUM ];
4036
4137// 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) {
10197}
10298
10399static 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;
106101}
107102
108103// The interrupt may get invoked by the bus lock.
@@ -197,8 +192,8 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
197192 // hal->cs_hold = 0;
198193 // hal->cs_pin_id = 0;
199194
200- hal -> sio = 1 ;
201- // hal->half_duplex = 0;
195+ hal -> sio = 0 ;
196+ hal -> half_duplex = 0 ;
202197 // hal->tx_lsbfirst = 0;
203198 // hal->rx_lsbfirst = 0;
204199 hal -> dma_enabled = 1 ;
@@ -216,9 +211,6 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
216211
217212 // This must be set after spi_hal_init.
218213 hal -> timing_conf = & self -> timing_conf ;
219- if (hal -> hw == NULL ) {
220- ESP_LOGE (TAG , "SPI error %p" , hal -> hw );
221- }
222214
223215 common_hal_busio_spi_configure (self , 250000 , 0 , 0 , 8 );
224216}
@@ -280,11 +272,7 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
280272 return false;
281273 }
282274
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 );
286275 spi_hal_setup_device (& self -> hal_context );
287- ESP_LOGI (TAG , "setup done" );
288276 return true;
289277}
290278
@@ -351,6 +339,7 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou
351339 while (!spi_hal_usr_is_done (hal )) {
352340 RUN_BACKGROUND_TASKS ;
353341 }
342+ spi_hal_fetch_result (hal );
354343 }
355344
356345 return true;
0 commit comments