Skip to content

Commit

Permalink
Fix for Teensy 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
greiman committed Apr 24, 2020
1 parent 56f3e4c commit 8adf5b5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
14 changes: 10 additions & 4 deletions src/FatLib/FatFileLFN.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -280,7 +282,8 @@ bool FatFile::parsePathName(const char* path,
}
}
if (fname->sfn[0] == ' ') {
return false;
DBG_FAIL_MACRO;
goto fail;
}

if (is83) {
Expand All @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion src/SdCard/SdioTeensy.cpp
Expand Up @@ -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 |
Expand Down
3 changes: 3 additions & 0 deletions src/SdFatConfig.h
Expand Up @@ -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
//------------------------------------------------------------------------------
Expand Down Expand Up @@ -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__)
Expand Down

0 comments on commit 8adf5b5

Please sign in to comment.