Skip to content

Commit 719be7c

Browse files
committed
updated test code
1 parent 907d85b commit 719be7c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

esp32/machine_spi_test.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ STATIC mp_obj_t spi_test(void) {
1414
spi_bus_config_t bus_config;
1515
spi_device_interface_config_t device_config;
1616
spi_device_handle_t spi;
17-
spi_host_device_t host = 1;
17+
spi_host_device_t host = 2;
1818
int dma = 1;
1919

2020
memset(&bus_config, 0, sizeof(spi_bus_config_t));
@@ -51,8 +51,14 @@ STATIC mp_obj_t spi_test(void) {
5151
assert(spi_bus_free(host) == ESP_OK);
5252

5353
// change things up!
54+
#if 0
5455
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
5662

5763
assert(spi_bus_initialize(host, &bus_config, dma) == ESP_OK);
5864
assert(spi_bus_add_device(host, &device_config, &spi) == ESP_OK);
@@ -61,6 +67,10 @@ STATIC mp_obj_t spi_test(void) {
6167
assert(spi_device_transmit(spi, &transaction) == ESP_OK);
6268
printf("after second xmit\n");
6369

70+
assert(spi_bus_remove_device(spi) == ESP_OK);
71+
assert(spi_bus_free(host) == ESP_OK);
72+
73+
6474
return mp_const_none;
6575
}
6676
MP_DEFINE_CONST_FUN_OBJ_0(spi_test_obj, spi_test);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy