Simple library for interfacing to Nokia 5110 LCD display (as found on the SparkFun website). - koristen softverski SPI umjesto hardverskog

Dependents:   Nokia_FRDM

Fork of N5110 by Craig Evans

Files at this revision

API Documentation at this revision

Comitter:
esokic
Date:
Fri May 20 23:23:46 2016 +0000
Parent:
6:adb79338d40f
Commit message:
Testni kod za spajanje Nokia displeja sa Freeescale FRDM razvojnim sistemom

Changed in this revision

N5110.cpp Show annotated file Show diff for this revision Revisions of this file
N5110.h Show annotated file Show diff for this revision Revisions of this file
diff -r adb79338d40f -r 9efee30ed6d3 N5110.cpp
--- a/N5110.cpp	Mon Jan 27 18:41:45 2014 +0000
+++ b/N5110.cpp	Fri May 20 23:23:46 2016 +0000
@@ -6,12 +6,14 @@
 */
 #include "mbed.h"
 #include "N5110.h"
-
+#include "SWSPI.h"
 
 N5110::N5110(PinName pwrPin, PinName scePin, PinName rstPin, PinName dcPin, PinName mosiPin, PinName sclkPin, PinName ledPin)
 {
     
-    spi = new SPI(mosiPin,NC,sclkPin); // create new SPI instance and initialise
+    //spi = new SPI(mosiPin,NC,sclkPin); // create new SPI instance and initialise
+    spi = new SWSPI(mosiPin,PTC0,sclkPin); // create new SPI instance and initialise
+    
     initSPI();    
     
     // set up pins as required
@@ -107,7 +109,9 @@
 // function to initialise SPI peripheral
 void N5110::initSPI()
 {
+    //spi->format(8,1);    // 8 bits, Mode 1 - polarity 0, phase 1 - base value of clock is 0, data captured on falling edge/propagated on rising edge
     spi->format(8,1);    // 8 bits, Mode 1 - polarity 0, phase 1 - base value of clock is 0, data captured on falling edge/propagated on rising edge
+
     spi->frequency(4000000);  // maximum of screen is 4 MHz
 }
 
diff -r adb79338d40f -r 9efee30ed6d3 N5110.h
--- a/N5110.h	Mon Jan 27 18:41:45 2014 +0000
+++ b/N5110.h	Fri May 20 23:23:46 2016 +0000
@@ -8,6 +8,8 @@
 #ifndef N5110_H
 #define N5110_H
 
+#include "SWSPI.h"
+
 // Command Bytes - taken from Chris Yan's library
 // More information can be found in the display datasheet
 // H = 0 - Basic instructions
@@ -207,7 +209,7 @@
     unsigned char buffer[84][6];  // screen buffer - the 6 is for the banks - each one is 8 bits;
 
 private:  // private variables
-    SPI*    spi;
+    SWSPI*    spi;
     PwmOut* led;
     DigitalOut* pwr;
     DigitalOut* sce;