From 97248873a4a131335972a1859cdf5674d9d23ba3 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Wed, 5 Jul 2017 12:27:22 -0500 Subject: [PATCH] Added constructor parameter for frequency --- SDBlockDevice.cpp | 4 ++-- SDBlockDevice.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SDBlockDevice.cpp b/SDBlockDevice.cpp index 2cf40984c0..ba45dc296c 100644 --- a/SDBlockDevice.cpp +++ b/SDBlockDevice.cpp @@ -232,7 +232,7 @@ #define SPI_READ_ERROR_ECC_C (0x1 << 2) /*!< Card ECC failed */ #define SPI_READ_ERROR_OFR (0x1 << 3) /*!< Out of Range */ -SDBlockDevice::SDBlockDevice(PinName mosi, PinName miso, PinName sclk, PinName cs) +SDBlockDevice::SDBlockDevice(PinName mosi, PinName miso, PinName sclk, PinName cs, uint64_t hz) : _spi(mosi, miso, sclk), _cs(cs), _is_initialized(0) { _cs = 1; @@ -240,7 +240,7 @@ SDBlockDevice::SDBlockDevice(PinName mosi, PinName miso, PinName sclk, PinName c // Set default to 100kHz for initialisation and 1MHz for data transfer _init_sck = 100000; - _transfer_sck = 1000000; + _transfer_sck = hz; // Only HC block size is supported. _block_size = BLOCK_SIZE_HC; diff --git a/SDBlockDevice.h b/SDBlockDevice.h index 17775720d4..8d46a986de 100644 --- a/SDBlockDevice.h +++ b/SDBlockDevice.h @@ -50,7 +50,7 @@ class SDBlockDevice : public BlockDevice { public: /** Lifetime of an SD card */ - SDBlockDevice(PinName mosi, PinName miso, PinName sclk, PinName cs); + SDBlockDevice(PinName mosi, PinName miso, PinName sclk, PinName cs, uint64_t hz=1000000); virtual ~SDBlockDevice(); /** Initialize a block device