Merge branch 'master' into jetson-spidev

This commit is contained in:
missionfloyd 2022-02-27 23:59:34 -07:00 committed by GitHub
commit 2007e46d20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
75 changed files with 16659 additions and 2453 deletions

5
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,5 @@
{
"files.associations": {
"imagedata.h": "c"
}
}

View file

@ -79,30 +79,6 @@ unsigned char WF_PARTIAL_1IN54_0[159] =
0x02,0x17,0x41,0xB0,0x32,0x28, 0x02,0x17,0x41,0xB0,0x32,0x28,
}; };
// waveform partial refresh(quality)
// unsigned char WF_PARTIAL_1IN54_1[159] =
// {
// 0x0,0x00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0xA,0x0,0x0,0x0,0x0,0x0,0x1,
// 0x1,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// 0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
// 0x22,0x17,0x41,0x0,0x32,0x20,
// };
Epd::~Epd() Epd::~Epd()
{ {
}; };

View file

@ -0,0 +1,432 @@
/*****************************************************************************
* | File : epd2in13_V3.cpp
* | Author : Waveshare team
* | Function : 2.13inch e-paper V3
* | Info :
*----------------
* | This version: V1.0
* | Date : 2021-11-01
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include <stdlib.h>
#include "epd2in13_V3.h"
const unsigned char lut_full_update[]= {
0x80, 0x4A, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x40, 0x4A, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x80, 0x4A, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x40, 0x4A, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0xF, 0x0, 0x0, 0xF, 0x0, 0x0, 0x2,
0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, 0x0,
0x22, 0x17, 0x41, 0x0, 0x32, 0x36
};
const unsigned char lut_partial_update[]= {
0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x14,0x0,0x0,0x0,0x0,0x0,0x0,
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
0x22,0x17,0x41,0x00,0x32,0x36,
};
Epd::~Epd()
{
};
/******************************************************************************
function : Pin definition
parameter:
******************************************************************************/
Epd::Epd()
{
reset_pin = RST_PIN;
dc_pin = DC_PIN;
cs_pin = CS_PIN;
busy_pin = BUSY_PIN;
width = EPD_WIDTH;
height = EPD_HEIGHT;
};
/******************************************************************************
function : send command
parameter:
command : Command register
******************************************************************************/
void Epd::SendCommand(unsigned char command)
{
DigitalWrite(dc_pin, LOW);
SpiTransfer(command);
}
/******************************************************************************
function : send data
parameter:
Data : Write data
******************************************************************************/
void Epd::SendData(unsigned char data)
{
DigitalWrite(dc_pin, HIGH);
SpiTransfer(data);
}
/******************************************************************************
function : Wait until the busy_pin goes LOW
parameter:
******************************************************************************/
void Epd::WaitUntilIdle(void)
{
while(1) { //LOW: idle, HIGH: busy
if(DigitalRead(busy_pin) == 0)
break;
DelayMs(10);
}
}
/******************************************************************************
function : Setting the display window
parameter:
Xstart : X-axis starting position
Ystart : Y-axis starting position
Xend : End position of X-axis
Yend : End position of Y-axis
******************************************************************************/
void Epd::SetWindows(unsigned char Xstart, unsigned char Ystart, unsigned char Xend, unsigned char Yend)
{
SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
SendData((Xstart>>3) & 0xFF);
SendData((Xend>>3) & 0xFF);
SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
SendData(Ystart & 0xFF);
SendData((Ystart >> 8) & 0xFF);
SendData(Yend & 0xFF);
SendData((Yend >> 8) & 0xFF);
}
/******************************************************************************
function : Set Cursor
parameter:
Xstart : X-axis starting position
Ystart : Y-axis starting position
******************************************************************************/
void Epd::SetCursor(unsigned char Xstart, unsigned char Ystart)
{
SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
SendData(Xstart & 0xFF);
SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
SendData(Ystart & 0xFF);
SendData((Ystart >> 8) & 0xFF);
}
/******************************************************************************
function : Send lut data and configuration
parameter:
lut : lut data
******************************************************************************/
void Epd::Lut(unsigned char *lut)
{
unsigned char count;
SendCommand(0x32);
for(count = 0; count < 153; count++) {
SendData(lut[count]);
}
SendCommand(0x3f);
SendData(*(lut+153));
SendCommand(0x03); // gate voltage
SendData(*(lut+154));
SendCommand(0x04); // source voltage
SendData(*(lut+155)); // VSH
SendData(*(lut+156)); // VSH2
SendData(*(lut+157)); // VSL
SendCommand(0x2c); // VCOM
SendData(*(lut+158));
}
/******************************************************************************
function : Initialize the e-Paper register
parameter:
Mode : Mode selection
******************************************************************************/
int Epd::Init(char Mode)
{
/* this calls the peripheral hardware interface, see epdif */
if (IfInit() != 0) {
return -1;
}
Reset();
int count;
if(Mode == FULL) {
WaitUntilIdle();
SendCommand(0x12); // soft reset
WaitUntilIdle();
SendCommand(0x01); //Driver output control
SendData(0xF9);
SendData(0x00);
SendData(0x00);
SendCommand(0x11); //data entry mode
SendData(0x03);
SetWindows(0, 0, EPD_WIDTH-1, EPD_HEIGHT-1);
SetCursor(0, 0);
SendCommand(0x3C); //BorderWavefrom
SendData(0x05);
SendCommand(0x21); // Display update control
SendData(0x00);
SendData(0x80);
SendCommand(0x18); //Read built-in temperature sensor
SendData(0x80);
WaitUntilIdle();
Lut(lut_full_update);
} else if(Mode == PART) {
DigitalWrite(reset_pin, LOW); //module reset
DelayMs(1);
DigitalWrite(reset_pin, HIGH);
Lut(lut_partial_update);
SendCommand(0x37);
SendData(0x00);
SendData(0x00);
SendData(0x00);
SendData(0x00);
SendData(0x00);
SendData(0x40);
SendData(0x00);
SendData(0x00);
SendData(0x00);
SendData(0x00);
SendCommand(0x3C); //BorderWavefrom
SendData(0x80);
SendCommand(0x22); //Display Update Sequence Option
SendData(0xC0); // Enable clock and Enable analog
SendCommand(0x20); //Activate Display Update Sequence
WaitUntilIdle();
SetWindows(0, 0, EPD_WIDTH-1, EPD_HEIGHT-1);
SetCursor(0, 0);
} else {
return -1;
}
return 0;
}
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
void Epd::Reset(void)
{
DigitalWrite(reset_pin, HIGH);
DelayMs(20);
DigitalWrite(reset_pin, LOW); //module reset
DelayMs(2);
DigitalWrite(reset_pin, HIGH);
DelayMs(20);
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void Epd::Clear(void)
{
int w, h;
w = (EPD_WIDTH % 8 == 0)? (EPD_WIDTH / 8 ): (EPD_WIDTH / 8 + 1);
h = EPD_HEIGHT;
SendCommand(0x24);
for (int j = 0; j < h; j++) {
for (int i = 0; i < w; i++) {
SendData(0xff);
}
}
//DISPLAY REFRESH
SendCommand(0x22);
SendData(0xC7);
SendCommand(0x20);
WaitUntilIdle();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
frame_buffer : Image data
******************************************************************************/
void Epd::Display(const unsigned char* frame_buffer)
{
int w = (EPD_WIDTH % 8 == 0)? (EPD_WIDTH / 8 ): (EPD_WIDTH / 8 + 1);
int h = EPD_HEIGHT;
if (frame_buffer != NULL) {
SendCommand(0x24);
for (int j = 0; j < h; j++) {
for (int i = 0; i < w; i++) {
SendData(pgm_read_byte(&frame_buffer[i + j * w]));
}
}
}
//DISPLAY REFRESH
SendCommand(0x22);
SendData(0xC7);
SendCommand(0x20);
WaitUntilIdle();
}
/******************************************************************************
function : Refresh a base image
parameter:
frame_buffer : Image data
******************************************************************************/
void Epd::DisplayPartBaseImage(const unsigned char* frame_buffer)
{
int w = (EPD_WIDTH % 8 == 0)? (EPD_WIDTH / 8 ): (EPD_WIDTH / 8 + 1);
int h = EPD_HEIGHT;
if (frame_buffer != NULL) {
SendCommand(0x24);
for (int j = 0; j < h; j++) {
for (int i = 0; i < w; i++) {
SendData(pgm_read_byte(&frame_buffer[i + j * w]));
}
}
SendCommand(0x26);
for (int j = 0; j < h; j++) {
for (int i = 0; i < w; i++) {
SendData(pgm_read_byte(&frame_buffer[i + j * w]));
}
}
}
//DISPLAY REFRESH
SendCommand(0x22);
SendData(0xC7);
SendCommand(0x20);
WaitUntilIdle();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and partial refresh
parameter:
frame_buffer : Image data
******************************************************************************/
void Epd::DisplayPart(const unsigned char* frame_buffer)
{
int w = (EPD_WIDTH % 8 == 0)? (EPD_WIDTH / 8 ): (EPD_WIDTH / 8 + 1);
int h = EPD_HEIGHT;
if (frame_buffer != NULL) {
SendCommand(0x24);
for (int j = 0; j < h; j++) {
for (int i = 0; i < w; i++) {
SendData(pgm_read_byte(&frame_buffer[i + j * w]));
}
}
}
//DISPLAY REFRESH
SendCommand(0x22);
SendData(0x0f);
SendCommand(0x20);
WaitUntilIdle();
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void Epd::ClearPart(void)
{
int w, h;
w = (EPD_WIDTH % 8 == 0)? (EPD_WIDTH / 8 ): (EPD_WIDTH / 8 + 1);
h = EPD_HEIGHT;
SendCommand(0x24);
for (int j = 0; j < h; j++) {
for (int i = 0; i < w; i++) {
SendData(0xff);
}
}
//DISPLAY REFRESH
SendCommand(0x22);
SendData(0x0f);
SendCommand(0x20);
WaitUntilIdle();
}
/******************************************************************************
function : Enter sleep mode
parameter:
******************************************************************************/
void Epd::Sleep()
{
SendCommand(0x10); //enter deep sleep
SendData(0x01);
DelayMs(200);
DigitalWrite(reset_pin, LOW);
}
/* END OF FILE */

View file

@ -0,0 +1,74 @@
/*****************************************************************************
* | File : epd2in13_V3.h
* | Author : Waveshare team
* | Function : 2.13inch e-paper V3
* | Info :
*----------------
* | This version: V1.0
* | Date : 2021-11-01
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#ifndef epd2in13_V3
#define epd2in13_V3
#include "epdif.h"
// Display resolution
#define EPD_WIDTH 122
#define EPD_HEIGHT 250
#define FULL 0
#define PART 1
class Epd : EpdIf {
public:
unsigned long width;
unsigned long height;
Epd();
~Epd();
int Init(char Mode);
void SendCommand(unsigned char command);
void SendData(unsigned char data);
void WaitUntilIdle(void);
void SetWindows(unsigned char Xstart, unsigned char Ystart, unsigned char Xend, unsigned char Yend);
void SetCursor(unsigned char Xstart, unsigned char Ystart);
void Lut(unsigned char *lut);
void Reset(void);
void Clear(void);
void Display(const unsigned char* frame_buffer);
void DisplayPartBaseImage(const unsigned char* frame_buffer);
void DisplayPart(const unsigned char* frame_buffer);
void ClearPart(void);
void Sleep(void);
private:
unsigned int reset_pin;
unsigned int dc_pin;
unsigned int cs_pin;
unsigned int busy_pin;
};
#endif /* EPD2IN13_V3_H */
/* END OF FILE */

View file

@ -0,0 +1,37 @@
#include <SPI.h>
#include "epd2in13_V3.h"
#include "imagedata.h"
Epd epd;
void setup()
{
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("epd FULL");
epd.Init(FULL);
epd.Display(IMAGE_DATA);
Serial.println("epd PART");
epd.DisplayPartBaseImage(IMAGE_DATA);
char i = 0;
for (i = 0; i < 10; i++) {
Serial.println("e-Paper PART IMAGE_DATA");
epd.Init(PART);
epd.DisplayPart(IMAGE_DATA);
Serial.println("e-Paper PART Clear");
epd.Init(PART);
epd.ClearPart();
}
epd.Init(FULL);
Serial.println("e-Paper clear and sleep");
epd.Clear();
epd.Sleep();
}
void loop()
{
}

View file

@ -0,0 +1,65 @@
/**
* @filename : epdif.cpp
* @brief : Implements EPD interface functions
* Users have to implement all the functions in epdif.cpp
* @author : Yehui from Waveshare
*
* Copyright (C) Waveshare August 10 2017
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documnetation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "epdif.h"
#include <spi.h>
EpdIf::EpdIf() {
};
EpdIf::~EpdIf() {
};
void EpdIf::DigitalWrite(int pin, int value) {
digitalWrite(pin, value);
}
int EpdIf::DigitalRead(int pin) {
return digitalRead(pin);
}
void EpdIf::DelayMs(unsigned int delaytime) {
delay(delaytime);
}
void EpdIf::SpiTransfer(unsigned char data) {
digitalWrite(CS_PIN, LOW);
SPI.transfer(data);
digitalWrite(CS_PIN, HIGH);
}
int EpdIf::IfInit(void) {
pinMode(CS_PIN, OUTPUT);
pinMode(RST_PIN, OUTPUT);
pinMode(DC_PIN, OUTPUT);
pinMode(BUSY_PIN, INPUT);
SPI.begin();
SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0));
return 0;
}

View file

@ -0,0 +1,51 @@
/**
* @filename : epdif.h
* @brief : Header file of epdif.cpp providing EPD interface functions
* Users have to implement all the functions in epdif.cpp
* @author : Yehui from Waveshare
*
* Copyright (C) Waveshare August 10 2017
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documnetation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef EPDIF_H
#define EPDIF_H
#include <arduino.h>
// Pin definition
#define RST_PIN 8
#define DC_PIN 9
#define CS_PIN 10
#define BUSY_PIN 7
class EpdIf {
public:
EpdIf(void);
~EpdIf(void);
static int IfInit(void);
static void DigitalWrite(int pin, int value);
static int DigitalRead(int pin);
static void DelayMs(unsigned int delaytime);
static void SpiTransfer(unsigned char data);
};
#endif

View file

@ -0,0 +1,342 @@
/**
* @filename : epdpaint.cpp
* @brief : Paint tools
* @author : Yehui from Waveshare
*
* Copyright (C) Waveshare September 9 2017
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documnetation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <avr/pgmspace.h>
#include "epdpaint.h"
Paint::Paint(unsigned char* image, int width, int height) {
this->rotate = ROTATE_0;
this->image = image;
/* 1 byte = 8 pixels, so the width should be the multiple of 8 */
this->width = width % 8 ? width + 8 - (width % 8) : width;
this->height = height;
}
Paint::~Paint() {
}
/**
* @brief: clear the image
*/
void Paint::Clear(int colored) {
for (int x = 0; x < this->width; x++) {
for (int y = 0; y < this->height; y++) {
DrawAbsolutePixel(x, y, colored);
}
}
}
/**
* @brief: this draws a pixel by absolute coordinates.
* this function won't be affected by the rotate parameter.
*/
void Paint::DrawAbsolutePixel(int x, int y, int colored) {
if (x < 0 || x >= this->width || y < 0 || y >= this->height) {
return;
}
if (IF_INVERT_COLOR) {
if (colored) {
image[(x + y * this->width) / 8] |= 0x80 >> (x % 8);
} else {
image[(x + y * this->width) / 8] &= ~(0x80 >> (x % 8));
}
} else {
if (colored) {
image[(x + y * this->width) / 8] &= ~(0x80 >> (x % 8));
} else {
image[(x + y * this->width) / 8] |= 0x80 >> (x % 8);
}
}
}
/**
* @brief: Getters and Setters
*/
unsigned char* Paint::GetImage(void) {
return this->image;
}
int Paint::GetWidth(void) {
return this->width;
}
void Paint::SetWidth(int width) {
this->width = width % 8 ? width + 8 - (width % 8) : width;
}
int Paint::GetHeight(void) {
return this->height;
}
void Paint::SetHeight(int height) {
this->height = height;
}
int Paint::GetRotate(void) {
return this->rotate;
}
void Paint::SetRotate(int rotate){
this->rotate = rotate;
}
/**
* @brief: this draws a pixel by the coordinates
*/
void Paint::DrawPixel(int x, int y, int colored) {
int point_temp;
if (this->rotate == ROTATE_0) {
if(x < 0 || x >= this->width || y < 0 || y >= this->height) {
return;
}
DrawAbsolutePixel(x, y, colored);
} else if (this->rotate == ROTATE_90) {
if(x < 0 || x >= this->height || y < 0 || y >= this->width) {
return;
}
point_temp = x;
x = this->width - y;
y = point_temp;
DrawAbsolutePixel(x, y, colored);
} else if (this->rotate == ROTATE_180) {
if(x < 0 || x >= this->width || y < 0 || y >= this->height) {
return;
}
x = this->width - x;
y = this->height - y;
DrawAbsolutePixel(x, y, colored);
} else if (this->rotate == ROTATE_270) {
if(x < 0 || x >= this->height || y < 0 || y >= this->width) {
return;
}
point_temp = x;
x = y;
y = this->height - point_temp;
DrawAbsolutePixel(x, y, colored);
}
}
/**
* @brief: this draws a charactor on the frame buffer but not refresh
*/
void Paint::DrawCharAt(int x, int y, char ascii_char, sFONT* font, int colored) {
int i, j;
unsigned int char_offset = (ascii_char - ' ') * font->Height * (font->Width / 8 + (font->Width % 8 ? 1 : 0));
const unsigned char* ptr = &font->table[char_offset];
for (j = 0; j < font->Height; j++) {
for (i = 0; i < font->Width; i++) {
if (pgm_read_byte(ptr) & (0x80 >> (i % 8))) {
DrawPixel(x + i, y + j, colored);
}
if (i % 8 == 7) {
ptr++;
}
}
if (font->Width % 8 != 0) {
ptr++;
}
}
}
/**
* @brief: this displays a string on the frame buffer but not refresh
*/
void Paint::DrawStringAt(int x, int y, const char* text, sFONT* font, int colored) {
const char* p_text = text;
unsigned int counter = 0;
int refcolumn = x;
/* Send the string character by character on EPD */
while (*p_text != 0) {
/* Display one character on EPD */
DrawCharAt(refcolumn, y, *p_text, font, colored);
/* Decrement the column position by 16 */
refcolumn += font->Width;
/* Point on the next character */
p_text++;
counter++;
}
}
/**
* @brief: this draws a line on the frame buffer
*/
void Paint::DrawLine(int x0, int y0, int x1, int y1, int colored) {
/* Bresenham algorithm */
int dx = x1 - x0 >= 0 ? x1 - x0 : x0 - x1;
int sx = x0 < x1 ? 1 : -1;
int dy = y1 - y0 <= 0 ? y1 - y0 : y0 - y1;
int sy = y0 < y1 ? 1 : -1;
int err = dx + dy;
while((x0 != x1) && (y0 != y1)) {
DrawPixel(x0, y0 , colored);
if (2 * err >= dy) {
err += dy;
x0 += sx;
}
if (2 * err <= dx) {
err += dx;
y0 += sy;
}
}
}
/**
* @brief: this draws a horizontal line on the frame buffer
*/
void Paint::DrawHorizontalLine(int x, int y, int line_width, int colored) {
int i;
for (i = x; i < x + line_width; i++) {
DrawPixel(i, y, colored);
}
}
/**
* @brief: this draws a vertical line on the frame buffer
*/
void Paint::DrawVerticalLine(int x, int y, int line_height, int colored) {
int i;
for (i = y; i < y + line_height; i++) {
DrawPixel(x, i, colored);
}
}
/**
* @brief: this draws a rectangle
*/
void Paint::DrawRectangle(int x0, int y0, int x1, int y1, int colored) {
int min_x, min_y, max_x, max_y;
min_x = x1 > x0 ? x0 : x1;
max_x = x1 > x0 ? x1 : x0;
min_y = y1 > y0 ? y0 : y1;
max_y = y1 > y0 ? y1 : y0;
DrawHorizontalLine(min_x, min_y, max_x - min_x + 1, colored);
DrawHorizontalLine(min_x, max_y, max_x - min_x + 1, colored);
DrawVerticalLine(min_x, min_y, max_y - min_y + 1, colored);
DrawVerticalLine(max_x, min_y, max_y - min_y + 1, colored);
}
/**
* @brief: this draws a filled rectangle
*/
void Paint::DrawFilledRectangle(int x0, int y0, int x1, int y1, int colored) {
int min_x, min_y, max_x, max_y;
int i;
min_x = x1 > x0 ? x0 : x1;
max_x = x1 > x0 ? x1 : x0;
min_y = y1 > y0 ? y0 : y1;
max_y = y1 > y0 ? y1 : y0;
for (i = min_x; i <= max_x; i++) {
DrawVerticalLine(i, min_y, max_y - min_y + 1, colored);
}
}
/**
* @brief: this draws a circle
*/
void Paint::DrawCircle(int x, int y, int radius, int colored) {
/* Bresenham algorithm */
int x_pos = -radius;
int y_pos = 0;
int err = 2 - 2 * radius;
int e2;
do {
DrawPixel(x - x_pos, y + y_pos, colored);
DrawPixel(x + x_pos, y + y_pos, colored);
DrawPixel(x + x_pos, y - y_pos, colored);
DrawPixel(x - x_pos, y - y_pos, colored);
e2 = err;
if (e2 <= y_pos) {
err += ++y_pos * 2 + 1;
if(-x_pos == y_pos && e2 <= x_pos) {
e2 = 0;
}
}
if (e2 > x_pos) {
err += ++x_pos * 2 + 1;
}
} while (x_pos <= 0);
}
/**
* @brief: this draws a filled circle
*/
void Paint::DrawFilledCircle(int x, int y, int radius, int colored) {
/* Bresenham algorithm */
int x_pos = -radius;
int y_pos = 0;
int err = 2 - 2 * radius;
int e2;
do {
DrawPixel(x - x_pos, y + y_pos, colored);
DrawPixel(x + x_pos, y + y_pos, colored);
DrawPixel(x + x_pos, y - y_pos, colored);
DrawPixel(x - x_pos, y - y_pos, colored);
DrawHorizontalLine(x + x_pos, y + y_pos, 2 * (-x_pos) + 1, colored);
DrawHorizontalLine(x + x_pos, y - y_pos, 2 * (-x_pos) + 1, colored);
e2 = err;
if (e2 <= y_pos) {
err += ++y_pos * 2 + 1;
if(-x_pos == y_pos && e2 <= x_pos) {
e2 = 0;
}
}
if(e2 > x_pos) {
err += ++x_pos * 2 + 1;
}
} while(x_pos <= 0);
}
/* END OF FILE */

View file

@ -0,0 +1,75 @@
/**
* @filename : epdpaint.h
* @brief : Header file for epdpaint.cpp
* @author : Yehui from Waveshare
*
* Copyright (C) Waveshare July 28 2017
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documnetation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef EPDPAINT_H
#define EPDPAINT_H
// Display orientation
#define ROTATE_0 0
#define ROTATE_90 1
#define ROTATE_180 2
#define ROTATE_270 3
// Color inverse. 1 or 0 = set or reset a bit if set a colored pixel
#define IF_INVERT_COLOR 1
#include "fonts.h"
class Paint {
public:
Paint(unsigned char* image, int width, int height);
~Paint();
void Clear(int colored);
int GetWidth(void);
void SetWidth(int width);
int GetHeight(void);
void SetHeight(int height);
int GetRotate(void);
void SetRotate(int rotate);
unsigned char* GetImage(void);
void DrawAbsolutePixel(int x, int y, int colored);
void DrawPixel(int x, int y, int colored);
void DrawCharAt(int x, int y, char ascii_char, sFONT* font, int colored);
void DrawStringAt(int x, int y, const char* text, sFONT* font, int colored);
void DrawLine(int x0, int y0, int x1, int y1, int colored);
void DrawHorizontalLine(int x, int y, int width, int colored);
void DrawVerticalLine(int x, int y, int height, int colored);
void DrawRectangle(int x0, int y0, int x1, int y1, int colored);
void DrawFilledRectangle(int x0, int y0, int x1, int y1, int colored);
void DrawCircle(int x, int y, int radius, int colored);
void DrawFilledCircle(int x, int y, int radius, int colored);
private:
unsigned char* image;
int width;
int height;
int rotate;
};
#endif
/* END OF FILE */

1385
Arduino/epd2in13_V3/font12.c Normal file

File diff suppressed because it is too large Load diff

1765
Arduino/epd2in13_V3/font16.c Normal file

File diff suppressed because it is too large Load diff

2143
Arduino/epd2in13_V3/font20.c Normal file

File diff suppressed because it is too large Load diff

2521
Arduino/epd2in13_V3/font24.c Normal file

File diff suppressed because it is too large Load diff

1005
Arduino/epd2in13_V3/font8.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,75 @@
/**
******************************************************************************
* @file fonts.h
* @author MCD Application Team
* @version V1.0.0
* @date 18-February-2014
* @brief Header for fonts.c file
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __FONTS_H
#define __FONTS_H
/* Max size of bitmap will based on a font24 (17x24) */
#define MAX_HEIGHT_FONT 24
#define MAX_WIDTH_FONT 17
#define OFFSET_BITMAP 54
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
typedef struct _tFont
{
const uint8_t *table;
uint16_t Width;
uint16_t Height;
} sFONT;
extern sFONT Font24;
extern sFONT Font20;
extern sFONT Font16;
extern sFONT Font12;
extern sFONT Font8;
#ifdef __cplusplus
}
#endif
#endif /* __FONTS_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,281 @@
/**
* @filename : imagedata.cpp
* @brief : data file for epd demo
*
* Copyright (C) Waveshare September 5 2017
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documnetation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "imagedata.h"
#include <avr/pgmspace.h>
const unsigned char IMAGE_DATA[] PROGMEM = {
/* 0X00,0X01,0X80,0X00,0XFA,0X00, */
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X38,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0X00,0X00,0X78,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0X80,0X00,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XC0,0X03,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X01,0X00,0X00,0X00,0X00,0X01,0XFF,0XE0,0X1F,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0XC0,0X00,0X00,0X00,0X03,0XFF,0X70,0X1F,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X7E,0X00,0X00,0X00,0X03,0XFF,0X78,0X38,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X3F,0X00,0X00,0X00,0X03,0XFF,0XF8,0XF0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X0F,0XC0,0X00,0X00,0X03,0XF0,0XF8,0XC1,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X03,0XF0,0X00,0X00,0X03,0XF3,0XF3,0X8F,0XFE,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X01,0XF8,0X00,0X00,0X03,0XFF,0XF3,0XBF,0XFF,0XC0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X3E,0X00,0X00,0X03,0XFF,0XFA,0X7F,0XFF,0XF0,0X00,0X00,
0X00,0X0F,0X00,0X00,0X00,0X3F,0XE0,0X00,0X00,0XE7,0XFB,0XFF,0XFF,0XF0,0X00,0X00,
0X00,0X07,0X00,0X00,0X00,0X3F,0XF0,0X00,0X00,0XE7,0XFB,0XFF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X1F,0XFC,0X00,0X00,0XFF,0XFB,0XFF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X0F,0XFE,0X00,0X00,0X7F,0XFB,0XCF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X03,0XFE,0X00,0X00,0X3F,0XF9,0XCF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X01,0XFF,0X80,0X00,0X0F,0XF1,0XFF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0XFF,0XC0,0X00,0X00,0X3D,0XEF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X7F,0XE0,0X00,0X03,0XFF,0XF7,0XFF,0XC0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X3F,0XE0,0X00,0X3F,0XFF,0XFF,0XFF,0X80,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X1F,0XE0,0X00,0X7E,0XFF,0XFF,0XFF,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X0F,0XE0,0X00,0X3E,0XFF,0XF1,0XFF,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X0F,0XE0,0X00,0X3F,0XFF,0XBF,0XFC,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X07,0XF0,0X00,0X3E,0X7F,0X3F,0XF8,0X38,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X07,0XF0,0X00,0X7E,0X7F,0XC0,0X00,0X7C,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X07,0XF0,0X00,0X7E,0X3F,0XC0,0X01,0XFE,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X07,0XF0,0X00,0X7F,0X1F,0XDF,0XFF,0XFF,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X00,0X7F,0X87,0XEF,0XFF,0XFF,0X80,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X00,0X7F,0XE3,0XF1,0XFF,0XFF,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X01,0X87,0XFC,0X78,0XFE,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X03,0X01,0XF8,0XFF,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X0E,0X00,0X01,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X0C,0X00,0X03,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X1C,0X00,0X0F,0X98,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X38,0X00,0X7F,0X9C,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X30,0X00,0X3F,0XDC,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X07,0XFE,0X07,0XE0,0X30,0X00,0X1F,0XFE,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X0F,0XFF,0X87,0XF0,0X70,0X00,0X1F,0XFC,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X1F,0XFF,0XC7,0XF0,0X00,0X00,0X0F,0XFE,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X3F,0XFF,0XE7,0XE0,0X00,0X00,0X0F,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X7F,0XFF,0XF3,0XE0,0X7F,0XFF,0XEF,0XE0,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0XFF,0X9F,0XFB,0XCF,0XFF,0XFF,0XC6,0X18,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X03,0XFF,0XCF,0XF9,0XDF,0XFF,0XFF,0XC0,0X08,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X0E,0XFF,0XDF,0XFD,0XFF,0XFF,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X01,0XF0,0XFF,0XFF,0XFD,0XFF,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X03,0XF8,0XFF,0XFF,0XFD,0XFF,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X07,0XFC,0XFF,0XDF,0XFD,0XFF,0XF8,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X0F,0XFE,0XC7,0XDF,0XFD,0XFF,0X80,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X3E,0X7F,0XF7,0XDF,0XFF,0XFE,0X30,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X3E,0X7F,0XF7,0XDF,0XCF,0XF0,0X38,0X00,0X06,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X7E,0X7F,0XFF,0XFF,0X9F,0XE0,0X38,0X00,0X1F,0XC0,0X00,0X00,0X00,0X00,
0X00,0X03,0X7F,0X1F,0XFF,0XFE,0X3E,0X00,0X3C,0X00,0X3B,0XE0,0X00,0X00,0X00,0X00,
0X00,0X03,0X7F,0X8F,0XFF,0XFE,0X7C,0X00,0X3C,0X00,0X3B,0XE0,0X00,0X00,0X00,0X00,
0X00,0X03,0X7F,0X87,0XFE,0X3F,0XF8,0X00,0X3C,0X00,0X7F,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X7F,0XA1,0XF8,0X1F,0XFC,0X00,0X1C,0X00,0X7C,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X3F,0XFF,0XF0,0X0F,0XFC,0X00,0X0C,0X00,0X7E,0X7C,0X00,0X00,0X00,0X00,
0X00,0X03,0X3F,0XFF,0XF0,0X0F,0XFE,0X00,0X0C,0X00,0X7F,0X3C,0X00,0X00,0X00,0X00,
0X00,0X03,0X1F,0XFF,0XF0,0X0F,0XFF,0X00,0X0C,0X00,0X3F,0X80,0X00,0X00,0X00,0X00,
0X00,0X03,0X0F,0XFF,0XF0,0X0E,0X7F,0X80,0X0C,0X00,0X3F,0XC0,0X00,0X00,0X00,0X00,
0X00,0X03,0X07,0XFF,0XF8,0X0E,0X3F,0XC0,0X0C,0X00,0X1F,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X03,0XFF,0XF8,0X1E,0X1F,0XE0,0X0C,0X00,0X0F,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X3F,0XFE,0X3F,0X87,0XE0,0X3C,0X00,0X0F,0XBE,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X47,0XFF,0XFF,0XF0,0X60,0X3C,0X00,0X0F,0XBF,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X31,0XFF,0XFF,0XF8,0XE0,0X38,0X00,0X0F,0XBF,0X80,0X00,0X00,0X00,
0X00,0X03,0X06,0X11,0XFF,0XFD,0XFF,0XE0,0X38,0X00,0X0F,0X1F,0X80,0X00,0X00,0X00,
0X00,0X03,0X0E,0X13,0XFF,0XF9,0XFF,0XE0,0X30,0X00,0X0E,0X07,0X80,0X00,0X00,0X00,
0X00,0X03,0X3C,0XD7,0XFD,0XFD,0XFF,0XE0,0X30,0X00,0X1C,0XC7,0X80,0X00,0X00,0X00,
0X00,0X03,0X39,0XEF,0XFB,0XFF,0XFF,0XE0,0X30,0X00,0X3D,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X73,0XEF,0XFB,0XFF,0XFF,0XE0,0X60,0X00,0X3D,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X67,0XEF,0XFB,0XFF,0XFF,0XC0,0XC0,0X00,0X3F,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X8F,0XF7,0XE3,0XFF,0XFF,0X80,0XE0,0X00,0X1B,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X9F,0XF3,0XE1,0XFF,0XE0,0X01,0XC0,0X00,0X3B,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X03,0X3F,0XF1,0XF9,0XFF,0XC0,0X03,0X80,0X00,0X7F,0XFF,0XE0,0X00,0X00,0X00,
0X00,0X03,0X7F,0XF1,0XFD,0XFF,0X80,0X07,0X00,0X00,0X1F,0XFF,0XF8,0X00,0X00,0X00,
0X00,0X03,0XFF,0XF1,0XFF,0XFF,0X80,0X0F,0X00,0X00,0X3F,0XFF,0XFC,0X00,0X00,0X00,
0X00,0X03,0XFF,0XE0,0XFF,0XFF,0X00,0X0E,0X00,0X00,0X3F,0XFF,0X9C,0X00,0X00,0X00,
0X00,0X03,0XFF,0X80,0X0F,0XFF,0X00,0X06,0X00,0X00,0X03,0XF6,0X7C,0X00,0X00,0X00,
0X00,0X03,0XFF,0X00,0X1F,0X7C,0X00,0XF8,0X00,0X00,0X09,0XF0,0X3C,0X00,0X00,0X00,
0X00,0X03,0XFE,0X00,0X3F,0X38,0X01,0XFC,0X00,0X00,0X1C,0XF8,0X1C,0X00,0X00,0X00,
0X00,0X03,0XFC,0X00,0XFF,0X90,0X03,0XFE,0X00,0X00,0X3D,0XFF,0X9C,0X00,0X00,0X00,
0X00,0X03,0XF8,0X00,0XFF,0XC0,0X0F,0XFF,0X00,0X00,0X73,0XFF,0XCC,0X00,0X00,0X00,
0X00,0X03,0XF0,0X00,0XFF,0XE0,0X0F,0XFF,0X00,0X00,0X61,0XFF,0XFC,0X60,0X00,0X00,
0X00,0X03,0XF0,0X01,0XFF,0XF0,0X1F,0XFF,0X00,0X00,0XC0,0XFF,0XFF,0XF0,0X00,0X00,
0X00,0X07,0XE0,0X01,0XFF,0XBF,0XFF,0XFF,0X80,0X00,0XE0,0X00,0X7F,0XF0,0X00,0X00,
0X00,0X03,0XC0,0X01,0XFF,0X3F,0XFF,0XFF,0X80,0X00,0XC0,0X00,0X3F,0XF8,0X00,0X00,
0X00,0X01,0X80,0X01,0XFE,0X7F,0XFF,0XFF,0X80,0X00,0X80,0X00,0X1F,0XFC,0X00,0X00,
0X00,0X07,0X00,0X00,0XFE,0X7F,0XFF,0XFF,0X80,0X00,0X80,0X00,0X0C,0XFC,0X00,0X00,
0X00,0X03,0X00,0X00,0XF0,0X7F,0XFF,0XFF,0X00,0X00,0X80,0X00,0X04,0X7C,0X00,0X00,
0X00,0X03,0X00,0X00,0X7E,0X3F,0XFF,0XFC,0X00,0X01,0X80,0X00,0X03,0XFC,0X00,0X00,
0X00,0X03,0X00,0X00,0X7E,0X3F,0XFF,0XFE,0X00,0X01,0X80,0X00,0X01,0XF0,0X00,0X00,
0X00,0X03,0X00,0X00,0X3F,0XDF,0XBF,0XFF,0X80,0X01,0X80,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X3F,0XCF,0XBF,0XFF,0XC0,0X01,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X7F,0XCF,0XFF,0XFF,0XE0,0X01,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0XFF,0XCF,0XCF,0XFF,0XC0,0X01,0X80,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X1E,0XFF,0XEF,0XC7,0XFF,0XC0,0X01,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X01,0XFC,0XFF,0XE7,0XF0,0X7F,0X80,0X03,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X07,0X07,0XC0,0XFF,0XF3,0XF8,0XFF,0X00,0X0F,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X0F,0X80,0X7F,0XF3,0XF9,0XFE,0X00,0X0E,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X1F,0X00,0X3F,0XF3,0XFB,0XFE,0X00,0X0C,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X38,0X00,0X03,0XF9,0XFB,0XF3,0XE0,0X18,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XF0,0X00,0X3C,0XF9,0XFB,0XEF,0XF0,0X30,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XC0,0X00,0X7D,0XF9,0XFB,0XCF,0XF0,0X70,0X00,0X00,0X18,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XFF,0XF8,0XFB,0XCF,0XFC,0XC0,0X00,0X03,0XF8,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XFF,0XFC,0XFB,0XFF,0XFC,0X00,0X00,0X07,0XF8,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XFF,0XDE,0XFB,0XFF,0X7C,0X00,0X00,0X3F,0XFC,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XFF,0XDE,0XF3,0XFF,0X3C,0X00,0X00,0X7F,0XFE,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XFF,0XC2,0XF3,0XFF,0X1C,0X00,0X00,0XFF,0XFE,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XFB,0XE3,0XFF,0XFF,0X3C,0X00,0X00,0XFF,0XFF,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XF9,0XEF,0XFF,0XFE,0X3C,0X00,0X00,0XFF,0XFF,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XFC,0XFF,0XFF,0XF9,0XFC,0X00,0X00,0XDC,0X7F,0X00,0X00,0X00,
0X00,0X01,0X00,0X01,0XFE,0X7F,0XFF,0XE3,0XFE,0X00,0X00,0XFF,0XBF,0X00,0X00,0X00,
0X00,0X01,0X00,0X01,0XFE,0X3F,0XFF,0XC7,0XFE,0X00,0X00,0XFF,0X9F,0X00,0X00,0X00,
0X00,0X01,0X00,0X03,0XFF,0X3F,0XFF,0XCF,0XFF,0X00,0X00,0XFF,0XBF,0X00,0X00,0X00,
0X00,0X01,0X00,0XFF,0XFF,0XCF,0XFF,0XFF,0XFF,0X80,0X00,0XFF,0XFE,0X00,0X00,0X00,
0X00,0X01,0X0F,0XE0,0X7F,0XFF,0X87,0XFF,0XFF,0X80,0X00,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X01,0X1F,0X80,0X3F,0XFF,0X03,0XFF,0XCE,0X00,0X00,0XFF,0X00,0X00,0X00,0X00,
0X00,0X01,0XF0,0X00,0X0F,0XFE,0X01,0XFC,0X1E,0X00,0X00,0XF0,0X00,0X00,0X00,0X00,
0X00,0X01,0XE0,0X7F,0XC7,0XFC,0X01,0XFC,0X3E,0X00,0X00,0XC1,0XFF,0XE0,0X00,0X00,
0X00,0X01,0XC1,0XFF,0XF7,0XF8,0X01,0XFF,0XFC,0X00,0X01,0X8D,0XFF,0XF0,0X00,0X00,
0X00,0X01,0X87,0XFF,0XFB,0XFC,0X01,0XFF,0XF8,0X00,0X0F,0X1E,0XFF,0XF8,0X00,0X00,
0X00,0X01,0X3F,0X80,0X03,0XFC,0X01,0XFF,0XF0,0X00,0X0E,0X7E,0X7F,0XFE,0X00,0X00,
0X00,0X01,0XF8,0X00,0X07,0XFE,0X01,0XFF,0XE2,0X00,0X1E,0X7F,0X3F,0XFC,0X00,0X00,
0X00,0X01,0XE0,0XFF,0X9F,0XDF,0X03,0XFF,0XC6,0X60,0X1C,0XFF,0X8F,0XFE,0X00,0X00,
0X00,0X01,0X8F,0XC0,0XFF,0X3F,0XC7,0XEF,0XE3,0X78,0X3E,0X1F,0XCF,0XFF,0X00,0X00,
0X00,0X01,0XDF,0X80,0XFE,0X7F,0XEF,0XE7,0XF1,0XBC,0X7F,0X0F,0XCF,0XFF,0XC0,0X00,
0X00,0X01,0XFC,0X00,0XFD,0XFF,0XFF,0XE3,0XF1,0X9E,0X3F,0XC3,0XE7,0XFF,0X00,0X00,
0X00,0X01,0XF8,0X01,0XF1,0XF9,0XFF,0XF1,0XFD,0XCF,0X9F,0XE1,0XFF,0XFF,0X00,0X00,
0X00,0X01,0X80,0X01,0XF3,0XF1,0XFF,0XF9,0XFD,0XC1,0X9F,0XF8,0XFF,0XE0,0X00,0X00,
0X00,0X01,0X00,0X01,0XFF,0XE3,0XFD,0XFE,0XFF,0XC0,0X3F,0XF0,0X00,0X03,0X80,0X00,
0X00,0X01,0X00,0X00,0XFF,0XE3,0XFD,0XFF,0X7F,0XC0,0X7F,0XC0,0X00,0X07,0X80,0X00,
0X00,0X01,0X00,0X00,0XFF,0XE7,0XFC,0XFF,0X07,0X80,0XFF,0XCF,0XFF,0XFF,0X00,0X00,
0X00,0X01,0X00,0X00,0XFF,0XEF,0XCE,0X7F,0X07,0X00,0X7E,0X7F,0XFF,0XFE,0X00,0X00,
0X00,0X01,0X1F,0XFE,0XFF,0XFF,0XCE,0X7F,0X3E,0X00,0X3E,0X7F,0XFF,0XFC,0X00,0X00,
0X00,0X01,0XFF,0XFF,0XFF,0XF1,0XCE,0X3F,0X3E,0X00,0X3F,0XFC,0X07,0XF8,0X00,0X00,
0X00,0X01,0XFF,0XFF,0X3F,0XE1,0X8E,0X3F,0X3E,0X00,0X1F,0XFC,0X07,0XF0,0X00,0X00,
0X00,0X01,0XE0,0X00,0X0E,0X03,0X8E,0X3F,0X3E,0X00,0X0F,0XFF,0XF8,0X00,0X00,0X00,
0X00,0X01,0XFF,0XFF,0X87,0XFF,0X8E,0X3F,0X1E,0X00,0X04,0XFE,0X3E,0X00,0X00,0X00,
0X00,0X01,0XFF,0XFF,0XC7,0XFF,0X8F,0X3F,0XBE,0X00,0X00,0XFE,0X1E,0X00,0X00,0X00,
0X00,0X01,0XFF,0XFF,0XC7,0XFF,0X8F,0X9F,0XFE,0X00,0X00,0XFC,0X3F,0X80,0X00,0X00,
0X00,0X01,0X87,0XFF,0X8F,0XFF,0X8F,0X9F,0XFE,0X00,0X00,0X79,0XFF,0XC0,0X00,0X00,
0X00,0X01,0X00,0X06,0X3F,0XFF,0X8F,0XDF,0XFE,0X00,0X00,0X7F,0XFF,0XC0,0X00,0X00,
0X00,0X01,0X00,0X00,0X7F,0XFF,0X8F,0X8F,0XFC,0X00,0X00,0X1F,0XFF,0XE0,0X00,0X00,
0X00,0X01,0X80,0X00,0XFF,0XFF,0X8F,0X1F,0X00,0X00,0X00,0X0F,0XFF,0XF0,0X00,0X00,
0X00,0X01,0XC0,0X01,0XFF,0XFF,0X8E,0X3F,0X81,0X00,0X00,0X01,0XFF,0XE0,0X00,0X00,
0X00,0X01,0XE0,0X01,0XFF,0XFF,0X8E,0X7F,0XC3,0X80,0X00,0X00,0XFF,0X80,0X00,0X00,
0X00,0X01,0XF8,0X00,0XFF,0XF3,0X8E,0X7F,0XE7,0XC0,0X00,0X00,0X7F,0X00,0X00,0X00,
0X00,0X01,0XFF,0X80,0XFF,0XE7,0X8F,0XFF,0XC4,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X87,0XE1,0XFF,0XDF,0X8F,0XFF,0XCE,0X1C,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XF1,0XF8,0XFF,0XFF,0X8F,0XFF,0XCF,0XCF,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFE,0X1C,0XFF,0XBE,0X43,0XE0,0X1F,0XF3,0X80,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFF,0X06,0X7F,0X3E,0X63,0XC1,0X3F,0XF1,0XE0,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFF,0X83,0X3E,0X3C,0XF3,0X81,0X1F,0XF8,0XF0,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFF,0XE1,0X80,0X39,0XFF,0X00,0X07,0XFE,0X78,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFF,0XFE,0X60,0X1F,0XFE,0X1C,0X03,0XFF,0X1C,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X0F,0XFF,0X3C,0X1F,0XFE,0X60,0X01,0XFF,0X8E,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X01,0XFF,0X9E,0X0F,0XFF,0XC0,0X00,0X3F,0XC3,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X00,0X7F,0XC3,0X8F,0XFD,0X80,0X00,0X3F,0XE3,0X80,0X00,0X00,0X00,0X00,
0X00,0X01,0X00,0X3F,0XE1,0XC7,0XFC,0X00,0X00,0X3F,0XF1,0XC0,0X00,0X00,0X00,0X00,
0X00,0X01,0X00,0X1F,0XF1,0XE3,0XF8,0X00,0X00,0X07,0XF0,0X60,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X0F,0XF1,0XE1,0XF0,0X00,0X00,0X03,0XF8,0X30,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X01,0XF8,0X30,0X00,0X00,0X00,0X01,0XFC,0X3C,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XF8,0X18,0X00,0X00,0X00,0X00,0XFC,0X0E,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XFC,0X0C,0X00,0X00,0X00,0X00,0XFE,0X0F,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X7C,0X0C,0X00,0X00,0X00,0X00,0X7E,0X07,0X80,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X7C,0X06,0X00,0X00,0X00,0X00,0X3F,0X03,0X80,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X7E,0X06,0X00,0X00,0X00,0X00,0X1F,0X81,0X80,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X1E,0X03,0X00,0X00,0X00,0X00,0X0F,0X80,0XC0,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X0E,0X01,0X00,0X00,0X00,0X00,0X07,0X80,0X60,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X0F,0X01,0X80,0X00,0X00,0X00,0X03,0XC0,0X30,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X07,0X81,0XC0,0X00,0X00,0X00,0X01,0XC0,0X38,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X07,0X81,0XC0,0X00,0X00,0X00,0X00,0XC0,0X18,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X07,0XC0,0XE0,0X00,0X00,0X00,0X00,0X40,0X08,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XC0,0XF0,0X00,0X00,0X00,0X00,0X00,0X04,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XC0,0X70,0X00,0X00,0X00,0X00,0X00,0X06,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X70,0X00,0XF8,0X00,0X00,0X00,0X02,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XC0,0X30,0X00,0XFF,0XF0,0X00,0X00,0X07,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XC0,0X30,0X01,0XFF,0XF8,0X00,0X00,0X03,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X30,0X01,0XFF,0XFC,0X00,0X00,0X03,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X18,0X01,0XFF,0XFE,0X00,0X00,0X03,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X08,0X00,0XFF,0XFF,0X00,0X00,0X01,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X08,0X00,0X67,0XFF,0X00,0X00,0X01,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X08,0X00,0XFF,0XFF,0X00,0X00,0X00,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0X80,0X08,0X03,0XFF,0XBF,0X80,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X07,0XFF,0X3F,0X80,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X03,0XFF,0XBF,0XC0,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X03,0XFF,0X3F,0XC0,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X03,0XF0,0X1F,0XC0,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X03,0XFF,0XCF,0XF0,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X01,0XFF,0XE7,0XFC,0X00,0X00,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X01,0XFF,0XF3,0XFF,0XF0,0X01,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X01,0XFF,0XF8,0XFF,0XF8,0X01,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X7F,0XFC,0X7F,0XFF,0X03,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X1F,0XFF,0X00,0X7F,0X83,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X3F,0XFF,0X80,0X1F,0XC7,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X3F,0XFF,0XFF,0XFF,0XC3,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X3F,0XFF,0XFF,0XFF,0XC4,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X3F,0XFF,0XFF,0XFF,0XC4,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X18,0X00,0X1F,0XFF,0XFF,0XFF,0XC4,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X38,0X00,0X0F,0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X78,0X00,0X03,0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0XF8,0X00,0X00,0X7F,0XFF,0XFF,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X01,0XF8,0X00,0X00,0X3F,0XFF,0XFF,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X38,0X00,0X00,0X3F,0XFF,0XF9,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X18,0X00,0X00,0X3F,0XFF,0XF3,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X00,0X3F,0XFF,0XE7,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X00,0X3C,0XFC,0X1F,0XF8,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X8C,0X00,0X00,0X7E,0X00,0X7F,0X98,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X79,0X8C,0X00,0X07,0XFF,0X0F,0XFF,0X9C,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0XFC,0XC6,0X00,0X0F,0XFF,0X7F,0XFF,0X78,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XF8,0X46,0X00,0X0F,0XFF,0X7F,0XFE,0X78,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XFC,0X07,0X00,0X0F,0XFF,0X7F,0XFE,0X78,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X07,0XFE,0X07,0XC0,0X0F,0XFF,0X7F,0XFE,0X60,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X07,0XF9,0XE7,0XE0,0X07,0XFF,0X7F,0XF8,0XC0,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X03,0XE3,0XF3,0XF0,0X03,0XFF,0XFF,0XF1,0XC0,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X7F,0XC3,0XF3,0X38,0X01,0XFF,0XFF,0XF1,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0XFF,0XDF,0XF3,0X1C,0X00,0X7F,0XFF,0XE3,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0XFF,0X9F,0XF3,0X8E,0X00,0X3F,0XFF,0XE7,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0XFE,0X33,0XFB,0XCF,0X00,0X1F,0XFF,0XCF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X01,0XFE,0X3F,0XF1,0XCF,0X00,0X0F,0XFF,0XCF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X0C,0X7F,0XCD,0XE3,0X80,0X0F,0XFF,0XDF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X01,0X01,0XFC,0X8E,0X7F,0X80,0X0F,0XFF,0X9F,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X0F,0XF9,0XFC,0X1E,0X3F,0X80,0X0F,0XF3,0XBF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X0F,0XFD,0XFC,0X3E,0X3F,0X80,0X0F,0XE1,0XBF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X0F,0XFC,0XFC,0X3F,0X3F,0X80,0X0F,0XC1,0X3F,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X1F,0XE5,0XF8,0X3B,0X9F,0X80,0X0F,0XC2,0X3F,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X1F,0XCF,0XF0,0X33,0XDF,0XC0,0X03,0X9C,0X0F,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X0E,0X00,0X39,0XD9,0XC0,0X00,0X38,0X63,0XC0,0X00,0X00,0X00,
0X00,0X00,0X80,0X0F,0XFE,0X00,0X0F,0XEE,0XF0,0X00,0XFF,0XF3,0XF0,0X00,0X00,0X00,
0X00,0X00,0X80,0X1F,0XFE,0X00,0X07,0XEE,0X78,0X01,0XFF,0XFF,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X1F,0XFE,0X00,0X07,0XEE,0X3C,0X01,0XFF,0XFF,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X1F,0XFE,0X00,0X07,0XEF,0X3C,0X01,0XFF,0XFF,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X1F,0X7C,0X00,0X00,0XEF,0XFC,0X01,0XFF,0XFF,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X1E,0X1C,0X00,0X00,0X6F,0XFC,0X01,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X33,0XFE,0X00,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFE,0X00,0XFF,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFE,0X00,0X3F,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFE,0X00,0X1F,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFC,0X00,0X03,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XFE,0X00,0X03,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X7E,0X00,0X03,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X78,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X30,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
};

View file

@ -0,0 +1,30 @@
/**
* @filename : imagedata.h
* @brief : head file for imagedata.cpp
*
* Copyright (C) Waveshare September 5 2017
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documnetation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
extern const unsigned char IMAGE_DATA[];
/* FILE END */

View file

@ -286,7 +286,7 @@ void Epd::TurnOnDisplay(void)
function : Initialize the e-Paper register function : Initialize the e-Paper register
parameter: parameter:
******************************************************************************/ ******************************************************************************/
void Epd::Init() int Epd::Init()
{ {
/* this calls the peripheral hardware interface, see epdif */ /* this calls the peripheral hardware interface, see epdif */
if (IfInit() != 0) { if (IfInit() != 0) {
@ -323,6 +323,8 @@ void Epd::Init()
SendCommand(0x82); //vcom_DC setting SendCommand(0x82); //vcom_DC setting
SendData(0x28); SendData(0x28);
return 0;
} }
void Epd::Clear(void) void Epd::Clear(void)

View file

@ -43,7 +43,7 @@ public:
Epd(); Epd();
~Epd(); ~Epd();
void Init(void); int Init(void);
void SendCommand(unsigned char command); void SendCommand(unsigned char command);
void SendData(unsigned char data); void SendData(unsigned char data);
void ReadBusy(void); void ReadBusy(void);

View file

@ -30,49 +30,63 @@
static const UBYTE lut_4Gray_GC[] = static const UBYTE lut_4Gray_GC[] =
{ {
0x2A,0x06,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1 0x2A,0x06,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1
0x28,0x06,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//2 0x28,0x06,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//2
0x20,0x06,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3 0x20,0x06,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3
0x14,0x06,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//4 0x14,0x06,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//4
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5
0x00,0x02,0x02,0x0A,0x00,0x00,0x00,0x08,0x08,0x02,//6 0x00,0x02,0x02,0x0A,0x00,0x00,0x00,0x08,0x08,0x02,//6
0x00,0x02,0x02,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,//7 0x00,0x02,0x02,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,//7
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//8 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//8
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//10 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//10
0x22,0x22,0x22,0x22,0x22 0x22,0x22,0x22,0x22,0x22
}; };
static const UBYTE lut_1Gray_GC[] = static const UBYTE lut_1Gray_GC[] =
{ {
0x2A,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1 0x2A,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1
0x05,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//2 0x05,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//2
0x2A,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3 0x2A,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3
0x05,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//4 0x05,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//4
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5
0x00,0x02,0x03,0x0A,0x00,0x02,0x06,0x0A,0x05,0x00,//6 0x00,0x02,0x03,0x0A,0x00,0x02,0x06,0x0A,0x05,0x00,//6
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//7 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//7
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//8 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//8
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//10 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//10
0x22,0x22,0x22,0x22,0x22 0x22,0x22,0x22,0x22,0x22
}; };
static const UBYTE lut_1Gray_DU[] = static const UBYTE lut_1Gray_DU[] =
{ {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1
0x01,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0A,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3 0x0A,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5
0x00,0x00,0x05,0x05,0x00,0x05,0x03,0x05,0x05,0x00, 0x00,0x00,0x05,0x05,0x00,0x05,0x03,0x05,0x05,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//7 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//7
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x22,0x22,0x22,0x22,0x22 0x22,0x22,0x22,0x22,0x22
}; };
static const UBYTE lut_1Gray_A2[] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //1
0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //2
0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //3
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //4
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //5
0x00,0x00,0x03,0x05,0x00,0x00,0x00,0x00,0x00,0x00, //6
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //7
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //8
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //10
0x22,0x22,0x22,0x22,0x22
};
Epd::~Epd() { Epd::~Epd() {
}; };
@ -185,11 +199,9 @@ void Epd::SendData(unsigned char data) {
void Epd::WaitUntilIdle(void) { void Epd::WaitUntilIdle(void) {
Serial.print("e-Paper busy \r\n "); Serial.print("e-Paper busy \r\n ");
UBYTE busy; UBYTE busy;
do do {
{
busy = DigitalRead(busy_pin); busy = DigitalRead(busy_pin);
} } while(busy);
while(busy);
DelayMs(200); DelayMs(200);
Serial.print("e-Paper busy release \r\n "); Serial.print("e-Paper busy release \r\n ");
} }
@ -200,16 +212,18 @@ void Epd::WaitUntilIdle(void) {
* see Epd::Sleep(); * see Epd::Sleep();
*/ */
void Epd::Reset(void) { void Epd::Reset(void) {
DigitalWrite(reset_pin, LOW); //module reset
DelayMs(1);
DigitalWrite(reset_pin, HIGH); DigitalWrite(reset_pin, HIGH);
DelayMs(200); DelayMs(20);
DigitalWrite(reset_pin, LOW); //module reset
DelayMs(2);
DigitalWrite(reset_pin, HIGH);
DelayMs(20);
} }
/****************************************************************************** /******************************************************************************
function : Display function : Display
******************************************************************************/ ******************************************************************************/
void Epd::DisplayFrame(const UBYTE *Image) { void Epd::DisplayFrame(const UBYTE *Image, bool isBase) {
UWORD i; UWORD i;
UWORD IMAGE_COUNTER = width * height / 8; UWORD IMAGE_COUNTER = width * height / 8;
@ -221,10 +235,15 @@ void Epd::DisplayFrame(const UBYTE *Image) {
SendData(0x00); SendData(0x00);
SendCommand(0x24); SendCommand(0x24);
for (i = 0; i < IMAGE_COUNTER; i++) for (i = 0; i < IMAGE_COUNTER; i++) {
{
SendData(pgm_read_byte(&Image[i])); SendData(pgm_read_byte(&Image[i]));
} }
if(isBase) {
SendCommand(0x26);
for (i = 0; i < IMAGE_COUNTER; i++) {
SendData(pgm_read_byte(&Image[i]));
}
}
Load_LUT(1); Load_LUT(1);
SendCommand(0x20); SendCommand(0x20);
@ -233,6 +252,9 @@ void Epd::DisplayFrame(const UBYTE *Image) {
/****************************************************************************** /******************************************************************************
function : Partial Display function : Partial Display
note:
1. iwidth must be a multiple of 8
2. The update will clear other parts of the image data
******************************************************************************/ ******************************************************************************/
void Epd::DisplayFrame_Partial(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD iwidth, UWORD iheight) { void Epd::DisplayFrame_Partial(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD iwidth, UWORD iheight) {
UWORD i, j; UWORD i, j;
@ -258,6 +280,54 @@ void Epd::DisplayFrame_Partial(const UBYTE *Image, UWORD Xstart, UWORD Ystart, U
WaitUntilIdle(); WaitUntilIdle();
} }
/******************************************************************************
function : Sends part the image buffer in RAM to e-Paper and displays
notes:
1. Xstart must be a multiple of 8
1. isGC: use GC mode to clear base-image
******************************************************************************/
void Epd::DisplayFrame_Part(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, bool isGC)
{
UWORD i, Width;
Width = (Xend-Xstart)%8 == 0 ? (Xend-Xstart)/8 : (Xend-Xstart)/8+1;
UWORD IMAGE_COUNTER = Width * (Yend-Ystart);
Xend -= 1;
Yend -= 1;
SendCommand(0x44);
SendData(Xstart & 0xff);
SendData((Xstart>>8) & 0x03);
SendData(Xend & 0xff);
SendData((Xend>>8) & 0x03);
SendCommand(0x45);
SendData(Ystart & 0xff);
SendData((Ystart>>8) & 0x03);
SendData(Yend & 0xff);
SendData((Yend>>8) & 0x03);
SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
SendData(Xstart & 0xFF);
SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
SendData(Ystart & 0xFF);
SendData((Ystart >> 8) & 0xFF);
SendCommand(0x24);
for (i = 0; i < IMAGE_COUNTER; i++)
{
SendData(Image[i]);
}
if(isGC)
Load_LUT(1);
else
Load_LUT(0);
}
void Epd::TurnOnDisplay(void) {
SendCommand(0x20);
WaitUntilIdle();
}
/****************************************************************************** /******************************************************************************
function : set the look-up tables function : set the look-up tables
@ -270,7 +340,7 @@ void Epd::Load_LUT(UBYTE mode) {
if(mode == 1) if(mode == 1)
SendData(lut_1Gray_GC[i]); SendData(lut_1Gray_GC[i]);
else if(mode == 0) else if(mode == 0)
SendData(lut_1Gray_DU[i]); SendData(lut_1Gray_A2[i]);
} }
} }
@ -302,7 +372,6 @@ void Epd::Clear(UBYTE mode) {
Load_LUT(0); Load_LUT(0);
SendCommand(0x20); SendCommand(0x20);
WaitUntilIdle(); WaitUntilIdle();
} }
/** /**
@ -319,7 +388,4 @@ void Epd::Sleep(void) {
SendCommand(0X07); //deep sleep SendCommand(0X07); //deep sleep
SendData(0xA5); SendData(0xA5);
} }
/* END OF FILE */ /* END OF FILE */

View file

@ -44,9 +44,11 @@ public:
int Init(void); int Init(void);
void WaitUntilIdle(void); void WaitUntilIdle(void);
void Reset(void); void Reset(void);
void DisplayFrame(const UBYTE *Image); void DisplayFrame(const UBYTE *Image, bool isBase);
void SendCommand(unsigned char command); void SendCommand(unsigned char command);
void DisplayFrame_Partial(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD iwidth, UWORD iheight); void DisplayFrame_Partial(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD iwidth, UWORD iheight);
void DisplayFrame_Part(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, bool isGC);
void TurnOnDisplay(void);
void SendData(unsigned char data); void SendData(unsigned char data);
void Sleep(void); void Sleep(void);
void Clear(UBYTE mode); void Clear(UBYTE mode);

View file

@ -32,7 +32,7 @@
#define COLORED 0 #define COLORED 0
#define UNCOLORED 1 #define UNCOLORED 1
UBYTE image[800]; UBYTE image[700];
Paint paint(image, 0, 0); // width should be the multiple of 8 Paint paint(image, 0, 0); // width should be the multiple of 8
UDOUBLE time_start_ms; UDOUBLE time_start_ms;
UDOUBLE time_now_s; UDOUBLE time_now_s;
@ -49,29 +49,39 @@ void setup() {
Serial.print("e-Paper Clear\r\n "); Serial.print("e-Paper Clear\r\n ");
epd.Clear(1); epd.Clear(1);
Serial.print("draw image\r\n "); Serial.print("draw image\r\n ");
epd.DisplayFrame(IMAGE_DATA); epd.DisplayFrame(IMAGE_DATA, true); // Set base image
delay(4000); delay(3000);
epd.Clear(0);
paint.SetWidth(40);
paint.SetHeight(120);
paint.SetRotate(ROTATE_270);
paint.Clear(UNCOLORED);
UBYTE i; UBYTE i;
time_start_ms = millis(); time_start_ms = millis();
for(i=0; i<10; i++) { for(i=0; i<5; i++) {
time_now_s = (millis() - time_start_ms) / 1000; time_now_s = (millis() - time_start_ms) / 1000;
char time_string[] = {'0', '0', ':', '0', '0', '\0'}; char time_string[] = {'0', '0', ':', '0', '0', '\0'};
time_string[0] = time_now_s / 60 / 10 + '0'; time_string[0] = time_now_s / 60 / 10 + '0';
time_string[1] = time_now_s / 60 % 10 + '0'; time_string[1] = time_now_s / 60 % 10 + '0';
time_string[3] = time_now_s % 60 / 10 + '0'; time_string[3] = time_now_s % 60 / 10 + '0';
time_string[4] = time_now_s % 60 % 10 + '0'; time_string[4] = time_now_s % 60 % 10 + '0';
paint.SetWidth(48);
paint.SetHeight(100);
paint.SetRotate(ROTATE_270);
paint.Clear(UNCOLORED); paint.Clear(UNCOLORED);
paint.DrawStringAt(20, 10, time_string, &Font16, COLORED); paint.DrawStringAt(20, 10, time_string, &Font16, COLORED);
Serial.print("refresh------\r\n "); Serial.print("refresh------\r\n ");
epd.DisplayFrame_Partial(paint.GetImage(), 20, 100, 48, 100); // epd.DisplayFrame_Partial(paint.GetImage(), 20, 100, 40, 120); // Width must be a multiple of 8
/* Writes new data to RAM */
epd.DisplayFrame_Part(paint.GetImage(), 40+i*40, 30, 80+i*40, 140, false); // Xstart must be a multiple of 8
/* Displays and toggles the RAM currently in use */
epd.TurnOnDisplay();
/* Writes the last data to another RAM */
epd.DisplayFrame_Part(paint.GetImage(), 40+i*40, 30, 80+i*40, 140, false); // Xstart must be a multiple of 8
delay(500);
} }
Serial.print("clear and sleep......\r\n "); Serial.print("clear and sleep......\r\n ");
epd.Init();
epd.Clear(1); epd.Clear(1);
epd.Sleep(); epd.Sleep();
} }

View file

@ -82,6 +82,7 @@ int Epd::Init(void) {
SendData(0x90); SendData(0x90);
SendCommand(0xE3); SendCommand(0xE3);
SendData(0xAA); SendData(0xAA);
return 0;
} }
/** /**

View file

@ -39,7 +39,6 @@ Epd::Epd() {
height = EPD_HEIGHT; height = EPD_HEIGHT;
}; };
int Epd::Init(void) { int Epd::Init(void) {
/* this calls the peripheral hardware interface, see epdif */ /* this calls the peripheral hardware interface, see epdif */
if (IfInit() != 0) { if (IfInit() != 0) {
@ -47,23 +46,38 @@ int Epd::Init(void) {
} }
/* EPD hardware init start */ /* EPD hardware init start */
Reset(); Reset();
SendCommand(POWER_SETTING); SendCommand(0x01);
SendData(0x03); // VDS_EN, VDG_EN SendData(0x03); // VDS_EN, VDG_EN
SendData(0x00); // VCOM_HV, VGHL_LV[1], VGHL_LV[0] SendData(0x00); // VCOM_HV, VGHL_LV[1], VGHL_LV[0]
SendData(0x2b); // VDH SendData(0x2b); // VDH
SendData(0x2b); // VDL SendData(0x2b); // VDL
SendData(0xff); // VDHR
SendCommand(BOOSTER_SOFT_START); SendCommand(0x06);
SendData(0x17); SendData(0x17);
SendData(0x17); SendData(0x17);
SendData(0x17); //07 0f 17 1f 27 2F 37 2f SendData(0x17); //07 0f 17 1f 27 2F 37 2f
SendCommand(POWER_ON); SendCommand(0x04);
WaitUntilIdle(); WaitUntilIdle();
SendCommand(PANEL_SETTING); SendCommand(0x00);
SendData(0xbf); // KW-BF KWR-AF BWROTP 0f SendData(0xbf); // KW-BF KWR-AF BWROTP 0f
SendData(0x0b);
SendCommand(PLL_CONTROL); SendCommand(0x30);
SendData(0x3c); // 3A 100HZ 29 150Hz 39 200HZ 31 171HZ SendData(0x3c); // 3A 100HZ 29 150Hz 39 200HZ 31 171HZ
SendCommand(0x61); // resolution setting
SendData(0x01);
SendData(0x90); //128
SendData(0x01); //
SendData(0x2c);
SendCommand(0x82); // vcom_DC setting
SendData(0x12);
SendCommand(0X50); // VCOM AND DATA INTERVAL SETTING
SendData(0x97); // 97white border 77black border VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7
SetLut();
/* EPD hardware init end */ /* EPD hardware init end */
return 0; return 0;
} }
@ -132,10 +146,8 @@ void Epd::SendData(unsigned char data) {
* @brief: Wait until the busy_pin goes HIGH * @brief: Wait until the busy_pin goes HIGH
*/ */
void Epd::WaitUntilIdle(void) { void Epd::WaitUntilIdle(void) {
SendCommand(0x71);
while(DigitalRead(busy_pin) == 0) { //0: busy, 1: idle while(DigitalRead(busy_pin) == 0) { //0: busy, 1: idle
DelayMs(100); // Wait
SendCommand(0x71);
} }
} }
@ -306,27 +318,27 @@ void Epd::Set_4GrayDisplay(const char *Image, int x, int y, int w, int l)
void Epd::SetLut(void) { void Epd::SetLut(void) {
unsigned int count; unsigned int count;
SendCommand(LUT_FOR_VCOM); //vcom SendCommand(LUT_FOR_VCOM); //vcom
for(count = 0; count < 44; count++) { for(count = 0; count < 36; count++) {
SendData(lut_vcom0[count]); SendData(lut_vcom0[count]);
} }
SendCommand(LUT_WHITE_TO_WHITE); //ww -- SendCommand(LUT_WHITE_TO_WHITE); //ww --
for(count = 0; count < 42; count++) { for(count = 0; count < 36; count++) {
SendData(lut_ww[count]); SendData(lut_ww[count]);
} }
SendCommand(LUT_BLACK_TO_WHITE); //bw r SendCommand(LUT_BLACK_TO_WHITE); //bw r
for(count = 0; count < 42; count++) { for(count = 0; count < 36; count++) {
SendData(lut_bw[count]); SendData(lut_bw[count]);
} }
SendCommand(LUT_WHITE_TO_BLACK); //wb w SendCommand(LUT_WHITE_TO_BLACK); //wb w
for(count = 0; count < 42; count++) { for(count = 0; count < 36; count++) {
SendData(lut_bb[count]); SendData(lut_bb[count]);
} }
SendCommand(LUT_BLACK_TO_BLACK); //bb b SendCommand(LUT_BLACK_TO_BLACK); //bb b
for(count = 0; count < 42; count++) { for(count = 0; count < 36; count++) {
SendData(lut_wb[count]); SendData(lut_wb[count]);
} }
} }
@ -389,9 +401,7 @@ void Epd::DisplayFrame(const unsigned char* frame_buffer) {
DelayMs(2); DelayMs(2);
} }
SetLut(); SendCommand(0x12);
SendCommand(DISPLAY_REFRESH);
DelayMs(100); DelayMs(100);
WaitUntilIdle(); WaitUntilIdle();
} }
@ -418,10 +428,6 @@ void Epd::ClearFrame(void) {
SendData(0xFF); SendData(0xFF);
} }
DelayMs(2); DelayMs(2);
SetLut();
SendCommand(DISPLAY_REFRESH);
DelayMs(100);
WaitUntilIdle();
} }
/** /**
@ -463,55 +469,56 @@ void Epd::Sleep() {
const unsigned char lut_vcom0[] = const unsigned char lut_vcom0[] =
{ {
0x00, 0x17, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x08, 0x00, 0x00, 0x02,
0x00, 0x17, 0x17, 0x00, 0x00, 0x02, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x00, 0x0A, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x08, 0x00, 0x00, 0x02,
0x00, 0x0E, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
}; };
const unsigned char lut_ww[] ={ const unsigned char lut_ww[] ={
0x40, 0x17, 0x00, 0x00, 0x00, 0x02, 0x50, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01, 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02,
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };
const unsigned char lut_bw[] ={ const unsigned char lut_bw[] ={
0x40, 0x17, 0x00, 0x00, 0x00, 0x02, 0x50, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01, 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02,
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };
const unsigned char lut_bb[] ={ const unsigned char lut_bb[] ={
0x80, 0x17, 0x00, 0x00, 0x00, 0x02, 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x80, 0x0A, 0x01, 0x00, 0x00, 0x01, 0x50, 0x08, 0x08, 0x00, 0x00, 0x02,
0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };
const unsigned char lut_wb[] ={ const unsigned char lut_wb[] ={
0x80, 0x17, 0x00, 0x00, 0x00, 0x02, 0x20, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x80, 0x0A, 0x01, 0x00, 0x00, 0x01, 0x10, 0x08, 0x08, 0x00, 0x00, 0x02,
0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };

View file

@ -229,8 +229,8 @@ void Epd::DisplayFrame(const unsigned char* frame_buffer) {
SendCommand(0x13); SendCommand(0x13);
for (unsigned long j = 0; j < height; j++) { for (unsigned long j = 0; j < height; j++) {
for (unsigned long i = 0; i < width; i++) { for (unsigned long i = 0; i < width/8; i++) {
SendData(~frame_buffer[i + j * width]); SendData(~frame_buffer[i + j * width/8]);
} }
} }
SendCommand(0x12); SendCommand(0x12);
@ -240,7 +240,6 @@ void Epd::DisplayFrame(const unsigned char* frame_buffer) {
void Epd::Displaypart(const unsigned char* pbuffer, unsigned long xStart, unsigned long yStart,unsigned long Picture_Width,unsigned long Picture_Height) { void Epd::Displaypart(const unsigned char* pbuffer, unsigned long xStart, unsigned long yStart,unsigned long Picture_Width,unsigned long Picture_Height) {
SendCommand(0x13); SendCommand(0x13);
int * padd;
// xStart = xStart/8; // xStart = xStart/8;
// xStart = xStart*8; // xStart = xStart*8;
for (unsigned long j = 0; j < height; j++) { for (unsigned long j = 0; j < height; j++) {

View file

@ -26,7 +26,7 @@
*/ */
#include "epdif.h" #include "epdif.h"
#include <spi.h> #include <SPI.h>
EpdIf::EpdIf() { EpdIf::EpdIf() {
}; };

View file

@ -28,7 +28,7 @@
#ifndef EPDIF_H #ifndef EPDIF_H
#define EPDIF_H #define EPDIF_H
#include <arduino.h> #include <Arduino.h>
// Pin definition // Pin definition
#define RST_PIN 8 #define RST_PIN 8

View file

@ -29,6 +29,7 @@
******************************************************************************/ ******************************************************************************/
#include "EPD_Test.h" #include "EPD_Test.h"
#include "EPD_1in54b_V2.h" #include "EPD_1in54b_V2.h"
#include "time.h"
int EPD_1in54b_V2_test(void) int EPD_1in54b_V2_test(void)
{ {
@ -37,7 +38,11 @@ int EPD_1in54b_V2_test(void)
return -1; return -1;
} }
EPD_1IN54B_V2_Init(); EPD_1IN54B_V2_Init();
struct timespec start={0,0}, finish={0,0};
clock_gettime(CLOCK_REALTIME,&start);
EPD_1IN54B_V2_Clear(); EPD_1IN54B_V2_Clear();
clock_gettime(CLOCK_REALTIME,&finish);
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
DEV_Delay_ms(200); DEV_Delay_ms(200);
UBYTE *BlackImage, *RedImage; UBYTE *BlackImage, *RedImage;

View file

@ -4,8 +4,8 @@
* | Function : 2.13inch e-paper V3 test demo * | Function : 2.13inch e-paper V3 test demo
* | Info : * | Info :
*---------------- *----------------
* | This version: V1.0 * | This version: V1.1
* | Date : 2020-12-22 * | Date : 2021-10-30
* | Info : * | Info :
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
@ -33,40 +33,40 @@
int EPD_2in13_V3_test(void) int EPD_2in13_V3_test(void)
{ {
printf("EPD_2in13_V3_test Demo\r\n"); Debug("EPD_2in13_V3_test Demo\r\n");
if(DEV_Module_Init()!=0){ if(DEV_Module_Init()!=0){
return -1; return -1;
} }
printf("e-Paper Init and Clear...\r\n"); Debug("e-Paper Init and Clear...\r\n");
EPD_2in13_V3_Init(); EPD_2in13_V3_Init();
struct timespec start={0,0}, finish={0,0}; struct timespec start={0,0}, finish={0,0};
clock_gettime(CLOCK_REALTIME,&start); clock_gettime(CLOCK_REALTIME,&start);
EPD_2in13_V3_Clear(); EPD_2in13_V3_Clear();
clock_gettime(CLOCK_REALTIME,&finish); clock_gettime(CLOCK_REALTIME,&finish);
printf("%ld S\r\n",finish.tv_sec-start.tv_sec); Debug("%ld S\r\n",finish.tv_sec-start.tv_sec);
//Create a new image cache //Create a new image cache
UBYTE *BlackImage; UBYTE *BlackImage;
UWORD Imagesize = ((EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1)) * EPD_2in13_V3_HEIGHT; UWORD Imagesize = ((EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1)) * EPD_2in13_V3_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) { if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n"); Debug("Failed to apply for black memory...\r\n");
return -1; return -1;
} }
printf("Paint_NewImage\r\n"); Debug("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE); Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
Paint_Clear(WHITE); Paint_Clear(WHITE);
#if 1 // show bmp #if 1 // show bmp
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE); Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
printf("show window BMP-----------------\r\n"); Debug("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage); Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/100x100.bmp", 0, 0); GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
EPD_2in13_V3_Display(BlackImage); EPD_2in13_V3_Display(BlackImage);
DEV_Delay_ms(3000); DEV_Delay_ms(3000);
printf("show bmp------------------------\r\n"); Debug("show bmp------------------------\r\n");
Paint_SelectImage(BlackImage); Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/2in13_1.bmp", 0, 0); GUI_ReadBmp("./pic/2in13_1.bmp", 0, 0);
EPD_2in13_V3_Display(BlackImage); EPD_2in13_V3_Display(BlackImage);
@ -74,7 +74,7 @@ int EPD_2in13_V3_test(void)
#endif #endif
#if 1 //show image for array #if 1 //show image for array
printf("show image for array\r\n"); Debug("show image for array\r\n");
Paint_SelectImage(BlackImage); Paint_SelectImage(BlackImage);
Paint_Clear(WHITE); Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_2in13_2); Paint_DrawBitMap(gImage_2in13_2);
@ -85,7 +85,7 @@ int EPD_2in13_V3_test(void)
#if 1 // Drawing on the image #if 1 // Drawing on the image
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE); Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
printf("Drawing\r\n"); Debug("Drawing\r\n");
//1.Select Image //1.Select Image
Paint_SelectImage(BlackImage); Paint_SelectImage(BlackImage);
Paint_Clear(WHITE); Paint_Clear(WHITE);
@ -109,8 +109,8 @@ int EPD_2in13_V3_test(void)
Paint_DrawString_EN(140, 15, "waveshare", &Font16, BLACK, WHITE); Paint_DrawString_EN(140, 15, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawNum(140, 40, 123456789, &Font16, BLACK, WHITE); Paint_DrawNum(140, 40, 123456789, &Font16, BLACK, WHITE);
Paint_DrawString_CN(140, 60, "你好abc", &Font12CN, BLACK, WHITE); Paint_DrawString_CN(140, 60, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(5, 65, "微雪电子", &Font24CN, WHITE, BLACK); Paint_DrawString_CN(5, 65, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
EPD_2in13_V3_Display_Base(BlackImage); EPD_2in13_V3_Display_Base(BlackImage);
DEV_Delay_ms(3000); DEV_Delay_ms(3000);
@ -118,7 +118,7 @@ int EPD_2in13_V3_test(void)
#if 1 //Partial refresh, example shows time #if 1 //Partial refresh, example shows time
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE); Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
printf("Partial refresh\r\n"); Debug("Partial refresh\r\n");
Paint_SelectImage(BlackImage); Paint_SelectImage(BlackImage);
PAINT_TIME sPaint_time; PAINT_TIME sPaint_time;
@ -153,17 +153,17 @@ int EPD_2in13_V3_test(void)
} }
#endif #endif
printf("Clear...\r\n"); Debug("Clear...\r\n");
EPD_2in13_V3_Init(); EPD_2in13_V3_Init();
EPD_2in13_V3_Clear(); EPD_2in13_V3_Clear();
printf("Goto Sleep...\r\n"); Debug("Goto Sleep...\r\n");
EPD_2in13_V3_Sleep(); EPD_2in13_V3_Sleep();
free(BlackImage); free(BlackImage);
BlackImage = NULL; BlackImage = NULL;
DEV_Delay_ms(2000);//important, at least 2s DEV_Delay_ms(2000);//important, at least 2s
// close 5V // close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n"); Debug("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit(); DEV_Module_Exit();
return 0; return 0;
} }

View file

@ -30,6 +30,7 @@
#include "EPD_Test.h" #include "EPD_Test.h"
#include "EPD_4in2.h" #include "EPD_4in2.h"
#include <string.h> #include <string.h>
#include <time.h>
int EPD_4in2_test(void) int EPD_4in2_test(void)
{ {
@ -39,9 +40,14 @@ int EPD_4in2_test(void)
} }
printf("e-Paper Init and Clear...\r\n"); printf("e-Paper Init and Clear...\r\n");
EPD_4IN2_Init(); EPD_4IN2_Init_Fast();
struct timespec start={0,0}, finish={0,0};
clock_gettime(CLOCK_REALTIME,&start);
EPD_4IN2_Clear(); EPD_4IN2_Clear();
DEV_Delay_ms(500); DEV_Delay_ms(500);
clock_gettime(CLOCK_REALTIME,&finish);
Debug("%ld S\r\n",finish.tv_sec-start.tv_sec);
//Create a new image cache //Create a new image cache
UBYTE *BlackImage; UBYTE *BlackImage;
@ -56,6 +62,9 @@ int EPD_4in2_test(void)
#if 1 // show bmp #if 1 // show bmp
EPD_4IN2_Init_Fast();
printf("show window BMP-----------------\r\n"); printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage); Paint_SelectImage(BlackImage);
Paint_Clear(WHITE); Paint_Clear(WHITE);
@ -68,9 +77,10 @@ int EPD_4in2_test(void)
GUI_ReadBmp("./pic/4in2.bmp", 0, 0); GUI_ReadBmp("./pic/4in2.bmp", 0, 0);
EPD_4IN2_Display(BlackImage); EPD_4IN2_Display(BlackImage);
DEV_Delay_ms(2000); DEV_Delay_ms(2000);
#endif #endif
#if 0 // show image for array #if 1 // show image for array
printf("show image for array\r\n"); printf("show image for array\r\n");
Paint_SelectImage(BlackImage); Paint_SelectImage(BlackImage);
Paint_Clear(WHITE); Paint_Clear(WHITE);
@ -102,15 +112,18 @@ int EPD_4in2_test(void)
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK); Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE); Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK); Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
Paint_DrawString_CN(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE); Paint_DrawString_CN(130, 0, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK); Paint_DrawString_CN(130, 20, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
printf("EPD_Display\r\n"); printf("EPD_Display\r\n");
EPD_4IN2_Display(BlackImage); EPD_4IN2_Display(BlackImage);
DEV_Delay_ms(2000); DEV_Delay_ms(2000);
#endif #endif
printf("Support for partial refresh, but the refresh effect is not good, but it is not recommended\r\n");
#if 0 #if 0
printf("Support for partial refresh, but the refresh effect is not good, but it is not recommended\r\n");
EPD_4IN2_Init_Partial();
printf("Partial refresh\r\n"); printf("Partial refresh\r\n");
PAINT_TIME sPaint_time; PAINT_TIME sPaint_time;
sPaint_time.Hour = 12; sPaint_time.Hour = 12;
@ -142,6 +155,8 @@ int EPD_4in2_test(void)
} }
} }
#endif #endif
#if 1
EPD_4IN2_Init_Fast();
EPD_4IN2_Clear(); EPD_4IN2_Clear();
EPD_4IN2_Init_4Gray(); EPD_4IN2_Init_4Gray();
printf("show Gray------------------------\r\n"); printf("show Gray------------------------\r\n");
@ -155,7 +170,7 @@ int EPD_4in2_test(void)
Paint_NewImage(BlackImage, EPD_4IN2_WIDTH, EPD_4IN2_HEIGHT, 0, WHITE); Paint_NewImage(BlackImage, EPD_4IN2_WIDTH, EPD_4IN2_HEIGHT, 0, WHITE);
Paint_SetScale(4); Paint_SetScale(4);
Paint_Clear(WHITE); Paint_Clear(WHITE);
#if 0
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT); Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT); Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT); Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
@ -171,20 +186,19 @@ int EPD_4in2_test(void)
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK); Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE); Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK); Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
Paint_DrawString_CN(140, 0, "ÄãºÃabc", &Font12CN, GRAY1, GRAY4); Paint_DrawString_CN(140, 0, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY1, GRAY4);
Paint_DrawString_CN(140, 40, "ÄãºÃabc", &Font12CN, GRAY2, GRAY3); Paint_DrawString_CN(140, 40, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY2, GRAY3);
Paint_DrawString_CN(140, 80, "ÄãºÃabc", &Font12CN, GRAY3, GRAY2); Paint_DrawString_CN(140, 80, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY3, GRAY2);
Paint_DrawString_CN(140, 120, "ÄãºÃabc", &Font12CN, GRAY4, GRAY1); Paint_DrawString_CN(140, 120, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY4, GRAY1);
Paint_DrawString_CN(220, 0, "΢ѩµç×Ó", &Font24CN, GRAY1, GRAY4); Paint_DrawString_CN(220, 0, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY1, GRAY4);
Paint_DrawString_CN(220, 40, "΢ѩµç×Ó", &Font24CN, GRAY2, GRAY3); Paint_DrawString_CN(220, 40, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY2, GRAY3);
Paint_DrawString_CN(220, 80, "΢ѩµç×Ó", &Font24CN, GRAY3, GRAY2); Paint_DrawString_CN(220, 80, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY3, GRAY2);
Paint_DrawString_CN(220, 120, "΢ѩµç×Ó", &Font24CN, GRAY4, GRAY1); Paint_DrawString_CN(220, 120, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY4, GRAY1);
EPD_4IN2_4GrayDisplay(BlackImage); EPD_4IN2_4GrayDisplay(BlackImage);
DEV_Delay_ms(2000); DEV_Delay_ms(2000);
#endif
#if 1
Paint_Clear(WHITE); Paint_Clear(WHITE);
EPD_4IN2_4GrayDisplay(gImage_4in2_4Gray1); EPD_4IN2_4GrayDisplay(gImage_4in2_4Gray1);
DEV_Delay_ms(2000); DEV_Delay_ms(2000);
@ -198,8 +212,7 @@ int EPD_4in2_test(void)
EPD_4IN2_4GrayDisplay(BlackImage); EPD_4IN2_4GrayDisplay(BlackImage);
DEV_Delay_ms(2000); DEV_Delay_ms(2000);
#endif #endif
EPD_4IN2_Clear(); EPD_4IN2_Init_Fast();
EPD_4IN2_Init();
EPD_4IN2_Clear(); EPD_4IN2_Clear();
printf("Goto Sleep...\r\n"); printf("Goto Sleep...\r\n");
EPD_4IN2_Sleep(); EPD_4IN2_Sleep();

View file

@ -53,7 +53,7 @@ int main(void)
// EPD_4in01f_test(); // EPD_4in01f_test();
// EPD_4in2_test(); EPD_4in2_test();
// EPD_4in2_V2_test(); // EPD_4in2_V2_test();
// EPD_4in2bc_test(); // EPD_4in2bc_test();
// EPD_4in2b_V2_test(); // EPD_4in2b_V2_test();

View file

@ -78,30 +78,6 @@ unsigned char WF_PARTIAL_1IN54_0[159] =
0x02,0x17,0x41,0xB0,0x32,0x28, 0x02,0x17,0x41,0xB0,0x32,0x28,
}; };
// waveform partial refresh(quality)
unsigned char WF_PARTIAL_1IN54_1[159] =
{
0x0,0x00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0xA,0x0,0x0,0x0,0x0,0x0,0x1,
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
0x22,0x17,0x41,0x0,0x32,0x20,
};
/****************************************************************************** /******************************************************************************
function : Software reset function : Software reset
parameter: parameter:
@ -109,11 +85,11 @@ parameter:
static void EPD_1IN54_V2_Reset(void) static void EPD_1IN54_V2_Reset(void)
{ {
DEV_Digital_Write(EPD_RST_PIN, 1); DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200); DEV_Delay_ms(20);
DEV_Digital_Write(EPD_RST_PIN, 0); DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2); DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1); DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200); DEV_Delay_ms(20);
} }
/****************************************************************************** /******************************************************************************
@ -276,7 +252,7 @@ void EPD_1IN54_V2_Init_Partial(void)
EPD_1IN54_V2_Reset(); EPD_1IN54_V2_Reset();
EPD_1IN54_V2_ReadBusy(); EPD_1IN54_V2_ReadBusy();
EPD_1IN54_V2_SetLut(WF_PARTIAL_1IN54_1); EPD_1IN54_V2_SetLut(WF_PARTIAL_1IN54_0);
EPD_1IN54_V2_SendCommand(0x37); EPD_1IN54_V2_SendCommand(0x37);
EPD_1IN54_V2_SendData(0x00); EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00); EPD_1IN54_V2_SendData(0x00);

View file

@ -4,8 +4,8 @@
* | Function : 2.13inch e-paper V3 * | Function : 2.13inch e-paper V3
* | Info : * | Info :
*---------------- *----------------
* | This version: V1.0 * | This version: V1.1
* | Date : 2020-12-22 * | Date : 2021-10-30
* | Info : * | Info :
* ----------------------------------------------------------------------------- * -----------------------------------------------------------------------------
# #
@ -31,50 +31,50 @@
#include "EPD_2in13_V3.h" #include "EPD_2in13_V3.h"
#include "Debug.h" #include "Debug.h"
UBYTE WF_PARTIAL_2IN13_V2[159] = UBYTE WF_PARTIAL_2IN13_V3[159] =
{ {
0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x14,0x0,0x0,0x0,0x0,0x0,0x0, 0x14,0x0,0x0,0x0,0x0,0x0,0x0,
0x1,0x0,0x0,0x0,0x0,0x0,0x0, 0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x1,0x0,0x0,0x0,0x0,0x0,0x0, 0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0, 0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
0x22,0x17,0x41,0x00,0x32,0x36, 0x22,0x17,0x41,0x00,0x32,0x36,
}; };
UBYTE WS_20_30_2IN13_V2[159] = UBYTE WS_20_30_2IN13_V3[159] =
{ {
0x80, 0x4A, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x4A, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x40, 0x4A, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x4A, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x80, 0x4A, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x4A, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x40, 0x4A, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x4A, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0xF, 0x0, 0x0, 0xF, 0x0, 0x0, 0x2, 0xF, 0x0, 0x0, 0xF, 0x0, 0x0, 0x2,
0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, 0x0, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, 0x0,
0x22, 0x17, 0x41, 0x0, 0x32, 0x36 0x22, 0x17, 0x41, 0x0, 0x32, 0x36
}; };
/****************************************************************************** /******************************************************************************
@ -84,11 +84,11 @@ parameter:
static void EPD_2in13_V3_Reset(void) static void EPD_2in13_V3_Reset(void)
{ {
DEV_Digital_Write(EPD_RST_PIN, 1); DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(100); DEV_Delay_ms(20);
DEV_Digital_Write(EPD_RST_PIN, 0); DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2); DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1); DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(100); DEV_Delay_ms(20);
} }
/****************************************************************************** /******************************************************************************
@ -140,20 +140,29 @@ parameter:
******************************************************************************/ ******************************************************************************/
static void EPD_2in13_V3_TurnOnDisplay(void) static void EPD_2in13_V3_TurnOnDisplay(void)
{ {
EPD_2in13_V3_SendCommand(0x22); //Display Update Control EPD_2in13_V3_SendCommand(0x22); // Display Update Control
EPD_2in13_V3_SendData(0xc7); EPD_2in13_V3_SendData(0xc7);
EPD_2in13_V3_SendCommand(0x20); //Activate Display Update Sequence EPD_2in13_V3_SendCommand(0x20); // Activate Display Update Sequence
EPD_2in13_V3_ReadBusy(); EPD_2in13_V3_ReadBusy();
} }
/******************************************************************************
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_2in13_V3_TurnOnDisplay_Partial(void) static void EPD_2in13_V3_TurnOnDisplay_Partial(void)
{ {
EPD_2in13_V3_SendCommand(0x22); //Display Update Control EPD_2in13_V3_SendCommand(0x22); // Display Update Control
EPD_2in13_V3_SendData(0x0f); // c0/ff EPD_2in13_V3_SendData(0x0f); // fast:0x0c, quality:0x0f, 0xcf
EPD_2in13_V3_SendCommand(0x20); //Activate Display Update Sequence EPD_2in13_V3_SendCommand(0x20); // Activate Display Update Sequence
EPD_2in13_V3_ReadBusy(); EPD_2in13_V3_ReadBusy();
} }
/******************************************************************************
function : Set lut
parameter:
lut : lut data
******************************************************************************/
static void EPD_2IN13_V3_LUT(UBYTE *lut) static void EPD_2IN13_V3_LUT(UBYTE *lut)
{ {
UBYTE count; UBYTE count;
@ -163,6 +172,11 @@ static void EPD_2IN13_V3_LUT(UBYTE *lut)
EPD_2in13_V3_ReadBusy(); EPD_2in13_V3_ReadBusy();
} }
/******************************************************************************
function : Send lut data and configuration
parameter:
lut : lut data
******************************************************************************/
static void EPD_2IN13_V2_LUT_by_host(UBYTE *lut) static void EPD_2IN13_V2_LUT_by_host(UBYTE *lut)
{ {
EPD_2IN13_V3_LUT((UBYTE *)lut); //lut EPD_2IN13_V3_LUT((UBYTE *)lut); //lut
@ -176,36 +190,37 @@ static void EPD_2IN13_V2_LUT_by_host(UBYTE *lut)
EPD_2in13_V3_SendData(*(lut+157)); // VSL EPD_2in13_V3_SendData(*(lut+157)); // VSL
EPD_2in13_V3_SendCommand(0x2c); // VCOM EPD_2in13_V3_SendCommand(0x2c); // VCOM
EPD_2in13_V3_SendData(*(lut+158)); EPD_2in13_V3_SendData(*(lut+158));
} }
/****************************************************************************** /******************************************************************************
function : Setting the display window function : Setting the display window
parameter: parameter:
Xstart : X-axis starting position
Ystart : Y-axis starting position
Xend : End position of X-axis
Yend : End position of Y-axis
******************************************************************************/ ******************************************************************************/
static void EPD_2in13_V3_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend) static void EPD_2in13_V3_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
{ {
// Ystart = 295 - Ystart;
EPD_2in13_V3_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION EPD_2in13_V3_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
EPD_2in13_V3_SendData((Xstart>>3) & 0xFF); EPD_2in13_V3_SendData((Xstart>>3) & 0xFF);
EPD_2in13_V3_SendData((Xend>>3) & 0xFF); EPD_2in13_V3_SendData((Xend>>3) & 0xFF);
EPD_2in13_V3_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION EPD_2in13_V3_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
EPD_2in13_V3_SendData(Yend & 0xFF);
EPD_2in13_V3_SendData((Yend >> 8) & 0xFF);
EPD_2in13_V3_SendData(Ystart & 0xFF); EPD_2in13_V3_SendData(Ystart & 0xFF);
EPD_2in13_V3_SendData((Ystart >> 8) & 0xFF); EPD_2in13_V3_SendData((Ystart >> 8) & 0xFF);
EPD_2in13_V3_SendData(Yend & 0xFF);
EPD_2in13_V3_SendData((Yend >> 8) & 0xFF);
} }
/****************************************************************************** /******************************************************************************
function : Set Cursor function : Set Cursor
parameter: parameter:
Xstart : X-axis starting position
Ystart : Y-axis starting position
******************************************************************************/ ******************************************************************************/
static void EPD_2in13_V3_SetCursor(UWORD Xstart, UWORD Ystart) static void EPD_2in13_V3_SetCursor(UWORD Xstart, UWORD Ystart)
{ {
Ystart = 295 - Ystart;
EPD_2in13_V3_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER EPD_2in13_V3_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
EPD_2in13_V3_SendData(Xstart & 0xFF); EPD_2in13_V3_SendData(Xstart & 0xFF);
@ -228,14 +243,15 @@ void EPD_2in13_V3_Init(void)
EPD_2in13_V3_ReadBusy(); EPD_2in13_V3_ReadBusy();
EPD_2in13_V3_SendCommand(0x01); //Driver output control EPD_2in13_V3_SendCommand(0x01); //Driver output control
EPD_2in13_V3_SendData(0x27); EPD_2in13_V3_SendData(0xf9);
EPD_2in13_V3_SendData(0x01); EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x01); EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendCommand(0x11); //data entry mode EPD_2in13_V3_SendCommand(0x11); //data entry mode
EPD_2in13_V3_SendData(0x01); EPD_2in13_V3_SendData(0x03);
EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, 296-1); EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, EPD_2in13_V3_HEIGHT-1);
EPD_2in13_V3_SetCursor(0, 0);
EPD_2in13_V3_SendCommand(0x3C); //BorderWavefrom EPD_2in13_V3_SendCommand(0x3C); //BorderWavefrom
EPD_2in13_V3_SendData(0x05); EPD_2in13_V3_SendData(0x05);
@ -247,10 +263,8 @@ void EPD_2in13_V3_Init(void)
EPD_2in13_V3_SendCommand(0x18); //Read built-in temperature sensor EPD_2in13_V3_SendCommand(0x18); //Read built-in temperature sensor
EPD_2in13_V3_SendData(0x80); EPD_2in13_V3_SendData(0x80);
EPD_2in13_V3_SetCursor(0, 0);
EPD_2in13_V3_ReadBusy(); EPD_2in13_V3_ReadBusy();
EPD_2IN13_V2_LUT_by_host(WS_20_30_2IN13_V3);
EPD_2IN13_V2_LUT_by_host(WS_20_30_2IN13_V2);
} }
/****************************************************************************** /******************************************************************************
@ -259,58 +273,85 @@ parameter:
******************************************************************************/ ******************************************************************************/
void EPD_2in13_V3_Clear(void) void EPD_2in13_V3_Clear(void)
{ {
UWORD i; UWORD Width, Height;
EPD_2in13_V3_SendCommand(0x24); //write RAM for black(0)/white (1) Width = (EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1);
for(i=0;i<4736;i++) Height = EPD_2in13_V3_HEIGHT;
{
EPD_2in13_V3_SendData(0xff); EPD_2in13_V3_SendCommand(0x24);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2in13_V3_SendData(0XFF);
} }
}
EPD_2in13_V3_TurnOnDisplay(); EPD_2in13_V3_TurnOnDisplay();
} }
/****************************************************************************** /******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays function : Sends the image buffer in RAM to e-Paper and displays
parameter: parameter:
Image : Image data
******************************************************************************/ ******************************************************************************/
void EPD_2in13_V3_Display(UBYTE *Image) void EPD_2in13_V3_Display(UBYTE *Image)
{ {
UWORD i; UWORD Width, Height;
EPD_2in13_V3_SendCommand(0x24); //write RAM for black(0)/white (1) Width = (EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1);
for(i=0;i<4736;i++) Height = EPD_2in13_V3_HEIGHT;
{
EPD_2in13_V3_SendData(Image[i]); EPD_2in13_V3_SendCommand(0x24);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2in13_V3_SendData(Image[i + j * Width]);
} }
}
EPD_2in13_V3_TurnOnDisplay(); EPD_2in13_V3_TurnOnDisplay();
} }
/******************************************************************************
function : Refresh a base image
parameter:
Image : Image data
******************************************************************************/
void EPD_2in13_V3_Display_Base(UBYTE *Image) void EPD_2in13_V3_Display_Base(UBYTE *Image)
{ {
UWORD i; UWORD Width, Height;
Width = (EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1);
Height = EPD_2in13_V3_HEIGHT;
EPD_2in13_V3_SendCommand(0x24); //Write Black and White image to RAM EPD_2in13_V3_SendCommand(0x24); //Write Black and White image to RAM
for(i=0;i<4736;i++) for (UWORD j = 0; j < Height; j++) {
{ for (UWORD i = 0; i < Width; i++) {
EPD_2in13_V3_SendData(Image[i]); EPD_2in13_V3_SendData(Image[i + j * Width]);
}
} }
EPD_2in13_V3_SendCommand(0x26); //Write Black and White image to RAM EPD_2in13_V3_SendCommand(0x26); //Write Black and White image to RAM
for(i=0;i<4736;i++) for (UWORD j = 0; j < Height; j++) {
{ for (UWORD i = 0; i < Width; i++) {
EPD_2in13_V3_SendData(Image[i]); EPD_2in13_V3_SendData(Image[i + j * Width]);
}
} }
EPD_2in13_V3_TurnOnDisplay(); EPD_2in13_V3_TurnOnDisplay();
} }
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and partial refresh
parameter:
Image : Image data
******************************************************************************/
void EPD_2in13_V3_Display_Partial(UBYTE *Image) void EPD_2in13_V3_Display_Partial(UBYTE *Image)
{ {
UWORD i; UWORD Width, Height;
Width = (EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1);
Height = EPD_2in13_V3_HEIGHT;
//Reset //Reset
DEV_Digital_Write(EPD_RST_PIN, 0); DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2); DEV_Delay_ms(1);
DEV_Digital_Write(EPD_RST_PIN, 1); DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(3);
EPD_2IN13_V2_LUT_by_host(WF_PARTIAL_2IN13_V2); EPD_2IN13_V2_LUT_by_host(WF_PARTIAL_2IN13_V3);
EPD_2in13_V3_SendCommand(0x37); EPD_2in13_V3_SendCommand(0x37);
EPD_2in13_V3_SendData(0x00); EPD_2in13_V3_SendData(0x00);
@ -332,13 +373,14 @@ void EPD_2in13_V3_Display_Partial(UBYTE *Image)
EPD_2in13_V3_SendCommand(0x20); //Activate Display Update Sequence EPD_2in13_V3_SendCommand(0x20); //Activate Display Update Sequence
EPD_2in13_V3_ReadBusy(); EPD_2in13_V3_ReadBusy();
EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, 296-1); EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, EPD_2in13_V3_HEIGHT-1);
EPD_2in13_V3_SetCursor(0, 0); EPD_2in13_V3_SetCursor(0, 0);
EPD_2in13_V3_SendCommand(0x24); //Write Black and White image to RAM EPD_2in13_V3_SendCommand(0x24); //Write Black and White image to RAM
for(i=0;i<4736;i++) for (UWORD j = 0; j < Height; j++) {
{ for (UWORD i = 0; i < Width; i++) {
EPD_2in13_V3_SendData(Image[i]); EPD_2in13_V3_SendData(Image[i + j * Width]);
}
} }
EPD_2in13_V3_TurnOnDisplay_Partial(); EPD_2in13_V3_TurnOnDisplay_Partial();
} }

View file

@ -4,8 +4,8 @@
* | Function : 2.13inch e-paper V3 * | Function : 2.13inch e-paper V3
* | Info : * | Info :
*---------------- *----------------
* | This version: V1.0 * | This version: V1.1
* | Date : 2020-12-22 * | Date : 2021-10-30
* | Info : * | Info :
* ----------------------------------------------------------------------------- * -----------------------------------------------------------------------------
# #

View file

@ -33,62 +33,62 @@
static const UBYTE lut_4Gray_GC[] = static const UBYTE lut_4Gray_GC[] =
{ {
0x2A,0x06,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1 0x2A,0x06,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1
0x28,0x06,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//2 0x28,0x06,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//2
0x20,0x06,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3 0x20,0x06,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3
0x14,0x06,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//4 0x14,0x06,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//4
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5
0x00,0x02,0x02,0x0A,0x00,0x00,0x00,0x08,0x08,0x02,//6 0x00,0x02,0x02,0x0A,0x00,0x00,0x00,0x08,0x08,0x02,//6
0x00,0x02,0x02,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,//7 0x00,0x02,0x02,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,//7
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//8 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//8
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//10 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//10
0x22,0x22,0x22,0x22,0x22 0x22,0x22,0x22,0x22,0x22
}; };
static const UBYTE lut_1Gray_GC[] = static const UBYTE lut_1Gray_GC[] =
{ {
0x2A,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1 0x2A,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1
0x05,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//2 0x05,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//2
0x2A,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3 0x2A,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3
0x05,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//4 0x05,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//4
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5
0x00,0x02,0x03,0x0A,0x00,0x02,0x06,0x0A,0x05,0x00,//6 0x00,0x02,0x03,0x0A,0x00,0x02,0x06,0x0A,0x05,0x00,//6
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//7 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//7
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//8 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//8
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//10 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//10
0x22,0x22,0x22,0x22,0x22 0x22,0x22,0x22,0x22,0x22
}; };
static const UBYTE lut_1Gray_DU[] = static const UBYTE lut_1Gray_DU[] =
{ {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1
0x01,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0A,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3 0x0A,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5
0x00,0x00,0x05,0x05,0x00,0x05,0x03,0x05,0x05,0x00, 0x00,0x00,0x05,0x05,0x00,0x05,0x03,0x05,0x05,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//7 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//7
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x22,0x22,0x22,0x22,0x22 0x22,0x22,0x22,0x22,0x22
}; };
static const UBYTE lut_1Gray_A2[] = static const UBYTE lut_1Gray_A2[] =
{ {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //1 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //1
0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //2 0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //2
0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //3 0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //3
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //4 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //4
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //5 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //5
0x00,0x00,0x03,0x05,0x00,0x00,0x00,0x00,0x00,0x00, //6 0x00,0x00,0x03,0x05,0x00,0x00,0x00,0x00,0x00,0x00, //6
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //7 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //7
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //8 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //8
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //9 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //10 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //10
0x22,0x22,0x22,0x22,0x22 0x22,0x22,0x22,0x22,0x22
}; };
/****************************************************************************** /******************************************************************************
@ -150,8 +150,7 @@ void EPD_3IN7_Load_LUT(UBYTE lut)
{ {
UWORD i; UWORD i;
EPD_3IN7_SendCommand(0x32); EPD_3IN7_SendCommand(0x32);
for (i = 0; i < 105; i++) for (i = 0; i < 105; i++) {
{
if(lut == 0) if(lut == 0)
EPD_3IN7_SendData(lut_4Gray_GC[i]); EPD_3IN7_SendData(lut_4Gray_GC[i]);
else if(lut == 1) else if(lut == 1)
@ -387,8 +386,7 @@ void EPD_3IN7_1Gray_Clear(void)
EPD_3IN7_SendData(0x00); EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x24); EPD_3IN7_SendCommand(0x24);
for (i = 0; i < IMAGE_COUNTER; i++) for (i = 0; i < IMAGE_COUNTER; i++) {
{
EPD_3IN7_SendData(0xff); EPD_3IN7_SendData(0xff);
} }
@ -529,8 +527,7 @@ void EPD_3IN7_1Gray_Display(const UBYTE *Image)
EPD_3IN7_SendData(0x00); EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x24); EPD_3IN7_SendCommand(0x24);
for (i = 0; i < IMAGE_COUNTER; i++) for (i = 0; i < IMAGE_COUNTER; i++) {
{
EPD_3IN7_SendData(Image[i]); EPD_3IN7_SendData(Image[i]);
} }
@ -542,9 +539,7 @@ void EPD_3IN7_1Gray_Display(const UBYTE *Image)
/****************************************************************************** /******************************************************************************
function : Sends part the image buffer in RAM to e-Paper and displays function : Sends part the image buffer in RAM to e-Paper and displays
notes: notes:
You can send a part of data to e-Paper,But this function is not recommended Xstart must be a multiple of 8
1.Xsize must be as big as EPD_3IN7_WIDTH
2.Ypointer must be start at 0
******************************************************************************/ ******************************************************************************/
void EPD_3IN7_1Gray_Display_Part(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend) void EPD_3IN7_1Gray_Display_Part(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
{ {
@ -574,8 +569,7 @@ void EPD_3IN7_1Gray_Display_Part(const UBYTE *Image, UWORD Xstart, UWORD Ystart,
EPD_3IN7_SendData((Ystart >> 8) & 0xFF); EPD_3IN7_SendData((Ystart >> 8) & 0xFF);
EPD_3IN7_SendCommand(0x24); EPD_3IN7_SendCommand(0x24);
for (i = 0; i < IMAGE_COUNTER; i++) for (i = 0; i < IMAGE_COUNTER; i++) {
{
EPD_3IN7_SendData(Image[i]); EPD_3IN7_SendData(Image[i]);
} }

View file

@ -113,173 +113,184 @@
#include "Debug.h" #include "Debug.h"
static const unsigned char EPD_4IN2_lut_vcom0[] = { static const unsigned char EPD_4IN2_lut_vcom0[] = {
0x00, 0x17, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x08, 0x00, 0x00, 0x02,
0x00, 0x17, 0x17, 0x00, 0x00, 0x02, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x00, 0x0A, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x08, 0x00, 0x00, 0x02,
0x00, 0x0E, 0x0E, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
};
static const unsigned char EPD_4IN2_lut_ww[] = { static const unsigned char EPD_4IN2_lut_ww[] = {
0x40, 0x17, 0x00, 0x00, 0x00, 0x02, 0x50, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01, 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02,
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const unsigned char EPD_4IN2_lut_bw[] = { static const unsigned char EPD_4IN2_lut_bw[] = {
0x40, 0x17, 0x00, 0x00, 0x00, 0x02, 0x50, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01, 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02,
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const unsigned char EPD_4IN2_lut_wb[] = { static const unsigned char EPD_4IN2_lut_wb[] = {
0x80, 0x17, 0x00, 0x00, 0x00, 0x02, 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x80, 0x0A, 0x01, 0x00, 0x00, 0x01, 0x50, 0x08, 0x08, 0x00, 0x00, 0x02,
0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const unsigned char EPD_4IN2_lut_bb[] = { static const unsigned char EPD_4IN2_lut_bb[] = {
0x80, 0x17, 0x00, 0x00, 0x00, 0x02, 0x20, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x80, 0x0A, 0x01, 0x00, 0x00, 0x01, 0x10, 0x08, 0x08, 0x00, 0x00, 0x02,
0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
/******************************partial screen update LUT*********************************/ /******************************partial screen update LUT*********************************/
const unsigned char EPD_4IN2_Partial_lut_vcom1[] ={ const unsigned char EPD_4IN2_Partial_lut_vcom1[] ={
0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x00, 0x01, 0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00, }; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const unsigned char EPD_4IN2_Partial_lut_ww1[] ={ const unsigned char EPD_4IN2_Partial_lut_ww1[] ={
0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x00, 0x01, 0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const unsigned char EPD_4IN2_Partial_lut_bw1[] ={ const unsigned char EPD_4IN2_Partial_lut_bw1[] ={
0x80 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x20, 0x01, 0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const unsigned char EPD_4IN2_Partial_lut_wb1[] ={ const unsigned char EPD_4IN2_Partial_lut_wb1[] ={
0x40 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x10, 0x01, 0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const unsigned char EPD_4IN2_Partial_lut_bb1[] ={ const unsigned char EPD_4IN2_Partial_lut_bb1[] ={
0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x00, 0x01,0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
};
/******************************gray*********************************/ /******************************gray*********************************/
//0~3 gray //0~3 gray
const unsigned char EPD_4IN2_4Gray_lut_vcom[] = const unsigned char EPD_4IN2_4Gray_lut_vcom[] =
{ {
0x00 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, 0x00 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
0x60 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, 0x60 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01, 0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
0x00 ,0x13 ,0x0A ,0x01 ,0x00 ,0x01, 0x00 ,0x13 ,0x0A ,0x01 ,0x00 ,0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00
}; };
//R21 //R21
const unsigned char EPD_4IN2_4Gray_lut_ww[] ={ const unsigned char EPD_4IN2_4Gray_lut_ww[] ={
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, 0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
0x10 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, 0x10 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
0xA0 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01, 0xA0 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
}; };
//R22H r //R22H r
const unsigned char EPD_4IN2_4Gray_lut_bw[] ={ const unsigned char EPD_4IN2_4Gray_lut_bw[] ={
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, 0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, 0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
0x99 ,0x0C ,0x01 ,0x03 ,0x04 ,0x01, 0x99 ,0x0C ,0x01 ,0x03 ,0x04 ,0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
}; };
//R23H w //R23H w
const unsigned char EPD_4IN2_4Gray_lut_wb[] ={ const unsigned char EPD_4IN2_4Gray_lut_wb[] ={
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, 0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, 0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
0x99 ,0x0B ,0x04 ,0x04 ,0x01 ,0x01, 0x99 ,0x0B ,0x04 ,0x04 ,0x01 ,0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
}; };
//R24H b //R24H b
const unsigned char EPD_4IN2_4Gray_lut_bb[] ={ const unsigned char EPD_4IN2_4Gray_lut_bb[] ={
0x80 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, 0x80 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
0x20 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, 0x20 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
0x50 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01, 0x50 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
}; };
/****************************************************************************** /******************************************************************************
function : Software reset function : Software reset
parameter: parameter:
******************************************************************************/ ******************************************************************************/
static void EPD_4IN2_Reset(void) static void EPD_4IN2_Reset(void)
{ {
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(20);
DEV_Digital_Write(EPD_RST_PIN, 0); DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2); DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 1); DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(20); DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 0); DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2); DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 1); DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(20); DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 0); DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2); DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 1); DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(20); DEV_Delay_ms(10);
} }
/****************************************************************************** /******************************************************************************
@ -338,35 +349,6 @@ static void EPD_4IN2_TurnOnDisplay(void)
function : set the look-up tables function : set the look-up tables
parameter: parameter:
******************************************************************************/ ******************************************************************************/
static void EPD_4IN2_SetLut(void)
{
UWORD count;
EPD_4IN2_SendCommand(0x20); //g vcom
for(count=0; count<44; count++) {
EPD_4IN2_SendData(EPD_4IN2_lut_vcom0[count]);
}
EPD_4IN2_SendCommand(0x21);
for(count=0; count<42; count++) {
EPD_4IN2_SendData(EPD_4IN2_lut_ww[count]);
}
EPD_4IN2_SendCommand(0x22);
for(count=0; count<42; count++) {
EPD_4IN2_SendData(EPD_4IN2_lut_bw[count]);
}
EPD_4IN2_SendCommand(0x23);
for(count=0; count<42; count++) {
EPD_4IN2_SendData(EPD_4IN2_lut_wb[count]);
}
EPD_4IN2_SendCommand(0x24);
for(count=0; count<42; count++) {
EPD_4IN2_SendData(EPD_4IN2_lut_bb[count]);
}
}
static void EPD_4IN2_Partial_SetLut(void) static void EPD_4IN2_Partial_SetLut(void)
{ {
unsigned int count; unsigned int count;
@ -391,6 +373,30 @@ static void EPD_4IN2_Partial_SetLut(void)
{EPD_4IN2_SendData(EPD_4IN2_Partial_lut_bb1[count]);} {EPD_4IN2_SendData(EPD_4IN2_Partial_lut_bb1[count]);}
} }
static void EPD_4IN2_SetLut(void)
{
unsigned int count;
EPD_4IN2_SendCommand(0x20);
for(count=0;count<36;count++)
{EPD_4IN2_SendData(EPD_4IN2_lut_vcom0[count]);}
EPD_4IN2_SendCommand(0x21);
for(count=0;count<36;count++)
{EPD_4IN2_SendData(EPD_4IN2_lut_ww[count]);}
EPD_4IN2_SendCommand(0x22);
for(count=0;count<36;count++)
{EPD_4IN2_SendData(EPD_4IN2_lut_bw[count]);}
EPD_4IN2_SendCommand(0x23);
for(count=0;count<36;count++)
{EPD_4IN2_SendData(EPD_4IN2_lut_wb[count]);}
EPD_4IN2_SendCommand(0x24);
for(count=0;count<36;count++)
{EPD_4IN2_SendData(EPD_4IN2_lut_bb[count]);}
}
//LUT download //LUT download
static void EPD_4IN2_4Gray_lut(void) static void EPD_4IN2_4Gray_lut(void)
{ {
@ -425,7 +431,8 @@ static void EPD_4IN2_4Gray_lut(void)
function : Initialize the e-Paper register function : Initialize the e-Paper register
parameter: parameter:
******************************************************************************/ ******************************************************************************/
void EPD_4IN2_Init(void)
void EPD_4IN2_Init_Partial(void)
{ {
EPD_4IN2_Reset(); EPD_4IN2_Reset();
@ -445,7 +452,6 @@ void EPD_4IN2_Init(void)
EPD_4IN2_SendCommand(0x00); // panel setting EPD_4IN2_SendCommand(0x00); // panel setting
EPD_4IN2_SendData(0xbf); // KW-BF KWR-AF BWROTP 0f BWOTP 1f EPD_4IN2_SendData(0xbf); // KW-BF KWR-AF BWROTP 0f BWOTP 1f
EPD_4IN2_SendData(0x0d);
EPD_4IN2_SendCommand(0x30); // PLL setting EPD_4IN2_SendCommand(0x30); // PLL setting
EPD_4IN2_SendData(0x3C); // 3A 100HZ 29 150Hz 39 200HZ 31 171HZ EPD_4IN2_SendData(0x3C); // 3A 100HZ 29 150Hz 39 200HZ 31 171HZ
@ -457,12 +463,54 @@ void EPD_4IN2_Init(void)
EPD_4IN2_SendData(0x2c); EPD_4IN2_SendData(0x2c);
EPD_4IN2_SendCommand(0x82); // vcom_DC setting EPD_4IN2_SendCommand(0x82); // vcom_DC setting
EPD_4IN2_SendData(0x28); EPD_4IN2_SendData(0x12);
EPD_4IN2_SendCommand(0X50); // VCOM AND DATA INTERVAL SETTING EPD_4IN2_SendCommand(0X50); // VCOM AND DATA INTERVAL SETTING
EPD_4IN2_SendData(0x97); // 97white border 77black border VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7 EPD_4IN2_SendData(0x07); // 97white border 77black border VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7
EPD_4IN2_Partial_SetLut();
}
//UC8176C
void EPD_4IN2_Init_Fast(void)
{
EPD_4IN2_Reset();
EPD_4IN2_SendCommand(0x01); //POWER SETTING
EPD_4IN2_SendData (0x03);
EPD_4IN2_SendData (0x00);
EPD_4IN2_SendData (0x2b);
EPD_4IN2_SendData (0x2b);
EPD_4IN2_SendCommand(0x06); //boost soft start
EPD_4IN2_SendData (0x17); //A
EPD_4IN2_SendData (0x17); //B
EPD_4IN2_SendData (0x17); //C
EPD_4IN2_SendCommand(0x04);
EPD_4IN2_ReadBusy();
EPD_4IN2_SendCommand(0x00); //panel setting
EPD_4IN2_SendData(0xbf); //KW-bf KWR-2F BWROTP 0f BWOTP 1f
EPD_4IN2_SendCommand(0x30);
EPD_4IN2_SendData (0x3c); // 3A 100HZ 29 150Hz 39 200HZ 31 171HZ
EPD_4IN2_SendCommand(0x61); //resolution setting
EPD_4IN2_SendData (0x01);
EPD_4IN2_SendData (0x90); //400
EPD_4IN2_SendData (0x01); //300
EPD_4IN2_SendData (0x2c);
EPD_4IN2_SendCommand(0x82); //vcom_DC setting
EPD_4IN2_SendData (0x12);
EPD_4IN2_SendCommand(0X50);
EPD_4IN2_SendData(0x97);
EPD_4IN2_SetLut(); EPD_4IN2_SetLut();
} }
void EPD_4IN2_Init_4Gray(void) void EPD_4IN2_Init_4Gray(void)
@ -524,8 +572,9 @@ void EPD_4IN2_Clear(void)
EPD_4IN2_SendData(0xFF); EPD_4IN2_SendData(0xFF);
} }
} }
EPD_4IN2_SendCommand(0x12); //DISPLAY REFRESH EPD_4IN2_SendCommand(0x12); //DISPLAY REFRESH
DEV_Delay_ms(10); DEV_Delay_ms(1);
EPD_4IN2_TurnOnDisplay(); EPD_4IN2_TurnOnDisplay();
} }
@ -539,6 +588,13 @@ void EPD_4IN2_Display(UBYTE *Image)
Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1); Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1);
Height = EPD_4IN2_HEIGHT; Height = EPD_4IN2_HEIGHT;
EPD_4IN2_SendCommand(0x10);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_4IN2_SendData(0x00);
}
}
EPD_4IN2_SendCommand(0x13); EPD_4IN2_SendCommand(0x13);
for (UWORD j = 0; j < Height; j++) { for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) { for (UWORD i = 0; i < Width; i++) {
@ -546,27 +602,23 @@ void EPD_4IN2_Display(UBYTE *Image)
} }
} }
EPD_4IN2_SendCommand(0x12); //DISPLAY REFRESH
DEV_Delay_ms(10);
EPD_4IN2_TurnOnDisplay(); EPD_4IN2_TurnOnDisplay();
} }
void EPD_4IN2_PartialDisplay(UWORD X_start,UWORD Y_start,UWORD X_end,UWORD Y_end, UBYTE *Image) void EPD_4IN2_PartialDisplay(UWORD X_start,UWORD Y_start,UWORD X_end,UWORD Y_end, UBYTE *Image)
{ {
UWORD Width, Height; UWORD Width, Height;
static UBYTE DATA[EPD_4IN2_WIDTH * EPD_4IN2_HEIGHT / 8] = {0x00};
Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1); Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1);
Height = EPD_4IN2_HEIGHT; Height = EPD_4IN2_HEIGHT;
X_start = (X_start % 8 == 0)? (X_start): (X_start/8*8+8); X_start = (X_start % 8 == 0)? (X_start): (X_start/8*8+8);
X_end = (X_end % 8 == 0)? (X_end): (X_end/8*8+8); X_end = (X_end % 8 == 0)? (X_end): (X_end/8*8+8);
EPD_4IN2_SendCommand(0X50);
EPD_4IN2_SendData(0xf7);
DEV_Delay_ms(100);
EPD_4IN2_SendCommand(0x82); //vcom_DC setting
EPD_4IN2_SendData (0x08);
EPD_4IN2_SendCommand(0X50);
EPD_4IN2_SendData(0x47);
EPD_4IN2_Partial_SetLut();
EPD_4IN2_SendCommand(0x91); //This command makes the display enter partial mode EPD_4IN2_SendCommand(0x91); //This command makes the display enter partial mode
EPD_4IN2_SendCommand(0x90); //resolution setting EPD_4IN2_SendCommand(0x90); //resolution setting
EPD_4IN2_SendData ((X_start)/256); EPD_4IN2_SendData ((X_start)/256);
@ -585,13 +637,14 @@ void EPD_4IN2_PartialDisplay(UWORD X_start,UWORD Y_start,UWORD X_end,UWORD Y_end
EPD_4IN2_SendCommand(0x10); //writes Old data to SRAM for programming EPD_4IN2_SendCommand(0x10); //writes Old data to SRAM for programming
for (UWORD j = 0; j < Y_end - Y_start; j++) { for (UWORD j = 0; j < Y_end - Y_start; j++) {
for (UWORD i = 0; i < (X_end - X_start)/8; i++) { for (UWORD i = 0; i < (X_end - X_start)/8; i++) {
EPD_4IN2_SendData(Image[(Y_start + j)*Width + X_start/8 + i]); EPD_4IN2_SendData(DATA[(Y_start + j)*Width + X_start/8 + i]);
} }
} }
EPD_4IN2_SendCommand(0x13); //writes New data to SRAM. EPD_4IN2_SendCommand(0x13); //writes New data to SRAM.
for (UWORD j = 0; j < Y_end - Y_start; j++) { for (UWORD j = 0; j < Y_end - Y_start; j++) {
for (UWORD i = 0; i < (X_end - X_start)/8; i++) { for (UWORD i = 0; i < (X_end - X_start)/8; i++) {
EPD_4IN2_SendData(~Image[(Y_start + j)*Width + X_start/8 + i]); EPD_4IN2_SendData(~Image[(Y_start + j)*Width + X_start/8 + i]);
DATA[(Y_start + j)*Width + X_start/8 + i] = ~Image[(Y_start + j)*Width + X_start/8 + i];
} }
} }
@ -703,8 +756,12 @@ parameter:
******************************************************************************/ ******************************************************************************/
void EPD_4IN2_Sleep(void) void EPD_4IN2_Sleep(void)
{ {
// EPD_4IN2_SendCommand(0x02); // POWER_OFF EPD_4IN2_SendCommand(0x50); // DEEP_SLEEP
// EPD_4IN2_ReadBusy(); EPD_4IN2_SendData(0XF7);
EPD_4IN2_SendCommand(0x02); // POWER_OFF
EPD_4IN2_ReadBusy();
EPD_4IN2_SendCommand(0x07); // DEEP_SLEEP EPD_4IN2_SendCommand(0x07); // DEEP_SLEEP
EPD_4IN2_SendData(0XA5); EPD_4IN2_SendData(0XA5);
} }

View file

@ -118,7 +118,8 @@
#define EPD_4IN2_WIDTH 400 #define EPD_4IN2_WIDTH 400
#define EPD_4IN2_HEIGHT 300 #define EPD_4IN2_HEIGHT 300
void EPD_4IN2_Init(void); void EPD_4IN2_Init_Fast(void);
void EPD_4IN2_Init_Partial(void);
void EPD_4IN2_Clear(void); void EPD_4IN2_Clear(void);
void EPD_4IN2_Display(UBYTE *Image); void EPD_4IN2_Display(UBYTE *Image);
void EPD_4IN2_Sleep(void); void EPD_4IN2_Sleep(void);

View file

@ -0,0 +1,93 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
import sys
import os
picdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'pic')
libdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'lib')
if os.path.exists(libdir):
sys.path.append(libdir)
import logging
from waveshare_epd import epd2in13_V3
import time
from PIL import Image,ImageDraw,ImageFont
import traceback
logging.basicConfig(level=logging.DEBUG)
try:
logging.info("epd2in13_V3 Demo")
epd = epd2in13_V3.EPD()
logging.info("init and Clear")
epd.init()
epd.Clear(0xFF)
# Drawing on the image
font15 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 15)
font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24)
logging.info("1.Drawing on the image...")
image = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
draw = ImageDraw.Draw(image)
draw.rectangle([(0,0),(50,50)],outline = 0)
draw.rectangle([(55,0),(100,50)],fill = 0)
draw.line([(0,0),(50,50)], fill = 0,width = 1)
draw.line([(0,50),(50,0)], fill = 0,width = 1)
draw.chord((10, 60, 50, 100), 0, 360, fill = 0)
draw.ellipse((55, 60, 95, 100), outline = 0)
draw.pieslice((55, 60, 95, 100), 90, 180, outline = 0)
draw.pieslice((55, 60, 95, 100), 270, 360, fill = 0)
draw.polygon([(110,0),(110,50),(150,25)],outline = 0)
draw.polygon([(190,0),(190,50),(150,25)],fill = 0)
draw.text((120, 60), 'e-Paper demo', font = font15, fill = 0)
draw.text((110, 90), u'微雪电子', font = font24, fill = 0)
# image = image.rotate(180) # rotate
epd.display(epd.getbuffer(image))
time.sleep(2)
# read bmp file
logging.info("2.read bmp file...")
image = Image.open(os.path.join(picdir, '2in13.bmp'))
epd.display(epd.getbuffer(image))
time.sleep(2)
# read bmp file on window
logging.info("3.read bmp file on window...")
# epd.Clear(0xFF)
image1 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
bmp = Image.open(os.path.join(picdir, '100x100.bmp'))
image1.paste(bmp, (2,2))
epd.display(epd.getbuffer(image1))
time.sleep(2)
# # partial update
logging.info("4.show time...")
time_image = Image.new('1', (epd.height, epd.width), 255)
time_draw = ImageDraw.Draw(time_image)
epd.displayPartBaseImage(epd.getbuffer(time_image))
num = 0
while (True):
time_draw.rectangle((120, 80, 220, 105), fill = 255)
time_draw.text((120, 80), time.strftime('%H:%M:%S'), font = font24, fill = 0)
epd.displayPartial(epd.getbuffer(time_image))
num = num + 1
if(num == 10):
break
logging.info("Clear...")
epd.init()
epd.Clear(0xFF)
logging.info("Goto Sleep...")
epd.sleep()
except IOError as e:
logging.info(e)
except KeyboardInterrupt:
logging.info("ctrl + c:")
epd2in13_V3.epdconfig.module_exit()
exit()

View file

@ -78,18 +78,20 @@ try:
logging.info("Clear...") logging.info("Clear...")
epd.Clear() epd.Clear()
Himage3 = Image.new('1', (epd.width, epd.height), 0) # 255: clear the frame if(0):
draw = ImageDraw.Draw(Himage3)
print("Support for partial refresh, but the refresh effect is not good, but it is not recommended") print("Support for partial refresh, but the refresh effect is not good, but it is not recommended")
print("Local refresh is off by default and is not recommended.") print("Local refresh is off by default and is not recommended.")
if(0): Himage3 = Image.new('1', (epd.width, epd.height), 0) # 255: clear the frame
draw = ImageDraw.Draw(Himage3)
epd.init_Partial()
for j in range(0, int(20)): for j in range(0, int(20)):
draw.rectangle((8, 80, 44, 155), fill = 0) draw.rectangle((8, 80, 48, 155), fill = 255)
draw.text((8, 80), str(j) , font = font35, fill = 1) draw.text((8, 80), str(j) , font = font35, fill = 0)
draw.text((8, 120), str(20-j) , font = font35, fill = 1) draw.text((8, 120), str(20-j) , font = font35, fill = 0)
epd.EPD_4IN2_PartialDisplay(8, 80, 42, 155, epd.getbuffer(Himage3)) epd.EPD_4IN2_PartialDisplay(8, 80, 42, 155, epd.getbuffer(Himage3))
time.sleep(2); time.sleep(2);
'''4Gray display''' '''4Gray display'''
logging.info("5.4Gray display--------------------------------") logging.info("5.4Gray display--------------------------------")
epd.Init_4Gray() epd.Init_4Gray()

View file

@ -91,29 +91,6 @@ class EPD:
0x02,0x17,0x41,0xB0,0x32,0x28, 0x02,0x17,0x41,0xB0,0x32,0x28,
] ]
# waveform partial refresh(quality)
WF_PARTIAL_1IN54_1 = [
0x0,0x00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0xA,0x0,0x0,0x0,0x0,0x0,0x1,
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
0x22,0x17,0x41,0x0,0x32,0x20,
]
# Hardware reset # Hardware reset
def reset(self): def reset(self):
epdconfig.digital_write(self.reset_pin, 1) epdconfig.digital_write(self.reset_pin, 1)
@ -176,24 +153,24 @@ class EPD:
self.send_data(lut[158]) self.send_data(lut[158])
def SetWindows(self, Xstart, Ystart, Xend, Yend): def SetWindows(self, Xstart, Ystart, Xend, Yend):
self.send_command(0x44) # SET_RAM_X_ADDRESS_START_END_POSITION self.send_command(0x44); # SET_RAM_X_ADDRESS_START_END_POSITION
self.send_data((Xstart>>3) & 0xFF) self.send_data((Xstart>>3) & 0xFF);
self.send_data((Xend>>3) & 0xFF) self.send_data((Xend>>3) & 0xFF);
self.send_command(0x45) # SET_RAM_Y_ADDRESS_START_END_POSITION self.send_command(0x45); # SET_RAM_Y_ADDRESS_START_END_POSITION
self.send_data(Ystart & 0xFF) self.send_data(Ystart & 0xFF);
self.send_data((Ystart >> 8) & 0xFF) self.send_data((Ystart >> 8) & 0xFF);
self.send_data(Yend & 0xFF) self.send_data(Yend & 0xFF);
self.send_data((Yend >> 8) & 0xFF) self.send_data((Yend >> 8) & 0xFF);
def SetCursor(self, Xstart, Ystart): def SetCursor(self, Xstart, Ystart):
self.send_command(0x4E) # SET_RAM_X_ADDRESS_COUNTER self.send_command(0x4E); # SET_RAM_X_ADDRESS_COUNTER
self.send_data(Xstart & 0xFF) self.send_data(Xstart & 0xFF);
self.send_command(0x4F) # SET_RAM_Y_ADDRESS_COUNTER self.send_command(0x4F); # SET_RAM_Y_ADDRESS_COUNTER
self.send_data(Ystart & 0xFF) self.send_data(Ystart & 0xFF);
self.send_data((Ystart >> 8) & 0xFF) self.send_data((Ystart >> 8) & 0xFF);
def init(self, isPartial): def init(self, isPartial):
if (epdconfig.module_init() != 0): if (epdconfig.module_init() != 0):
@ -315,7 +292,7 @@ class EPD:
for i in range(0, int(self.width / 8)): for i in range(0, int(self.width / 8)):
self.send_data(image[i + j * int(self.width / 8)]) self.send_data(image[i + j * int(self.width / 8)])
self.TurnOnDisplayPart() self.TurnOnDisplay()
def displayPart(self, image): def displayPart(self, image):
if (image == None): if (image == None):

View file

@ -0,0 +1,397 @@
# *****************************************************************************
# * | File : epd2in13_V3.py
# * | Author : Waveshare team
# * | Function : Electronic paper driver
# * | Info :
# *----------------
# * | This version: V1.1
# * | Date : 2021-10-30
# # | Info : python demo
# -----------------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
import logging
from . import epdconfig
import numpy as np
# Display resolution
EPD_WIDTH = 122
EPD_HEIGHT = 250
logger = logging.getLogger(__name__)
class EPD:
def __init__(self):
self.reset_pin = epdconfig.RST_PIN
self.dc_pin = epdconfig.DC_PIN
self.busy_pin = epdconfig.BUSY_PIN
self.cs_pin = epdconfig.CS_PIN
self.width = EPD_WIDTH
self.height = EPD_HEIGHT
lut_partial_update= [
0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x14,0x0,0x0,0x0,0x0,0x0,0x0,
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
0x22,0x17,0x41,0x00,0x32,0x36,
]
lut_full_update = [
0x80,0x4A,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x40,0x4A,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x80,0x4A,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x40,0x4A,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0xF,0x0,0x0,0x0,0x0,0x0,0x0,
0xF,0x0,0x0,0xF,0x0,0x0,0x2,
0xF,0x0,0x0,0x0,0x0,0x0,0x0,
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
0x22,0x17,0x41,0x0,0x32,0x36,
]
'''
function :Hardware reset
parameter:
'''
def reset(self):
epdconfig.digital_write(self.reset_pin, 1)
epdconfig.delay_ms(20)
epdconfig.digital_write(self.reset_pin, 0)
epdconfig.delay_ms(2)
epdconfig.digital_write(self.reset_pin, 1)
epdconfig.delay_ms(20)
'''
function :send command
parameter:
command : Command register
'''
def send_command(self, command):
epdconfig.digital_write(self.dc_pin, 0)
epdconfig.digital_write(self.cs_pin, 0)
epdconfig.spi_writebyte([command])
epdconfig.digital_write(self.cs_pin, 1)
'''
function :send data
parameter:
data : Write data
'''
def send_data(self, data):
epdconfig.digital_write(self.dc_pin, 1)
epdconfig.digital_write(self.cs_pin, 0)
epdconfig.spi_writebyte([data])
epdconfig.digital_write(self.cs_pin, 1)
'''
function :Wait until the busy_pin goes LOW
parameter:
'''
def ReadBusy(self):
logger.debug("e-Paper busy")
while(epdconfig.digital_read(self.busy_pin) == 1): # 0: idle, 1: busy
epdconfig.delay_ms(10)
logger.debug("e-Paper busy release")
'''
function : Turn On Display
parameter:
'''
def TurnOnDisplay(self):
self.send_command(0x22) # Display Update Control
self.send_data(0xC7)
self.send_command(0x20) # Activate Display Update Sequence
self.ReadBusy()
'''
function : Turn On Display Part
parameter:
'''
def TurnOnDisplayPart(self):
self.send_command(0x22) # Display Update Control
self.send_data(0x0f) # fast:0x0c, quality:0x0f, 0xcf
self.send_command(0x20) # Activate Display Update Sequence
self.ReadBusy()
'''
function : Set lut
parameter:
lut : lut data
'''
def Lut(self, lut):
self.send_command(0x32)
for i in range(0, 153):
self.send_data(lut[i])
self.ReadBusy()
'''
function : Send lut data and configuration
parameter:
lut : lut data
'''
def SetLut(self, lut):
self.Lut(lut)
self.send_command(0x3f)
self.send_data(lut[153])
self.send_command(0x03) # gate voltage
self.send_data(lut[154])
self.send_command(0x04) # source voltage
self.send_data(lut[155]) # VSH
self.send_data(lut[156]) # VSH2
self.send_data(lut[157]) # VSL
self.send_command(0x2c) # VCOM
self.send_data(lut[158])
'''
function : Setting the display window
parameter:
xstart : X-axis starting position
ystart : Y-axis starting position
xend : End position of X-axis
yend : End position of Y-axis
'''
def SetWindow(self, x_start, y_start, x_end, y_end):
self.send_command(0x44) # SET_RAM_X_ADDRESS_START_END_POSITION
# x point must be the multiple of 8 or the last 3 bits will be ignored
self.send_data((x_start>>3) & 0xFF)
self.send_data((x_end>>3) & 0xFF)
self.send_command(0x45) # SET_RAM_Y_ADDRESS_START_END_POSITION
self.send_data(y_start & 0xFF)
self.send_data((y_start >> 8) & 0xFF)
self.send_data(y_end & 0xFF)
self.send_data((y_end >> 8) & 0xFF)
'''
function : Set Cursor
parameter:
x : X-axis starting position
y : Y-axis starting position
'''
def SetCursor(self, x, y):
self.send_command(0x4E) # SET_RAM_X_ADDRESS_COUNTER
# x point must be the multiple of 8 or the last 3 bits will be ignored
self.send_data(x & 0xFF)
self.send_command(0x4F) # SET_RAM_Y_ADDRESS_COUNTER
self.send_data(y & 0xFF)
self.send_data((y >> 8) & 0xFF)
'''
function : Initialize the e-Paper register
parameter:
'''
def init(self):
if (epdconfig.module_init() != 0):
return -1
# EPD hardware init start
self.reset()
self.ReadBusy()
self.send_command(0x12) #SWRESET
self.ReadBusy()
self.send_command(0x01) #Driver output control
self.send_data(0xf9)
self.send_data(0x00)
self.send_data(0x00)
self.send_command(0x11) #data entry mode
self.send_data(0x03)
self.SetWindow(0, 0, self.width-1, self.height-1)
self.SetCursor(0, 0)
self.send_command(0x3c)
self.send_data(0x05)
self.send_command(0x21) # Display update control
self.send_data(0x00)
self.send_data(0x80)
self.send_command(0x18)
self.send_data(0x80)
self.ReadBusy()
self.SetLut(self.lut_full_update)
return 0
'''
function : Display images
parameter:
image : Image data
'''
def getbuffer(self, image):
img = image
imwidth, imheight = img.size
if(imwidth == self.width and imheight == self.height):
img = img.convert('1')
elif(imwidth == self.height and imheight == self.width):
# image has correct dimensions, but needs to be rotated
img = img.rotate(90, expand=True).convert('1')
else:
logger.warning("Wrong image dimensions: must be " + str(self.width) + "x" + str(self.height))
# return a blank buffer
return [0x00] * (int(self.width/8) * self.height)
buf = bytearray(img.tobytes('raw'))
return buf
'''
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
image : Image data
'''
def display(self, image):
if self.width%8 == 0:
linewidth = int(self.width/8)
else:
linewidth = int(self.width/8) + 1
self.send_command(0x24)
for j in range(0, self.height):
for i in range(0, linewidth):
self.send_data(image[i + j * linewidth])
self.TurnOnDisplay()
'''
function : Sends the image buffer in RAM to e-Paper and partial refresh
parameter:
image : Image data
'''
def displayPartial(self, image):
if self.width%8 == 0:
linewidth = int(self.width/8)
else:
linewidth = int(self.width/8) + 1
epdconfig.digital_write(self.reset_pin, 0)
epdconfig.delay_ms(1)
epdconfig.digital_write(self.reset_pin, 1)
self.SetLut(self.lut_partial_update)
self.send_command(0x37)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x40)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_command(0x3C) #BorderWavefrom
self.send_data(0x80)
self.send_command(0x22)
self.send_data(0xC0)
self.send_command(0x20)
self.ReadBusy()
self.SetWindow(0, 0, self.width - 1, self.height - 1)
self.SetCursor(0, 0)
self.send_command(0x24) # WRITE_RAM
for j in range(0, self.height):
for i in range(0, linewidth):
self.send_data(image[i + j * linewidth])
self.TurnOnDisplayPart()
'''
function : Refresh a base image
parameter:
image : Image data
'''
def displayPartBaseImage(self, image):
if self.width%8 == 0:
linewidth = int(self.width/8)
else:
linewidth = int(self.width/8) + 1
self.send_command(0x24)
for j in range(0, self.height):
for i in range(0, linewidth):
self.send_data(image[i + j * linewidth])
self.send_command(0x26)
for j in range(0, self.height):
for i in range(0, linewidth):
self.send_data(image[i + j * linewidth])
self.TurnOnDisplay()
'''
function : Clear screen
parameter:
'''
def Clear(self, color):
if self.width%8 == 0:
linewidth = int(self.width/8)
else:
linewidth = int(self.width/8) + 1
# logger.debug(linewidth)
self.send_command(0x24)
for j in range(0, self.height):
for i in range(0, linewidth):
self.send_data(color)
self.TurnOnDisplay()
'''
function : Enter sleep mode
parameter:
'''
def sleep(self):
self.send_command(0x10) #enter deep sleep
self.send_data(0x01)
epdconfig.delay_ms(2000)
epdconfig.module_exit()
### END OF FILE ###

View file

@ -51,7 +51,7 @@ class EPD:
0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0A,0x0,0x0,0x0,0x0,0x0,0x2, 0x0A,0x0,0x0,0x0,0x0,0x0,0x1,
0x1,0x0,0x0,0x0,0x0,0x0,0x0, 0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x1,0x0,0x0,0x0,0x0,0x0,0x0, 0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,

View file

@ -56,98 +56,110 @@ class EPD:
self.GRAY2 = GRAY2 self.GRAY2 = GRAY2
self.GRAY3 = GRAY3 #gray self.GRAY3 = GRAY3 #gray
self.GRAY4 = GRAY4 #Blackest self.GRAY4 = GRAY4 #Blackest
self.DATA = [0x00] * 15000
lut_vcom0 = [ lut_vcom0 = [
0x00, 0x17, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x08, 0x00, 0x00, 0x02,
0x00, 0x17, 0x17, 0x00, 0x00, 0x02, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x00, 0x0A, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x08, 0x00, 0x00, 0x02,
0x00, 0x0E, 0x0E, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
] ]
lut_ww = [ lut_ww = [
0x40, 0x17, 0x00, 0x00, 0x00, 0x02, 0x50, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01, 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02,
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
] ]
lut_bw = [ lut_bw = [
0x40, 0x17, 0x00, 0x00, 0x00, 0x02, 0x50, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01, 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02,
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
] ]
lut_wb = [ lut_wb = [
0x80, 0x17, 0x00, 0x00, 0x00, 0x02, 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x80, 0x0A, 0x01, 0x00, 0x00, 0x01, 0x50, 0x08, 0x08, 0x00, 0x00, 0x02,
0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
] ]
lut_bb = [ lut_bb = [
0x80, 0x17, 0x00, 0x00, 0x00, 0x02, 0x20, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x80, 0x0A, 0x01, 0x00, 0x00, 0x01, 0x10, 0x08, 0x08, 0x00, 0x00, 0x02,
0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
] ]
#******************************partial screen update LUT*********************************/ #******************************partial screen update LUT*********************************/
EPD_4IN2_Partial_lut_vcom1 =[ EPD_4IN2_Partial_lut_vcom1 =[
0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x00, 0x01, 0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00, ] 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
EPD_4IN2_Partial_lut_ww1 =[ EPD_4IN2_Partial_lut_ww1 =[
0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x00, 0x01, 0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,] 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
EPD_4IN2_Partial_lut_bw1 =[ EPD_4IN2_Partial_lut_bw1 =[
0x80 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x20, 0x01, 0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, ] 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
EPD_4IN2_Partial_lut_wb1 =[ EPD_4IN2_Partial_lut_wb1 =[
0x40 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x10, 0x01, 0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, ] 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
EPD_4IN2_Partial_lut_bb1 =[ EPD_4IN2_Partial_lut_bb1 =[
0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x00, 0x01,0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, ] 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
]
#******************************gray*********************************/ #******************************gray*********************************/
#0~3 gray #0~3 gray
@ -204,19 +216,19 @@ class EPD:
# Hardware reset # Hardware reset
def reset(self): def reset(self):
epdconfig.digital_write(self.reset_pin, 1) epdconfig.digital_write(self.reset_pin, 1)
epdconfig.delay_ms(20) epdconfig.delay_ms(10)
epdconfig.digital_write(self.reset_pin, 0) epdconfig.digital_write(self.reset_pin, 0)
epdconfig.delay_ms(5) epdconfig.delay_ms(10)
epdconfig.digital_write(self.reset_pin, 1) epdconfig.digital_write(self.reset_pin, 1)
epdconfig.delay_ms(20) epdconfig.delay_ms(10)
epdconfig.digital_write(self.reset_pin, 0) epdconfig.digital_write(self.reset_pin, 0)
epdconfig.delay_ms(5) epdconfig.delay_ms(10)
epdconfig.digital_write(self.reset_pin, 1) epdconfig.digital_write(self.reset_pin, 1)
epdconfig.delay_ms(20) epdconfig.delay_ms(10)
epdconfig.digital_write(self.reset_pin, 0) epdconfig.digital_write(self.reset_pin, 0)
epdconfig.delay_ms(5) epdconfig.delay_ms(10)
epdconfig.digital_write(self.reset_pin, 1) epdconfig.digital_write(self.reset_pin, 1)
epdconfig.delay_ms(20) epdconfig.delay_ms(10)
def send_command(self, command): def send_command(self, command):
epdconfig.digital_write(self.dc_pin, 0) epdconfig.digital_write(self.dc_pin, 0)
@ -238,23 +250,23 @@ class EPD:
def set_lut(self): def set_lut(self):
self.send_command(0x20) # vcom self.send_command(0x20) # vcom
for count in range(0, 44): for count in range(0, 36):
self.send_data(self.lut_vcom0[count]) self.send_data(self.lut_vcom0[count])
self.send_command(0x21) # ww -- self.send_command(0x21) # ww --
for count in range(0, 42): for count in range(0, 36):
self.send_data(self.lut_ww[count]) self.send_data(self.lut_ww[count])
self.send_command(0x22) # bw r self.send_command(0x22) # bw r
for count in range(0, 42): for count in range(0, 36):
self.send_data(self.lut_bw[count]) self.send_data(self.lut_bw[count])
self.send_command(0x23) # wb w self.send_command(0x23) # wb w
for count in range(0, 42): for count in range(0, 36):
self.send_data(self.lut_bb[count]) self.send_data(self.lut_bb[count])
self.send_command(0x24) # bb b self.send_command(0x24) # bb b
for count in range(0, 42): for count in range(0, 36):
self.send_data(self.lut_wb[count]) self.send_data(self.lut_wb[count])
@ -329,7 +341,6 @@ class EPD:
self.send_command(0x00) # panel setting self.send_command(0x00) # panel setting
self.send_data(0xbf) # KW-BF KWR-AF BWROTP 0f self.send_data(0xbf) # KW-BF KWR-AF BWROTP 0f
self.send_data(0x0d)
self.send_command(0x30) # PLL setting self.send_command(0x30) # PLL setting
self.send_data(0x3c) # 3A 100HZ 29 150Hz 39 200HZ 31 171HZ self.send_data(0x3c) # 3A 100HZ 29 150Hz 39 200HZ 31 171HZ
@ -341,7 +352,7 @@ class EPD:
self.send_data(0x2c) self.send_data(0x2c)
self.send_command(0x82) # vcom_DC setting self.send_command(0x82) # vcom_DC setting
self.send_data(0x28) self.send_data(0x12)
self.send_command(0X50) # VCOM AND DATA INTERVAL SETTING self.send_command(0X50) # VCOM AND DATA INTERVAL SETTING
self.send_data(0x97) # 97white border 77black border VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7 self.send_data(0x97) # 97white border 77black border VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7
@ -350,6 +361,48 @@ class EPD:
# EPD hardware init end # EPD hardware init end
return 0 return 0
def init_Partial(self):
if (epdconfig.module_init() != 0):
return -1
# EPD hardware init start
self.reset()
self.send_command(0x01) # POWER SETTING
self.send_data(0x03) # VDS_EN, VDG_EN
self.send_data(0x00) # VCOM_HV, VGHL_LV[1], VGHL_LV[0]
self.send_data(0x2b) # VDH
self.send_data(0x2b) # VDL
self.send_command(0x06) # boost soft start
self.send_data(0x17)
self.send_data(0x17)
self.send_data(0x17)
self.send_command(0x04) # POWER_ON
self.ReadBusy()
self.send_command(0x00) # panel setting
self.send_data(0xbf) # KW-BF KWR-AF BWROTP 0f
self.send_command(0x30) # PLL setting
self.send_data(0x3c) # 3A 100HZ 29 150Hz 39 200HZ 31 171HZ
self.send_command(0x61) # resolution setting
self.send_data(0x01)
self.send_data(0x90) # 128
self.send_data(0x01)
self.send_data(0x2c)
self.send_command(0x82) # vcom_DC setting
self.send_data(0x12)
self.send_command(0X50) # VCOM AND DATA INTERVAL SETTING
self.send_data(0x07) # 97white border 77black border VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7
self.Partial_SetLut();
# EPD hardware init end
return 0
def Init_4Gray(self): def Init_4Gray(self):
if (epdconfig.module_init() != 0): if (epdconfig.module_init() != 0):
return -1 return -1
@ -478,7 +531,7 @@ class EPD:
if(X_end % 8 != 0): if(X_end % 8 != 0):
X_end = int(X_end/8)*8+8 X_end = int(X_end/8)*8+8
self.Partial_SetLut();
self.send_command(0x91); #This command makes the display enter partial mode self.send_command(0x91); #This command makes the display enter partial mode
self.send_command(0x90); #resolution setting self.send_command(0x90); #resolution setting
self.send_data (int(X_start/256)); self.send_data (int(X_start/256));
@ -498,12 +551,13 @@ class EPD:
self.send_command(0x10); #writes Old data to SRAM for programming self.send_command(0x10); #writes Old data to SRAM for programming
for j in range(0, int(Y_end - Y_start)): for j in range(0, int(Y_end - Y_start)):
for i in range(0, int(X_end/8) - int(X_start/8)): for i in range(0, int(X_end/8) - int(X_start/8)):
self.send_data(Image[(Y_start + j)*Width + int(X_start/8) + i]); self.send_data(self.DATA[(Y_start + j)*Width + int(X_start/8) + i]);
self.send_command(0x13); #writes New data to SRAM. self.send_command(0x13); #writes New data to SRAM.
for j in range(0, int(Y_end - Y_start)): for j in range(0, int(Y_end - Y_start)):
for i in range(0, int(X_end/8) - int(X_start/8)): for i in range(0, int(X_end/8) - int(X_start/8)):
self.send_data(~Image[(Y_start + j)*Width + int(X_start/8) + i]); self.send_data(~Image[(Y_start + j)*Width + int(X_start/8) + i]);
self.DATA[(Y_start + j)*Width + int(X_start/8) + i] = ~Image[(Y_start + j)*Width + int(X_start/8) + i]
self.send_command(0x12); #DISPLAY REFRESH self.send_command(0x12); #DISPLAY REFRESH
epdconfig.delay_ms(200) #The delay here is necessary, 200uS at least!!! epdconfig.delay_ms(200) #The delay here is necessary, 200uS at least!!!

View file

@ -176,24 +176,24 @@ class EPD:
# self.send_data(0x3f) #VDH=15V # self.send_data(0x3f) #VDH=15V
# self.send_data(0x3f) #VDL=-15V # self.send_data(0x3f) #VDL=-15V
self.send_command(0x01) # power setting self.send_command(0x01); # power setting
self.send_data(0x17) # 1-0=11: internal power self.send_data(0x17); # 1-0=11: internal power
self.send_data(self.Voltage_Frame_7IN5_V2[6]) # VGH&VGL self.send_data(self.Voltage_Frame_7IN5_V2[6]); # VGH&VGL
self.send_data(self.Voltage_Frame_7IN5_V2[1]) # VSH self.send_data(self.Voltage_Frame_7IN5_V2[1]); # VSH
self.send_data(self.Voltage_Frame_7IN5_V2[2]) # VSL self.send_data(self.Voltage_Frame_7IN5_V2[2]); # VSL
self.send_data(self.Voltage_Frame_7IN5_V2[3]) # VSHR self.send_data(self.Voltage_Frame_7IN5_V2[3]); # VSHR
self.send_command(0x82) # VCOM DC Setting self.send_command(0x82); # VCOM DC Setting
self.send_data(self.Voltage_Frame_7IN5_V2[4]) # VCOM self.send_data(self.Voltage_Frame_7IN5_V2[4]); # VCOM
self.send_command(0x06) # Booster Setting self.send_command(0x06); # Booster Setting
self.send_data(0x27) self.send_data(0x27);
self.send_data(0x27) self.send_data(0x27);
self.send_data(0x2F) self.send_data(0x2F);
self.send_data(0x17) self.send_data(0x17);
self.send_command(0x30) # OSC Setting self.send_command(0x30); # OSC Setting
self.send_data(self.Voltage_Frame_7IN5_V2[0]) # 2-0=100: N=4 5-3=111: M=7 3C=50Hz 3A=100HZ self.send_data(self.Voltage_Frame_7IN5_V2[0]); # 2-0=100: N=4 ; 5-3=111: M=7 ; 3C=50Hz 3A=100HZ
self.send_command(0x04) #POWER ON self.send_command(0x04) #POWER ON
epdconfig.delay_ms(100) epdconfig.delay_ms(100)
@ -218,11 +218,11 @@ class EPD:
self.send_command(0X60) #TCON SETTING self.send_command(0X60) #TCON SETTING
self.send_data(0x22) self.send_data(0x22)
self.send_command(0x65) # Resolution setting self.send_command(0x65); # Resolution setting
self.send_data(0x00) self.send_data(0x00);
self.send_data(0x00) # 800*480 self.send_data(0x00); # 800*480
self.send_data(0x00) self.send_data(0x00);
self.send_data(0x00) self.send_data(0x00);
self.SetLut(self.LUT_VCOM_7IN5_V2, self.LUT_WW_7IN5_V2, self.LUT_BW_7IN5_V2, self.LUT_WB_7IN5_V2, self.LUT_BB_7IN5_V2) self.SetLut(self.LUT_VCOM_7IN5_V2, self.LUT_WW_7IN5_V2, self.LUT_BW_7IN5_V2, self.LUT_WB_7IN5_V2, self.LUT_BB_7IN5_V2)
# EPD hardware init end # EPD hardware init end

View file

@ -4,8 +4,8 @@
# * | Function : Electronic paper driver # * | Function : Electronic paper driver
# * | Info : # * | Info :
# *---------------- # *----------------
# * | This version: V4.1 # * | This version: V4.2
# * | Date : 2020-11-30 # * | Date : 2022-01-08
# # | Info : python demo # # | Info : python demo
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
@ -67,6 +67,12 @@ class EPD:
epdconfig.spi_writebyte([data]) epdconfig.spi_writebyte([data])
epdconfig.digital_write(self.cs_pin, 1) epdconfig.digital_write(self.cs_pin, 1)
def send_data2(self, data): #faster
epdconfig.digital_write(self.dc_pin, 1)
epdconfig.digital_write(self.cs_pin, 0)
epdconfig.SPI.writebytes2(data)
epdconfig.digital_write(self.cs_pin, 1)
def ReadBusy(self): def ReadBusy(self):
logger.debug("e-Paper busy") logger.debug("e-Paper busy")
self.send_command(0x71) self.send_command(0x71)
@ -127,50 +133,47 @@ class EPD:
return 0 return 0
def getbuffer(self, image): def getbuffer(self, image):
# logger.debug("bufsiz = ",int(self.width/8) * self.height) img = image
buf = [0xFF] * (int(self.width/8) * self.height) imwidth, imheight = img.size
image_monocolor = image.convert('1')
imwidth, imheight = image_monocolor.size
pixels = image_monocolor.load()
logger.debug('imwidth = %d imheight = %d ',imwidth, imheight)
if(imwidth == self.width and imheight == self.height): if(imwidth == self.width and imheight == self.height):
logger.debug("Horizontal") img = img.convert('1')
for y in range(imheight):
for x in range(imwidth):
# Set the bits for the column of pixels at the current position.
if pixels[x, y] == 0:
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
elif(imwidth == self.height and imheight == self.width): elif(imwidth == self.height and imheight == self.width):
logger.debug("Vertical") # image has correct dimensions, but needs to be rotated
for y in range(imheight): img = img.rotate(90, expand=True).convert('1')
for x in range(imwidth): else:
newx = y logger.warning("Wrong image dimensions: must be " + str(self.width) + "x" + str(self.height))
newy = self.height - x - 1 # return a blank buffer
if pixels[x, y] == 0: return [0x00] * (int(self.width/8) * self.height)
buf[int((newx + newy*self.width) / 8)] &= ~(0x80 >> (y % 8))
buf = bytearray(img.tobytes('raw'))
# The bytes need to be inverted, because in the PIL world 0=black and 1=white, but
# in the e-paper world 0=white and 1=black.
for i in range(len(buf)):
buf[i] ^= 0xFF
return buf return buf
def display(self, imageblack, imagered): def display(self, imageblack, imagered):
self.send_command(0x10) self.send_command(0x10)
for i in range(0, int(self.width * self.height / 8)): # The black bytes need to be inverted back from what getbuffer did
self.send_data(imageblack[i]); for i in range(len(imageblack)):
imageblack[i] ^= 0xFF
self.send_data2(imageblack)
self.send_command(0x13) self.send_command(0x13)
for i in range(0, int(self.width * self.height / 8)): self.send_data2(imagered)
self.send_data(~imagered[i]);
self.send_command(0x12) self.send_command(0x12)
epdconfig.delay_ms(100) epdconfig.delay_ms(100)
self.ReadBusy() self.ReadBusy()
def Clear(self): def Clear(self):
buf = [0x00] * (int(self.width/8) * self.height)
buf2 = [0xff] * (int(self.width/8) * self.height)
self.send_command(0x10) self.send_command(0x10)
for i in range(0, int(self.width * self.height / 8)): self.send_data2(buf2)
self.send_data(0xff)
self.send_command(0x13) self.send_command(0x13)
for i in range(0, int(self.width * self.height / 8)): self.send_data2(buf)
self.send_data(0x00)
self.send_command(0x12) self.send_command(0x12)
epdconfig.delay_ms(100) epdconfig.delay_ms(100)

View file

@ -81,6 +81,6 @@ def module_exit():
GPIO.output(RST_PIN, 0) GPIO.output(RST_PIN, 0)
GPIO.output(DC_PIN, 0) GPIO.output(DC_PIN, 0)
GPIO.cleanup() GPIO.cleanup([RST_PIN, DC_PIN, CS_PIN, BUSY_PIN])
### END OF FILE ### ### END OF FILE ###

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -145,7 +145,7 @@
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>ST-LINKIII-KEIL_SWO</Key> <Key>ST-LINKIII-KEIL_SWO</Key>
<Name>-U38FF6D064246373030270457 -O2254 -SF1800 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F10x_512 -FS08000000 -FL080000 -FP0($$Device:STM32F103ZE$Flash\STM32F10x_512.FLM)</Name> <Name>-U50FF6E066675545724371487 -O2254 -SF1800 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F10x_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32F103ZE$Flash\STM32F10x_512.FLM)</Name>
</SetRegEntry> </SetRegEntry>
</TargetDriverDllRegistry> </TargetDriverDllRegistry>
<Breakpoint> <Breakpoint>
@ -234,6 +234,7 @@
<pMultCmdsp></pMultCmdsp> <pMultCmdsp></pMultCmdsp>
<DebugDescription> <DebugDescription>
<Enable>1</Enable> <Enable>1</Enable>
<EnableFlashSeq>0</EnableFlashSeq>
<EnableLog>0</EnableLog> <EnableLog>0</EnableLog>
<Protocol>2</Protocol> <Protocol>2</Protocol>
<DbgClock>10000000</DbgClock> <DbgClock>10000000</DbgClock>
@ -243,7 +244,7 @@
<Group> <Group>
<GroupName>Application/MDK-ARM</GroupName> <GroupName>Application/MDK-ARM</GroupName>
<tvExp>1</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
@ -343,7 +344,7 @@
<Group> <Group>
<GroupName>Examples</GroupName> <GroupName>Examples</GroupName>
<tvExp>1</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
@ -546,6 +547,18 @@
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\User\Examples\EPD_2in13_V3_test.c</PathWithFileName>
<FilenameWithoutPath>EPD_2in13_V3_test.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>25</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\Examples\EPD_2in13b_V3_test.c</PathWithFileName> <PathWithFileName>..\User\Examples\EPD_2in13b_V3_test.c</PathWithFileName>
<FilenameWithoutPath>EPD_2in13b_V3_test.c</FilenameWithoutPath> <FilenameWithoutPath>EPD_2in13b_V3_test.c</FilenameWithoutPath>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
@ -553,7 +566,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>25</FileNumber> <FileNumber>26</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -565,7 +578,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>26</FileNumber> <FileNumber>27</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -577,7 +590,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>27</FileNumber> <FileNumber>28</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -589,7 +602,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>28</FileNumber> <FileNumber>29</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -601,7 +614,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>29</FileNumber> <FileNumber>30</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -613,7 +626,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>30</FileNumber> <FileNumber>31</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -625,7 +638,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>31</FileNumber> <FileNumber>32</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -637,7 +650,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>32</FileNumber> <FileNumber>33</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -649,7 +662,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>33</FileNumber> <FileNumber>34</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -661,7 +674,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>34</FileNumber> <FileNumber>35</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -673,7 +686,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>35</FileNumber> <FileNumber>36</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -685,7 +698,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>36</FileNumber> <FileNumber>37</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -697,7 +710,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>37</FileNumber> <FileNumber>38</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -709,7 +722,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>38</FileNumber> <FileNumber>39</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -721,7 +734,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>39</FileNumber> <FileNumber>40</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -733,7 +746,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>40</FileNumber> <FileNumber>41</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -745,7 +758,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>41</FileNumber> <FileNumber>42</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -757,7 +770,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>42</FileNumber> <FileNumber>43</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -769,7 +782,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>43</FileNumber> <FileNumber>44</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -781,7 +794,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>44</FileNumber> <FileNumber>45</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -793,7 +806,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>45</FileNumber> <FileNumber>46</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -813,7 +826,7 @@
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>46</FileNumber> <FileNumber>47</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -825,7 +838,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>47</FileNumber> <FileNumber>48</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -837,7 +850,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>48</FileNumber> <FileNumber>49</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -849,7 +862,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>49</FileNumber> <FileNumber>50</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -861,7 +874,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>50</FileNumber> <FileNumber>51</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -873,7 +886,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>51</FileNumber> <FileNumber>52</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -885,7 +898,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>52</FileNumber> <FileNumber>53</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -897,7 +910,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>53</FileNumber> <FileNumber>54</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -909,7 +922,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>54</FileNumber> <FileNumber>55</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -921,7 +934,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>55</FileNumber> <FileNumber>56</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -933,7 +946,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>56</FileNumber> <FileNumber>57</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -945,7 +958,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>57</FileNumber> <FileNumber>58</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -957,7 +970,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>58</FileNumber> <FileNumber>59</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -969,7 +982,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>59</FileNumber> <FileNumber>60</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -981,7 +994,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>60</FileNumber> <FileNumber>61</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -993,7 +1006,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>61</FileNumber> <FileNumber>62</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1005,7 +1018,19 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>62</FileNumber> <FileNumber>63</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\User\e-Paper\EPD_2in13_V3.c</PathWithFileName>
<FilenameWithoutPath>EPD_2in13_V3.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>64</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1017,7 +1042,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>63</FileNumber> <FileNumber>65</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1029,7 +1054,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>64</FileNumber> <FileNumber>66</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1041,7 +1066,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>65</FileNumber> <FileNumber>67</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1053,7 +1078,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>66</FileNumber> <FileNumber>68</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1065,7 +1090,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>67</FileNumber> <FileNumber>69</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1077,7 +1102,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>68</FileNumber> <FileNumber>70</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1089,7 +1114,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>69</FileNumber> <FileNumber>71</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1101,7 +1126,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>70</FileNumber> <FileNumber>72</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1113,7 +1138,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>71</FileNumber> <FileNumber>73</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1125,7 +1150,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>72</FileNumber> <FileNumber>74</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1137,7 +1162,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>73</FileNumber> <FileNumber>75</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1149,7 +1174,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>74</FileNumber> <FileNumber>76</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1161,7 +1186,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>75</FileNumber> <FileNumber>77</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1173,7 +1198,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>76</FileNumber> <FileNumber>78</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1185,7 +1210,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>77</FileNumber> <FileNumber>79</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1197,7 +1222,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>78</FileNumber> <FileNumber>80</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1209,7 +1234,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>79</FileNumber> <FileNumber>81</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1221,7 +1246,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>80</FileNumber> <FileNumber>82</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1233,7 +1258,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>81</FileNumber> <FileNumber>83</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1245,7 +1270,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>82</FileNumber> <FileNumber>84</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1265,7 +1290,7 @@
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>83</FileNumber> <FileNumber>85</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1285,7 +1310,7 @@
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<File> <File>
<GroupNumber>6</GroupNumber> <GroupNumber>6</GroupNumber>
<FileNumber>84</FileNumber> <FileNumber>86</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1305,7 +1330,7 @@
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>85</FileNumber> <FileNumber>87</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1317,7 +1342,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>86</FileNumber> <FileNumber>88</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1329,7 +1354,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>87</FileNumber> <FileNumber>89</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1341,7 +1366,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>88</FileNumber> <FileNumber>90</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1353,7 +1378,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>89</FileNumber> <FileNumber>91</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1365,7 +1390,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>90</FileNumber> <FileNumber>92</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1377,7 +1402,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>91</FileNumber> <FileNumber>93</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1397,7 +1422,7 @@
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<File> <File>
<GroupNumber>8</GroupNumber> <GroupNumber>8</GroupNumber>
<FileNumber>92</FileNumber> <FileNumber>94</FileNumber>
<FileType>5</FileType> <FileType>5</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1409,7 +1434,7 @@
</File> </File>
<File> <File>
<GroupNumber>8</GroupNumber> <GroupNumber>8</GroupNumber>
<FileNumber>93</FileNumber> <FileNumber>95</FileNumber>
<FileType>5</FileType> <FileType>5</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1429,7 +1454,7 @@
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<File> <File>
<GroupNumber>9</GroupNumber> <GroupNumber>9</GroupNumber>
<FileNumber>94</FileNumber> <FileNumber>96</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1449,7 +1474,7 @@
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>95</FileNumber> <FileNumber>97</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1461,7 +1486,7 @@
</File> </File>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>96</FileNumber> <FileNumber>98</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1473,7 +1498,7 @@
</File> </File>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>97</FileNumber> <FileNumber>99</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1485,7 +1510,7 @@
</File> </File>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>98</FileNumber> <FileNumber>100</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1497,7 +1522,7 @@
</File> </File>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>99</FileNumber> <FileNumber>101</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1509,7 +1534,7 @@
</File> </File>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>100</FileNumber> <FileNumber>102</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1521,7 +1546,7 @@
</File> </File>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>101</FileNumber> <FileNumber>103</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1533,7 +1558,7 @@
</File> </File>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>102</FileNumber> <FileNumber>104</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1545,7 +1570,7 @@
</File> </File>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>103</FileNumber> <FileNumber>105</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1557,7 +1582,7 @@
</File> </File>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>104</FileNumber> <FileNumber>106</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1569,7 +1594,7 @@
</File> </File>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>105</FileNumber> <FileNumber>107</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1581,7 +1606,7 @@
</File> </File>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>106</FileNumber> <FileNumber>108</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1593,7 +1618,7 @@
</File> </File>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>107</FileNumber> <FileNumber>109</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1605,7 +1630,7 @@
</File> </File>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>108</FileNumber> <FileNumber>110</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -1617,7 +1642,7 @@
</File> </File>
<File> <File>
<GroupNumber>10</GroupNumber> <GroupNumber>10</GroupNumber>
<FileNumber>109</FileNumber> <FileNumber>111</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>

View file

@ -16,7 +16,7 @@
<TargetCommonOption> <TargetCommonOption>
<Device>STM32F103ZE</Device> <Device>STM32F103ZE</Device>
<Vendor>STMicroelectronics</Vendor> <Vendor>STMicroelectronics</Vendor>
<PackID>Keil.STM32F1xx_DFP.2.3.0</PackID> <PackID>Keil.STM32F1xx_DFP.2.1.0</PackID>
<PackURL>http://www.keil.com/pack/</PackURL> <PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000-0x2000FFFF) IROM(0x8000000-0x807FFFF) CLOCK(8000000) CPUTYPE("Cortex-M3")</Cpu> <Cpu>IRAM(0x20000000-0x2000FFFF) IROM(0x8000000-0x807FFFF) CLOCK(8000000) CPUTYPE("Cortex-M3")</Cpu>
<FlashUtilSpec></FlashUtilSpec> <FlashUtilSpec></FlashUtilSpec>
@ -184,6 +184,7 @@
<hadXRAM>0</hadXRAM> <hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam> <uocXRam>0</uocXRam>
<RvdsVP>0</RvdsVP> <RvdsVP>0</RvdsVP>
<RvdsMve>0</RvdsMve>
<hadIRAM2>0</hadIRAM2> <hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2> <hadIROM2>0</hadIROM2>
<StupSel>8</StupSel> <StupSel>8</StupSel>
@ -506,6 +507,11 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\User\Examples\EPD_2in13_V2_test.c</FilePath> <FilePath>..\User\Examples\EPD_2in13_V2_test.c</FilePath>
</File> </File>
<File>
<FileName>EPD_2in13_V3_test.c</FileName>
<FileType>1</FileType>
<FilePath>..\User\Examples\EPD_2in13_V3_test.c</FilePath>
</File>
<File> <File>
<FileName>EPD_2in13b_V3_test.c</FileName> <FileName>EPD_2in13b_V3_test.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
@ -701,6 +707,11 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\User\e-Paper\EPD_2in13_V2.c</FilePath> <FilePath>..\User\e-Paper\EPD_2in13_V2.c</FilePath>
</File> </File>
<File>
<FileName>EPD_2in13_V3.c</FileName>
<FileType>1</FileType>
<FilePath>..\User\e-Paper\EPD_2in13_V3.c</FilePath>
</File>
<File> <File>
<FileName>EPD_2in13bc.c</FileName> <FileName>EPD_2in13bc.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>

View file

@ -3,57 +3,61 @@
<pre> <pre>
<h1>µVision Build Log</h1> <h1>µVision Build Log</h1>
<h2>Tool Versions:</h2> <h2>Tool Versions:</h2>
IDE-Version: ¦ÌVision V5.25.2.0 IDE-Version: ¦ÌVision V5.26.2.0
Copyright (C) 2018 ARM Ltd and ARM Germany GmbH. All rights reserved. Copyright (C) 2018 ARM Ltd and ARM Germany GmbH. All rights reserved.
License Information: ass ass, ass, LIC=JL2UH-W872P-CJR6Z-JYZTW-ESB48-R6YF4 License Information: , , LIC=RC93N-YLJYL-JJH6S-LI3Z1-D1AV2-99PL8
Tool Versions: Tool Versions:
Toolchain: MDK-ARM Plus Version: 5.25.2.0 Toolchain: MDK-ARM Plus Version: 5.26.2.0
Toolchain Path: D:\Program Files\keil5\ARM\ARMCC\Bin Toolchain Path: D:\KEIL\azwz\ARM\ARMCC\Bin
C Compiler: Armcc.exe V5.06 update 6 (build 750) C Compiler: Armcc.exe V5.06 update 6 (build 750)
Assembler: Armasm.exe V5.06 update 6 (build 750) Assembler: Armasm.exe V5.06 update 6 (build 750)
Linker/Locator: ArmLink.exe V5.06 update 6 (build 750) Linker/Locator: ArmLink.exe V5.06 update 6 (build 750)
Library Manager: ArmAr.exe V5.06 update 6 (build 750) Library Manager: ArmAr.exe V5.06 update 6 (build 750)
Hex Converter: FromElf.exe V5.06 update 6 (build 750) Hex Converter: FromElf.exe V5.06 update 6 (build 750)
CPU DLL: SARMCM3.DLL V5.25.2.0 CPU DLL: SARMCM3.DLL V5.26.2.0
Dialog DLL: DCM.DLL V1.17.1.0 Dialog DLL: DCM.DLL V1.17.2.0
Target DLL: STLink\ST-LINKIII-KEIL_SWO.dll V3.0.1.0 Target DLL: STLink\ST-LINKIII-KEIL_SWO.dll V3.0.5.0
Dialog DLL: TCM.DLL V1.35.1.0 Dialog DLL: TCM.DLL V1.36.1.0
<h2>Project:</h2> <h2>Project:</h2>
E:\github\E-Paper_code\STM32\STM32-F103ZET6\MDK-ARM\epd-demo.uvprojx E:\ÏîÄ¿\e-Paper\Code\4.2\bK\E-Paper_code\STM32\STM32-F103ZET6\MDK-ARM\epd-demo.uvprojx
Project File Date: 07/19/2021 Project File Date: 01/19/2022
<h2>Output:</h2> <h2>Output:</h2>
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'D:\Program Files\keil5\ARM\ARMCC\Bin' *** Using Compiler 'V5.06 update 6 (build 750)', folder: 'D:\KEIL\azwz\ARM\ARMCC\Bin'
Build target 'epd-demo' Build target 'epd-demo'
compiling main.c... compiling EPD_4in2_test.c...
compiling EPD_4in2.c...
..\User\e-Paper\EPD_4in2.c(612): warning: #550-D: variable "Height" was set but never used
UWORD Width, Height;
..\User\e-Paper\EPD_4in2.c: 1 warning, 0 errors
linking... linking...
Program Size: Code=18544 RO-data=360 RW-data=20 ZI-data=4252 Program Size: Code=25928 RO-data=56420 RW-data=68 ZI-data=56140
FromELF: creating hex file... FromELF: creating hex file...
"epd-demo\epd-demo.axf" - 0 Error(s), 0 Warning(s). "epd-demo\epd-demo.axf" - 0 Error(s), 1 Warning(s).
<h2>Software Packages used:</h2> <h2>Software Packages used:</h2>
Package Vendor: ARM Package Vendor: ARM
http://www.keil.com/pack/ARM.CMSIS.5.7.0.pack http://www.keil.com/pack/ARM.CMSIS.5.4.0.pack
ARM.CMSIS.5.7.0 ARM.CMSIS.5.4.0
CMSIS (Cortex Microcontroller Software Interface Standard) CMSIS (Cortex Microcontroller Software Interface Standard)
* Component: CORE Version: 5.4.0 * Component: CORE Version: 5.1.2
Package Vendor: Keil Package Vendor: Keil
http://www.keil.com/pack/Keil.STM32F1xx_DFP.2.3.0.pack http://www.keil.com/pack/Keil.STM32F1xx_DFP.2.1.0.pack
Keil.STM32F1xx_DFP.2.3.0 Keil.STM32F1xx_DFP.2.1.0
STMicroelectronics STM32F1 Series Device Support, Drivers and Examples STMicroelectronics STM32F1 Series Device Support, Drivers and Examples
<h2>Collection of Component include folders:</h2> <h2>Collection of Component include folders:</h2>
.\RTE\_epd-demo .\RTE\_epd-demo
D:\Program Files\keil5\ARM\PACK\ARM\CMSIS\5.7.0\CMSIS\Core\Include D:\KEIL\azwz\ARM\PACK\ARM\CMSIS\5.4.0\CMSIS\Core\Include
D:\Program Files\keil5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include D:\KEIL\azwz\ARM\PACK\Keil\STM32F1xx_DFP\2.1.0\Device\Include
<h2>Collection of Component Files used:</h2> <h2>Collection of Component Files used:</h2>
* Component: ARM::CMSIS:CORE:5.4.0 * Component: ARM::CMSIS:CORE:5.1.2
Build Time Elapsed: 00:00:03 Build Time Elapsed: 00:00:03
</pre> </pre>
</body> </body>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -580,17 +580,17 @@ ARM Macro Assembler Page 9
00000000 00000000
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M3 --apcs=interw Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M3 --apcs=interw
ork --depend=epd-demo\startup_stm32f103xe.d -oepd-demo\startup_stm32f103xe.o -I ork --depend=epd-demo\startup_stm32f103xe.d -oepd-demo\startup_stm32f103xe.o -I
.\RTE\_epd-demo -I"D:\Program Files\keil5\ARM\PACK\ARM\CMSIS\5.7.0\CMSIS\Core\I .\RTE\_epd-demo -ID:\KEIL\azwz\ARM\PACK\ARM\CMSIS\5.4.0\CMSIS\Core\Include -ID:
nclude" -I"D:\Program Files\keil5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Incl \KEIL\azwz\ARM\PACK\Keil\STM32F1xx_DFP\2.1.0\Device\Include --predefine="__MICR
ude" --predefine="__MICROLIB SETA 1" --predefine="__UVISION_VERSION SETA 525" - OLIB SETA 1" --predefine="__UVISION_VERSION SETA 526" --predefine="_RTE_ SETA 1
ARM Macro Assembler Page 10 ARM Macro Assembler Page 10
-predefine="_RTE_ SETA 1" --predefine="STM32F10X_HD SETA 1" --list=startup_stm3 " --predefine="STM32F10X_HD SETA 1" --list=startup_stm32f103xe.lst startup_stm3
2f103xe.lst startup_stm32f103xe.s 2f103xe.s

View file

@ -114,6 +114,7 @@ int main(void)
// EPD_2in13_test(); // EPD_2in13_test();
// EPD_2in13_V2_test(); // EPD_2in13_V2_test();
// EPD_2in13_V3_test();
// EPD_2in13bc_test(); // EPD_2in13bc_test();
// EPD_2in13b_V3_test(); // EPD_2in13b_V3_test();
// EPD_2in13d_test(); // EPD_2in13d_test();
@ -125,7 +126,7 @@ int main(void)
// EPD_4in01f_test(); // EPD_4in01f_test();
// EPD_4in2_test(); EPD_4in2_test();
// EPD_4in2bc_test(); // EPD_4in2bc_test();
// EPD_4in2b_V2_test(); // EPD_4in2b_V2_test();
// EPD_5in65f_test(); // EPD_5in65f_test();

View file

@ -0,0 +1,149 @@
/*****************************************************************************
* | File : EPD_2in13_V3_test.c
* | Author : Waveshare team
* | Function : 2.13inch e-paper V3 test demo
* | Info :
*----------------
* | This version: V1.1
* | Date : 2021-10-30
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in13_V3.h"
int EPD_2in13_V3_test(void)
{
Debug("EPD_2in13_V3_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
Debug("e-Paper Init and Clear...\r\n");
EPD_2in13_V3_Init();
EPD_2in13_V3_Clear();
//Create a new image cache
UBYTE *BlackImage;
UWORD Imagesize = ((EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1)) * EPD_2in13_V3_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
Debug("Failed to apply for black memory...\r\n");
return -1;
}
Debug("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
Paint_Clear(WHITE);
#if 1 //show image for array
Debug("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_2in13);
EPD_2in13_V3_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 // Drawing on the image
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
Debug("Drawing\r\n");
//1.Select Image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
// 2.Drawing on the image
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(45, 15, 45, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(25, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(110, 35, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawString_EN(140, 15, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawNum(140, 40, 123456789, &Font16, BLACK, WHITE);
Paint_DrawString_CN(140, 60, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(5, 65, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
EPD_2in13_V3_Display_Base(BlackImage);
DEV_Delay_ms(3000);
#endif
#if 1 //Partial refresh, example shows time
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
Debug("Partial refresh\r\n");
Paint_SelectImage(BlackImage);
PAINT_TIME sPaint_time;
sPaint_time.Hour = 12;
sPaint_time.Min = 34;
sPaint_time.Sec = 56;
UBYTE num = 10;
for (;;) {
sPaint_time.Sec = sPaint_time.Sec + 1;
if (sPaint_time.Sec == 60) {
sPaint_time.Min = sPaint_time.Min + 1;
sPaint_time.Sec = 0;
if (sPaint_time.Min == 60) {
sPaint_time.Hour = sPaint_time.Hour + 1;
sPaint_time.Min = 0;
if (sPaint_time.Hour == 24) {
sPaint_time.Hour = 0;
sPaint_time.Min = 0;
sPaint_time.Sec = 0;
}
}
}
Paint_ClearWindows(150, 80, 150 + Font20.Width * 7, 80 + Font20.Height, WHITE);
Paint_DrawTime(150, 80, &sPaint_time, &Font20, WHITE, BLACK);
num = num - 1;
if(num == 0) {
break;
}
EPD_2in13_V3_Display_Partial(BlackImage);
DEV_Delay_ms(500);//Analog clock 1s
}
#endif
Debug("Clear...\r\n");
EPD_2in13_V3_Init();
EPD_2in13_V3_Clear();
Debug("Goto Sleep...\r\n");
EPD_2in13_V3_Sleep();
free(BlackImage);
BlackImage = NULL;
DEV_Delay_ms(2000);//important, at least 2s
// close 5V
Debug("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -58,7 +58,7 @@ int EPD_2in66_test(void)
Paint_SelectImage(BlackImage); Paint_SelectImage(BlackImage);
Paint_Clear(WHITE); Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_2in66); Paint_DrawBitMap(gImage_2in66);
Paint_DrawBitMap_Paste(gImage_100X50, 10, 10, 100, 50, TRUE);
EPD_2IN66_Display(BlackImage); EPD_2IN66_Display(BlackImage);
DEV_Delay_ms(2000); DEV_Delay_ms(2000);
#endif #endif
@ -92,8 +92,8 @@ int EPD_2in66_test(void)
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE); Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK); Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE); Paint_DrawString_CN(130, 0,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK); Paint_DrawString_CN(130, 20, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
EPD_2IN66_Display(BlackImage); EPD_2IN66_Display(BlackImage);
DEV_Delay_ms(4000); DEV_Delay_ms(4000);

View file

@ -39,7 +39,7 @@ int EPD_4in2_test(void)
} }
printf("e-Paper Init and Clear...\r\n"); printf("e-Paper Init and Clear...\r\n");
EPD_4IN2_Init(); EPD_4IN2_Init_Fast();
EPD_4IN2_Clear(); EPD_4IN2_Clear();
DEV_Delay_ms(500); DEV_Delay_ms(500);
@ -86,8 +86,8 @@ int EPD_4in2_test(void)
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK); Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE); Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK); Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
Paint_DrawString_CN(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE); Paint_DrawString_CN(130, 0, " <EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK); Paint_DrawString_CN(130, 20, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
printf("EPD_Display\r\n"); printf("EPD_Display\r\n");
EPD_4IN2_Display(BlackImage); EPD_4IN2_Display(BlackImage);
@ -95,6 +95,7 @@ int EPD_4in2_test(void)
#endif #endif
printf("Support for partial refresh, but the refresh effect is not good, but it is not recommended\r\n"); printf("Support for partial refresh, but the refresh effect is not good, but it is not recommended\r\n");
#if 0 #if 0
EPD_4IN2_Init_Partial();
printf("Partial refresh\r\n"); printf("Partial refresh\r\n");
PAINT_TIME sPaint_time; PAINT_TIME sPaint_time;
sPaint_time.Hour = 12; sPaint_time.Hour = 12;
@ -155,15 +156,15 @@ int EPD_4in2_test(void)
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK); Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE); Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK); Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
Paint_DrawString_CN(140, 0, "ÄãºÃabc", &Font12CN, GRAY1, GRAY4); Paint_DrawString_CN(140, 0, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY1, GRAY4);
Paint_DrawString_CN(140, 40, "ÄãºÃabc", &Font12CN, GRAY2, GRAY3); Paint_DrawString_CN(140, 40, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY2, GRAY3);
Paint_DrawString_CN(140, 80, "ÄãºÃabc", &Font12CN, GRAY3, GRAY2); Paint_DrawString_CN(140, 80, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY3, GRAY2);
Paint_DrawString_CN(140, 120, "ÄãºÃabc", &Font12CN, GRAY4, GRAY1); Paint_DrawString_CN(140, 120, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY4, GRAY1);
Paint_DrawString_CN(220, 0, "΢ѩµç×Ó", &Font24CN, GRAY1, GRAY4); Paint_DrawString_CN(220, 0, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY1, GRAY4);
Paint_DrawString_CN(220, 40, "΢ѩµç×Ó", &Font24CN, GRAY2, GRAY3); Paint_DrawString_CN(220, 40, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY2, GRAY3);
Paint_DrawString_CN(220, 80, "΢ѩµç×Ó", &Font24CN, GRAY3, GRAY2); Paint_DrawString_CN(220, 80, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY3, GRAY2);
Paint_DrawString_CN(220, 120, "΢ѩµç×Ó", &Font24CN, GRAY4, GRAY1); Paint_DrawString_CN(220, 120, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY4, GRAY1);
EPD_4IN2_4GrayDisplay(BlackImage); EPD_4IN2_4GrayDisplay(BlackImage);
DEV_Delay_ms(500); DEV_Delay_ms(500);
@ -175,6 +176,7 @@ int EPD_4in2_test(void)
EPD_4IN2_Clear(); EPD_4IN2_Clear();
EPD_4IN2_Init_Fast();
printf("Goto Sleep...\r\n"); printf("Goto Sleep...\r\n");
EPD_4IN2_Sleep(); EPD_4IN2_Sleep();
free(BlackImage); free(BlackImage);

View file

@ -56,6 +56,7 @@ int EPD_2in9d_test(void);
int EPD_2in13_test(void); int EPD_2in13_test(void);
int EPD_2in13_V2_test(void); int EPD_2in13_V2_test(void);
int EPD_2in13_V3_test(void);
int EPD_2in13bc_test(void); int EPD_2in13bc_test(void);
int EPD_2in13b_V3_test(void); int EPD_2in13b_V3_test(void);
int EPD_2in13d_test(void); int EPD_2in13d_test(void);

View file

@ -30,6 +30,52 @@
******************************************************************************/ ******************************************************************************/
#include "ImageData.h" #include "ImageData.h"
const unsigned char gImage_100X50[656] = { /*0X00,0X01,0X64,0X00,0X32,0X00,*/
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XC7,0X00,0X66,0X00,0X0E,0X66,0X00,
0X03,0X03,0X00,0X00,0X00,0X00,0XC7,0X00,0X66,0X00,0X0E,0XE6,0X00,0X03,0X03,0X00,
0X00,0X00,0X00,0XC7,0X00,0X66,0X00,0X06,0XFE,0X00,0X03,0X1F,0X00,0X00,0X00,0X00,
0XC7,0X3F,0X66,0X7E,0X07,0XFE,0X7E,0X7B,0X3F,0X00,0X00,0X00,0X00,0XFF,0X33,0X66,
0X66,0X07,0XFC,0X66,0X63,0X73,0X00,0X00,0X00,0X00,0XC7,0X7F,0X66,0XE6,0X07,0XFC,
0XE6,0X63,0X73,0X00,0X00,0X00,0X00,0XC7,0X70,0X66,0XE6,0X03,0XBC,0XE6,0X63,0X73,
0X00,0X00,0X00,0X00,0XC7,0X3F,0X66,0X7E,0X03,0X9C,0X7E,0X63,0X3F,0X00,0X00,0X00,
0X00,0XC7,0X1E,0X66,0X3C,0X03,0X98,0X3C,0X63,0X1F,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,};
const unsigned char gImage_1in02d[2560] = { /* 0X00,0X02,0X80,0X00,0X50,0X00, */ const unsigned char gImage_1in02d[2560] = { /* 0X00,0X02,0X80,0X00,0X50,0X00, */
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0C,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0C,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,

View file

@ -31,6 +31,9 @@
#ifndef _IMAGEDATA_H_ #ifndef _IMAGEDATA_H_
#define _IMAGEDATA_H_ #define _IMAGEDATA_H_
extern const unsigned char gImage_100X50[];
extern const unsigned char gImage_1in02d[]; extern const unsigned char gImage_1in02d[];
extern const unsigned char gImage_1in54[]; extern const unsigned char gImage_1in54[];

View file

@ -777,6 +777,36 @@ void Paint_DrawBitMap(const unsigned char* image_buffer)
} }
} }
/******************************************************************************
function: paste monochrome bitmap to a frame buff
parameter:
image_buffer A picture data converted to a bitmap
xStart: The starting x coordinate
yStart: The starting y coordinate
imageWidth: Original image width
imageHeight: Original image height
flipColor: Whether the color is reversed
info:
Use this function to paste image data into a buffer
******************************************************************************/
void Paint_DrawBitMap_Paste(const unsigned char* image_buffer, UWORD xStart, UWORD yStart, UWORD imageWidth, UWORD imageHeight, UBYTE flipColor)
{
UBYTE color, srcImage;
UWORD x, y;
UWORD width = (imageWidth%8==0 ? imageWidth/8 : imageWidth/8+1);
for (y = 0; y < imageHeight; y++) {
for (x = 0; x < imageWidth; x++) {
srcImage = image_buffer[y*width + x/8];
if(flipColor)
color = (((srcImage<<(x%8) & 0x80) == 0) ? 1 : 0);
else
color = (((srcImage<<(x%8) & 0x80) == 0) ? 0 : 1);
Paint_SetPixel(x+xStart, y+yStart, color);
}
}
}
///****************************************************************************** ///******************************************************************************
//function: SDisplay half of monochrome bitmap //function: SDisplay half of monochrome bitmap
//parameter: //parameter:

View file

@ -116,6 +116,9 @@ typedef enum {
#define FONT_FOREGROUND BLACK #define FONT_FOREGROUND BLACK
#define FONT_BACKGROUND WHITE #define FONT_BACKGROUND WHITE
#define TRUE 1
#define FALSE 0
//4 Gray level //4 Gray level
#define GRAY1 0x03 //Blackest #define GRAY1 0x03 //Blackest
#define GRAY2 0x02 #define GRAY2 0x02
@ -200,6 +203,7 @@ void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font,
//pic //pic
void Paint_DrawBitMap(const unsigned char* image_buffer); void Paint_DrawBitMap(const unsigned char* image_buffer);
void Paint_DrawBitMap_Paste(const unsigned char* image_buffer, UWORD Xstart, UWORD Ystart, UWORD imageWidth, UWORD imageHeight, UBYTE flipColor);
//void Paint_DrawBitMap_Half(const unsigned char* image_buffer, UBYTE Region); //void Paint_DrawBitMap_Half(const unsigned char* image_buffer, UBYTE Region);
//void Paint_DrawBitMap_OneQuarter(const unsigned char* image_buffer, UBYTE Region); //void Paint_DrawBitMap_OneQuarter(const unsigned char* image_buffer, UBYTE Region);
//void Paint_DrawBitMap_OneEighth(const unsigned char* image_buffer, UBYTE Region); //void Paint_DrawBitMap_OneEighth(const unsigned char* image_buffer, UBYTE Region);

View file

@ -78,30 +78,6 @@ unsigned char WF_PARTIAL_1IN54_0[159] =
0x02,0x17,0x41,0xB0,0x32,0x28, 0x02,0x17,0x41,0xB0,0x32,0x28,
}; };
// waveform partial refresh(quality)
unsigned char WF_PARTIAL_1IN54_1[159] =
{
0x0,0x00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0xA,0x0,0x0,0x0,0x0,0x0,0x1,
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
0x22,0x17,0x41,0x0,0x32,0x20,
};
/****************************************************************************** /******************************************************************************
function : Software reset function : Software reset
parameter: parameter:
@ -276,7 +252,7 @@ void EPD_1IN54_V2_Init_Partial(void)
EPD_1IN54_V2_Reset(); EPD_1IN54_V2_Reset();
EPD_1IN54_V2_ReadBusy(); EPD_1IN54_V2_ReadBusy();
EPD_1IN54_V2_SetLut(WF_PARTIAL_1IN54_1); EPD_1IN54_V2_SetLut(WF_PARTIAL_1IN54_0);
EPD_1IN54_V2_SendCommand(0x37); EPD_1IN54_V2_SendCommand(0x37);
EPD_1IN54_V2_SendData(0x00); EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00); EPD_1IN54_V2_SendData(0x00);

View file

@ -0,0 +1,396 @@
/*****************************************************************************
* | File : EPD_2in13_V3.c
* | Author : Waveshare team
* | Function : 2.13inch e-paper V3
* | Info :
*----------------
* | This version: V1.1
* | Date : 2021-10-30
* | Info :
* -----------------------------------------------------------------------------
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_2in13_V3.h"
#include "Debug.h"
UBYTE WF_PARTIAL_2IN13_V3[159] =
{
0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x14,0x0,0x0,0x0,0x0,0x0,0x0,
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
0x22,0x17,0x41,0x00,0x32,0x36,
};
UBYTE WS_20_30_2IN13_V3[159] =
{
0x80, 0x4A, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x40, 0x4A, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x80, 0x4A, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x40, 0x4A, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0xF, 0x0, 0x0, 0xF, 0x0, 0x0, 0x2,
0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, 0x0,
0x22, 0x17, 0x41, 0x0, 0x32, 0x36
};
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
static void EPD_2in13_V3_Reset(void)
{
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(20);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(20);
}
/******************************************************************************
function : send command
parameter:
Reg : Command register
******************************************************************************/
static void EPD_2in13_V3_SendCommand(UBYTE Reg)
{
DEV_Digital_Write(EPD_DC_PIN, 0);
DEV_Digital_Write(EPD_CS_PIN, 0);
DEV_SPI_WriteByte(Reg);
DEV_Digital_Write(EPD_CS_PIN, 1);
}
/******************************************************************************
function : send data
parameter:
Data : Write data
******************************************************************************/
static void EPD_2in13_V3_SendData(UBYTE Data)
{
DEV_Digital_Write(EPD_DC_PIN, 1);
DEV_Digital_Write(EPD_CS_PIN, 0);
DEV_SPI_WriteByte(Data);
DEV_Digital_Write(EPD_CS_PIN, 1);
}
/******************************************************************************
function : Wait until the busy_pin goes LOW
parameter:
******************************************************************************/
void EPD_2in13_V3_ReadBusy(void)
{
Debug("e-Paper busy\r\n");
while(1)
{ //=1 BUSY
if(DEV_Digital_Read(EPD_BUSY_PIN)==0)
break;
DEV_Delay_ms(10);
}
DEV_Delay_ms(10);
Debug("e-Paper busy release\r\n");
}
/******************************************************************************
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_2in13_V3_TurnOnDisplay(void)
{
EPD_2in13_V3_SendCommand(0x22); // Display Update Control
EPD_2in13_V3_SendData(0xc7);
EPD_2in13_V3_SendCommand(0x20); // Activate Display Update Sequence
EPD_2in13_V3_ReadBusy();
}
/******************************************************************************
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_2in13_V3_TurnOnDisplay_Partial(void)
{
EPD_2in13_V3_SendCommand(0x22); // Display Update Control
EPD_2in13_V3_SendData(0x0f); // fast:0x0c, quality:0x0f, 0xcf
EPD_2in13_V3_SendCommand(0x20); // Activate Display Update Sequence
EPD_2in13_V3_ReadBusy();
}
/******************************************************************************
function : Set lut
parameter:
lut : lut data
******************************************************************************/
static void EPD_2IN13_V3_LUT(UBYTE *lut)
{
UBYTE count;
EPD_2in13_V3_SendCommand(0x32);
for(count=0; count<153; count++)
EPD_2in13_V3_SendData(lut[count]);
EPD_2in13_V3_ReadBusy();
}
/******************************************************************************
function : Send lut data and configuration
parameter:
lut : lut data
******************************************************************************/
static void EPD_2IN13_V2_LUT_by_host(UBYTE *lut)
{
EPD_2IN13_V3_LUT((UBYTE *)lut); //lut
EPD_2in13_V3_SendCommand(0x3f);
EPD_2in13_V3_SendData(*(lut+153));
EPD_2in13_V3_SendCommand(0x03); // gate voltage
EPD_2in13_V3_SendData(*(lut+154));
EPD_2in13_V3_SendCommand(0x04); // source voltage
EPD_2in13_V3_SendData(*(lut+155)); // VSH
EPD_2in13_V3_SendData(*(lut+156)); // VSH2
EPD_2in13_V3_SendData(*(lut+157)); // VSL
EPD_2in13_V3_SendCommand(0x2c); // VCOM
EPD_2in13_V3_SendData(*(lut+158));
}
/******************************************************************************
function : Setting the display window
parameter:
Xstart : X-axis starting position
Ystart : Y-axis starting position
Xend : End position of X-axis
Yend : End position of Y-axis
******************************************************************************/
static void EPD_2in13_V3_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
{
EPD_2in13_V3_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
EPD_2in13_V3_SendData((Xstart>>3) & 0xFF);
EPD_2in13_V3_SendData((Xend>>3) & 0xFF);
EPD_2in13_V3_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
EPD_2in13_V3_SendData(Ystart & 0xFF);
EPD_2in13_V3_SendData((Ystart >> 8) & 0xFF);
EPD_2in13_V3_SendData(Yend & 0xFF);
EPD_2in13_V3_SendData((Yend >> 8) & 0xFF);
}
/******************************************************************************
function : Set Cursor
parameter:
Xstart : X-axis starting position
Ystart : Y-axis starting position
******************************************************************************/
static void EPD_2in13_V3_SetCursor(UWORD Xstart, UWORD Ystart)
{
EPD_2in13_V3_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
EPD_2in13_V3_SendData(Xstart & 0xFF);
EPD_2in13_V3_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
EPD_2in13_V3_SendData(Ystart & 0xFF);
EPD_2in13_V3_SendData((Ystart >> 8) & 0xFF);
}
/******************************************************************************
function : Initialize the e-Paper register
parameter:
******************************************************************************/
void EPD_2in13_V3_Init(void)
{
EPD_2in13_V3_Reset();
DEV_Delay_ms(100);
EPD_2in13_V3_ReadBusy();
EPD_2in13_V3_SendCommand(0x12); //SWRESET
EPD_2in13_V3_ReadBusy();
EPD_2in13_V3_SendCommand(0x01); //Driver output control
EPD_2in13_V3_SendData(0xf9);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendCommand(0x11); //data entry mode
EPD_2in13_V3_SendData(0x03);
EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, EPD_2in13_V3_HEIGHT-1);
EPD_2in13_V3_SetCursor(0, 0);
EPD_2in13_V3_SendCommand(0x3C); //BorderWavefrom
EPD_2in13_V3_SendData(0x05);
EPD_2in13_V3_SendCommand(0x21); // Display update control
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x80);
EPD_2in13_V3_SendCommand(0x18); //Read built-in temperature sensor
EPD_2in13_V3_SendData(0x80);
EPD_2in13_V3_ReadBusy();
EPD_2IN13_V2_LUT_by_host(WS_20_30_2IN13_V3);
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void EPD_2in13_V3_Clear(void)
{
UWORD Width, Height;
Width = (EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1);
Height = EPD_2in13_V3_HEIGHT;
EPD_2in13_V3_SendCommand(0x24);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2in13_V3_SendData(0XFF);
}
}
EPD_2in13_V3_TurnOnDisplay();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
image : Image data
******************************************************************************/
void EPD_2in13_V3_Display(UBYTE *Image)
{
UWORD Width, Height;
Width = (EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1);
Height = EPD_2in13_V3_HEIGHT;
EPD_2in13_V3_SendCommand(0x24);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2in13_V3_SendData(Image[i + j * Width]);
}
}
EPD_2in13_V3_TurnOnDisplay();
}
/******************************************************************************
function : Refresh a base image
parameter:
image : Image data
******************************************************************************/
void EPD_2in13_V3_Display_Base(UBYTE *Image)
{
UWORD Width, Height;
Width = (EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1);
Height = EPD_2in13_V3_HEIGHT;
EPD_2in13_V3_SendCommand(0x24); //Write Black and White image to RAM
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2in13_V3_SendData(Image[i + j * Width]);
}
}
EPD_2in13_V3_SendCommand(0x26); //Write Black and White image to RAM
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2in13_V3_SendData(Image[i + j * Width]);
}
}
EPD_2in13_V3_TurnOnDisplay();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and partial refresh
parameter:
image : Image data
******************************************************************************/
void EPD_2in13_V3_Display_Partial(UBYTE *Image)
{
UWORD Width, Height;
Width = (EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1);
Height = EPD_2in13_V3_HEIGHT;
//Reset
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(1);
DEV_Digital_Write(EPD_RST_PIN, 1);
EPD_2IN13_V2_LUT_by_host(WF_PARTIAL_2IN13_V3);
EPD_2in13_V3_SendCommand(0x37);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x40); ///RAM Ping-Pong enable
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendCommand(0x3C); //BorderWavefrom
EPD_2in13_V3_SendData(0x80);
EPD_2in13_V3_SendCommand(0x22); //Display Update Sequence Option
EPD_2in13_V3_SendData(0xC0); // Enable clock and Enable analog
EPD_2in13_V3_SendCommand(0x20); //Activate Display Update Sequence
EPD_2in13_V3_ReadBusy();
EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, EPD_2in13_V3_HEIGHT-1);
EPD_2in13_V3_SetCursor(0, 0);
EPD_2in13_V3_SendCommand(0x24); //Write Black and White image to RAM
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2in13_V3_SendData(Image[i + j * Width]);
}
}
EPD_2in13_V3_TurnOnDisplay_Partial();
}
/******************************************************************************
function : Enter sleep mode
parameter:
******************************************************************************/
void EPD_2in13_V3_Sleep(void)
{
EPD_2in13_V3_SendCommand(0x10); //enter deep sleep
EPD_2in13_V3_SendData(0x01);
DEV_Delay_ms(100);
}

View file

@ -0,0 +1,47 @@
/*****************************************************************************
* | File : EPD_2Iin13_V3.h
* | Author : Waveshare team
* | Function : 2.13inch e-paper V3
* | Info :
*----------------
* | This version: V1.1
* | Date : 2021-10-30
* | Info :
* -----------------------------------------------------------------------------
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#ifndef __EPD_2in13_V3_H_
#define __EPD_2in13_V3_H_
#include "DEV_Config.h"
// Display resolution
#define EPD_2in13_V3_WIDTH 122
#define EPD_2in13_V3_HEIGHT 250
void EPD_2in13_V3_Init(void);
void EPD_2in13_V3_Clear(void);
void EPD_2in13_V3_Display(UBYTE *Image);
void EPD_2in13_V3_Display_Base(UBYTE *Image);
void EPD_2in13_V3_Display_Partial(UBYTE *Image);
void EPD_2in13_V3_Sleep(void);
#endif

View file

@ -113,106 +113,114 @@
#include "Debug.h" #include "Debug.h"
static const unsigned char EPD_4IN2_lut_vcom0[] = { static const unsigned char EPD_4IN2_lut_vcom0[] = {
0x00, 0x17, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x08, 0x00, 0x00, 0x02,
0x00, 0x17, 0x17, 0x00, 0x00, 0x02, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x00, 0x0A, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x08, 0x00, 0x00, 0x02,
0x00, 0x0E, 0x0E, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
};
static const unsigned char EPD_4IN2_lut_ww[] = { static const unsigned char EPD_4IN2_lut_ww[] = {
0x40, 0x17, 0x00, 0x00, 0x00, 0x02, 0x50, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01, 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02,
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const unsigned char EPD_4IN2_lut_bw[] = { static const unsigned char EPD_4IN2_lut_bw[] = {
0x40, 0x17, 0x00, 0x00, 0x00, 0x02, 0x50, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01, 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02,
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const unsigned char EPD_4IN2_lut_wb[] = { static const unsigned char EPD_4IN2_lut_wb[] = {
0x80, 0x17, 0x00, 0x00, 0x00, 0x02, 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x80, 0x0A, 0x01, 0x00, 0x00, 0x01, 0x50, 0x08, 0x08, 0x00, 0x00, 0x02,
0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const unsigned char EPD_4IN2_lut_bb[] = { static const unsigned char EPD_4IN2_lut_bb[] = {
0x80, 0x17, 0x00, 0x00, 0x00, 0x02, 0x20, 0x08, 0x08, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01,
0x80, 0x0A, 0x01, 0x00, 0x00, 0x01, 0x10, 0x08, 0x08, 0x00, 0x00, 0x02,
0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
/******************************partial screen update LUT*********************************/ /******************************partial screen update LUT*********************************/
const unsigned char EPD_4IN2_Partial_lut_vcom1[] = { const unsigned char EPD_4IN2_Partial_lut_vcom1[] ={
0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x00, 0x01, 0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };
const unsigned char EPD_4IN2_Partial_lut_ww1[] = { const unsigned char EPD_4IN2_Partial_lut_ww1[] ={
0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x00, 0x01, 0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };
const unsigned char EPD_4IN2_Partial_lut_bw1[] = { const unsigned char EPD_4IN2_Partial_lut_bw1[] ={
0x80 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x20, 0x01, 0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };
const unsigned char EPD_4IN2_Partial_lut_wb1[] = { const unsigned char EPD_4IN2_Partial_lut_wb1[] ={
0x40 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x10, 0x01, 0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };
const unsigned char EPD_4IN2_Partial_lut_bb1[] = { const unsigned char EPD_4IN2_Partial_lut_bb1[] ={
0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, 0x00, 0x01,0x20, 0x01, 0x00, 0x01,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,
}; };
/******************************gray*********************************/ /******************************gray*********************************/
//0~3 gray //0~3 gray
const unsigned char EPD_4IN2_4Gray_lut_vcom[] = { const unsigned char EPD_4IN2_4Gray_lut_vcom[] =
{
0x00 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, 0x00 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
0x60 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, 0x60 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01, 0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
@ -223,7 +231,7 @@ const unsigned char EPD_4IN2_4Gray_lut_vcom[] = {
}; };
//R21 //R21
const unsigned char EPD_4IN2_4Gray_lut_ww[] = { const unsigned char EPD_4IN2_4Gray_lut_ww[] ={
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, 0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
0x10 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, 0x10 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
@ -233,7 +241,7 @@ const unsigned char EPD_4IN2_4Gray_lut_ww[] = {
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
}; };
//R22H r //R22H r
const unsigned char EPD_4IN2_4Gray_lut_bw[] = { const unsigned char EPD_4IN2_4Gray_lut_bw[] ={
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, 0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, 0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
@ -243,7 +251,7 @@ const unsigned char EPD_4IN2_4Gray_lut_bw[] = {
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
}; };
//R23H w //R23H w
const unsigned char EPD_4IN2_4Gray_lut_wb[] = { const unsigned char EPD_4IN2_4Gray_lut_wb[] ={
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, 0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, 0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
@ -253,7 +261,7 @@ const unsigned char EPD_4IN2_4Gray_lut_wb[] = {
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
}; };
//R24H b //R24H b
const unsigned char EPD_4IN2_4Gray_lut_bb[] = { const unsigned char EPD_4IN2_4Gray_lut_bb[] ={
0x80 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, 0x80 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
0x20 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, 0x20 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
@ -263,27 +271,26 @@ const unsigned char EPD_4IN2_4Gray_lut_bb[] = {
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
}; };
/****************************************************************************** /******************************************************************************
function : Software reset function : Software reset
parameter: parameter:
******************************************************************************/ ******************************************************************************/
static void EPD_4IN2_Reset(void) static void EPD_4IN2_Reset(void)
{ {
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(20);
DEV_Digital_Write(EPD_RST_PIN, 0); DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2); DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 1); DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(20); DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 0); DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2); DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 1); DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(20); DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 0); DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2); DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 1); DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(20); DEV_Delay_ms(10);
} }
/****************************************************************************** /******************************************************************************
@ -342,62 +349,52 @@ static void EPD_4IN2_TurnOnDisplay(void)
function : set the look-up tables function : set the look-up tables
parameter: parameter:
******************************************************************************/ ******************************************************************************/
static void EPD_4IN2_SetLut(void)
{
UWORD count;
EPD_4IN2_SendCommand(0x20); //g vcom
for(count=0; count<44; count++) {
EPD_4IN2_SendData(EPD_4IN2_lut_vcom0[count]);
}
EPD_4IN2_SendCommand(0x21);
for(count=0; count<42; count++) {
EPD_4IN2_SendData(EPD_4IN2_lut_ww[count]);
}
EPD_4IN2_SendCommand(0x22);
for(count=0; count<42; count++) {
EPD_4IN2_SendData(EPD_4IN2_lut_bw[count]);
}
EPD_4IN2_SendCommand(0x23);
for(count=0; count<42; count++) {
EPD_4IN2_SendData(EPD_4IN2_lut_wb[count]);
}
EPD_4IN2_SendCommand(0x24);
for(count=0; count<42; count++) {
EPD_4IN2_SendData(EPD_4IN2_lut_bb[count]);
}
}
static void EPD_4IN2_Partial_SetLut(void) static void EPD_4IN2_Partial_SetLut(void)
{ {
unsigned int count; unsigned int count;
EPD_4IN2_SendCommand(0x20); EPD_4IN2_SendCommand(0x20);
for(count=0; count<44; count++) { for(count=0;count<44;count++)
EPD_4IN2_SendData(EPD_4IN2_Partial_lut_vcom1[count]); {EPD_4IN2_SendData(EPD_4IN2_Partial_lut_vcom1[count]);}
}
EPD_4IN2_SendCommand(0x21); EPD_4IN2_SendCommand(0x21);
for(count=0; count<42; count++) { for(count=0;count<42;count++)
EPD_4IN2_SendData(EPD_4IN2_Partial_lut_ww1[count]); {EPD_4IN2_SendData(EPD_4IN2_Partial_lut_ww1[count]);}
}
EPD_4IN2_SendCommand(0x22); EPD_4IN2_SendCommand(0x22);
for(count=0; count<42; count++) { for(count=0;count<42;count++)
EPD_4IN2_SendData(EPD_4IN2_Partial_lut_bw1[count]); {EPD_4IN2_SendData(EPD_4IN2_Partial_lut_bw1[count]);}
}
EPD_4IN2_SendCommand(0x23); EPD_4IN2_SendCommand(0x23);
for(count=0; count<42; count++) { for(count=0;count<42;count++)
EPD_4IN2_SendData(EPD_4IN2_Partial_lut_wb1[count]); {EPD_4IN2_SendData(EPD_4IN2_Partial_lut_wb1[count]);}
}
EPD_4IN2_SendCommand(0x24); EPD_4IN2_SendCommand(0x24);
for(count=0; count<42; count++) { for(count=0;count<42;count++)
EPD_4IN2_SendData(EPD_4IN2_Partial_lut_bb1[count]); {EPD_4IN2_SendData(EPD_4IN2_Partial_lut_bb1[count]);}
} }
static void EPD_4IN2_SetLut(void)
{
unsigned int count;
EPD_4IN2_SendCommand(0x20);
for(count=0;count<36;count++)
{EPD_4IN2_SendData(EPD_4IN2_lut_vcom0[count]);}
EPD_4IN2_SendCommand(0x21);
for(count=0;count<36;count++)
{EPD_4IN2_SendData(EPD_4IN2_lut_ww[count]);}
EPD_4IN2_SendCommand(0x22);
for(count=0;count<36;count++)
{EPD_4IN2_SendData(EPD_4IN2_lut_bw[count]);}
EPD_4IN2_SendCommand(0x23);
for(count=0;count<36;count++)
{EPD_4IN2_SendData(EPD_4IN2_lut_wb[count]);}
EPD_4IN2_SendCommand(0x24);
for(count=0;count<36;count++)
{EPD_4IN2_SendData(EPD_4IN2_lut_bb[count]);}
} }
//LUT download //LUT download
@ -406,41 +403,36 @@ static void EPD_4IN2_4Gray_lut(void)
unsigned int count; unsigned int count;
{ {
EPD_4IN2_SendCommand(0x20); //vcom EPD_4IN2_SendCommand(0x20); //vcom
for(count=0; count<42; count++) { for(count=0;count<42;count++)
EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_vcom[count]); {EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_vcom[count]);}
}
EPD_4IN2_SendCommand(0x21); //red not use EPD_4IN2_SendCommand(0x21); //red not use
for(count=0; count<42; count++) { for(count=0;count<42;count++)
EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_ww[count]); {EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_ww[count]);}
}
EPD_4IN2_SendCommand(0x22); //bw r EPD_4IN2_SendCommand(0x22); //bw r
for(count=0; count<42; count++) { for(count=0;count<42;count++)
EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_bw[count]); {EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_bw[count]);}
}
EPD_4IN2_SendCommand(0x23); //wb w EPD_4IN2_SendCommand(0x23); //wb w
for(count=0; count<42; count++) { for(count=0;count<42;count++)
EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_wb[count]); {EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_wb[count]);}
}
EPD_4IN2_SendCommand(0x24); //bb b EPD_4IN2_SendCommand(0x24); //bb b
for(count=0; count<42; count++) { for(count=0;count<42;count++)
EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_bb[count]); {EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_bb[count]);}
}
EPD_4IN2_SendCommand(0x25); //vcom EPD_4IN2_SendCommand(0x25); //vcom
for(count=0; count<42; count++) { for(count=0;count<42;count++)
EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_ww[count]); {EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_ww[count]);}
}
} }
} }
/****************************************************************************** /******************************************************************************
function : Initialize the e-Paper register function : Initialize the e-Paper register
parameter: parameter:
******************************************************************************/ ******************************************************************************/
void EPD_4IN2_Init(void)
void EPD_4IN2_Init_Partial(void)
{ {
EPD_4IN2_Reset(); EPD_4IN2_Reset();
@ -460,7 +452,6 @@ void EPD_4IN2_Init(void)
EPD_4IN2_SendCommand(0x00); // panel setting EPD_4IN2_SendCommand(0x00); // panel setting
EPD_4IN2_SendData(0xbf); // KW-BF KWR-AF BWROTP 0f BWOTP 1f EPD_4IN2_SendData(0xbf); // KW-BF KWR-AF BWROTP 0f BWOTP 1f
EPD_4IN2_SendData(0x0d);
EPD_4IN2_SendCommand(0x30); // PLL setting EPD_4IN2_SendCommand(0x30); // PLL setting
EPD_4IN2_SendData(0x3C); // 3A 100HZ 29 150Hz 39 200HZ 31 171HZ EPD_4IN2_SendData(0x3C); // 3A 100HZ 29 150Hz 39 200HZ 31 171HZ
@ -472,12 +463,54 @@ void EPD_4IN2_Init(void)
EPD_4IN2_SendData(0x2c); EPD_4IN2_SendData(0x2c);
EPD_4IN2_SendCommand(0x82); // vcom_DC setting EPD_4IN2_SendCommand(0x82); // vcom_DC setting
EPD_4IN2_SendData(0x28); EPD_4IN2_SendData(0x12);
EPD_4IN2_SendCommand(0X50); // VCOM AND DATA INTERVAL SETTING EPD_4IN2_SendCommand(0X50); // VCOM AND DATA INTERVAL SETTING
EPD_4IN2_SendData(0x97); // 97white border 77black border VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7 EPD_4IN2_SendData(0x07); // 97white border 77black border VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7
EPD_4IN2_Partial_SetLut();
}
//UC8176C
void EPD_4IN2_Init_Fast(void)
{
EPD_4IN2_Reset();
EPD_4IN2_SendCommand(0x01); //POWER SETTING
EPD_4IN2_SendData (0x03);
EPD_4IN2_SendData (0x00);
EPD_4IN2_SendData (0x2b);
EPD_4IN2_SendData (0x2b);
EPD_4IN2_SendCommand(0x06); //boost soft start
EPD_4IN2_SendData (0x17); //A
EPD_4IN2_SendData (0x17); //B
EPD_4IN2_SendData (0x17); //C
EPD_4IN2_SendCommand(0x04);
EPD_4IN2_ReadBusy();
EPD_4IN2_SendCommand(0x00); //panel setting
EPD_4IN2_SendData(0xbf); //KW-bf KWR-2F BWROTP 0f BWOTP 1f
EPD_4IN2_SendCommand(0x30);
EPD_4IN2_SendData (0x3c); // 3A 100HZ 29 150Hz 39 200HZ 31 171HZ
EPD_4IN2_SendCommand(0x61); //resolution setting
EPD_4IN2_SendData (0x01);
EPD_4IN2_SendData (0x90); //400
EPD_4IN2_SendData (0x01); //300
EPD_4IN2_SendData (0x2c);
EPD_4IN2_SendCommand(0x82); //vcom_DC setting
EPD_4IN2_SendData (0x12);
EPD_4IN2_SendCommand(0X50);
EPD_4IN2_SendData(0x97);
EPD_4IN2_SetLut(); EPD_4IN2_SetLut();
} }
void EPD_4IN2_Init_4Gray(void) void EPD_4IN2_Init_4Gray(void)
@ -539,8 +572,9 @@ void EPD_4IN2_Clear(void)
EPD_4IN2_SendData(0xFF); EPD_4IN2_SendData(0xFF);
} }
} }
EPD_4IN2_SendCommand(0x12); //DISPLAY REFRESH EPD_4IN2_SendCommand(0x12); //DISPLAY REFRESH
DEV_Delay_ms(10); DEV_Delay_ms(1);
EPD_4IN2_TurnOnDisplay(); EPD_4IN2_TurnOnDisplay();
} }
@ -554,6 +588,13 @@ void EPD_4IN2_Display(UBYTE *Image)
Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1); Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1);
Height = EPD_4IN2_HEIGHT; Height = EPD_4IN2_HEIGHT;
EPD_4IN2_SendCommand(0x10);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_4IN2_SendData(0x00);
}
}
EPD_4IN2_SendCommand(0x13); EPD_4IN2_SendCommand(0x13);
for (UWORD j = 0; j < Height; j++) { for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) { for (UWORD i = 0; i < Width; i++) {
@ -561,26 +602,23 @@ void EPD_4IN2_Display(UBYTE *Image)
} }
} }
EPD_4IN2_SendCommand(0x12); //DISPLAY REFRESH
DEV_Delay_ms(10);
EPD_4IN2_TurnOnDisplay(); EPD_4IN2_TurnOnDisplay();
} }
void EPD_4IN2_PartialDisplay(UWORD X_start,UWORD Y_start,UWORD X_end,UWORD Y_end, UBYTE *Image) void EPD_4IN2_PartialDisplay(UWORD X_start,UWORD Y_start,UWORD X_end,UWORD Y_end, UBYTE *Image)
{ {
UWORD Width; UWORD Width, Height;
static UBYTE DATA[EPD_4IN2_WIDTH * EPD_4IN2_HEIGHT / 8] = {0x00};
Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1); Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1);
Height = EPD_4IN2_HEIGHT;
X_start = (X_start % 8 == 0)? (X_start): (X_start/8*8+8); X_start = (X_start % 8 == 0)? (X_start): (X_start/8*8+8);
X_end = (X_end % 8 == 0)? (X_end): (X_end/8*8+8); X_end = (X_end % 8 == 0)? (X_end): (X_end/8*8+8);
EPD_4IN2_SendCommand(0X50);
EPD_4IN2_SendData(0xf7);
DEV_Delay_ms(100);
EPD_4IN2_SendCommand(0x82); //vcom_DC setting
EPD_4IN2_SendData (0x08);
EPD_4IN2_SendCommand(0X50);
EPD_4IN2_SendData(0x47);
EPD_4IN2_Partial_SetLut();
EPD_4IN2_SendCommand(0x91); //This command makes the display enter partial mode EPD_4IN2_SendCommand(0x91); //This command makes the display enter partial mode
EPD_4IN2_SendCommand(0x90); //resolution setting EPD_4IN2_SendCommand(0x90); //resolution setting
EPD_4IN2_SendData ((X_start)/256); EPD_4IN2_SendData ((X_start)/256);
@ -599,13 +637,14 @@ void EPD_4IN2_PartialDisplay(UWORD X_start,UWORD Y_start,UWORD X_end,UWORD Y_end
EPD_4IN2_SendCommand(0x10); //writes Old data to SRAM for programming EPD_4IN2_SendCommand(0x10); //writes Old data to SRAM for programming
for (UWORD j = 0; j < Y_end - Y_start; j++) { for (UWORD j = 0; j < Y_end - Y_start; j++) {
for (UWORD i = 0; i < (X_end - X_start)/8; i++) { for (UWORD i = 0; i < (X_end - X_start)/8; i++) {
EPD_4IN2_SendData(Image[(Y_start + j)*Width + X_start/8 + i]); EPD_4IN2_SendData(DATA[(Y_start + j)*Width + X_start/8 + i]);
} }
} }
EPD_4IN2_SendCommand(0x13); //writes New data to SRAM. EPD_4IN2_SendCommand(0x13); //writes New data to SRAM.
for (UWORD j = 0; j < Y_end - Y_start; j++) { for (UWORD j = 0; j < Y_end - Y_start; j++) {
for (UWORD i = 0; i < (X_end - X_start)/8; i++) { for (UWORD i = 0; i < (X_end - X_start)/8; i++) {
EPD_4IN2_SendData(~Image[(Y_start + j)*Width + X_start/8 + i]); EPD_4IN2_SendData(~Image[(Y_start + j)*Width + X_start/8 + i]);
DATA[(Y_start + j)*Width + X_start/8 + i] = ~Image[(Y_start + j)*Width + X_start/8 + i];
} }
} }
@ -616,20 +655,26 @@ void EPD_4IN2_PartialDisplay(UWORD X_start,UWORD Y_start,UWORD X_end,UWORD Y_end
void EPD_4IN2_4GrayDisplay(const UBYTE *Image) void EPD_4IN2_4GrayDisplay(const UBYTE *Image)
{ {
UDOUBLE i,j,k; UDOUBLE i,j,k,m;
UBYTE temp1,temp2,temp3; UBYTE temp1,temp2,temp3;
/****Color display description**** /****Color display description****
white gray1 gray2 black white gray1 gray2 black
0x10| 01 01 00 00 0x10| 01 01 00 00
0x13| 01 00 01 00 0x13| 01 00 01 00
*********************************/ *********************************/
EPD_4IN2_SendCommand(0x10); EPD_4IN2_SendCommand(0x10);
// EPD_4IN2_HEIGHT
for(i=0; i<15000; i++) { //5808*4 46464 // EPD_4IN2_WIDTH
for(m = 0; m<EPD_4IN2_HEIGHT;m++)
for(i=0;i<EPD_4IN2_WIDTH/8;i++)
{
temp3=0; temp3=0;
for(j=0; j<2; j++) { for(j=0;j<2;j++)
temp1 = Image[i*2+j]; {
for(k=0; k<2; k++) {
temp1 = Image[(m*(EPD_4IN2_WIDTH/8)+i)*2+j];
for(k=0;k<2;k++)
{
temp2 = temp1&0xC0 ; temp2 = temp1&0xC0 ;
if(temp2 == 0xC0) if(temp2 == 0xC0)
temp3 |= 0x01;//white temp3 |= 0x01;//white
@ -662,11 +707,15 @@ void EPD_4IN2_4GrayDisplay(const UBYTE *Image)
} }
// new data // new data
EPD_4IN2_SendCommand(0x13); EPD_4IN2_SendCommand(0x13);
for(i=0; i<15000; i++) { //5808*4 46464 for(m = 0; m<EPD_4IN2_HEIGHT;m++)
for(i=0;i<EPD_4IN2_WIDTH/8;i++)
{
temp3=0; temp3=0;
for(j=0; j<2; j++) { for(j=0;j<2;j++)
temp1 = Image[i*2+j]; {
for(k=0; k<2; k++) { temp1 = Image[(m*(EPD_4IN2_WIDTH/8)+i)*2+j];
for(k=0;k<2;k++)
{
temp2 = temp1&0xC0 ; temp2 = temp1&0xC0 ;
if(temp2 == 0xC0) if(temp2 == 0xC0)
temp3 |= 0x01;//white temp3 |= 0x01;//white
@ -707,8 +756,12 @@ parameter:
******************************************************************************/ ******************************************************************************/
void EPD_4IN2_Sleep(void) void EPD_4IN2_Sleep(void)
{ {
EPD_4IN2_SendCommand(0x50); // DEEP_SLEEP
EPD_4IN2_SendData(0XF7);
EPD_4IN2_SendCommand(0x02); // POWER_OFF EPD_4IN2_SendCommand(0x02); // POWER_OFF
EPD_4IN2_ReadBusy(); EPD_4IN2_ReadBusy();
EPD_4IN2_SendCommand(0x07); // DEEP_SLEEP EPD_4IN2_SendCommand(0x07); // DEEP_SLEEP
EPD_4IN2_SendData(0XA5); EPD_4IN2_SendData(0XA5);
} }

View file

@ -118,7 +118,8 @@
#define EPD_4IN2_WIDTH 400 #define EPD_4IN2_WIDTH 400
#define EPD_4IN2_HEIGHT 300 #define EPD_4IN2_HEIGHT 300
void EPD_4IN2_Init(void); void EPD_4IN2_Init_Fast(void);
void EPD_4IN2_Init_Partial(void);
void EPD_4IN2_Clear(void); void EPD_4IN2_Clear(void);
void EPD_4IN2_Display(UBYTE *Image); void EPD_4IN2_Display(UBYTE *Image);
void EPD_4IN2_Sleep(void); void EPD_4IN2_Sleep(void);
@ -126,4 +127,6 @@ void EPD_4IN2_PartialDisplay(UWORD X_start,UWORD Y_start,UWORD X_end,UWORD Y_end
void EPD_4IN2_Init_4Gray(void); void EPD_4IN2_Init_4Gray(void);
void EPD_4IN2_4GrayDisplay(const UBYTE *Image); void EPD_4IN2_4GrayDisplay(const UBYTE *Image);
#endif #endif

View file

@ -24,4 +24,5 @@
2020-12-09添加新程序5.83inch V2 e-Paper例程。 2020-12-09添加新程序5.83inch V2 e-Paper例程。
2020-12-25添加新程序4.01inch (F) e-Paper例程。 2020-12-25添加新程序4.01inch (F) e-Paper例程。
2021-02-22添加新程序2.7inch B V2 e-Paper例程。 2021-02-22添加新程序2.7inch B V2 e-Paper例程。
2021-07-19: 1.54V2、2.13V3、2.9V2、7.5V2程序均采用外部波形,并提升了刷新速度 2021-07-191.54V2、2.13V3、2.9V2、7.5V2程序均采用外部波形,并提升了刷新速度
2021-11-01添加新程序2.13inch V3 e-Paper例程。

View file

@ -24,3 +24,4 @@
2020-12-25: Added new program 4.01inch (F) e-Paper routine. 2020-12-25: Added new program 4.01inch (F) e-Paper routine.
2021-02-22: Added new program 2.7inch B V2 e-Paper routine. 2021-02-22: Added new program 2.7inch B V2 e-Paper routine.
2021-07-19: 1.54v2, 2.13v3, 2.9v2, and 7.5v2 programs all use external waveforms and have improved refresh speed. 2021-07-19: 1.54v2, 2.13v3, 2.9v2, and 7.5v2 programs all use external waveforms and have improved refresh speed.
2021-11-01: Added new program 2.13inch V3 e-Paper routine.