Reglobalised sd card object.

This commit is contained in:
nitko12 2020-09-15 08:37:15 +02:00
parent cb5c74138b
commit 933be84808
3 changed files with 70 additions and 70 deletions

View File

@ -1,94 +1,94 @@
#include "Inkplate.h" #include "Inkplate.h"
#define CL 0x01 #define CL 0x01
#define CL_SET \ #define CL_SET \
{ \ { \
GPIO.out_w1ts = CL; \ GPIO.out_w1ts = CL; \
} }
#define CL_CLEAR \ #define CL_CLEAR \
{ \ { \
GPIO.out_w1tc = CL; \ GPIO.out_w1tc = CL; \
} }
#define CKV 0x01 #define CKV 0x01
#define CKV_SET \ #define CKV_SET \
{ \ { \
GPIO.out1_w1ts.val = CKV; \ GPIO.out1_w1ts.val = CKV; \
} }
#define CKV_CLEAR \ #define CKV_CLEAR \
{ \ { \
GPIO.out1_w1tc.val = CKV; \ GPIO.out1_w1tc.val = CKV; \
} }
#define SPH 0x02 #define SPH 0x02
#define SPH_SET \ #define SPH_SET \
{ \ { \
GPIO.out1_w1ts.val = SPH; \ GPIO.out1_w1ts.val = SPH; \
} }
#define SPH_CLEAR \ #define SPH_CLEAR \
{ \ { \
GPIO.out1_w1tc.val = SPH; \ GPIO.out1_w1tc.val = SPH; \
} }
#define LE 0x04 #define LE 0x04
#define LE_SET \ #define LE_SET \
{ \ { \
GPIO.out_w1ts = LE; \ GPIO.out_w1ts = LE; \
} }
#define LE_CLEAR \ #define LE_CLEAR \
{ \ { \
GPIO.out_w1tc = LE; \ GPIO.out_w1tc = LE; \
} }
#define OE 0 #define OE 0
#define OE_SET \ #define OE_SET \
{ \ { \
digitalWriteMCP(OE, HIGH); \ digitalWriteMCP(OE, HIGH); \
} }
#define OE_CLEAR \ #define OE_CLEAR \
{ \ { \
digitalWriteMCP(OE, LOW); \ digitalWriteMCP(OE, LOW); \
} }
#define GMOD 1 #define GMOD 1
#define GMOD_SET \ #define GMOD_SET \
{ \ { \
digitalWriteMCP(GMOD, HIGH); \ digitalWriteMCP(GMOD, HIGH); \
} }
#define GMOD_CLEAR \ #define GMOD_CLEAR \
{ \ { \
digitalWriteMCP(GMOD, LOW); \ digitalWriteMCP(GMOD, LOW); \
} }
#define SPV 2 #define SPV 2
#define SPV_SET \ #define SPV_SET \
{ \ { \
digitalWriteMCP(SPV, HIGH); \ digitalWriteMCP(SPV, HIGH); \
} }
#define SPV_CLEAR \ #define SPV_CLEAR \
{ \ { \
digitalWriteMCP(SPV, LOW); \ digitalWriteMCP(SPV, LOW); \
} }
#define WAKEUP 3 #define WAKEUP 3
#define WAKEUP_SET \ #define WAKEUP_SET \
{ \ { \
digitalWriteMCP(WAKEUP, HIGH); \ digitalWriteMCP(WAKEUP, HIGH); \
} }
#define WAKEUP_CLEAR \ #define WAKEUP_CLEAR \
{ \ { \
digitalWriteMCP(WAKEUP, LOW); \ digitalWriteMCP(WAKEUP, LOW); \
} }
#define PWRUP 4 #define PWRUP 4
#define PWRUP_SET \ #define PWRUP_SET \
{ \ { \
digitalWriteMCP(PWRUP, HIGH); \ digitalWriteMCP(PWRUP, HIGH); \
} }
#define PWRUP_CLEAR \ #define PWRUP_CLEAR \
{ \ { \
digitalWriteMCP(PWRUP, LOW); \ digitalWriteMCP(PWRUP, LOW); \
} }
#define VCOM 5 #define VCOM 5
#define VCOM_SET \ #define VCOM_SET \
{ \ { \
digitalWriteMCP(VCOM, HIGH); \ digitalWriteMCP(VCOM, HIGH); \
} }
#define VCOM_CLEAR \ #define VCOM_CLEAR \
{ \ { \
digitalWriteMCP(VCOM, LOW); \ digitalWriteMCP(VCOM, LOW); \
} }
#define GPIO0_ENABLE 8 #define GPIO0_ENABLE 8
@ -194,7 +194,6 @@ void Inkplate::display1b()
{ {
memcpy(DMemoryNew, _partial, 60000); memcpy(DMemoryNew, _partial, 60000);
uint32_t _send; uint32_t _send;
uint8_t data; uint8_t data;
uint8_t dram; uint8_t dram;
@ -598,7 +597,6 @@ void Inkplate::hscan_start(uint32_t _d)
SPH_SET; SPH_SET;
} }
void Inkplate::vscan_end() void Inkplate::vscan_end()
{ {
CKV_CLEAR; CKV_CLEAR;
@ -608,7 +606,6 @@ void Inkplate::vscan_end()
CKV_SET; CKV_SET;
} }
void Inkplate::pinsZstate() void Inkplate::pinsZstate()
{ {
pinMode(0, INPUT); pinMode(0, INPUT);

View File

@ -9,12 +9,17 @@
#include "include/Graphics.h" #include "include/Graphics.h"
#include "include/System.h" #include "include/System.h"
#include "SPI.h"
#include "libs/SdFat/SdFat.h"
#include "include/defines.h" #include "include/defines.h"
extern SPIClass spi2;
extern SdFat sd;
class Inkplate : public System, public Graphics class Inkplate : public System, public Graphics
{ {
public: public:
Inkplate(uint8_t _mode); Inkplate(uint8_t _mode);
void begin(void); void begin(void);
@ -39,7 +44,7 @@ class Inkplate : public System, public Graphics
return NetworkClient::isConnected(); return NetworkClient::isConnected();
}; };
private: private:
void precalculateGamma(uint8_t *c, float gamma); void precalculateGamma(uint8_t *c, float gamma);
void display1b(); void display1b();
@ -56,9 +61,7 @@ class Inkplate : public System, public Graphics
uint8_t _beginDone = 0; 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}, 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}};
{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] = { const uint32_t waveform[50] = {
0x00000008, 0x00000008, 0x00200408, 0x80281888, 0x60A81898, 0x60A8A8A8, 0x60A8A8A8, 0x6068A868, 0x6868A868, 0x00000008, 0x00000008, 0x00200408, 0x80281888, 0x60A81898, 0x60A8A8A8, 0x60A8A8A8, 0x6068A868, 0x6868A868,
0x6868A868, 0x68686868, 0x6A686868, 0x5A686868, 0x5A686868, 0x5A586A68, 0x5A5A6A68, 0x5A5A6A68, 0x55566A68, 0x6868A868, 0x68686868, 0x6A686868, 0x5A686868, 0x5A686868, 0x5A586A68, 0x5A5A6A68, 0x5A5A6A68, 0x55566A68,

View File

@ -11,7 +11,7 @@
class System : public Esp, public Mcp, virtual public NetworkClient class System : public Esp, public Mcp, virtual public NetworkClient
{ {
public: public:
void setPanelState(uint8_t s); void setPanelState(uint8_t s);
uint8_t getPanelState(); uint8_t getPanelState();
@ -29,7 +29,7 @@ class System : public Esp, public Mcp, virtual public NetworkClient
SdFat getSdFat(); SdFat getSdFat();
SPIClass getSPI(); SPIClass getSPI();
private: private:
uint8_t _panelOn = 0; uint8_t _panelOn = 0;
int8_t _temperature; int8_t _temperature;
int16_t _sdCardOk = 0; int16_t _sdCardOk = 0;