Fix bug in 7color display's pin assignment
This commit is contained in:
parent
0ba0101ff6
commit
8ee6144e34
@ -34,14 +34,10 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "epd7in3f.h"
|
#include "epd7in3f.h"
|
||||||
|
|
||||||
Epd::~Epd(){};
|
Epd::Epd(int reset_pin, int dc_pin, int cs_pin, int busy_pin, int width, int height)
|
||||||
|
: EpdIf(reset_pin, dc_pin, cs_pin, busy_pin, width, height) {}
|
||||||
|
|
||||||
Epd::Epd(UWORD width, UWORD height, int busyPin, int restPin, int dcPin, int csPin)
|
Epd::~Epd(){};
|
||||||
: EpdIf(busyPin, restPin, dcPin, csPin)
|
|
||||||
{
|
|
||||||
width = width;
|
|
||||||
height = height;
|
|
||||||
};
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
function : Initialize the e-Paper register
|
function : Initialize the e-Paper register
|
||||||
|
@ -53,7 +53,7 @@ Color Index
|
|||||||
class Epd : EpdIf
|
class Epd : EpdIf
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Epd(UWORD width, UWORD height, int busyPin, int restPin, int dcPin, int csPin);
|
Epd(int reset_pin, int dc_pin, int cs_pin, int busy_pin, int width, int height);
|
||||||
~Epd();
|
~Epd();
|
||||||
int Init(void);
|
int Init(void);
|
||||||
void EPD_7IN3F_BusyHigh(void);
|
void EPD_7IN3F_BusyHigh(void);
|
||||||
@ -67,10 +67,6 @@ public:
|
|||||||
void SendData(unsigned char data);
|
void SendData(unsigned char data);
|
||||||
void Sleep(void);
|
void Sleep(void);
|
||||||
void Clear(UBYTE color);
|
void Clear(UBYTE color);
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned long width;
|
|
||||||
unsigned long height;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* EPD5IN83B_HD_H */
|
#endif /* EPD5IN83B_HD_H */
|
||||||
|
@ -30,15 +30,15 @@
|
|||||||
|
|
||||||
#ifdef EPD7IN3F
|
#ifdef EPD7IN3F
|
||||||
|
|
||||||
EpdIf::EpdIf(int busyPin, int restPin, int dcPin, int csPin)
|
EpdIf::EpdIf(int reset_pin, int dc_pin, int cs_pin, int busy_pin, int width, int height)
|
||||||
{
|
: reset_pin(reset_pin),
|
||||||
reset_pin = restPin;
|
dc_pin(dc_pin),
|
||||||
dc_pin = dcPin;
|
cs_pin(cs_pin),
|
||||||
cs_pin = csPin;
|
busy_pin(busy_pin),
|
||||||
busy_pin = busyPin;
|
width(width),
|
||||||
};
|
height(height) {}
|
||||||
|
|
||||||
EpdIf::~EpdIf(){};
|
EpdIf::~EpdIf() {}
|
||||||
|
|
||||||
void EpdIf::DigitalWrite(int pin, int value)
|
void EpdIf::DigitalWrite(int pin, int value)
|
||||||
{
|
{
|
||||||
|
@ -28,25 +28,35 @@
|
|||||||
#ifndef EPDIF_H
|
#ifndef EPDIF_H
|
||||||
#define EPDIF_H
|
#define EPDIF_H
|
||||||
|
|
||||||
|
// #define DISPLAY_WIDTH 800
|
||||||
|
// #define DISPLAY_HEIGHT 480
|
||||||
|
|
||||||
|
// #define BUSY_PIN 26
|
||||||
|
// #define RST_PIN 27
|
||||||
|
// #define DC_PIN 15
|
||||||
|
// #define CS_PIN 14
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
class EpdIf
|
class EpdIf
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EpdIf(int busyPin, int restPin, int dcPin, int csPin);
|
EpdIf(int reset_pin, int dc_pin, int cs_pin, int busy_pin, int width, int height);
|
||||||
~EpdIf(void);
|
~EpdIf();
|
||||||
|
|
||||||
int IfInit(void);
|
int IfInit();
|
||||||
void DigitalWrite(int pin, int value);
|
void DigitalWrite(int pin, int value);
|
||||||
int DigitalRead(int pin);
|
int DigitalRead(int pin);
|
||||||
void DelayMs(unsigned int delaytime);
|
void DelayMs(unsigned int delaytime);
|
||||||
void SpiTransfer(unsigned char data);
|
void SpiTransfer(unsigned char data);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
unsigned int reset_pin;
|
int reset_pin;
|
||||||
unsigned int dc_pin;
|
int dc_pin;
|
||||||
unsigned int cs_pin;
|
int cs_pin;
|
||||||
unsigned int busy_pin;
|
int busy_pin;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,7 +47,7 @@ const char *einkDisplayProperties = R"json(
|
|||||||
}
|
}
|
||||||
)json";
|
)json";
|
||||||
|
|
||||||
Epd epd(DISPLAY_WIDTH, DISPLAY_HEIGHT, BUSY_PIN, RST_PIN, DC_PIN, CS_PIN);
|
Epd epd(RST_PIN, DC_PIN, CS_PIN, BUSY_PIN, DISPLAY_WIDTH, DISPLAY_HEIGHT);
|
||||||
|
|
||||||
void initDisplay()
|
void initDisplay()
|
||||||
{
|
{
|
||||||
@ -60,8 +60,6 @@ void initDisplay()
|
|||||||
|
|
||||||
void drawImage(uint8_t *image)
|
void drawImage(uint8_t *image)
|
||||||
{
|
{
|
||||||
Serial.println("Wake up display");
|
|
||||||
epd.Reset();
|
|
||||||
Serial.println("Draw image");
|
Serial.println("Draw image");
|
||||||
epd.EPD_7IN3F_Display(image);
|
epd.EPD_7IN3F_Display(image);
|
||||||
Serial.println("Put display to sleep");
|
Serial.println("Put display to sleep");
|
||||||
|
@ -5,25 +5,27 @@
|
|||||||
#include "eink.h"
|
#include "eink.h"
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
|
|
||||||
void fetchAndDrawImage();
|
void fetchAndDrawImage(const char *url);
|
||||||
void hibernate_and_restart();
|
void hibernate_and_restart();
|
||||||
|
|
||||||
const char *ssid = WIFI_SSID;
|
const char *ssid = WIFI_SSID;
|
||||||
const char *password = WIFI_PASSWORD;
|
const char *password = WIFI_PASSWORD;
|
||||||
|
|
||||||
#define HIBERNATE_TIME_SEC 120 // hibernate time in seconds
|
#define HIBERNATE_TIME_SEC 5 // hibernate time in seconds
|
||||||
|
// #define HIBERNATE_TIME_SEC 120 // hibernate time in seconds
|
||||||
|
|
||||||
const char *serverName = "http://192.168.3.133:8080/fetchImage";
|
const char *clearImage = "http://192.168.3.192:8080/clearImage";
|
||||||
|
const char *fetchImage = "http://192.168.3.192:8080/fetchImage";
|
||||||
|
const char *calibrationImage = "http://192.168.3.192:8080/calibrationImage";
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
// put your setup code here, to run once:
|
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
initDisplay();
|
|
||||||
|
|
||||||
delay(3000);
|
delay(3000);
|
||||||
|
|
||||||
|
initDisplay();
|
||||||
|
|
||||||
WiFi.begin(ssid, password);
|
WiFi.begin(ssid, password);
|
||||||
Serial.println("Connecting");
|
Serial.println("Connecting");
|
||||||
while(WiFi.status() != WL_CONNECTED) {
|
while(WiFi.status() != WL_CONNECTED) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user