]> granicus.if.org Git - esp-idf/commitdiff
sdmmc, sdspi: fix initializers to be C++-compatible, add test
authorIvan Grokhotkov <ivan@espressif.com>
Mon, 23 Apr 2018 06:35:13 +0000 (14:35 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Mon, 23 Apr 2018 06:35:13 +0000 (14:35 +0800)
Closes https://github.com/espressif/esp-idf/issues/1861
Closes https://github.com/espressif/arduino-esp32/issues/1312

components/driver/include/driver/sdmmc_host.h
components/driver/include/driver/sdspi_host.h
components/driver/test/test_sdmmc_sdspi_init.cpp [new file with mode: 0644]

index aa3357a736cd851cedbf797a985db2550f26a2be..2c610ad365744ec0f83a524fda198fd2ae3f6700 100644 (file)
@@ -43,9 +43,9 @@ extern "C" {
     .set_card_clk = &sdmmc_host_set_card_clk, \
     .do_transaction = &sdmmc_host_do_transaction, \
     .deinit = &sdmmc_host_deinit, \
-    .command_timeout_ms = 0, \
     .io_int_enable = sdmmc_host_io_int_enable, \
     .io_int_wait = sdmmc_host_io_int_wait, \
+    .command_timeout_ms = 0, \
 }
 
 /**
index 9dad6cf7a7acf933f932b6a2be404a309cc8619d..9f72cb0dc4bc0c7a2d056ecd5d511357535c0520 100644 (file)
@@ -40,6 +40,7 @@ extern "C" {
     .io_voltage = 3.3f, \
     .init = &sdspi_host_init, \
     .set_bus_width = NULL, \
+    .get_bus_width = NULL, \
     .set_card_clk = &sdspi_host_set_card_clk, \
     .do_transaction = &sdspi_host_do_transaction, \
     .deinit = &sdspi_host_deinit, \
@@ -72,8 +73,8 @@ typedef struct {
     .gpio_mosi = GPIO_NUM_15, \
     .gpio_sck  = GPIO_NUM_14, \
     .gpio_cs   = GPIO_NUM_13, \
-    .gpio_cd   = SDMMC_SLOT_NO_CD, \
-    .gpio_wp   = SDMMC_SLOT_NO_WP, \
+    .gpio_cd   = SDSPI_SLOT_NO_CD, \
+    .gpio_wp   = SDSPI_SLOT_NO_WP, \
     .dma_channel = 1 \
 }
 
diff --git a/components/driver/test/test_sdmmc_sdspi_init.cpp b/components/driver/test/test_sdmmc_sdspi_init.cpp
new file mode 100644 (file)
index 0000000..d2406f5
--- /dev/null
@@ -0,0 +1,20 @@
+#include "driver/sdmmc_host.h"
+#include "driver/sdspi_host.h"
+
+
+/**
+ * Check that C-style designated initializers are valid in C++ file.
+ */
+static void test_initializers() __attribute__((unused));
+
+static void test_initializers()
+{
+    sdmmc_host_t sdmmc_host = SDMMC_HOST_DEFAULT();
+    (void) sdmmc_host;
+    sdmmc_slot_config_t sdmmc_slot = SDMMC_SLOT_CONFIG_DEFAULT();
+    (void) sdmmc_slot;
+    sdmmc_host_t sdspi_host = SDSPI_HOST_DEFAULT();
+    (void) sdspi_host;
+    sdspi_slot_config_t sdspi_slot = SDSPI_SLOT_CONFIG_DEFAULT();
+    (void) sdspi_slot;
+}