Simple library for interfacing to Nokia 5110 LCD display (as found on the SparkFun website). - koristen softverski SPI umjesto hardverskog
Fork of N5110 by
Diff: N5110.cpp
- Revision:
- 7:9efee30ed6d3
- Parent:
- 6:adb79338d40f
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 }