diff --git a/src/Inkplate.cpp b/src/Inkplate.cpp index 89cfa4b..2e4e5c3 100644 --- a/src/Inkplate.cpp +++ b/src/Inkplate.cpp @@ -1,94 +1,94 @@ #include "Inkplate.h" #define CL 0x01 -#define CL_SET \ - { \ - GPIO.out_w1ts = CL; \ +#define CL_SET \ + { \ + GPIO.out_w1ts = CL; \ } -#define CL_CLEAR \ - { \ - GPIO.out_w1tc = CL; \ +#define CL_CLEAR \ + { \ + GPIO.out_w1tc = CL; \ } #define CKV 0x01 -#define CKV_SET \ - { \ - GPIO.out1_w1ts.val = CKV; \ +#define CKV_SET \ + { \ + GPIO.out1_w1ts.val = CKV; \ } -#define CKV_CLEAR \ - { \ - GPIO.out1_w1tc.val = CKV; \ +#define CKV_CLEAR \ + { \ + GPIO.out1_w1tc.val = CKV; \ } #define SPH 0x02 -#define SPH_SET \ - { \ - GPIO.out1_w1ts.val = SPH; \ +#define SPH_SET \ + { \ + GPIO.out1_w1ts.val = SPH; \ } -#define SPH_CLEAR \ - { \ - GPIO.out1_w1tc.val = SPH; \ +#define SPH_CLEAR \ + { \ + GPIO.out1_w1tc.val = SPH; \ } #define LE 0x04 -#define LE_SET \ - { \ - GPIO.out_w1ts = LE; \ +#define LE_SET \ + { \ + GPIO.out_w1ts = LE; \ } -#define LE_CLEAR \ - { \ - GPIO.out_w1tc = LE; \ +#define LE_CLEAR \ + { \ + GPIO.out_w1tc = LE; \ } #define OE 0 -#define OE_SET \ - { \ - digitalWriteMCP(OE, HIGH); \ +#define OE_SET \ + { \ + digitalWriteMCP(OE, HIGH); \ } -#define OE_CLEAR \ - { \ - digitalWriteMCP(OE, LOW); \ +#define OE_CLEAR \ + { \ + digitalWriteMCP(OE, LOW); \ } #define GMOD 1 -#define GMOD_SET \ - { \ - digitalWriteMCP(GMOD, HIGH); \ +#define GMOD_SET \ + { \ + digitalWriteMCP(GMOD, HIGH); \ } -#define GMOD_CLEAR \ - { \ - digitalWriteMCP(GMOD, LOW); \ +#define GMOD_CLEAR \ + { \ + digitalWriteMCP(GMOD, LOW); \ } #define SPV 2 -#define SPV_SET \ - { \ - digitalWriteMCP(SPV, HIGH); \ +#define SPV_SET \ + { \ + digitalWriteMCP(SPV, HIGH); \ } -#define SPV_CLEAR \ - { \ - digitalWriteMCP(SPV, LOW); \ +#define SPV_CLEAR \ + { \ + digitalWriteMCP(SPV, LOW); \ } #define WAKEUP 3 -#define WAKEUP_SET \ - { \ - digitalWriteMCP(WAKEUP, HIGH); \ +#define WAKEUP_SET \ + { \ + digitalWriteMCP(WAKEUP, HIGH); \ } -#define WAKEUP_CLEAR \ - { \ - digitalWriteMCP(WAKEUP, LOW); \ +#define WAKEUP_CLEAR \ + { \ + digitalWriteMCP(WAKEUP, LOW); \ } #define PWRUP 4 -#define PWRUP_SET \ - { \ - digitalWriteMCP(PWRUP, HIGH); \ +#define PWRUP_SET \ + { \ + digitalWriteMCP(PWRUP, HIGH); \ } -#define PWRUP_CLEAR \ - { \ - digitalWriteMCP(PWRUP, LOW); \ +#define PWRUP_CLEAR \ + { \ + digitalWriteMCP(PWRUP, LOW); \ } #define VCOM 5 -#define VCOM_SET \ - { \ - digitalWriteMCP(VCOM, HIGH); \ +#define VCOM_SET \ + { \ + digitalWriteMCP(VCOM, HIGH); \ } -#define VCOM_CLEAR \ - { \ - digitalWriteMCP(VCOM, LOW); \ +#define VCOM_CLEAR \ + { \ + digitalWriteMCP(VCOM, LOW); \ } #define GPIO0_ENABLE 8 @@ -194,7 +194,6 @@ void Inkplate::display1b() { memcpy(DMemoryNew, _partial, 60000); - uint32_t _send; uint8_t data; uint8_t dram; @@ -598,7 +597,6 @@ void Inkplate::hscan_start(uint32_t _d) SPH_SET; } - void Inkplate::vscan_end() { CKV_CLEAR; @@ -608,7 +606,6 @@ void Inkplate::vscan_end() CKV_SET; } - void Inkplate::pinsZstate() { pinMode(0, INPUT); diff --git a/src/Inkplate.h b/src/Inkplate.h index c4c3e2c..7433468 100644 --- a/src/Inkplate.h +++ b/src/Inkplate.h @@ -9,12 +9,17 @@ #include "include/Graphics.h" #include "include/System.h" +#include "SPI.h" +#include "libs/SdFat/SdFat.h" #include "include/defines.h" +extern SPIClass spi2; +extern SdFat sd; + class Inkplate : public System, public Graphics { - public: +public: Inkplate(uint8_t _mode); void begin(void); @@ -39,7 +44,7 @@ class Inkplate : public System, public Graphics return NetworkClient::isConnected(); }; - private: +private: void precalculateGamma(uint8_t *c, float gamma); void display1b(); @@ -56,9 +61,7 @@ class Inkplate : public System, public Graphics uint8_t _beginDone = 0; - const uint8_t waveform3Bit[8][8] = {{0, 0, 0, 0, 1, 1, 1, 0}, {1, 2, 2, 2, 1, 1, 1, 0}, {0, 1, 2, 1, 1, 2, 1, 0}, - {0, 2, 1, 2, 1, 2, 1, 0}, {0, 0, 0, 1, 1, 1, 2, 0}, {2, 1, 1, 1, 2, 1, 2, 0}, - {1, 1, 1, 2, 1, 2, 2, 0}, {0, 0, 0, 0, 0, 0, 2, 0}}; + const uint8_t waveform3Bit[8][8] = {{0, 0, 0, 0, 1, 1, 1, 0}, {1, 2, 2, 2, 1, 1, 1, 0}, {0, 1, 2, 1, 1, 2, 1, 0}, {0, 2, 1, 2, 1, 2, 1, 0}, {0, 0, 0, 1, 1, 1, 2, 0}, {2, 1, 1, 1, 2, 1, 2, 0}, {1, 1, 1, 2, 1, 2, 2, 0}, {0, 0, 0, 0, 0, 0, 2, 0}}; const uint32_t waveform[50] = { 0x00000008, 0x00000008, 0x00200408, 0x80281888, 0x60A81898, 0x60A8A8A8, 0x60A8A8A8, 0x6068A868, 0x6868A868, 0x6868A868, 0x68686868, 0x6A686868, 0x5A686868, 0x5A686868, 0x5A586A68, 0x5A5A6A68, 0x5A5A6A68, 0x55566A68, diff --git a/src/include/System.h b/src/include/System.h index c22f14e..f0956c4 100644 --- a/src/include/System.h +++ b/src/include/System.h @@ -11,7 +11,7 @@ class System : public Esp, public Mcp, virtual public NetworkClient { - public: +public: void setPanelState(uint8_t s); uint8_t getPanelState(); @@ -29,7 +29,7 @@ class System : public Esp, public Mcp, virtual public NetworkClient SdFat getSdFat(); SPIClass getSPI(); - private: +private: uint8_t _panelOn = 0; int8_t _temperature; int16_t _sdCardOk = 0;