mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-24 05:50:16 +00:00
SD software SPI control
This commit is contained in:
parent
920505698b
commit
1c8a763496
@ -12,7 +12,8 @@
|
|||||||
#include "SPILock.h"
|
#include "SPILock.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
|
||||||
#ifdef HAS_SDCARD
|
// Software SPI is used by MUI so disable SD card here until it's also implemented
|
||||||
|
#if defined(HAS_SDCARD) && !defined(SDCARD_USE_SOFT_SPI)
|
||||||
#include <SD.h>
|
#include <SD.h>
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
|
|
||||||
@ -306,7 +307,7 @@ void fsInit()
|
|||||||
*/
|
*/
|
||||||
void setupSDCard()
|
void setupSDCard()
|
||||||
{
|
{
|
||||||
#ifdef HAS_SDCARD
|
#if defined(HAS_SDCARD) && !defined(SDCARD_USE_SOFT_SPI)
|
||||||
concurrency::LockGuard g(spiLock);
|
concurrency::LockGuard g(spiLock);
|
||||||
SDHandler.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
|
SDHandler.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
|
||||||
if (!SD.begin(SDCARD_CS, SDHandler, SD_SPI_FREQUENCY)) {
|
if (!SD.begin(SDCARD_CS, SDHandler, SD_SPI_FREQUENCY)) {
|
||||||
|
@ -17,6 +17,14 @@ static const uint8_t MOSI = 48;
|
|||||||
static const uint8_t MISO = 47;
|
static const uint8_t MISO = 47;
|
||||||
static const uint8_t SCK = 41;
|
static const uint8_t SCK = 41;
|
||||||
|
|
||||||
|
#ifndef CROW_SELECT
|
||||||
|
static const uint8_t SPI_MOSI = 6;
|
||||||
|
static const uint8_t SPI_SCK = 5;
|
||||||
|
static const uint8_t SPI_MISO = 4;
|
||||||
|
static const uint8_t SPI_CS = 7; // SD does not support -1
|
||||||
|
static const uint8_t SDCARD_CS = SPI_CS;
|
||||||
|
#endif
|
||||||
|
|
||||||
static const uint8_t A0 = 1;
|
static const uint8_t A0 = 1;
|
||||||
static const uint8_t A1 = 2;
|
static const uint8_t A1 = 2;
|
||||||
static const uint8_t A2 = 3;
|
static const uint8_t A2 = 3;
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
extends = esp32s3_base
|
extends = esp32s3_base
|
||||||
board = crowpanel
|
board = crowpanel
|
||||||
board_check = true
|
board_check = true
|
||||||
board_level = extra
|
|
||||||
upload_protocol = esptool
|
upload_protocol = esptool
|
||||||
|
|
||||||
build_flags = ${esp32s3_base.build_flags}
|
build_flags = ${esp32s3_base.build_flags}
|
||||||
@ -83,8 +82,10 @@ build_flags =
|
|||||||
${crowpanel_base_tft.build_flags}
|
${crowpanel_base_tft.build_flags}
|
||||||
-D TFT_HEIGHT=320 ; needed in variant.h
|
-D TFT_HEIGHT=320 ; needed in variant.h
|
||||||
-D HAS_SDCARD
|
-D HAS_SDCARD
|
||||||
|
-D SDCARD_USE_SOFT_SPI
|
||||||
|
-D SPI_DRIVER_SELECT=2
|
||||||
-D USE_I2S_BUZZER
|
-D USE_I2S_BUZZER
|
||||||
; -D INPUTDRIVER_BUTTON_TYPE=0
|
-D INPUTDRIVER_BUTTON_TYPE=0
|
||||||
-D LGFX_DRIVER_TEMPLATE
|
-D LGFX_DRIVER_TEMPLATE
|
||||||
-D LGFX_DRIVER=LGFX_GENERIC
|
-D LGFX_DRIVER=LGFX_GENERIC
|
||||||
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_GENERIC.h\"
|
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_GENERIC.h\"
|
||||||
@ -128,8 +129,10 @@ build_flags =
|
|||||||
${crowpanel_base_tft.build_flags}
|
${crowpanel_base_tft.build_flags}
|
||||||
-D TFT_HEIGHT=480 ; needed in variant.h
|
-D TFT_HEIGHT=480 ; needed in variant.h
|
||||||
-D HAS_SDCARD
|
-D HAS_SDCARD
|
||||||
|
-D SDCARD_USE_SOFT_SPI
|
||||||
|
-D SPI_DRIVER_SELECT=2
|
||||||
-D USE_I2S_BUZZER
|
-D USE_I2S_BUZZER
|
||||||
; -D INPUTDRIVER_BUTTON_TYPE=0
|
-D INPUTDRIVER_BUTTON_TYPE=0
|
||||||
-D LV_CACHE_DEF_SIZE=2097152
|
-D LV_CACHE_DEF_SIZE=2097152
|
||||||
-D LGFX_DRIVER_TEMPLATE
|
-D LGFX_DRIVER_TEMPLATE
|
||||||
-D LGFX_DRIVER=LGFX_GENERIC
|
-D LGFX_DRIVER=LGFX_GENERIC
|
||||||
@ -159,6 +162,7 @@ build_flags =
|
|||||||
# 4.3 inch 800x480 IPS ST7265
|
# 4.3 inch 800x480 IPS ST7265
|
||||||
[env:elecrow-43]
|
[env:elecrow-43]
|
||||||
extends = crowpanel_base
|
extends = crowpanel_base
|
||||||
|
board_level = extra
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
${crowpanel_base.build_flags}
|
${crowpanel_base.build_flags}
|
||||||
@ -172,6 +176,7 @@ build_flags =
|
|||||||
# 5 inch 800x480 IPS ST7262
|
# 5 inch 800x480 IPS ST7262
|
||||||
[env:elecrow-50]
|
[env:elecrow-50]
|
||||||
extends = crowpanel_base
|
extends = crowpanel_base
|
||||||
|
board_level = extra
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
${crowpanel_base.build_flags}
|
${crowpanel_base.build_flags}
|
||||||
@ -185,6 +190,7 @@ build_flags =
|
|||||||
# 7 inch 800x480 IPS SC7277
|
# 7 inch 800x480 IPS SC7277
|
||||||
[env:elecrow-70]
|
[env:elecrow-70]
|
||||||
extends = crowpanel_base
|
extends = crowpanel_base
|
||||||
|
board_level = extra
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
${crowpanel_base.build_flags}
|
${crowpanel_base.build_flags}
|
||||||
@ -197,6 +203,7 @@ build_flags =
|
|||||||
|
|
||||||
[env:elecrow-70-tft]
|
[env:elecrow-70-tft]
|
||||||
extends = crowpanel_base_tft
|
extends = crowpanel_base_tft
|
||||||
|
board_level = extra
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
${crowpanel_base_tft.build_flags}
|
${crowpanel_base_tft.build_flags}
|
||||||
|
@ -135,18 +135,6 @@
|
|||||||
#define GPS_RX_PIN 18
|
#define GPS_RX_PIN 18
|
||||||
#define GPS_TX_PIN 17
|
#define GPS_TX_PIN 17
|
||||||
|
|
||||||
#if TFT_HEIGHT == 320 || TFT_HEIGHT == 480
|
|
||||||
// SDCard 2.4 - 3.5 TFT
|
|
||||||
// #define HAS_SDCARD -> must be defined in platformio.ini
|
|
||||||
#define SPI_SCK 5
|
|
||||||
#define SPI_MISO 4
|
|
||||||
#define SPI_MOSI 6
|
|
||||||
#define SDCARD_CS 7 // SD does not support -1
|
|
||||||
#else
|
|
||||||
// SDCard (from 4.3 only if LoRa is disabled)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Extension Slot Layout, viewed from above (2.4-3.5)
|
// Extension Slot Layout, viewed from above (2.4-3.5)
|
||||||
// DIO1/IO1 o o IO2/NRESET
|
// DIO1/IO1 o o IO2/NRESET
|
||||||
// SCK/IO10 o o IO16/NC
|
// SCK/IO10 o o IO16/NC
|
||||||
|
Loading…
Reference in New Issue
Block a user