@@ -14,7 +14,7 @@ STATIC mp_obj_t spi_test(void) {
14
14
spi_bus_config_t bus_config ;
15
15
spi_device_interface_config_t device_config ;
16
16
spi_device_handle_t spi ;
17
- spi_host_device_t host = 1 ;
17
+ spi_host_device_t host = 2 ;
18
18
int dma = 1 ;
19
19
20
20
memset (& bus_config , 0 , sizeof (spi_bus_config_t ));
@@ -51,8 +51,14 @@ STATIC mp_obj_t spi_test(void) {
51
51
assert (spi_bus_free (host ) == ESP_OK );
52
52
53
53
// change things up!
54
+ #if 0
54
55
bus_config .mosi_io_num = 4 ;
55
- host = 2 ;
56
+ printf ("changing mosi to %d\n" , bus_config .mosi_io_num );
57
+ #endif
58
+ #if 1
59
+ host = 1 ;
60
+ printf ("changing host to %d\n" , host );
61
+ #endif
56
62
57
63
assert (spi_bus_initialize (host , & bus_config , dma ) == ESP_OK );
58
64
assert (spi_bus_add_device (host , & device_config , & spi ) == ESP_OK );
@@ -61,6 +67,10 @@ STATIC mp_obj_t spi_test(void) {
61
67
assert (spi_device_transmit (spi , & transaction ) == ESP_OK );
62
68
printf ("after second xmit\n" );
63
69
70
+ assert (spi_bus_remove_device (spi ) == ESP_OK );
71
+ assert (spi_bus_free (host ) == ESP_OK );
72
+
73
+
64
74
return mp_const_none ;
65
75
}
66
76
MP_DEFINE_CONST_FUN_OBJ_0 (spi_test_obj , spi_test );
0 commit comments