EPD display library. Check this version (it should work)

Fork of GDEP015OC1 by Jurica Resetar

Files at this revision

API Documentation at this revision

Comitter:
Anunnaki
Date:
Wed Sep 14 14:57:23 2016 +0000
Parent:
0:5bcd2ada1e26
Child:
2:1c8f73aa2a16
Commit message:
Added function prototypes and started working on the declarations.

Changed in this revision

EPD.cpp Show diff for this revision Revisions of this file
EPD.h Show diff for this revision Revisions of this file
GDEP015OC1.cpp Show annotated file Show diff for this revision Revisions of this file
GDEP015OC1.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GDEP015OC1.cpp	Wed Sep 14 14:57:23 2016 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+
+#include "GDEP015OC1.h"
+
+GDEP015OC1::GDEP015OC1(spi& spi, PinName cs=p5, PinName dc=p6, PinName rst=p7, PinName busy=p8) : _spi(spi), _cs(cs), _dc(dc), _rst(rst), _busy(busy){
+    _init();
+}
+
+void GDEP015OC1::_spiCallback(int event){
+    if(event = SPI_EVENT_COMPLETE)
+        cs = 1;    
+}
+
+bool GDEP015OC1::_spiCommand(unsigned char command){
+    unsigned char _package = command;
+    cs = dc = 0;
+    wait_us(1);
+    
+    while(transfer(&_package, 1, NULL, 0, NULL)!= 0);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GDEP015OC1.h	Wed Sep 14 14:57:23 2016 +0000
@@ -0,0 +1,28 @@
+namespace GDEP015OC1
+{
+    class GDEP015OC1
+    {
+        public:            
+            void fill(unsigned char data, uin16_t i);            
+            unsigned char get(uint16_t i);            
+            void empty(void);            
+            void invert(void);            
+            bool write(void);            
+            void drawPixel(uint16_t startX, uint16_t startY, bool color);            
+            void drawLine(uint16_t startX,  uint16_t startY, uint16_t stopX, uint16_t stopY, bool color);
+        private:
+            SPI& _spi;
+            DigitalOut _cs;
+            DigitalOut _dc;
+            DigitalOut _rst;
+            DigitalIn  _busy;
+    
+            void _spiCallback(int event);
+            bool _spiCommand(unsigned char command);            
+            bool _spiData(unsigned char data);            
+            void _init(void);
+            void _wakeUp(void);            
+            void _sleep(void);            
+            unsigned char _pixelConv(unsigned char *data, int i);
+    };    
+}
\ No newline at end of file