瀏覽代碼

Fix for Teensy 4.1

main
Bill Greiman 4 年之前
父節點
當前提交
8adf5b5a86
共有 3 個檔案被更改,包括 17 行新增5 行删除
  1. +10
    -4
      src/FatLib/FatFileLFN.cpp
  2. +4
    -1
      src/SdCard/SdioTeensy.cpp
  3. +3
    -0
      src/SdFatConfig.h

+ 10
- 4
src/FatLib/FatFileLFN.cpp 查看文件

@@ -89,7 +89,7 @@ static bool lfnGetName(DirLfn_t *ldir, char* name, size_t n) {
return true;
}
//------------------------------------------------------------------------------
inline bool lfnLegalChar(char c) {
inline bool lfnLegalChar(uint8_t c) {
if (c == '/' || c == '\\' || c == '"' || c == '*' ||
c == ':' || c == '<' || c == '>' || c == '?' || c == '|') {
return false;
@@ -208,7 +208,8 @@ bool FatFile::parsePathName(const char* path,
break;
}
if (!lfnLegalChar(c)) {
return false;
DBG_FAIL_MACRO;
goto fail;
}
}
// Advance to next path component.
@@ -225,7 +226,8 @@ bool FatFile::parsePathName(const char* path,
}
// Max length of LFN is 255.
if (len > 255) {
return false;
DBG_FAIL_MACRO;
goto fail;
}
fname->len = len;
// Blank file short name.
@@ -280,7 +282,8 @@ bool FatFile::parsePathName(const char* path,
}
}
if (fname->sfn[0] == ' ') {
return false;
DBG_FAIL_MACRO;
goto fail;
}

if (is83) {
@@ -291,6 +294,9 @@ bool FatFile::parsePathName(const char* path,
fname->sfn[fname->seqPos + 1] = '1';
}
return true;
fail:
return false;
}
//------------------------------------------------------------------------------
bool FatFile::open(FatFile* dirFile, fname_t* fname, oflag_t oflag) {

+ 4
- 1
src/SdCard/SdioTeensy.cpp 查看文件

@@ -298,8 +298,11 @@ static void gpioMux(uint8_t mode) {
// add speed strength args?
static void enableGPIO(bool enable) {
const uint32_t CLOCK_MASK = IOMUXC_SW_PAD_CTL_PAD_PKE |
// IOMUXC_SW_PAD_CTL_PAD_DSE(1) |
#if defined(ARDUINO_TEENSY41)
IOMUXC_SW_PAD_CTL_PAD_DSE(1) |
#else // defined(ARDUINO_TEENSY41)
IOMUXC_SW_PAD_CTL_PAD_DSE(4) | ///// WHG
#endif // defined(ARDUINO_TEENSY41)
IOMUXC_SW_PAD_CTL_PAD_SPEED(2);

const uint32_t DATA_MASK = CLOCK_MASK | IOMUXC_SW_PAD_CTL_PAD_PUE |

+ 3
- 0
src/SdFatConfig.h 查看文件

@@ -38,6 +38,7 @@
#define ENABLE_ARDUINO_SERIAL 1
/** For Debug - must be one */
#define ENABLE_ARDUINO_STRING 1
//------------------------------------------------------------------------------
/** Set USE_BLOCK_DEVICE_INTERFACE nonzero to use generic block device */
#define USE_BLOCK_DEVICE_INTERFACE 0
//------------------------------------------------------------------------------
@@ -192,6 +193,8 @@ typedef uint8_t SdCsPin_t;
#elif defined(__arm__)
// ARM gcc defines open flags.
#define USE_FCNTL_H 1
#elif defined(ESP32)
#define USE_FCNTL_H 1
#else // defined(__AVR__)
#define USE_FCNTL_H 0
#endif // defined(__AVR__)

Loading…
取消
儲存