Driver library for ST7565 graphics LCD controller over SPI interface.

Dependents:   ST7565SPI_Test OpPanel_Offline OpPanel_Offline_cmake_gcc_arm_NUCLEO_F303RENew

Files at this revision

API Documentation at this revision

Comitter:
kayekss
Date:
Mon Mar 02 23:17:25 2015 +0000
Parent:
2:138b0570a8e8
Commit message:
Update naming conventions.

Changed in this revision

ST7565SPI.cpp Show annotated file Show diff for this revision Revisions of this file
ST7565SPI.h Show annotated file Show diff for this revision Revisions of this file
diff -r 138b0570a8e8 -r 86209398c73b ST7565SPI.cpp
--- a/ST7565SPI.cpp	Sun Mar 01 22:06:09 2015 +0000
+++ b/ST7565SPI.cpp	Mon Mar 02 23:17:25 2015 +0000
@@ -5,22 +5,22 @@
 
 #include "ST7565SPI.h"
 
-ST7565SPI::ST7565SPI(PinName mosiPin, PinName sckPin, PinName csPin,
-                     PinName rsPin, PinName rstPin, int frequency)
+ST7565SPI::ST7565SPI(PinName mosi, PinName sck, PinName cs,
+                     PinName rs, PinName rst, int frequency)
 :
-    rs(rsPin),
-    rst(rstPin),
-    spi(mosiPin, NC, sckPin),
-    cs(csPin)
+    _rs(rs),
+    _rst(rst),
+    _spi(mosi, NC, sck),
+    _cs(cs)
 {
     // Initialize SPI
-    spi.format(8, 0);
-    spi.frequency(frequency);
+    _spi.format(8, 0);
+    _spi.frequency(frequency);
     
     // Initialize pins
-    rs = 0;
-    rst = 1;
-    cs = 1;
+    _rs = 0;
+    _rst = 1;
+    _cs = 1;
     
     reset();
 }
@@ -30,9 +30,9 @@
 
 void ST7565SPI::reset() {
     wait_ms(10);
-    rst = 0;
+    _rst = 0;
     wait_ms(10);
-    rst = 1;
+    _rst = 1;
 }
 
 void ST7565SPI::clear() {
@@ -84,15 +84,15 @@
 }
 
 void ST7565SPI::command(uint8_t c) {
-    rs = 0;
-    cs = 0;
-    spi.write(c);
-    cs = 1;
+    _rs = 0;
+    _cs = 0;
+    _spi.write(c);
+    _cs = 1;
 }
 
 void ST7565SPI::data(uint8_t d) {
-    rs = 1;
-    cs = 0;
-    spi.write(d);
-    cs = 1;
+    _rs = 1;
+    _cs = 0;
+    _spi.write(d);
+    _cs = 1;
 }
diff -r 138b0570a8e8 -r 86209398c73b ST7565SPI.h
--- a/ST7565SPI.h	Sun Mar 01 22:06:09 2015 +0000
+++ b/ST7565SPI.h	Mon Mar 02 23:17:25 2015 +0000
@@ -113,22 +113,22 @@
     const static uint8_t MODIFY_WRITE_OFF    = 0xee;
     
 private:
-    DigitalOut rs;
-    DigitalOut rst;
-    SPI        spi;
-    DigitalOut cs;
+    DigitalOut _rs;
+    DigitalOut _rst;
+    SPI        _spi;
+    DigitalOut _cs;
 
 public:
     /** Constructor of class ST7565SPI.
-     * @param mosiPin    SPI data output (MOSI) pin.
-     * @param sckPin     SPI clock output (SCK) pin.
-     * @param csPin      SPI Chip select (CS) pin.
-     * @param rsPin      Register select (RS or A0) pin.
-     * @param rstPin     Hardware reset (RST) pin.
+     * @param mosi       SPI data output (MOSI) pin.
+     * @param sck        SPI clock output (SCK) pin.
+     * @param cs         SPI Chip select (CS) pin.
+     * @param rs         Register select (RS or A0) pin.
+     * @param rst        Hardware reset (RST) pin.
      * @param frequency  SPI interface frequency by hertz. (default is 1000000)
      */
-    ST7565SPI(PinName mosiPin, PinName sckPin, PinName csPin,
-              PinName rsPin, PinName rstPin, int frequency=1000000);
+    ST7565SPI(PinName mosi, PinName sck, PinName cs,
+              PinName rs, PinName rst, int frequency=1000000);
     
     /** Destructor of class ST7565SPI. */
     ~ST7565SPI();