Added SPI speed parameter

Dependents:   EasyCAT_LAB_simple EasyCAT_LAB

  • The default SPI speed has been set to 27MHz, but it can be configured using the last parameter of the constructor.
  • This is an optimization for the EasyCAT LAB , a complete educational and experimental EtherCAT® system, composed of one master and two slaves .
Revision:
9:2e5c5943b3fd
Parent:
8:32bf76e1ec9f
Child:
10:2ea035fb95d0
--- a/SPI_TFT_ILI9341.cpp	Thu Mar 20 15:29:19 2014 +0000
+++ b/SPI_TFT_ILI9341.cpp	Tue Jun 11 09:59:18 2019 +0000
@@ -24,13 +24,13 @@
 //extern Serial pc;
 //extern DigitalOut xx;     // debug !!
 
-SPI_TFT_ILI9341::SPI_TFT_ILI9341(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset, PinName dc, const char *name)
+SPI_TFT_ILI9341::SPI_TFT_ILI9341(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset, PinName dc, int spiSpeed, const char *name)
     : GraphicsDisplay(name), _spi(mosi, miso, sclk), _cs(cs), _dc(dc)
 {
     orientation = 0;
     char_x = 0;
     _reset = reset;
-    tft_reset();
+    tft_reset(spiSpeed);
 }
 
 int SPI_TFT_ILI9341::width()
@@ -105,10 +105,10 @@
 
 // Init code based on MI0283QT datasheet
 
-void SPI_TFT_ILI9341::tft_reset()
+void SPI_TFT_ILI9341::tft_reset(int spiSpeed)
 {
     _spi.format(8,3);                  // 8 bit spi mode 3
-    _spi.frequency(10000000);          // 10 Mhz SPI clock
+    _spi.frequency(spiSpeed);          // SPI clock
     _cs = 1;                           // cs high
     _dc = 1;                           // dc high 
     if (_reset != NC)