浏览代码

TeensySdioDemo - print SD clk

main
Bill Greiman 8 年前
父节点
当前提交
7aa42c303a
共有 3 个文件被更改,包括 10 次插入2 次删除
  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 查看文件

@@ -102,7 +102,9 @@ void setup() {
Serial.print("yieldCalls ");
Serial.println(yieldCalls);
Serial.print("yieldMaxUsec ");
Serial.println(yieldMaxUsec);
Serial.println(yieldMaxUsec);
Serial.print("kHzSdClk ");
Serial.println(sd.card()->kHzSdClk());
Serial.println("Done");
}


+ 2
- 0
SdFat/src/SdCard/SdioCard.h 查看文件

@@ -62,6 +62,8 @@ class SdioCard : public BaseBlockDriver {
uint32_t errorData();
/** \return error line for last error. Tmp function for debug. */
uint32_t errorLine();
/** \return the SD clock frequency in kHz. */
uint32_t kHzSdClk();
/**
* Read a 512 byte block from an SD card.
*

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

@@ -274,7 +274,7 @@ static void setSdclk(uint32_t kHzMax) {
while ((F_CPU/(sdclkfs*dvs) > maxSdclk) && (dvs < DVS_LIMIT)) {
dvs++;
}
m_sdClkKhz = F_CPU/(sdclkfs*dvs);
m_sdClkKhz = F_CPU/(1000*sdclkfs*dvs);
sdclkfs >>= 1;
dvs--;

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


正在加载...
取消
保存