From c413d79f4fe149fccf417c934fdd1c644568ea3f Mon Sep 17 00:00:00 2001 From: dschmenk Date: Mon, 15 Aug 2016 16:08:31 -0700 Subject: [PATCH] handle lower case files and io timing --- src/libsrc/sdfat.pla | 3 +-- src/samplesrc/fatget.pla | 14 +++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/libsrc/sdfat.pla b/src/libsrc/sdfat.pla index 3a1d726..c1d07ed 100644 --- a/src/libsrc/sdfat.pla +++ b/src/libsrc/sdfat.pla @@ -143,6 +143,5 @@ end // Init SD card FAT filesystem // spiSend(14) // SDINIT -spiDelay(100) -return spiRecv <> SPI_SLAVE_READY // Is Arduino READY? +return spiReady <> 0 // Is Arduino READY? done \ No newline at end of file diff --git a/src/samplesrc/fatget.pla b/src/samplesrc/fatget.pla index 0c5c84c..dc3e99a 100644 --- a/src/samplesrc/fatget.pla +++ b/src/samplesrc/fatget.pla @@ -4,6 +4,7 @@ include "inc/args.plh" include "inc/sdfat.plh" const COPY_BUF_SIZE = 8912 // 8K +const LOWER_DIFF = 'a' - 'A' byte[17] proname byte protype @@ -29,14 +30,21 @@ def putWord(val) return putByte(val.0) end +def charUpper(c) + if c >= 'a' and c <= 'z' + return c - LOWER_DIFF + fin + return c +end + def hexByte(hexChars) byte lo, hi - lo = ^(hexChars + 1) - '0' + lo = charUpper(^(hexChars + 1)) - '0' if lo > 9 lo = lo - 7 fin - hi = ^hexChars - '0' + hi = charUpper(^hexChars) - '0' if hi > 9 hi = hi - 7 fin @@ -44,7 +52,7 @@ def hexByte(hexChars) end def hexWord(hexChars) - return (hexByte(hexChars + 2) << 8) | hexByte(hexChars) + return (hexByte(hexChars) << 8) | hexByte(hexChars + 2) end def mkProName(fatName, proName, proType, proAux)