Skip to content

Commit f8c3d8c

Browse files
committed
add SPI pins init code
1 parent c4607cd commit f8c3d8c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/M5Stack.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@
77
M5Stack::M5Stack() : isInited(0) {
88
}
99

10-
void M5Stack::begin(bool LCDEnable, bool SDEnable, bool SerialEnable,
11-
bool I2CEnable) {
10+
void M5Stack::begin(bool LCDEnable, bool SDEnable, bool SerialEnable, bool I2CEnable) {
1211
// Correct init once
1312
if (isInited == true) {
1413
return;
1514
} else {
1615
isInited = true;
1716
}
1817

18+
for (auto gpio : (const uint8_t[]){18, 19, 23}) {
19+
*(volatile uint32_t*)(GPIO_PIN_MUX_REG[gpio]) |= FUN_DRV_M;
20+
gpio_pulldown_dis((gpio_num_t)gpio);
21+
gpio_pullup_en((gpio_num_t)gpio);
22+
}
23+
1924
// UART
2025
if (SerialEnable == true) {
2126
Serial.begin(115200);

0 commit comments

Comments
 (0)