Skip to content

Commit

Permalink
add SPI pins init code
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitshaoxiang committed Jul 22, 2024
1 parent c4607cd commit f8c3d8c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/M5Stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@
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;
} else {
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);
Expand Down

0 comments on commit f8c3d8c

Please sign in to comment.