From f8c3d8ce1d693789e1d5b0e1267bf40c4be9a2bb Mon Sep 17 00:00:00 2001 From: sean <1026025056@qq.com> Date: Mon, 22 Jul 2024 10:23:34 +0800 Subject: [PATCH] add SPI pins init code --- src/M5Stack.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/M5Stack.cpp b/src/M5Stack.cpp index 069ea44c..c0974047 100644 --- a/src/M5Stack.cpp +++ b/src/M5Stack.cpp @@ -7,8 +7,7 @@ M5Stack::M5Stack() : isInited(0) { } -void M5Stack::begin(bool LCDEnable, bool SDEnable, bool SerialEnable, - bool I2CEnable) { +void M5Stack::begin(bool LCDEnable, bool SDEnable, bool SerialEnable, bool I2CEnable) { // Correct init once if (isInited == true) { return; @@ -16,6 +15,12 @@ void M5Stack::begin(bool LCDEnable, bool SDEnable, bool SerialEnable, isInited = true; } + for (auto gpio : (const uint8_t[]){18, 19, 23}) { + *(volatile uint32_t*)(GPIO_PIN_MUX_REG[gpio]) |= FUN_DRV_M; + gpio_pulldown_dis((gpio_num_t)gpio); + gpio_pullup_en((gpio_num_t)gpio); + } + // UART if (SerialEnable == true) { Serial.begin(115200);