-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SD card init and keyboard backlight preferences
- basic SD card initialization - keyboard backlight brightness is saved in the settings
- Loading branch information
Showing
9 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <Arduino.h> | ||
#include "sd_card_hal_esp32.h" | ||
#include <SD.h> | ||
#include <SPI.h> | ||
|
||
uint8_t SD_EN_GPIO = 16; | ||
uint8_t SD_CS_GPIO = 18; | ||
uint8_t SD_MISO_GPIO = 7; | ||
uint8_t SD_MOSI_GPIO = 17; | ||
uint8_t SD_SCK_GPIO = 15; | ||
|
||
void init_SD_HAL(void) { | ||
pinMode(SD_EN_GPIO, OUTPUT); | ||
digitalWrite(SD_EN_GPIO, LOW); | ||
delay(10); // wait for the SD card to power up | ||
SPI.begin(SD_SCK_GPIO, SD_MISO_GPIO, SD_MOSI_GPIO, SD_CS_GPIO); | ||
if (!SD.begin(SD_CS_GPIO, SPI, 10000000)) { // 10 MHz | ||
Serial.println("No SD card found."); | ||
return; | ||
} | ||
else{ | ||
Serial.println("SD card initialized successfully."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
extern uint8_t SD_EN_GPIO; | ||
extern uint8_t SD_CS_GPIO; | ||
extern uint8_t SD_MISO_GPIO; | ||
extern uint8_t SD_MOSI_GPIO; | ||
extern uint8_t SD_SCK_GPIO; | ||
|
||
void init_SD_HAL(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters