Browse Source

TeensySdioDemo - print SD clk

main
Bill Greiman 8 years ago
parent
commit
7aa42c303a
3 changed files with 10 additions and 2 deletions
  1. +3
    -1
      SdFat/examples/TeensySdioDemo/TeensySdioDemo.ino
  2. +2
    -0
      SdFat/src/SdCard/SdioCard.h
  3. +5
    -1
      SdFat/src/SdCard/SdioTeensy.cpp

+ 3
- 1
SdFat/examples/TeensySdioDemo/TeensySdioDemo.ino View File

Serial.print("yieldCalls "); Serial.print("yieldCalls ");
Serial.println(yieldCalls); Serial.println(yieldCalls);
Serial.print("yieldMaxUsec "); Serial.print("yieldMaxUsec ");
Serial.println(yieldMaxUsec);
Serial.println(yieldMaxUsec);
Serial.print("kHzSdClk ");
Serial.println(sd.card()->kHzSdClk());
Serial.println("Done"); Serial.println("Done");
} }



+ 2
- 0
SdFat/src/SdCard/SdioCard.h View File

uint32_t errorData(); uint32_t errorData();
/** \return error line for last error. Tmp function for debug. */ /** \return error line for last error. Tmp function for debug. */
uint32_t errorLine(); uint32_t errorLine();
/** \return the SD clock frequency in kHz. */
uint32_t kHzSdClk();
/** /**
* Read a 512 byte block from an SD card. * Read a 512 byte block from an SD card.
* *

+ 5
- 1
SdFat/src/SdCard/SdioTeensy.cpp View File

while ((F_CPU/(sdclkfs*dvs) > maxSdclk) && (dvs < DVS_LIMIT)) { while ((F_CPU/(sdclkfs*dvs) > maxSdclk) && (dvs < DVS_LIMIT)) {
dvs++; dvs++;
} }
m_sdClkKhz = F_CPU/(sdclkfs*dvs);
m_sdClkKhz = F_CPU/(1000*sdclkfs*dvs);
sdclkfs >>= 1; sdclkfs >>= 1;
dvs--; dvs--;


return m_errorLine; return m_errorLine;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
uint32_t SdioCard::kHzSdClk() {
return m_sdClkKhz;
}
//-----------------------------------------------------------------------------
bool SdioCard::readBlock(uint32_t lba, uint8_t* buf) { bool SdioCard::readBlock(uint32_t lba, uint8_t* buf) {
uint8_t aligned[512]; uint8_t aligned[512];



Loading…
Cancel
Save