Driver library for ST7565 graphics LCD controller over SPI interface.
Dependents: ST7565SPI_Test OpPanel_Offline OpPanel_Offline_cmake_gcc_arm_NUCLEO_F303RENew
Diff: ST7565SPI.cpp
- Revision:
- 3:86209398c73b
- Parent:
- 2:138b0570a8e8
--- 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; }