Adafruit library for our project

Dependents:   ece495_firmware

Fork of Adafruit_ILI9341 by James Kidd

Files at this revision

API Documentation at this revision

Comitter:
bdk9
Date:
Thu Dec 08 20:00:16 2016 +0000
Parent:
2:dd1efb72ee21
Commit message:
Port to f401re

Changed in this revision

Adafruit_ILI9341.cpp Show annotated file Show diff for this revision Revisions of this file
Adafruit_ILI9341.h Show annotated file Show diff for this revision Revisions of this file
diff -r dd1efb72ee21 -r faeae97c1170 Adafruit_ILI9341.cpp
--- a/Adafruit_ILI9341.cpp	Tue Nov 29 16:56:30 2016 +0000
+++ b/Adafruit_ILI9341.cpp	Thu Dec 08 20:00:16 2016 +0000
@@ -18,15 +18,15 @@
 #include "Adafruit_ILI9341.h"
 #include "mbed.h"
 #include "PinNames.h"
-#include "BurstSPI.h"
+//#include "BurstSPI.h"
 
 Adafruit_ILI9341::Adafruit_ILI9341(PinName DC, PinName CS, PinName RST) : Adafruit_GFX(ILI9341_TFTWIDTH,ILI9341_TFTHEIGHT) {
     _pins.rst = RST;
     _pins.cs = CS;
     _pins.dc = DC;
-    _pins.miso = SPI_MISO;
-    _pins.mosi = SPI_MOSI;
-    _pins.sclk = SPI_SCK;
+    _pins.miso = PC_11;
+    _pins.mosi = PC_12;
+    _pins.sclk = PC_10;
     hwSPI = true;
 }
 
@@ -41,7 +41,7 @@
 void Adafruit_ILI9341::writecommand(uint8_t c) {
 
     LcdSPI->format(8,3);
-    LcdSPI->setFormat();
+//    LcdSPI->setFormat();
     Pins[PIN_DC]->write(0);
     if(Pins[PIN_SCE] > 0)
         Pins[PIN_SCE]->write(0);
@@ -50,13 +50,13 @@
     if(Pins[PIN_SCE] > 0)
         Pins[PIN_SCE]->write(1);
     LcdSPI->format(16,3);
-    LcdSPI->setFormat();
+//    LcdSPI->setFormat();
 }
 
 void Adafruit_ILI9341::writedata(uint16_t c) {
 
     LcdSPI->format(8,3);
-    LcdSPI->setFormat();
+//    LcdSPI->setFormat();
     Pins[PIN_DC]->write(1);
     if(Pins[PIN_SCE] > 0)
         Pins[PIN_SCE]->write(0);
@@ -65,7 +65,7 @@
     if(Pins[PIN_SCE] > 0)
         Pins[PIN_SCE]->write(1);
     LcdSPI->format(16,3);
-    LcdSPI->setFormat();
+//    LcdSPI->setFormat();
 }
 
 void Adafruit_ILI9341::commandList(uint8_t *addr) {
@@ -91,10 +91,10 @@
   }*/
 }
 void Adafruit_ILI9341::begin(void) {
-    LcdSPI = new BurstSPI(_pins.mosi,_pins.miso,_pins.sclk);
+    LcdSPI = new SPI(_pins.mosi,_pins.miso,_pins.sclk);
             LcdSPI->format(LCD_SPI_BITS, LCD_SPI_MODE);
             LcdSPI->frequency(LCD_FREQ);
-            LcdSPI->setFormat();
+//            LcdSPI->setFormat();
             Pins = new DigitalOut*[3];
              Pins[PIN_RST]   = new DigitalOut(_pins.rst);
                Pins[PIN_SCE]   = new DigitalOut(_pins.cs);
@@ -328,7 +328,7 @@
   Pins[PIN_SCE]->write(0);
 
   while (h--) {
-      LcdSPI->fastWrite(color);
+      LcdSPI->write(color);
       //spiwrite(color);
     //spiwrite(hi);
     //spiwrite(lo);
@@ -337,7 +337,7 @@
   //*csport |= cspinmask;
   //digitalWrite(_cs, HIGH);
   if (hwSPI) spi_end();
-  LcdSPI->clearRX();
+  //LcdSPI->clearRX();
 }
 
 
@@ -359,7 +359,7 @@
   //digitalWrite(_cs, LOW);
   while (w--) {
       //spiwrite(color);
-      LcdSPI->fastWrite(color);
+      LcdSPI->write(color);
     //spiwrite(hi);
     //spiwrite(lo);
   }
@@ -367,7 +367,7 @@
   //*csport |= cspinmask;
   //digitalWrite(_cs, HIGH);
   if (hwSPI) spi_end();
-  LcdSPI->clearRX();
+  //LcdSPI->clearRX();
 }
 
 void Adafruit_ILI9341::fillScreen(uint16_t color) {
@@ -399,7 +399,7 @@
   Pins[PIN_SCE]->write(0);
   int32_t cnt;
   for(cnt = w*h;cnt > 0;cnt--){
-      LcdSPI->fastWrite(color);
+      LcdSPI->write(color);
       //spiwrite(hi);
 //spiwrite(color);
             //spiwrite(color);
@@ -421,7 +421,7 @@
   if (hwSPI) spi_end();
 
   //wait_ms(30);
-  LcdSPI->clearRX();
+  //LcdSPI->clearRX();
   //LcdSPI->format(LCD_SPI_BITS, LCD_SPI_MODE);
   //LcdSPI->setFormat();
 }
diff -r dd1efb72ee21 -r faeae97c1170 Adafruit_ILI9341.h
--- a/Adafruit_ILI9341.h	Tue Nov 29 16:56:30 2016 +0000
+++ b/Adafruit_ILI9341.h	Thu Dec 08 20:00:16 2016 +0000
@@ -22,7 +22,7 @@
 #include "Adafruit_GFX.h"
 #include "mbed.h"
 
-#include "BurstSPI.h"
+//#include "BurstSPI.h"
 #define spi_begin()
 #define spi_end()
 
@@ -153,7 +153,7 @@
 private:
         bool hwSPI;
    AdaLcdPins _pins;
-   BurstSPI* LcdSPI;
+   SPI* LcdSPI;
    DigitalOut** Pins;
    uint8_t  tabcolor;
 };