Skip to content

Commit eb299d3

Browse files
committed
fix/machine: SDCard Compile Error
Signed-off-by: lbuque <[email protected]>
1 parent 3020eab commit eb299d3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

m5stack/machine_sdcard.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,11 @@ STATIC mp_obj_t machine_sdcard_make_new(const mp_obj_type_t *type, size_t n_args
274274
SET_CONFIG_PIN(dev_config, gpio_cd, ARG_cd);
275275
SET_CONFIG_PIN(dev_config, gpio_wp, ARG_wp);
276276

277-
if (spi_host_id == HSPI_HOST || spi_host_id == SPI2_HOST) {
277+
#if CONFIG_IDF_TARGET_ESP32
278+
if (spi_host_id == HSPI_HOST) {
279+
#else
280+
if (spi_host_id == SPI2_HOST) {
281+
#endif
278282
// NOTE:
279283
// core2和cores3的屏幕和sd卡复用一个spi,
280284
// 所以这里不需要对VSPI_HOST和SPI3_HOST进行初始化。
@@ -334,7 +338,11 @@ STATIC mp_obj_t sd_deinit(mp_obj_t self_in) {
334338
}
335339
if (self->host.flags & SDMMC_HOST_FLAG_SPI) {
336340
// SD card used a (dedicated) SPI bus, so free that SPI bus.
337-
if ((self->host.slot + 2) == HSPI_HOST || (self->host.slot + 2) == SPI2_HOST) {
341+
#if CONFIG_IDF_TARGET_ESP32
342+
if ((self->host.slot + 2) == HSPI_HOST) {
343+
#else
344+
if ((self->host.slot + 2) == SPI2_HOST) {
345+
#endif
338346
spi_bus_free(self->host.slot);
339347
}
340348
}

0 commit comments

Comments
 (0)