2019.07.31
This commit is contained in:
parent
0c77852dae
commit
717cbb8d92
734 changed files with 2999 additions and 61893 deletions
|
|
@ -45,7 +45,7 @@ void setup()
|
|||
return;
|
||||
}
|
||||
//Serial.print("ClearFrameMemory\n");
|
||||
// epd.ClearFrameMemory(); // bit set = white, bit reset = black
|
||||
// epd.ClearFrameMemory(); // bit set = white, bit reset = black
|
||||
|
||||
/**
|
||||
* there are 2 memory areas embedded in the e-paper display
|
||||
|
|
|
|||
|
|
@ -1,65 +0,0 @@
|
|||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/**
|
||||
* @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
|
||||
|
|
@ -1,292 +0,0 @@
|
|||
/**
|
||||
* @filename : epd2in13.cpp
|
||||
* @brief : Implements for e-paper library
|
||||
* @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 <stdlib.h>
|
||||
#include "fepd2in13.h"
|
||||
|
||||
/**
|
||||
* full screen update LUT
|
||||
**/
|
||||
const unsigned char lut_vcomDC[] = {
|
||||
0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
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[] = {
|
||||
0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
const unsigned char lut_bw[] = {
|
||||
0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x0F, 0x0F, 0x00, 0x00, 0x03,
|
||||
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01,
|
||||
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
const unsigned char lut_wb[] = {
|
||||
0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
const unsigned char lut_bb[] = {
|
||||
0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
Epd::~Epd() {
|
||||
};
|
||||
|
||||
Epd::Epd() {
|
||||
reset_pin = RST_PIN;
|
||||
dc_pin = DC_PIN;
|
||||
cs_pin = CS_PIN;
|
||||
busy_pin = BUSY_PIN;
|
||||
width = EPD_WIDTH;
|
||||
height = EPD_HEIGHT;
|
||||
};
|
||||
|
||||
int Epd::Init() {
|
||||
Serial.begin(9600);
|
||||
/* this calls the peripheral hardware interface, see epdif */
|
||||
if (IfInit() != 0) {
|
||||
return -1;
|
||||
}
|
||||
/* EPD hardware init start */
|
||||
Reset();
|
||||
|
||||
SendCommand(0x01); //POWER SETTING
|
||||
SendData(0x03);
|
||||
SendData(0x00);
|
||||
SendData(0x2b);
|
||||
SendData(0x2b);
|
||||
SendData(0x03);
|
||||
|
||||
SendCommand(0x06); //boost soft start
|
||||
SendData(0x17); //A
|
||||
SendData(0x17); //B
|
||||
SendData(0x17); //C
|
||||
|
||||
SendCommand(0x04);
|
||||
// WaitUntilIdle();
|
||||
|
||||
SendCommand(0x00); //panel setting
|
||||
SendData(0xbf); //LUT from OTP£¬128x296
|
||||
SendData(0x0d); //VCOM to 0V fast
|
||||
|
||||
SendCommand(0x30); //PLL setting
|
||||
SendData(0x3a); // 3a 100HZ 29 150Hz 39 200HZ 31 171HZ
|
||||
|
||||
SendCommand(0x61); //resolution setting
|
||||
SendData(EPD_WIDTH);
|
||||
SendData((EPD_HEIGHT >> 8) & 0xff);
|
||||
SendData(EPD_HEIGHT& 0xff);
|
||||
|
||||
SendCommand(0x82); //vcom_DC setting
|
||||
SendData(0x28);
|
||||
/* EPD hardware init end */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: basic function for sending commands
|
||||
*/
|
||||
void Epd::SendCommand(unsigned char command) {
|
||||
DigitalWrite(dc_pin, LOW);
|
||||
SpiTransfer(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: basic function for sending data
|
||||
*/
|
||||
void Epd::SendData(unsigned char data) {
|
||||
DigitalWrite(dc_pin, HIGH);
|
||||
SpiTransfer(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: Wait until the busy_pin goes LOW
|
||||
*/
|
||||
void Epd::WaitUntilIdle(void) {
|
||||
while(DigitalRead(busy_pin) == HIGH) { //LOW: idle, HIGH: busy
|
||||
DelayMs(100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: module reset.
|
||||
* often used to awaken the module in deep sleep,
|
||||
* see Epd::Sleep();
|
||||
*/
|
||||
void Epd::Reset(void) {
|
||||
DigitalWrite(reset_pin, LOW); //module reset
|
||||
DelayMs(200);
|
||||
DigitalWrite(reset_pin, HIGH);
|
||||
DelayMs(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: set the look-up table register
|
||||
*/
|
||||
void Epd::SetFullReg(void)
|
||||
{
|
||||
SendCommand(0X50); //VCOM AND DATA INTERVAL SETTING
|
||||
SendData(0x97); //WBmode:VBDF 17|D7 VBDW 97 VBDB 57 WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7
|
||||
|
||||
unsigned int count;
|
||||
SendCommand(0x20);
|
||||
for(count=0; count<44; count++) {
|
||||
SendData(lut_vcomDC[count]);
|
||||
}
|
||||
|
||||
SendCommand(0x21);
|
||||
for(count=0; count<42; count++) {
|
||||
SendData(lut_ww[count]);
|
||||
}
|
||||
|
||||
SendCommand(0x22);
|
||||
for(count=0; count<42; count++) {
|
||||
SendData(lut_bw[count]);
|
||||
}
|
||||
|
||||
SendCommand(0x23);
|
||||
for(count=0; count<42; count++) {
|
||||
SendData(lut_wb[count]);
|
||||
}
|
||||
|
||||
SendCommand(0x24);
|
||||
for(count=0; count<42; count++) {
|
||||
SendData(lut_bb[count]);
|
||||
}
|
||||
}
|
||||
|
||||
void Epd::SetFrameMemory(const unsigned char* image_buffer) {
|
||||
unsigned char Width, Height, data;
|
||||
Width = (EPD_WIDTH % 8 == 0)? (EPD_WIDTH / 8 ): (EPD_WIDTH / 8 + 1);
|
||||
Height = EPD_HEIGHT;
|
||||
|
||||
SendCommand(0x10);
|
||||
for (int j = 0; j < Height; j++) {
|
||||
for (int i = 0; i < Width; i++) {
|
||||
SendData(0x00);
|
||||
}
|
||||
}
|
||||
DelayMs(10);
|
||||
|
||||
SendCommand(0x13);
|
||||
for (int j = 0; j < Height; j++) {
|
||||
for (int i = 0; i < Width; i++) {
|
||||
data = pgm_read_byte(&image_buffer[i + j * Width]);
|
||||
SendData(data);
|
||||
// Serial.print(data);
|
||||
}
|
||||
}
|
||||
DelayMs(10);
|
||||
|
||||
SetFullReg();
|
||||
DisplayFrame();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: clear the frame memory with the specified color.
|
||||
* this won't update the display.
|
||||
*/
|
||||
void Epd::ClearFrameMemory() {
|
||||
unsigned char Width, Height;
|
||||
Width = (EPD_WIDTH % 8 == 0)? (EPD_WIDTH / 8 ): (EPD_WIDTH / 8 + 1);
|
||||
Height = EPD_HEIGHT;
|
||||
|
||||
SendCommand(0x10);
|
||||
for (int j = 0; j < Height; j++) {
|
||||
for (int i = 0; i < Width; i++) {
|
||||
SendData(0x00);
|
||||
}
|
||||
}
|
||||
DelayMs(10);
|
||||
|
||||
SendCommand(0x13);
|
||||
for (int j = 0; j < Height; j++) {
|
||||
for (int i = 0; i < Width; i++) {
|
||||
SendData(0xFF);
|
||||
}
|
||||
}
|
||||
DelayMs(10);
|
||||
|
||||
SetFullReg();
|
||||
DisplayFrame();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: update the display
|
||||
* there are 2 memory areas embedded in the e-paper display
|
||||
* but once this function is called,
|
||||
* the the next action of SetFrameMemory or ClearFrame will
|
||||
* set the other memory area.
|
||||
*/
|
||||
void Epd::DisplayFrame(void) {
|
||||
SendCommand(0x12);
|
||||
DelayMs(100);
|
||||
WaitUntilIdle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: After this command is transmitted, the chip would enter the
|
||||
* deep-sleep mode to save power.
|
||||
* The deep sleep mode would return to standby by hardware reset.
|
||||
* You can use Epd::Init() to awaken
|
||||
*/
|
||||
void Epd::Sleep() {
|
||||
SendCommand(0X50);
|
||||
SendData(0xf7);
|
||||
SendCommand(0X02); //power off
|
||||
SendCommand(0X07); //deep sleep
|
||||
SendData(0xA5);
|
||||
}
|
||||
|
||||
|
||||
/* END OF FILE */
|
||||
|
||||
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/**
|
||||
* @filename : epd2in13.h
|
||||
* @brief : Header file for e-paper display library epd2in13.cpp
|
||||
* @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.
|
||||
*/
|
||||
|
||||
#ifndef FEPD2IN13_H
|
||||
#define FEPD2IN13_H
|
||||
|
||||
#include "epdif.h"
|
||||
|
||||
// Display resolution
|
||||
/* the resolution is 122x250 in fact */
|
||||
/* however, the logical resolution is 128x250 */
|
||||
#define EPD_WIDTH 104
|
||||
#define EPD_HEIGHT 212
|
||||
|
||||
class Epd : EpdIf {
|
||||
public:
|
||||
unsigned long width;
|
||||
unsigned long height;
|
||||
|
||||
Epd();
|
||||
~Epd();
|
||||
int Init();
|
||||
void SendCommand(unsigned char command);
|
||||
void SendData(unsigned char data);
|
||||
void WaitUntilIdle(void);
|
||||
void Reset(void);
|
||||
void SetFrameMemory(const unsigned char* image_buffer);
|
||||
void ClearFrameMemory();
|
||||
void DisplayFrame(void);
|
||||
void Sleep(void);
|
||||
|
||||
private:
|
||||
unsigned int reset_pin;
|
||||
unsigned int dc_pin;
|
||||
unsigned int cs_pin;
|
||||
unsigned int busy_pin;
|
||||
const unsigned char* lut;
|
||||
|
||||
void SetFullReg(void);
|
||||
};
|
||||
|
||||
#endif /* EPD2IN13_H */
|
||||
|
||||
/* END OF FILE */
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
DIR_Config = ./lib/Config
|
||||
DIR_EPD = ./lib/e-Paper
|
||||
DIR_FONTS = ./lib/Fonts
|
||||
DIR_GUI = ./lib/GUI
|
||||
DIR_Examples = ./examples
|
||||
DIR_BIN = ./bin
|
||||
|
||||
OBJ_C = $(wildcard ${DIR_EPD}/*.c ${DIR_Config}/*.c ${DIR_GUI}/*.c ${DIR_Examples}/*.c ${DIR_FONTS}/*.c)
|
||||
OBJ_O = $(patsubst %.c,${DIR_BIN}/%.o,$(notdir ${OBJ_C}))
|
||||
|
||||
TARGET = epd
|
||||
|
||||
CC = gcc
|
||||
|
||||
MSG = -g -O0 -Wall
|
||||
DEBUG = -D DEBUG
|
||||
# DEBUG =
|
||||
CFLAGS += $(MSG) $(DEBUG)
|
||||
|
||||
LIB = -I $(shell pwd)
|
||||
|
||||
${TARGET}:${OBJ_O}
|
||||
$(CC) $(CFLAGS) $(OBJ_O) -o $@
|
||||
|
||||
${DIR_BIN}/%.o:$(DIR_Examples)/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) -I $(DIR_GUI) -I $(DIR_EPD)
|
||||
|
||||
${DIR_BIN}/%.o:$(DIR_Config)/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
${DIR_BIN}/%.o:$(DIR_EPD)/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config)
|
||||
|
||||
${DIR_BIN}/%.o:$(DIR_FONTS)/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
${DIR_BIN}/%.o:$(DIR_GUI)/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config)
|
||||
|
||||
clean :
|
||||
rm $(DIR_BIN)/*.*
|
||||
rm $(TARGET)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,163 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1IN54_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | 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_1in54.h"
|
||||
|
||||
int EPD_1in54_test(void)
|
||||
{
|
||||
printf("EPD_1IN54_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54_Init(EPD_1IN54_FULL);
|
||||
EPD_1IN54_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_1IN54_WIDTH % 8 == 0)? (EPD_1IN54_WIDTH / 8 ): (EPD_1IN54_WIDTH / 8 + 1)) * EPD_1IN54_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN54_WIDTH, EPD_1IN54_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 50, 50);
|
||||
EPD_1IN54_Display(BlackImage);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/1in54.bmp", 0, 0);
|
||||
EPD_1IN54_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_1in54);
|
||||
|
||||
EPD_1IN54_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("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_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(170, 85, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 85, "waveshare", &Font20, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 110, 123456789, &Font20, BLACK, WHITE);
|
||||
|
||||
Paint_DrawString_CN(5, 135,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 155, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_1IN54_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
EPD_1IN54_Init(EPD_1IN54_PART);
|
||||
Paint_SelectImage(BlackImage);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 20;
|
||||
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(15, 65, 15 + Font20.Width * 7, 65 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(15, 65, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_1IN54_Display(BlackImage);
|
||||
// DEV_Delay_ms(100);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54_Init(EPD_1IN54_FULL);
|
||||
EPD_1IN54_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,172 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN13_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper(V2) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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_V2.h"
|
||||
|
||||
int EPD_2in13_V2_test(void)
|
||||
{
|
||||
printf("EPD_2IN13_V2_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
|
||||
EPD_2IN13_V2_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1)) * EPD_2IN13_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN13_V2_WIDTH, EPD_2IN13_V2_HEIGHT, 270, WHITE);
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_SetMirroring(MIRROR_HORIZONTAL); //
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in13-v2.bmp", 0, 0);
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in13);
|
||||
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("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_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
|
||||
EPD_2IN13_V2_DisplayPartBaseImage(BlackImage);
|
||||
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_PART);
|
||||
Paint_SelectImage(BlackImage);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 20;
|
||||
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(140, 90, 140 + Font20.Width * 7, 90 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(140, 90, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2IN13_V2_DisplayPart(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
|
||||
EPD_2IN13_V2_Clear();
|
||||
DEV_Delay_ms(2000);//Analog clock 1s
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13_V2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(1000);//Analog clock 1s
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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_4in2.h"
|
||||
|
||||
int EPD_4in2_test(void)
|
||||
{
|
||||
printf("EPD_4IN2_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN2_Init();
|
||||
EPD_4IN2_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1)) * EPD_4IN2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_4IN2_WIDTH, EPD_4IN2_HEIGHT, 180, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_4IN2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/4in2.bmp", 0, 0);
|
||||
EPD_4IN2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_4in2);
|
||||
EPD_4IN2_Display(BlackImage);
|
||||
DEV_Delay_ms(500);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_4IN2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_4IN2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in83_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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_5in83.h"
|
||||
|
||||
int EPD_5in83_test(void)
|
||||
{
|
||||
printf("EPD_5IN83_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5IN83_Init();
|
||||
EPD_5IN83_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_5IN83_WIDTH % 8 == 0)? (EPD_5IN83_WIDTH / 8 ): (EPD_5IN83_WIDTH / 8 + 1)) * EPD_5IN83_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_5IN83_WIDTH, EPD_5IN83_HEIGHT, 180, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_5IN83_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/5in83.bmp", 0, 0);
|
||||
EPD_5IN83_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 0 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_5in83);
|
||||
EPD_5IN83_Display(BlackImage);
|
||||
DEV_Delay_ms(500);
|
||||
#endif
|
||||
|
||||
#if 0 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_5IN83_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5IN83_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5IN83_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in83bc_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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_5in83bc.h"
|
||||
|
||||
int EPD_5in83bc_test(void)
|
||||
{
|
||||
printf("EPD_5IN83BC_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5IN83BC_Init();
|
||||
EPD_5IN83BC_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage;
|
||||
UWORD Imagesize = ((EPD_5IN83BC_WIDTH % 8 == 0)? (EPD_5IN83BC_WIDTH / 8 ): (EPD_5IN83BC_WIDTH / 8 + 1)) * EPD_5IN83BC_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize / 2)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize / 2)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_5IN83BC_WIDTH, EPD_5IN83BC_HEIGHT / 2, 0, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_5IN83BC_WIDTH, EPD_5IN83BC_HEIGHT / 2, 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_5IN83BC_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/5in83bc-b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/5in83bc-ry.bmp", 0, 0);
|
||||
EPD_5IN83BC_Display(BlackImage, RYImage);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_5IN83BC_Display(gImage_5in83bc_b, gImage_5in83bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75,+ 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_5IN83BC_DisplayHalfScreen(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5IN83BC_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5IN83BC_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5bc_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | 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_7in5bc.h"
|
||||
|
||||
int EPD_7in5bc_test(void)
|
||||
{
|
||||
printf("EPD_7IN5BC_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5BC_Init();
|
||||
EPD_7IN5BC_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage;
|
||||
UWORD Imagesize = ((EPD_7IN5BC_WIDTH % 8 == 0)? (EPD_7IN5BC_WIDTH / 8 ): (EPD_7IN5BC_WIDTH / 8 + 1)) * EPD_7IN5BC_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize / 2)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize / 2)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5BC_WIDTH, EPD_7IN5BC_HEIGHT / 2, 0, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_7IN5BC_WIDTH, EPD_7IN5BC_HEIGHT / 2, 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_7IN5BC_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/7in5b-b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/7in5b-r.bmp", 0, 0);
|
||||
EPD_7IN5BC_Display(BlackImage, RYImage);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_7IN5BC_Display(gImage_7in5bc_b, gImage_7in5bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN5BC_DisplayHalfScreen(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5BC_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5BC_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* | File : DEV_Config.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : Hardware underlying interface
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-05
|
||||
* | 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 "DEV_Config.h"
|
||||
|
||||
/******************************************************************************
|
||||
function: Initialization pin
|
||||
parameter:
|
||||
Info:
|
||||
******************************************************************************/
|
||||
static void DEV_GPIOConfig(void)
|
||||
{
|
||||
SYSFS_GPIO_Export(EPD_CS_PIN);
|
||||
SYSFS_GPIO_Export(EPD_DC_PIN);
|
||||
SYSFS_GPIO_Export(EPD_RST_PIN);
|
||||
SYSFS_GPIO_Export(EPD_BUSY_PIN);
|
||||
|
||||
SYSFS_GPIO_Direction(EPD_CS_PIN, OUT);
|
||||
SYSFS_GPIO_Direction(EPD_DC_PIN, OUT);
|
||||
SYSFS_GPIO_Direction(EPD_RST_PIN, OUT);
|
||||
SYSFS_GPIO_Direction(EPD_BUSY_PIN, IN);
|
||||
}
|
||||
|
||||
void DEV_Delay_us(UWORD xus)
|
||||
{
|
||||
for(int j=xus; j > 0; j--);
|
||||
}
|
||||
|
||||
void DEV_Delay_ms(UWORD xms)
|
||||
{
|
||||
for(int j=xms; j > 0; j--)
|
||||
for(int j=xms; j > 0; j--);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Module Initialize, the BCM2835 library and initialize the pins, SPI protocol
|
||||
parameter:
|
||||
Info:
|
||||
******************************************************************************/
|
||||
UBYTE DEV_Module_Init(void)
|
||||
{
|
||||
DEV_GPIOConfig();
|
||||
|
||||
SYSFS_software_spi_begin();
|
||||
SYSFS_software_spi_setBitOrder(SOFTWARE_SPI_MSBFIRST);
|
||||
SYSFS_software_spi_setDataMode(SOFTWARE_SPI_Mode0);
|
||||
SYSFS_software_spi_setClockDivider(SOFTWARE_SPI_CLOCK_DIV4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DEV_SPI_WriteByte(UBYTE value)
|
||||
{
|
||||
SYSFS_software_spi_transfer(value);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Module exits, closes SPI and BCM2835 library
|
||||
parameter:
|
||||
Info:
|
||||
******************************************************************************/
|
||||
void DEV_Module_Exit(void)
|
||||
{
|
||||
SYSFS_software_spi_end();
|
||||
|
||||
SYSFS_GPIO_Write(EPD_CS_PIN, LOW);
|
||||
SYSFS_GPIO_Write(EPD_DC_PIN, LOW);
|
||||
SYSFS_GPIO_Write(EPD_RST_PIN, LOW);
|
||||
|
||||
SYSFS_GPIO_Unexport(EPD_CS_PIN);
|
||||
SYSFS_GPIO_Unexport(EPD_DC_PIN);
|
||||
SYSFS_GPIO_Unexport(EPD_RST_PIN);
|
||||
SYSFS_GPIO_Unexport(EPD_BUSY_PIN);
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* | File : DEV_Config.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : Hardware underlying interface
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-04
|
||||
* | 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 _DEV_CONFIG_H_
|
||||
#define _DEV_CONFIG_H_
|
||||
|
||||
#include "sysfs_gpio.h"
|
||||
#include "sysfs_software_spi.h"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/**
|
||||
* data
|
||||
**/
|
||||
#define UBYTE uint8_t
|
||||
#define UWORD uint16_t
|
||||
#define UDOUBLE uint32_t
|
||||
|
||||
/**
|
||||
* GPIO config
|
||||
**/
|
||||
// #define EPD_MOSI_PIN SPI0_MOSI
|
||||
// #define EPD_SCK_PIN SPI0_SCK
|
||||
#define EPD_CS_PIN SPI0_CS0
|
||||
#define EPD_DC_PIN GPIO25
|
||||
#define EPD_RST_PIN GPIO17
|
||||
#define EPD_BUSY_PIN GPIO24
|
||||
|
||||
/**
|
||||
* GPIO read and write
|
||||
**/
|
||||
#define DEV_Digital_Write(_pin, _value) SYSFS_GPIO_Write(_pin, _value)
|
||||
#define DEV_Digital_Read(_pin) SYSFS_GPIO_Read(_pin)
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------*/
|
||||
UBYTE DEV_Module_Init(void);
|
||||
void DEV_Module_Exit(void);
|
||||
void DEV_Delay_us(UWORD xus);
|
||||
void DEV_Delay_ms(UWORD xms);
|
||||
void DEV_SPI_WriteByte(UBYTE value);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,465 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file Font12.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 18-February-2014
|
||||
* @brief This file provides text Font12 for STM32xx-EVAL's LCD driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "fonts.h"
|
||||
|
||||
|
||||
//
|
||||
// Font data for Courier New 12pt
|
||||
//
|
||||
|
||||
const CH_CN Font24CN_Table[] =
|
||||
{
|
||||
/*-- 文字: 你 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"你",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC1,0xC0,0x00,
|
||||
0x01,0xE3,0xE0,0x00,0x03,0xE3,0xC0,0x00,0x03,0xC7,0x80,0x00,0x03,0xC7,0xFF,0xFF,
|
||||
0x07,0x8F,0xFF,0xFF,0x07,0x8F,0x00,0x0F,0x0F,0x1E,0x00,0x1E,0x0F,0x3C,0x1E,0x1E,
|
||||
0x1F,0x3C,0x1E,0x3E,0x1F,0x18,0x1E,0x3C,0x3F,0x00,0x1E,0x1C,0x7F,0x00,0x1E,0x00,
|
||||
0x7F,0x07,0x9E,0x70,0xFF,0x07,0x9E,0xF0,0xEF,0x0F,0x9E,0x78,0x6F,0x0F,0x1E,0x78,
|
||||
0x0F,0x0F,0x1E,0x3C,0x0F,0x1E,0x1E,0x3C,0x0F,0x1E,0x1E,0x1E,0x0F,0x3C,0x1E,0x1E,
|
||||
0x0F,0x3C,0x1E,0x1F,0x0F,0x7C,0x1E,0x0F,0x0F,0x78,0x1E,0x0E,0x0F,0x00,0x1E,0x00,
|
||||
0x0F,0x00,0x1E,0x00,0x0F,0x00,0x3C,0x00,0x0F,0x07,0xFC,0x00,0x0F,0x07,0xF8,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 好 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"好",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,
|
||||
0x0F,0x07,0xFF,0xFE,0x0F,0x07,0xFF,0xFE,0x0F,0x00,0x00,0x3E,0x1E,0x00,0x00,0xFC,
|
||||
0xFF,0xF8,0x01,0xF0,0xFF,0xF8,0x03,0xE0,0x1E,0x78,0x07,0xC0,0x1E,0x78,0x0F,0x80,
|
||||
0x3C,0x78,0x0F,0x00,0x3C,0x78,0x0F,0x00,0x3C,0x78,0x0F,0x00,0x3C,0x78,0x0F,0x00,
|
||||
0x3C,0x7F,0xFF,0xFF,0x78,0xFF,0xFF,0xFF,0x78,0xF0,0x0F,0x00,0x78,0xF0,0x0F,0x00,
|
||||
0x3D,0xE0,0x0F,0x00,0x1F,0xE0,0x0F,0x00,0x0F,0xE0,0x0F,0x00,0x07,0xC0,0x0F,0x00,
|
||||
0x07,0xE0,0x0F,0x00,0x07,0xF0,0x0F,0x00,0x0F,0xF8,0x0F,0x00,0x1E,0x7C,0x0F,0x00,
|
||||
0x3C,0x38,0x0F,0x00,0x78,0x00,0x0F,0x00,0xF0,0x03,0xFF,0x00,0x60,0x01,0xFE,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 微 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"微",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x01,0xE0,0x07,0x87,0x01,0xE0,
|
||||
0x07,0x07,0x01,0xC0,0x0F,0xF7,0x79,0xC0,0x1E,0xF7,0x7B,0xC0,0x1E,0xF7,0x7B,0x80,
|
||||
0x3C,0xF7,0x7B,0xFF,0x78,0xF7,0x7B,0xFF,0xF8,0xF7,0x7F,0x9E,0xF7,0xFF,0xFF,0x9E,
|
||||
0x67,0xFF,0xFF,0x9E,0x07,0x00,0x7F,0x9C,0x0F,0x00,0x0F,0x9C,0x1E,0x00,0x1F,0x9C,
|
||||
0x1E,0x7F,0xFF,0xBC,0x3E,0x7F,0xF3,0xFC,0x3E,0x00,0x03,0xFC,0x7E,0x00,0x01,0xF8,
|
||||
0xFE,0x00,0x01,0xF8,0xFE,0x7F,0xE1,0xF8,0xDE,0x7F,0xE1,0xF8,0x1E,0x78,0xE0,0xF0,
|
||||
0x1E,0x78,0xEE,0xF0,0x1E,0x78,0xFF,0xF0,0x1E,0x78,0xFD,0xF8,0x1E,0x79,0xFB,0xFC,
|
||||
0x1E,0xF1,0xF7,0xBC,0x1E,0xF0,0xEF,0x9E,0x1F,0xE0,0x0F,0x0F,0x1E,0xC0,0x1E,0x0F,
|
||||
0x1E,0x00,0x0C,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 软 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"软",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x03,0xC0,0x78,0x00,0x07,0x80,0x78,0x00,0x07,0x80,0x78,0x00,
|
||||
0x07,0x80,0xF0,0x00,0x0F,0x00,0xF0,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
0x1E,0x03,0xC0,0x1F,0x1E,0x03,0xC0,0x1E,0x1F,0xE7,0x8F,0x3E,0x3D,0xE7,0x8F,0x3C,
|
||||
0x3D,0xEF,0x0F,0x7C,0x3D,0xE7,0x0F,0x78,0x79,0xE0,0x0F,0x00,0x79,0xE0,0x0E,0x00,
|
||||
0x7F,0xFE,0x0E,0x00,0x7F,0xFE,0x1F,0x00,0x01,0xE0,0x1F,0x00,0x01,0xE0,0x1F,0x00,
|
||||
0x01,0xE0,0x1F,0x80,0x01,0xE0,0x1F,0x80,0x01,0xE0,0x3F,0x80,0x01,0xFF,0x3F,0xC0,
|
||||
0x0F,0xFF,0x7B,0xC0,0xFF,0xF0,0x79,0xE0,0xF9,0xE0,0xF1,0xF0,0x01,0xE1,0xF0,0xF0,
|
||||
0x01,0xE3,0xE0,0xF8,0x01,0xE7,0xC0,0x7C,0x01,0xFF,0x80,0x3F,0x01,0xFF,0x00,0x1F,
|
||||
0x01,0xEC,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 雅 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"雅",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x77,0x00,0x00,0x00,0xFF,0x00,
|
||||
0x7F,0xFC,0xF7,0x80,0x7F,0xFD,0xE3,0xC0,0x01,0xC1,0xE3,0xC0,0x01,0xC3,0xC1,0x80,
|
||||
0x3D,0xC7,0xFF,0xFF,0x39,0xC7,0xFF,0xFF,0x39,0xCF,0x83,0x80,0x79,0xDF,0x83,0x80,
|
||||
0x79,0xFF,0x83,0x80,0x79,0xDF,0x83,0x80,0x71,0xC3,0x83,0x80,0x7F,0xFF,0xFF,0xFE,
|
||||
0x7F,0xFF,0xFF,0xFE,0x03,0xC3,0x83,0x80,0x07,0xC3,0x83,0x80,0x07,0xC3,0x83,0x80,
|
||||
0x0F,0xC3,0x83,0x80,0x0F,0xC3,0x83,0x80,0x1F,0xC3,0xFF,0xFE,0x1D,0xC3,0xFF,0xFE,
|
||||
0x3D,0xC3,0x83,0x80,0x79,0xC3,0x83,0x80,0xF1,0xC3,0x83,0x80,0xF1,0xC3,0x83,0x80,
|
||||
0x61,0xC3,0x83,0x80,0x01,0xC3,0xFF,0xFF,0x03,0xC3,0xFF,0xFF,0x1F,0xC3,0x80,0x00,
|
||||
0x1F,0x83,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 黑 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"黑",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x1F,0xFF,0xFF,0xFC,0x1F,0xFF,0xFF,0xFC,0x1E,0x03,0xC0,0x3C,0x1E,0xC3,0xC7,0x3C,
|
||||
0x1F,0xE3,0xC7,0xBC,0x1E,0xF3,0xCF,0x3C,0x1E,0xFB,0xDF,0x3C,0x1E,0x7B,0xDE,0x3C,
|
||||
0x1E,0x33,0xDC,0x3C,0x1E,0x03,0xC0,0x3C,0x1F,0xFF,0xFF,0xFC,0x1F,0xFF,0xFF,0xFC,
|
||||
0x1E,0x03,0xC0,0x3C,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x3F,0xFF,0xFF,0xFC,
|
||||
0x3F,0xFF,0xFF,0xFC,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x1C,0x38,0x70,0x70,
|
||||
0x3E,0x78,0xF8,0xF8,0x3C,0x7C,0x78,0x7C,0x7C,0x3C,0x3C,0x3E,0xF8,0x3E,0x3C,0x1F,
|
||||
0xF0,0x1C,0x18,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 此 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"此",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x3C,0x00,
|
||||
0x00,0x78,0x3C,0x00,0x00,0x78,0x3C,0x00,0x00,0x78,0x3C,0x00,0x00,0x78,0x3C,0x00,
|
||||
0x00,0x78,0x3C,0x0C,0x3C,0x78,0x3C,0x1E,0x3C,0x78,0x3C,0x3F,0x3C,0x78,0x3C,0xF8,
|
||||
0x3C,0x7F,0xFD,0xF0,0x3C,0x7F,0xFF,0xE0,0x3C,0x78,0x3F,0x80,0x3C,0x78,0x3E,0x00,
|
||||
0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x00,
|
||||
0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x0E,0x3C,0x78,0x3C,0x0F,
|
||||
0x3C,0x78,0x3C,0x0F,0x3C,0x79,0xFC,0x0F,0x3C,0x7F,0xFC,0x0F,0x3F,0xFF,0x3C,0x0F,
|
||||
0x3F,0xF0,0x3E,0x1E,0xFF,0x00,0x1F,0xFE,0xF0,0x00,0x0F,0xFC,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 字 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"字",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x03,0xC0,0x00,
|
||||
0x00,0x03,0xE0,0x00,0x00,0x01,0xE0,0x00,0x7F,0xFF,0xFF,0xFE,0x7F,0xFF,0xFF,0xFE,
|
||||
0x78,0x00,0x00,0x1E,0x78,0x00,0x00,0x1E,0x78,0x00,0x00,0x1E,0x78,0x00,0x00,0x1E,
|
||||
0x7B,0xFF,0xFF,0xDE,0x03,0xFF,0xFF,0xC0,0x00,0x00,0x0F,0xC0,0x00,0x00,0x3F,0x00,
|
||||
0x00,0x00,0x7E,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,
|
||||
0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,
|
||||
0x00,0x03,0xE0,0x00,0x00,0x03,0xC0,0x00,0x00,0xFF,0xC0,0x00,0x00,0xFF,0x80,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 体 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"体",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x3C,0x00,
|
||||
0x03,0xC0,0x3C,0x00,0x03,0xC0,0x3C,0x00,0x07,0x80,0x3C,0x00,0x07,0x80,0x3C,0x00,
|
||||
0x07,0x80,0x3C,0x00,0x0F,0xFF,0xFF,0xFF,0x0F,0xFF,0xFF,0xFF,0x1F,0x01,0xFE,0x00,
|
||||
0x1F,0x01,0xFF,0x00,0x3F,0x01,0xFF,0x00,0x3F,0x03,0xFF,0x00,0x7F,0x03,0xFF,0x80,
|
||||
0x7F,0x07,0xBF,0x80,0xFF,0x07,0xBF,0xC0,0xEF,0x0F,0x3D,0xC0,0xCF,0x0F,0x3D,0xE0,
|
||||
0x0F,0x1E,0x3D,0xE0,0x0F,0x1E,0x3C,0xF0,0x0F,0x3C,0x3C,0x78,0x0F,0x7C,0x3C,0x7C,
|
||||
0x0F,0xF8,0x3C,0x3E,0x0F,0xF7,0xFF,0xDF,0x0F,0xE7,0xFF,0xCF,0x0F,0xC0,0x3C,0x06,
|
||||
0x0F,0x00,0x3C,0x00,0x0F,0x00,0x3C,0x00,0x0F,0x00,0x3C,0x00,0x0F,0x00,0x3C,0x00,
|
||||
0x0F,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 下 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"下",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
|
||||
0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
|
||||
0x00,0x0F,0xE0,0x00,0x00,0x0F,0xF8,0x00,0x00,0x0F,0xFC,0x00,0x00,0x0F,0xBF,0x00,
|
||||
0x00,0x0F,0x9F,0x80,0x00,0x0F,0x87,0xE0,0x00,0x0F,0x83,0xF0,0x00,0x0F,0x80,0xF8,
|
||||
0x00,0x0F,0x80,0x7C,0x00,0x0F,0x80,0x38,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
|
||||
0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
|
||||
0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 对 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"对",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,
|
||||
0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x7F,0xFC,0x00,0x78,0x7F,0xFC,0x00,0x78,
|
||||
0x00,0x3C,0x00,0x78,0x00,0x3F,0xFF,0xFF,0x30,0x3F,0xFF,0xFF,0x78,0x3C,0x00,0x78,
|
||||
0x3C,0x38,0x00,0x78,0x3E,0x78,0x00,0x78,0x1E,0x78,0xC0,0x78,0x0F,0x79,0xE0,0x78,
|
||||
0x0F,0xF0,0xF0,0x78,0x07,0xF0,0xF8,0x78,0x03,0xF0,0x78,0x78,0x01,0xE0,0x3C,0x78,
|
||||
0x03,0xF0,0x3E,0x78,0x03,0xF0,0x18,0x78,0x07,0xF8,0x00,0x78,0x07,0xFC,0x00,0x78,
|
||||
0x0F,0x3E,0x00,0x78,0x1F,0x1E,0x00,0x78,0x3E,0x1F,0x00,0x78,0x7C,0x0E,0x00,0xF8,
|
||||
0xF8,0x00,0x00,0xF0,0xF0,0x00,0x3F,0xF0,0x60,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 应 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"应",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x03,0xE0,0x00,0x00,0x01,0xE0,0x00,
|
||||
0x00,0x01,0xF0,0x00,0x00,0x00,0xF0,0x00,0x1F,0xFF,0xFF,0xFF,0x1F,0xFF,0xFF,0xFF,
|
||||
0x1E,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x1E,0x01,0xE0,0x78,0x1E,0x01,0xE0,0x78,
|
||||
0x1E,0xE1,0xE0,0x78,0x1F,0xF1,0xF0,0xF8,0x1E,0xF0,0xF0,0xF0,0x1E,0xF0,0xF0,0xF0,
|
||||
0x1E,0xF8,0xF0,0xF0,0x1E,0x78,0xF1,0xF0,0x1E,0x78,0xF9,0xE0,0x1E,0x78,0x79,0xE0,
|
||||
0x1E,0x7C,0x7B,0xE0,0x1E,0x3C,0x7B,0xC0,0x1E,0x3C,0x7B,0xC0,0x1E,0x3C,0x7B,0xC0,
|
||||
0x3C,0x3E,0x07,0x80,0x3C,0x1C,0x07,0x80,0x3C,0x00,0x07,0x80,0x3C,0x00,0x0F,0x00,
|
||||
0x78,0x00,0x0F,0x00,0x7B,0xFF,0xFF,0xFF,0xF3,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,
|
||||
0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 的 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"的",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x3C,0x00,0x07,0xC0,0x3E,0x00,
|
||||
0x07,0x80,0x3C,0x00,0x07,0x80,0x7C,0x00,0x0F,0x00,0x78,0x00,0x7F,0xFE,0x7F,0xFE,
|
||||
0x7F,0xFE,0xFF,0xFE,0x78,0x1E,0xF0,0x1E,0x78,0x1F,0xE0,0x1E,0x78,0x1F,0xE0,0x1E,
|
||||
0x78,0x1F,0xC0,0x1E,0x78,0x1F,0xC0,0x1E,0x78,0x1F,0xF0,0x1E,0x78,0x1E,0xF8,0x1E,
|
||||
0x78,0x1E,0x7C,0x1E,0x7F,0xFE,0x3C,0x1E,0x7F,0xFE,0x1E,0x1E,0x78,0x1E,0x1F,0x1E,
|
||||
0x78,0x1E,0x0F,0x9E,0x78,0x1E,0x07,0x9E,0x78,0x1E,0x07,0x1E,0x78,0x1E,0x00,0x1E,
|
||||
0x78,0x1E,0x00,0x1E,0x78,0x1E,0x00,0x3E,0x78,0x1E,0x00,0x3C,0x78,0x1E,0x00,0x3C,
|
||||
0x7F,0xFE,0x00,0x3C,0x7F,0xFE,0x00,0x7C,0x78,0x1E,0x3F,0xF8,0x78,0x1E,0x3F,0xF0,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 点 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"点",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
|
||||
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xFF,0xFF,0x00,0x03,0xFF,0xFF,
|
||||
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
|
||||
0x0F,0xFF,0xFF,0xF8,0x0F,0xFF,0xFF,0xF8,0x0F,0x00,0x00,0x78,0x0F,0x00,0x00,0x78,
|
||||
0x0F,0x00,0x00,0x78,0x0F,0x00,0x00,0x78,0x0F,0x00,0x00,0x78,0x0F,0x00,0x00,0x78,
|
||||
0x0F,0xFF,0xFF,0xF8,0x0F,0xFF,0xFF,0xF8,0x0F,0x00,0x00,0x78,0x00,0x00,0x00,0x00,
|
||||
0x0C,0x38,0x38,0x30,0x1E,0x7C,0x78,0x78,0x3E,0x3C,0x78,0x78,0x3C,0x3C,0x3C,0x3C,
|
||||
0x7C,0x3E,0x3C,0x3E,0xF8,0x1E,0x3C,0x1E,0xF0,0x1E,0x1E,0x1F,0x70,0x1E,0x1C,0x0E,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 阵 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"阵",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x78,0x00,
|
||||
0x7F,0xF0,0x78,0x00,0x7F,0xF0,0x78,0x00,0x79,0xFF,0xFF,0xFF,0x79,0xFF,0xFF,0xFF,
|
||||
0x79,0xE1,0xE0,0x00,0x79,0xE1,0xE0,0x00,0x7B,0xC1,0xEF,0x80,0x7B,0xC3,0xCF,0x80,
|
||||
0x7B,0xC3,0xCF,0x80,0x7F,0x87,0xCF,0x80,0x7F,0x87,0x8F,0x80,0x7F,0x87,0x8F,0x80,
|
||||
0x7B,0xCF,0x0F,0x80,0x7B,0xCF,0xFF,0xFE,0x79,0xEF,0xFF,0xFE,0x79,0xE0,0x0F,0x80,
|
||||
0x78,0xE0,0x0F,0x80,0x78,0xF0,0x0F,0x80,0x78,0xF0,0x0F,0x80,0x78,0xF0,0x0F,0x80,
|
||||
0x78,0xFF,0xFF,0xFF,0x79,0xFF,0xFF,0xFF,0x7F,0xE0,0x0F,0x80,0x7F,0xC0,0x0F,0x80,
|
||||
0x78,0x00,0x0F,0x80,0x78,0x00,0x0F,0x80,0x78,0x00,0x0F,0x80,0x78,0x00,0x0F,0x80,
|
||||
0x78,0x00,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 为 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"为",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,
|
||||
0x0E,0x07,0x80,0x00,0x1F,0x07,0x80,0x00,0x0F,0x87,0x80,0x00,0x07,0xC7,0x80,0x00,
|
||||
0x01,0xE7,0x80,0x00,0x00,0xC7,0x80,0x00,0x00,0x07,0x80,0x00,0x7F,0xFF,0xFF,0xFC,
|
||||
0x7F,0xFF,0xFF,0xFC,0x00,0x07,0x80,0x3C,0x00,0x0F,0x80,0x3C,0x00,0x0F,0x00,0x3C,
|
||||
0x00,0x0F,0x00,0x3C,0x00,0x0F,0x60,0x3C,0x00,0x1F,0xF0,0x3C,0x00,0x1E,0x78,0x3C,
|
||||
0x00,0x3E,0x3C,0x3C,0x00,0x3C,0x3E,0x3C,0x00,0x7C,0x1F,0x3C,0x00,0x78,0x0F,0x3C,
|
||||
0x00,0xF8,0x06,0x3C,0x01,0xF0,0x00,0x3C,0x03,0xE0,0x00,0x7C,0x07,0xC0,0x00,0x7C,
|
||||
0x0F,0x80,0x00,0x78,0x1F,0x00,0x00,0xF8,0x3E,0x00,0xFF,0xF0,0x7C,0x00,0xFF,0xE0,
|
||||
0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 树 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"树",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x38,
|
||||
0x0F,0x00,0x00,0x38,0x0F,0x00,0x00,0x38,0x0F,0x3F,0xF8,0x38,0x0F,0x3F,0xF8,0x38,
|
||||
0x0F,0x00,0x78,0x38,0xFF,0xE0,0x7F,0xFF,0xFF,0xE0,0x7F,0xFF,0x0F,0x00,0x70,0x38,
|
||||
0x0F,0x18,0xF0,0x38,0x1F,0x3C,0xF0,0x38,0x1F,0x1C,0xFE,0x38,0x1F,0xDE,0xFE,0x38,
|
||||
0x3F,0xEF,0xEF,0x38,0x3F,0xFF,0xEF,0x38,0x3F,0xF7,0xE7,0xB8,0x7F,0x67,0xC7,0xB8,
|
||||
0x7F,0x03,0xC3,0xB8,0xFF,0x07,0xE0,0x38,0xEF,0x07,0xE0,0x38,0xEF,0x0F,0xF0,0x38,
|
||||
0xCF,0x1F,0xF0,0x38,0x0F,0x1E,0x78,0x38,0x0F,0x3C,0x7C,0x38,0x0F,0x78,0x3C,0x38,
|
||||
0x0F,0xF8,0x38,0x38,0x0F,0x60,0x00,0x78,0x0F,0x00,0x0F,0xF8,0x0F,0x00,0x07,0xF0,
|
||||
0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 莓 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"莓",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x1E,0x00,0x00,0x3C,0x1E,0x00,
|
||||
0x00,0x3C,0x1E,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x3C,0x1E,0x00,
|
||||
0x07,0xBC,0x1E,0x00,0x07,0x80,0x00,0x00,0x0F,0xFF,0xFF,0xFC,0x0F,0xFF,0xFF,0xFC,
|
||||
0x1E,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xF0,
|
||||
0xF7,0xFF,0xFF,0xF0,0x37,0x83,0x80,0xF0,0x07,0x87,0xC0,0xF0,0x07,0x83,0xF0,0xF0,
|
||||
0x07,0x00,0xE0,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x0F,0x00,0xE0,
|
||||
0x0F,0x0F,0x81,0xE0,0x0E,0x03,0xE1,0xE0,0x1E,0x01,0xC1,0xE0,0x1F,0xFF,0xFF,0xFE,
|
||||
0x1F,0xFF,0xFF,0xFE,0x00,0x00,0x01,0xE0,0x00,0x00,0x03,0xC0,0x00,0x00,0xFF,0xC0,
|
||||
0x00,0x00,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 派 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"派",
|
||||
0x00,0x00,0x00,0x00,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,0x3E,
|
||||
0x7C,0x00,0x3F,0xFE,0x3F,0x3F,0xFF,0xF0,0x1F,0xBF,0xE0,0x00,0x07,0xBC,0x00,0x00,
|
||||
0x03,0x3C,0x00,0x00,0x00,0x3C,0x00,0x3C,0x00,0x3C,0x0F,0xFE,0x70,0x3D,0xFF,0xF8,
|
||||
0xF8,0x3D,0xFF,0x00,0x7C,0x3D,0xE7,0x80,0x3F,0x3D,0xE7,0x80,0x1F,0x3D,0xE7,0x8E,
|
||||
0x0E,0x3D,0xE7,0x9F,0x00,0x3D,0xE7,0xFE,0x00,0x39,0xE7,0xF8,0x00,0x39,0xE3,0xF0,
|
||||
0x1C,0x39,0xE3,0xC0,0x1E,0x79,0xE3,0xC0,0x1E,0x79,0xE1,0xE0,0x1E,0x79,0xE1,0xE0,
|
||||
0x3C,0x79,0xE0,0xF0,0x3C,0x79,0xE0,0xF8,0x3C,0xF1,0xE0,0x7C,0x3C,0xF1,0xE3,0x7C,
|
||||
0x7D,0xF1,0xEF,0x3F,0x79,0xE1,0xFE,0x1F,0x7B,0xE1,0xF8,0x0E,0x7B,0xC3,0xE0,0x00,
|
||||
0x79,0x81,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: A --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{
|
||||
"A",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x7C,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xFE,0x00,0x00,
|
||||
0x01,0xFF,0x00,0x00,0x01,0xFF,0x00,0x00,0x01,0xEF,0x00,0x00,0x03,0xEF,0x80,0x00,
|
||||
0x03,0xCF,0x80,0x00,0x07,0xC7,0x80,0x00,0x07,0xC7,0xC0,0x00,0x07,0x87,0xC0,0x00,
|
||||
0x0F,0x83,0xE0,0x00,0x0F,0x83,0xE0,0x00,0x0F,0x01,0xE0,0x00,0x1F,0xFF,0xF0,0x00,
|
||||
0x1F,0xFF,0xF0,0x00,0x3F,0xFF,0xF8,0x00,0x3E,0x00,0xF8,0x00,0x3C,0x00,0xF8,0x00,
|
||||
0x7C,0x00,0x7C,0x00,0x7C,0x00,0x7C,0x00,0x78,0x00,0x3C,0x00,0xF8,0x00,0x3E,0x00,
|
||||
0xF8,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: a --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"a",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF8,0x00,0x00,
|
||||
0x1F,0xFE,0x00,0x00,0x3F,0xFE,0x00,0x00,0x3E,0x3F,0x00,0x00,0x38,0x1F,0x00,0x00,
|
||||
0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x03,0xFF,0x00,0x00,0x1F,0xFF,0x00,0x00,
|
||||
0x3F,0x8F,0x00,0x00,0x7C,0x0F,0x00,0x00,0x7C,0x0F,0x00,0x00,0x78,0x1F,0x00,0x00,
|
||||
0x7C,0x1F,0x00,0x00,0x7E,0x7F,0x00,0x00,0x7F,0xFF,0x00,0x00,0x3F,0xFF,0x00,0x00,
|
||||
0x0F,0xCF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: b --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"b",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,
|
||||
0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,
|
||||
0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0xFE,0x00,0x00,
|
||||
0x3D,0xFF,0x80,0x00,0x3F,0xFF,0xC0,0x00,0x3F,0x8F,0xC0,0x00,0x3F,0x07,0xE0,0x00,
|
||||
0x3E,0x03,0xE0,0x00,0x3E,0x03,0xE0,0x00,0x3C,0x01,0xE0,0x00,0x3C,0x01,0xE0,0x00,
|
||||
0x3C,0x01,0xE0,0x00,0x3C,0x03,0xE0,0x00,0x3E,0x03,0xE0,0x00,0x3E,0x03,0xE0,0x00,
|
||||
0x3F,0x07,0xC0,0x00,0x3F,0x8F,0xC0,0x00,0x3F,0xFF,0x80,0x00,0x3F,0xFF,0x00,0x00,
|
||||
0x3C,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: c --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"c",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFC,0x00,0x00,
|
||||
0x07,0xFE,0x00,0x00,0x1F,0xFE,0x00,0x00,0x3F,0x86,0x00,0x00,0x3E,0x00,0x00,0x00,
|
||||
0x7C,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x78,0x00,0x00,0x00,
|
||||
0x78,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,
|
||||
0x3E,0x00,0x00,0x00,0x3F,0x86,0x00,0x00,0x1F,0xFE,0x00,0x00,0x0F,0xFE,0x00,0x00,
|
||||
0x03,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 微 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"微",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x01,0xE0,0x07,0x87,0x01,0xE0,
|
||||
0x07,0x07,0x01,0xC0,0x0F,0xF7,0x79,0xC0,0x1E,0xF7,0x7B,0xC0,0x1E,0xF7,0x7B,0x80,
|
||||
0x3C,0xF7,0x7B,0xFF,0x78,0xF7,0x7B,0xFF,0xF8,0xF7,0x7F,0x9E,0xF7,0xFF,0xFF,0x9E,
|
||||
0x67,0xFF,0xFF,0x9E,0x07,0x00,0x7F,0x9C,0x0F,0x00,0x0F,0x9C,0x1E,0x00,0x1F,0x9C,
|
||||
0x1E,0x7F,0xFF,0xBC,0x3E,0x7F,0xF3,0xFC,0x3E,0x00,0x03,0xFC,0x7E,0x00,0x01,0xF8,
|
||||
0xFE,0x00,0x01,0xF8,0xFE,0x7F,0xE1,0xF8,0xDE,0x7F,0xE1,0xF8,0x1E,0x78,0xE0,0xF0,
|
||||
0x1E,0x78,0xEE,0xF0,0x1E,0x78,0xFF,0xF0,0x1E,0x78,0xFD,0xF8,0x1E,0x79,0xFB,0xFC,
|
||||
0x1E,0xF1,0xF7,0xBC,0x1E,0xF0,0xEF,0x9E,0x1F,0xE0,0x0F,0x0F,0x1E,0xC0,0x1E,0x0F,
|
||||
0x1E,0x00,0x0C,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 雪 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"雪",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x1F,0xFF,0xFF,0xF8,0x1F,0xFF,0xFF,0xF8,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
|
||||
0x7F,0xFF,0xFF,0xFE,0x7F,0xFF,0xFF,0xFE,0x78,0x03,0xC0,0x1E,0x78,0x03,0xC0,0x1E,
|
||||
0x7F,0xFF,0xFF,0xFE,0x7F,0xFF,0xFF,0xFE,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
|
||||
0x07,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xE0,0x00,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,
|
||||
0x1F,0xFF,0xFF,0xF8,0x1F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,
|
||||
0x1F,0xFF,0xFF,0xF8,0x1F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,
|
||||
0x00,0x00,0x00,0x78,0x3F,0xFF,0xFF,0xF8,0x3F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x78,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 电 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"电",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,
|
||||
0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x7F,0xFF,0xFF,0xF8,0x7F,0xFF,0xFF,0xF8,
|
||||
0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,
|
||||
0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x7F,0xFF,0xFF,0xF8,0x7F,0xFF,0xFF,0xF8,
|
||||
0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,
|
||||
0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x7F,0xFF,0xFF,0xF8,0x7F,0xFF,0xFF,0xF8,
|
||||
0x78,0x07,0x80,0x0E,0x78,0x07,0x80,0x0F,0x00,0x07,0x80,0x0F,0x00,0x07,0x80,0x0F,
|
||||
0x00,0x07,0x80,0x1F,0x00,0x07,0x80,0x1E,0x00,0x03,0xFF,0xFE,0x00,0x01,0xFF,0xFC,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
/*-- 文字: 子 --*/
|
||||
/*-- 微软雅黑24; 此字体下对应的点阵为:宽x高=32x41 --*/
|
||||
{"子",
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x1F,0xFF,0xFF,0xF8,0x1F,0xFF,0xFF,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x07,0xE0,
|
||||
0x00,0x00,0x0F,0xC0,0x00,0x00,0x1F,0x80,0x00,0x00,0x3E,0x00,0x00,0x00,0xFC,0x00,
|
||||
0x00,0x01,0xF8,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,
|
||||
0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,
|
||||
0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,
|
||||
0x00,0x03,0xE0,0x00,0x00,0x03,0xC0,0x00,0x01,0xFF,0xC0,0x00,0x00,0xFF,0x80,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00},
|
||||
|
||||
|
||||
};
|
||||
|
||||
cFONT Font24CN = {
|
||||
Font24CN_Table,
|
||||
sizeof(Font24CN_Table)/sizeof(CH_CN), /*size of table*/
|
||||
24, /* ASCII Width */
|
||||
32, /* Width */
|
||||
41, /* Height */
|
||||
};
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file fonts.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 18-February-2014
|
||||
* @brief Header for fonts.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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
|
||||
|
||||
/*最大字体微软雅黑24 (32x41) */
|
||||
#define MAX_HEIGHT_FONT 41
|
||||
#define MAX_WIDTH_FONT 32
|
||||
#define OFFSET_BITMAP
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
//ASCII
|
||||
typedef struct _tFont
|
||||
{
|
||||
const uint8_t *table;
|
||||
uint16_t Width;
|
||||
uint16_t Height;
|
||||
|
||||
} sFONT;
|
||||
|
||||
|
||||
//GB2312
|
||||
typedef struct // 汉字字模数据结构
|
||||
{
|
||||
unsigned char index[2]; // 汉字内码索引
|
||||
const char matrix[MAX_HEIGHT_FONT*MAX_WIDTH_FONT/8]; // 点阵码数据
|
||||
}CH_CN;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const CH_CN *table;
|
||||
uint16_t size;
|
||||
uint16_t ASCII_Width;
|
||||
uint16_t Width;
|
||||
uint16_t Height;
|
||||
|
||||
}cFONT;
|
||||
|
||||
extern sFONT Font24;
|
||||
extern sFONT Font20;
|
||||
extern sFONT Font16;
|
||||
extern sFONT Font12;
|
||||
extern sFONT Font8;
|
||||
|
||||
extern cFONT Font12CN;
|
||||
extern cFONT Font24CN;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __FONTS_H */
|
||||
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* | File : GUI_BMPfile.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : Hardware underlying interface
|
||||
* | Info :
|
||||
* Used to shield the underlying layers of each master
|
||||
* and enhance portability
|
||||
*----------------
|
||||
* | This version: V2.0
|
||||
* | Date : 2018-11-12
|
||||
* | Info :
|
||||
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
|
||||
* 2.fix: GUI_ReadBmp()
|
||||
* Now Xstart and Xstart can control the position of the picture normally,
|
||||
* and support the display of images of any size. If it is larger than
|
||||
* the actual display range, it will not be displayed.
|
||||
#
|
||||
# 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 "GUI_BMPfile.h"
|
||||
#include "GUI_Paint.h"
|
||||
#include "Debug.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h> //exit()
|
||||
#include <string.h> //memset()
|
||||
#include <math.h> //memset()
|
||||
|
||||
UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
FILE *fp; //Define a file pointer
|
||||
BMPFILEHEADER bmpFileHeader; //Define a bmp file header structure
|
||||
BMPINFOHEADER bmpInfoHeader; //Define a bmp info header structure
|
||||
|
||||
|
||||
// Binary file open
|
||||
if((fp = fopen(path, "rb")) == NULL) {
|
||||
Debug("Cann't open the file!\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Set the file pointer from the beginning
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
fread(&bmpFileHeader, sizeof(BMPFILEHEADER), 1, fp); //sizeof(BMPFILEHEADER) must be 14
|
||||
fread(&bmpInfoHeader, sizeof(BMPINFOHEADER), 1, fp); //sizeof(BMPFILEHEADER) must be 50
|
||||
printf("pixel = %d * %d\r\n", bmpInfoHeader.biWidth, bmpInfoHeader.biHeight);
|
||||
|
||||
UWORD Image_Width_Byte = (bmpInfoHeader.biWidth % 8 == 0)? (bmpInfoHeader.biWidth / 8): (bmpInfoHeader.biWidth / 8 + 1);
|
||||
UWORD Bmp_Width_Byte = (Image_Width_Byte % 4 == 0) ? Image_Width_Byte: ((Image_Width_Byte / 4 + 1) * 4);
|
||||
UBYTE Image[Image_Width_Byte * bmpInfoHeader.biHeight];
|
||||
memset(Image, 0xFF, Image_Width_Byte * bmpInfoHeader.biHeight);
|
||||
|
||||
// Determine if it is a monochrome bitmap
|
||||
int readbyte = bmpInfoHeader.biBitCount;
|
||||
if(readbyte != 1) {
|
||||
Debug("the bmp Image is not a monochrome bitmap!\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Determine black and white based on the palette
|
||||
UWORD i;
|
||||
UWORD Bcolor, Wcolor;
|
||||
// UWORD bmprgbquadsize = pow(2, bmpInfoHeader.biBitCount);// 2^1 = 2
|
||||
// BMPRGBQUAD bmprgbquad[bmprgbquadsize]; //palette
|
||||
BMPRGBQUAD bmprgbquad[2]; //palette
|
||||
|
||||
// for(i = 0; i < bmprgbquadsize; i++){
|
||||
for(i = 0; i < 2; i++) {
|
||||
fread(&bmprgbquad[i * 4], sizeof(BMPRGBQUAD), 1, fp);
|
||||
}
|
||||
if(bmprgbquad[0].rgbBlue == 0xff && bmprgbquad[0].rgbGreen == 0xff && bmprgbquad[0].rgbRed == 0xff) {
|
||||
Bcolor = BLACK;
|
||||
Wcolor = WHITE;
|
||||
} else {
|
||||
Bcolor = WHITE;
|
||||
Wcolor = BLACK;
|
||||
}
|
||||
|
||||
// Read image data into the cache
|
||||
UWORD x, y;
|
||||
UBYTE Rdata;
|
||||
fseek(fp, bmpFileHeader.bOffset, SEEK_SET);
|
||||
for(y = 0; y < bmpInfoHeader.biHeight; y++) {//Total display column
|
||||
for(x = 0; x < Bmp_Width_Byte; x++) {//Show a line in the line
|
||||
if(fread((char *)&Rdata, 1, readbyte, fp) != readbyte) {
|
||||
perror("get bmpdata:\r\n");
|
||||
break;
|
||||
}
|
||||
if(x < Image_Width_Byte) { //bmp
|
||||
Image[x + (bmpInfoHeader.biHeight - y - 1) * Image_Width_Byte] = Rdata;
|
||||
// printf("rdata = %d\r\n", Rdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
// Refresh the image to the display buffer based on the displayed orientation
|
||||
UBYTE color, temp;
|
||||
for(y = 0; y < bmpInfoHeader.biHeight; y++) {
|
||||
for(x = 0; x < bmpInfoHeader.biWidth; x++) {
|
||||
if(x > Paint.Width || y > Paint.Height) {
|
||||
break;
|
||||
}
|
||||
temp = Image[(x / 8) + (y * Image_Width_Byte)];
|
||||
color = (((temp << (x%8)) & 0x80) == 0x80) ?Bcolor:Wcolor;
|
||||
Paint_SetPixel(Xstart + x, Ystart + y, color);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,369 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in7b.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.7inch e-paper b
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* lut_vcom_dc[] => EPD_2in7B_lut_vcom_dc[]
|
||||
* lut_ww[] => EPD_2in7B_lut_ww[]
|
||||
* lut_bw[] => EPD_2in7B_lut_bw[]
|
||||
* lut_bb[] => EPD_2in7B_lut_bb[]
|
||||
* lut_wb[] => EPD_2in7B_lut_wb[]
|
||||
* EPD_Reset() => EPD_2in7B_Reset()
|
||||
* EPD_SendCommand() => EPD_2in7B_SendCommand()
|
||||
* EPD_SendData() => EPD_2in7B_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2in7B_ReadBusy()
|
||||
* EPD_SetLut() => EPD_2in7B_SetLut()
|
||||
* EPD_Init() => EPD_2in7B_Init()
|
||||
* EPD_Clear() => EPD_2in7B_Clear()
|
||||
* EPD_Display() => EPD_2in7B_Display()
|
||||
* EPD_Sleep() => EPD_2in7B_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define PANEL_SETTING 0x00
|
||||
* #define POWER_SETTING 0x01
|
||||
* #define POWER_OFF 0x02
|
||||
* #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
* #define POWER_ON 0x04
|
||||
* #define POWER_ON_MEASURE 0x05
|
||||
* #define BOOSTER_SOFT_START 0x06
|
||||
* #define DEEP_SLEEP 0x07
|
||||
* #define DATA_START_TRANSMISSION_1 0x10
|
||||
* #define DATA_STOP 0x11
|
||||
* #define DISPLAY_REFRESH 0x12
|
||||
* #define DATA_START_TRANSMISSION_2 0x13
|
||||
* #define PARTIAL_DATA_START_TRANSMISSION_1 0x14
|
||||
* #define PARTIAL_DATA_START_TRANSMISSION_2 0x15
|
||||
* #define PARTIAL_DISPLAY_REFRESH 0x16
|
||||
* #define LUT_FOR_VCOM 0x20
|
||||
* #define LUT_WHITE_TO_WHITE 0x21
|
||||
* #define LUT_BLACK_TO_WHITE 0x22
|
||||
* #define LUT_WHITE_TO_BLACK 0x23
|
||||
* #define LUT_BLACK_TO_BLACK 0x24
|
||||
* #define PLL_CONTROL 0x30
|
||||
* #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
* #define TEMPERATURE_SENSOR_CALIBRATION 0x41
|
||||
* #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
* #define TEMPERATURE_SENSOR_READ 0x43
|
||||
* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
* #define LOW_POWER_DETECTION 0x51
|
||||
* #define TCON_SETTING 0x60
|
||||
* #define TCON_RESOLUTION 0x61
|
||||
* #define SOURCE_AND_GATE_START_SETTING 0x62
|
||||
* #define GET_STATUS 0x71
|
||||
* #define AUTO_MEASURE_VCOM 0x80
|
||||
* #define VCOM_VALUE 0x81
|
||||
* #define VCM_DC_SETTING_REGISTER 0x82
|
||||
* #define PROGRAM_MODE 0xA0
|
||||
* #define ACTIVE_PROGRAM 0xA1
|
||||
* #define READ_OTP_DATA 0xA2
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-10-30):
|
||||
* 1.Remove:ImageBuff[EPD_2IN7B_HEIGHT * EPD_2IN7B_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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_2in7b.h"
|
||||
#include "Debug.h"
|
||||
|
||||
static const unsigned char EPD_2IN7B_lut_vcom_dc[] = {
|
||||
0x00, 0x00,
|
||||
0x00, 0x1A, 0x1A, 0x00, 0x00, 0x01,
|
||||
0x00, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x00, 0x0E, 0x01, 0x0E, 0x01, 0x10,
|
||||
0x00, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x00, 0x04, 0x10, 0x00, 0x00, 0x05,
|
||||
0x00, 0x03, 0x0E, 0x00, 0x00, 0x0A,
|
||||
0x00, 0x23, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
//R21H
|
||||
static const unsigned char EPD_2IN7B_lut_ww[] = {
|
||||
0x90, 0x1A, 0x1A, 0x00, 0x00, 0x01,
|
||||
0x40, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x84, 0x0E, 0x01, 0x0E, 0x01, 0x10,
|
||||
0x80, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x00, 0x04, 0x10, 0x00, 0x00, 0x05,
|
||||
0x00, 0x03, 0x0E, 0x00, 0x00, 0x0A,
|
||||
0x00, 0x23, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
//R22H r
|
||||
static const unsigned char EPD_2IN7B_lut_bw[] = {
|
||||
0xA0, 0x1A, 0x1A, 0x00, 0x00, 0x01,
|
||||
0x00, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x84, 0x0E, 0x01, 0x0E, 0x01, 0x10,
|
||||
0x90, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0xB0, 0x04, 0x10, 0x00, 0x00, 0x05,
|
||||
0xB0, 0x03, 0x0E, 0x00, 0x00, 0x0A,
|
||||
0xC0, 0x23, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
//R23H w
|
||||
static const unsigned char EPD_2IN7B_lut_bb[] = {
|
||||
0x90, 0x1A, 0x1A, 0x00, 0x00, 0x01,
|
||||
0x40, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x84, 0x0E, 0x01, 0x0E, 0x01, 0x10,
|
||||
0x80, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x00, 0x04, 0x10, 0x00, 0x00, 0x05,
|
||||
0x00, 0x03, 0x0E, 0x00, 0x00, 0x0A,
|
||||
0x00, 0x23, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
//R24H b
|
||||
static const unsigned char EPD_2IN7B_lut_wb[] = {
|
||||
0x90, 0x1A, 0x1A, 0x00, 0x00, 0x01,
|
||||
0x20, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x84, 0x0E, 0x01, 0x0E, 0x01, 0x10,
|
||||
0x10, 0x0A, 0x0A, 0x00, 0x00, 0x08,
|
||||
0x00, 0x04, 0x10, 0x00, 0x00, 0x05,
|
||||
0x00, 0x03, 0x0E, 0x00, 0x00, 0x0A,
|
||||
0x00, 0x23, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7B_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7B_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_2IN7B_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:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7B_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) { //0: busy, 1: idle
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : set the look-up tables
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7B_SetLut(void)
|
||||
{
|
||||
unsigned int count;
|
||||
EPD_2IN7B_SendCommand(0x20); //vcom
|
||||
for(count = 0; count < 44; count++) {
|
||||
EPD_2IN7B_SendData(EPD_2IN7B_lut_vcom_dc[count]);
|
||||
}
|
||||
|
||||
EPD_2IN7B_SendCommand(0x21); //ww --
|
||||
for(count = 0; count < 42; count++) {
|
||||
EPD_2IN7B_SendData(EPD_2IN7B_lut_ww[count]);
|
||||
}
|
||||
|
||||
EPD_2IN7B_SendCommand(0x22); //bw r
|
||||
for(count = 0; count < 42; count++) {
|
||||
EPD_2IN7B_SendData(EPD_2IN7B_lut_bw[count]);
|
||||
}
|
||||
|
||||
EPD_2IN7B_SendCommand(0x23); //wb w
|
||||
for(count = 0; count < 42; count++) {
|
||||
EPD_2IN7B_SendData(EPD_2IN7B_lut_bb[count]);
|
||||
}
|
||||
|
||||
EPD_2IN7B_SendCommand(0x24); //bb b
|
||||
for(count = 0; count < 42; count++) {
|
||||
EPD_2IN7B_SendData(EPD_2IN7B_lut_wb[count]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7B_Init(void)
|
||||
{
|
||||
EPD_2IN7B_Reset();
|
||||
|
||||
EPD_2IN7B_SendCommand(0x04); // POWER_ON
|
||||
EPD_2IN7B_ReadBusy();
|
||||
|
||||
EPD_2IN7B_SendCommand(0x00); // PANEL_SETTING
|
||||
EPD_2IN7B_SendData(0xaf); // KW-BF KWR-AF BWROTP 0f
|
||||
|
||||
EPD_2IN7B_SendCommand(0x30); // PLL_CONTROL
|
||||
EPD_2IN7B_SendData(0x3a); //3A 100HZ 29 150Hz 39 200HZ 31 171HZ
|
||||
|
||||
EPD_2IN7B_SendCommand(0x01); // PANEL_SETTING
|
||||
EPD_2IN7B_SendData(0x03); // VDS_EN, VDG_EN
|
||||
EPD_2IN7B_SendData(0x00); // VCOM_HV, VGHL_LV[1], VGHL_LV[0]
|
||||
EPD_2IN7B_SendData(0x2b); // VDH
|
||||
EPD_2IN7B_SendData(0x2b); // VDL
|
||||
EPD_2IN7B_SendData(0x09); // VDHR
|
||||
|
||||
EPD_2IN7B_SendCommand(0x06); // BOOSTER_SOFT_START
|
||||
EPD_2IN7B_SendData(0x07);
|
||||
EPD_2IN7B_SendData(0x07);
|
||||
EPD_2IN7B_SendData(0x17);
|
||||
|
||||
// Power optimization
|
||||
EPD_2IN7B_SendCommand(0xF8);
|
||||
EPD_2IN7B_SendData(0x60);
|
||||
EPD_2IN7B_SendData(0xA5);
|
||||
|
||||
// Power optimization
|
||||
EPD_2IN7B_SendCommand(0xF8);
|
||||
EPD_2IN7B_SendData(0x89);
|
||||
EPD_2IN7B_SendData(0xA5);
|
||||
|
||||
// Power optimization
|
||||
EPD_2IN7B_SendCommand(0xF8);
|
||||
EPD_2IN7B_SendData(0x90);
|
||||
EPD_2IN7B_SendData(0x00);
|
||||
|
||||
// Power optimization
|
||||
EPD_2IN7B_SendCommand(0xF8);
|
||||
EPD_2IN7B_SendData(0x93);
|
||||
EPD_2IN7B_SendData(0x2A);
|
||||
|
||||
// Power optimization
|
||||
EPD_2IN7B_SendCommand(0xF8);
|
||||
EPD_2IN7B_SendData(0x73);
|
||||
EPD_2IN7B_SendData(0x41);
|
||||
|
||||
EPD_2IN7B_SendCommand(0x82); // VCM_DC_SETTING_REGISTER
|
||||
EPD_2IN7B_SendData(0x12);
|
||||
EPD_2IN7B_SendCommand(0x50); // VCOM_AND_DATA_INTERVAL_SETTING
|
||||
EPD_2IN7B_SendData(0x87); // define by OTP
|
||||
|
||||
EPD_2IN7B_SetLut();
|
||||
|
||||
EPD_2IN7B_SendCommand(0x16); // PARTIAL_DISPLAY_REFRESH
|
||||
EPD_2IN7B_SendData(0x00);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7B_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN7B_WIDTH % 8 == 0)? (EPD_2IN7B_WIDTH / 8 ): (EPD_2IN7B_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN7B_HEIGHT;
|
||||
|
||||
EPD_2IN7B_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7B_SendData(0X00);
|
||||
}
|
||||
}
|
||||
EPD_2IN7B_SendCommand(0x11); // DATA_STOP
|
||||
|
||||
EPD_2IN7B_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7B_SendData(0X00);
|
||||
}
|
||||
}
|
||||
EPD_2IN7B_SendCommand(0x11); // DATA_STOP
|
||||
|
||||
EPD_2IN7B_SendCommand(0x12);
|
||||
EPD_2IN7B_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7B_Display(UBYTE *Imageblack, UBYTE *Imagered)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN7B_WIDTH % 8 == 0)? (EPD_2IN7B_WIDTH / 8 ): (EPD_2IN7B_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN7B_HEIGHT;
|
||||
|
||||
EPD_2IN7B_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7B_SendData(~Imageblack[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN7B_SendCommand(0x11); // DATA_STOP
|
||||
|
||||
EPD_2IN7B_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7B_SendData(~Imagered[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN7B_SendCommand(0x11); // DATA_STOP
|
||||
|
||||
EPD_2IN7B_SendCommand(0x12);
|
||||
EPD_2IN7B_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7B_Sleep(void)
|
||||
{
|
||||
EPD_2IN7B_SendCommand(0X50);
|
||||
EPD_2IN7B_SendData(0xf7);
|
||||
EPD_2IN7B_SendCommand(0X02); //power off
|
||||
EPD_2IN7B_SendCommand(0X07); //deep sleep
|
||||
EPD_2IN7B_SendData(0xA5);
|
||||
}
|
||||
|
|
@ -1,296 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
* 1.Change:
|
||||
* lut_full_update[] => EPD_2IN9_lut_full_update[]
|
||||
* lut_partial_update[] => EPD_2IN9_lut_partial_update[]
|
||||
* EPD_Reset() => EPD_2IN9_Reset()
|
||||
* EPD_SendCommand() => EPD_2IN9_SendCommand()
|
||||
* EPD_SendData() => EPD_2IN9_SendData()
|
||||
* EPD_WaitUntilIdle() => EPD_2IN9_ReadBusy()
|
||||
* EPD_SetLut() => EPD_2IN9_SetLut()
|
||||
* EPD_SetWindow() => EPD_2IN9_SetWindow()
|
||||
* EPD_SetCursor() => EPD_2IN9_SetCursor()
|
||||
* EPD_TurnOnDisplay() => EPD_2IN9_TurnOnDisplay()
|
||||
* EPD_Init() => EPD_2IN9_Init()
|
||||
* EPD_Clear() => EPD_2IN9_Clear()
|
||||
* EPD_Display() => EPD_2IN9_Display()
|
||||
* EPD_Sleep() => EPD_2IN9_Sleep()
|
||||
* 2.remove commands define:
|
||||
* #define DRIVER_OUTPUT_CONTROL 0x01
|
||||
* #define BOOSTER_SOFT_START_CONTROL 0x0C
|
||||
* #define GATE_SCAN_START_POSITION 0x0F
|
||||
* #define DEEP_SLEEP_MODE 0x10
|
||||
* #define DATA_ENTRY_MODE_SETTING 0x11
|
||||
* #define SW_RESET 0x12
|
||||
* #define TEMPERATURE_SENSOR_CONTROL 0x1A
|
||||
* #define MASTER_ACTIVATION 0x20
|
||||
* #define DISPLAY_UPDATE_CONTROL_1 0x21
|
||||
* #define DISPLAY_UPDATE_CONTROL_2 0x22
|
||||
* #define WRITE_RAM 0x24
|
||||
* #define WRITE_VCOM_REGISTER 0x2C
|
||||
* #define WRITE_LUT_REGISTER 0x32
|
||||
* #define SET_DUMMY_LINE_PERIOD 0x3A
|
||||
* #define SET_GATE_TIME 0x3B
|
||||
* #define BORDER_WAVEFORM_CONTROL 0x3C
|
||||
* #define SET_RAM_X_ADDRESS_START_END_POSITION 0x44
|
||||
* #define SET_RAM_Y_ADDRESS_START_END_POSITION 0x45
|
||||
* #define SET_RAM_X_ADDRESS_COUNTER 0x4E
|
||||
* #define SET_RAM_Y_ADDRESS_COUNTER 0x4F
|
||||
* #define TERMINATE_FRAME_READ_WRITE 0xFF
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-06):
|
||||
* 1.Remove:ImageBuff[EPD_2IN9_HEIGHT * EPD_2IN9_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
* 3.Change:
|
||||
* EPD_RST -> EPD_RST_PIN
|
||||
* EPD_DC -> EPD_DC_PIN
|
||||
* EPD_CS -> EPD_CS_PIN
|
||||
* EPD_BUSY -> EPD_BUSY_PIN
|
||||
#
|
||||
# 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_2in9.h"
|
||||
#include "Debug.h"
|
||||
|
||||
const unsigned char EPD_2IN9_lut_full_update[] = {
|
||||
0x50, 0xAA, 0x55, 0xAA, 0x11, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFF, 0xFF, 0x1F, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
const unsigned char EPD_2IN9_lut_partial_update[] = {
|
||||
0x10, 0x18, 0x18, 0x08, 0x18, 0x18,
|
||||
0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x13, 0x14, 0x44, 0x12,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_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_2IN9_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_2IN9_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Setting the display window
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_2IN9_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_2IN9_SendData((Xstart >> 3) & 0xFF);
|
||||
EPD_2IN9_SendData((Xend >> 3) & 0xFF);
|
||||
|
||||
EPD_2IN9_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_2IN9_SendData(Ystart & 0xFF);
|
||||
EPD_2IN9_SendData((Ystart >> 8) & 0xFF);
|
||||
EPD_2IN9_SendData(Yend & 0xFF);
|
||||
EPD_2IN9_SendData((Yend >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set Cursor
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
EPD_2IN9_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_2IN9_SendData((Xstart >> 3) & 0xFF);
|
||||
|
||||
EPD_2IN9_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_2IN9_SendData(Ystart & 0xFF);
|
||||
EPD_2IN9_SendData((Ystart >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN9_SendCommand(0x22); // DISPLAY_UPDATE_CONTROL_2
|
||||
EPD_2IN9_SendData(0xC4);
|
||||
EPD_2IN9_SendCommand(0x20); // MASTER_ACTIVATION
|
||||
EPD_2IN9_SendCommand(0xFF); // TERMINATE_FRAME_READ_WRITE
|
||||
|
||||
EPD_2IN9_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9_Init(UBYTE Mode)
|
||||
{
|
||||
EPD_2IN9_Reset();
|
||||
|
||||
EPD_2IN9_SendCommand(0x01); // DRIVER_OUTPUT_CONTROL
|
||||
EPD_2IN9_SendData((EPD_2IN9_HEIGHT - 1) & 0xFF);
|
||||
EPD_2IN9_SendData(((EPD_2IN9_HEIGHT - 1) >> 8) & 0xFF);
|
||||
EPD_2IN9_SendData(0x00); // GD = 0; SM = 0; TB = 0;
|
||||
|
||||
EPD_2IN9_SendCommand(0x0C); // BOOSTER_SOFT_START_CONTROL
|
||||
EPD_2IN9_SendData(0xD7);
|
||||
EPD_2IN9_SendData(0xD6);
|
||||
EPD_2IN9_SendData(0x9D);
|
||||
|
||||
EPD_2IN9_SendCommand(0x2C); // WRITE_VCOM_REGISTER
|
||||
EPD_2IN9_SendData(0xA8); // VCOM 7C
|
||||
|
||||
EPD_2IN9_SendCommand(0x3A); // SET_DUMMY_LINE_PERIOD
|
||||
EPD_2IN9_SendData(0x1A); // 4 dummy lines per gate
|
||||
|
||||
EPD_2IN9_SendCommand(0x3B); // SET_GATE_TIME
|
||||
EPD_2IN9_SendData(0x08); // 2us per line
|
||||
|
||||
EPD_2IN9_SendCommand(0x3C); // BORDER_WAVEFORM_CONTROL
|
||||
EPD_2IN9_SendData(0x03);
|
||||
EPD_2IN9_SendCommand(0x11); // DATA_ENTRY_MODE_SETTING
|
||||
EPD_2IN9_SendData(0x03);
|
||||
|
||||
//set the look-up table register
|
||||
EPD_2IN9_SendCommand(0x32); // WRITE_LUT_REGISTER
|
||||
if(Mode == EPD_2IN9_FULL){
|
||||
for (UWORD i = 0; i < 30; i++) {
|
||||
EPD_2IN9_SendData(EPD_2IN9_lut_full_update[i]);
|
||||
}
|
||||
}else if(Mode == EPD_2IN9_PART){
|
||||
for (UWORD i = 0; i < 30; i++) {
|
||||
EPD_2IN9_SendData(EPD_2IN9_lut_partial_update[i]);
|
||||
}
|
||||
}else{
|
||||
Debug("error, the Mode is EPD_2IN9_FULL or EPD_2IN9_PART");
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN9_WIDTH % 8 == 0)? (EPD_2IN9_WIDTH / 8 ): (EPD_2IN9_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN9_HEIGHT;
|
||||
EPD_2IN9_SetWindows(0, 0, EPD_2IN9_WIDTH, EPD_2IN9_HEIGHT);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
EPD_2IN9_SetCursor(0, j);
|
||||
EPD_2IN9_SendCommand(0x24);
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN9_SendData(0XFF);
|
||||
}
|
||||
}
|
||||
EPD_2IN9_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN9_WIDTH % 8 == 0)? (EPD_2IN9_WIDTH / 8 ): (EPD_2IN9_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN9_HEIGHT;
|
||||
|
||||
UDOUBLE Addr = 0;
|
||||
// UDOUBLE Offset = ImageName;
|
||||
EPD_2IN9_SetWindows(0, 0, EPD_2IN9_WIDTH, EPD_2IN9_HEIGHT);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
EPD_2IN9_SetCursor(0, j);
|
||||
EPD_2IN9_SendCommand(0x24);
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
Addr = i + j * Width;
|
||||
EPD_2IN9_SendData(Image[Addr]);
|
||||
}
|
||||
}
|
||||
EPD_2IN9_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9_Sleep(void)
|
||||
{
|
||||
EPD_2IN9_SendCommand(0x10);
|
||||
EPD_2IN9_SendData(0x01);
|
||||
// EPD_2IN9_ReadBusy();
|
||||
}
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* | File : Readme_CN.txt
|
||||
* | Author : Waveshare team
|
||||
* | Function : Help with use
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-17
|
||||
* | Info : 在这里提供一个中文版本的使用文档,以便你的快速使用
|
||||
******************************************************************************/
|
||||
这个文件是帮助您使用本例程。
|
||||
由于我们的墨水屏越来越多,不便于我们的维护,因此把所有的墨水屏程序做成一个工程。
|
||||
在这里简略的描述本工程的使用:
|
||||
|
||||
1.基本信息:
|
||||
本例程是基于jetson-nano-sd-r32.1-2019-03-18系统镜像而开发的,由于目前的系统是没有硬件SPI的,
|
||||
目前采用模拟SPI进行开发的,因此墨水屏的刷新速度较慢;
|
||||
本例程是基于Jetson Nano进行开发的,例程均在Jetson Nano上进行了验证;
|
||||
本例程使用e-paper Driver HAT模块进行了验证,你可以在工程的Examples\中查看对应的测试例程;
|
||||
|
||||
2.管脚连接:
|
||||
管脚连接你可以在\lib\Config目录下查看DEV_Config.h中查看,这里也再重述一次:
|
||||
EPD => Jetson Nano/RPI(BCM)
|
||||
VCC -> 3.3
|
||||
GND -> GND
|
||||
DIN -> 10(SPI0_MOSI)
|
||||
CLK -> 11(SPI0_SCK)
|
||||
CS -> 8(SPI0_CS0)
|
||||
DC -> 25
|
||||
RST -> 17
|
||||
BUSY -> 24
|
||||
|
||||
3.基本使用:
|
||||
由于本工程是一个综合工程,对于使用而言,你可能需要阅读以下内容:
|
||||
你可以在main.c中的19行到43行看到已经进行了注释的19个函数,
|
||||
请注意你购买的是哪一款的墨水屏。
|
||||
栗子1:
|
||||
如果你购买的5.83inch e-paper,那么你应该把对应的39行代码的注释去掉,即:
|
||||
// EPD_5in83_test();
|
||||
修改成:
|
||||
EPD_5in83_test();
|
||||
栗子2:
|
||||
如果你购买的2.9inch e-paper (B),由于2.9寸的B型和C型是公用的驱动代码,
|
||||
那么你应该把对应的28行代码的注释去掉,即:
|
||||
// EPD_2in9bc_test();
|
||||
修改成:
|
||||
EPD_2in9bc_test();
|
||||
注意:对于EPD_1in54_V2_test()和EPD_2in13_V2_test()请注意你的屏幕背面是否贴有V2标识。
|
||||
|
||||
然后你需要执行:make,编译程序,会生成可执行文件:epd
|
||||
运行:sudo ./epd
|
||||
如果修改了程序,需要执行:make clear,然后重新make。
|
||||
|
||||
4.目录结构(选读):
|
||||
如果你经常使用我们的产品,对我们的程序目录结构会十分熟悉,关于具体的函数的我们有一份
|
||||
函数的API手册,你可以在我们的WIKI上下载或像售后客服索取,这里简单介绍一次:
|
||||
\lib\Config\:此目录为硬件接口层文件,在DEV_Config.c(.h)可以看到很多定义,包括:
|
||||
数据类型;
|
||||
GPIO;
|
||||
读写GPIO;
|
||||
延时:注意:此延时函数并未使用示波器测量具体数值,因此会不准;
|
||||
模块初始化与退出的处理:
|
||||
void DEV_Module_Init(void);
|
||||
void DEV_Module_Exit(void);
|
||||
注意:1.这里是处理使用墨水屏前与使用完之后一些GPIO的处理。
|
||||
2.对于PCB带有Rev2.1的,DEV_Module_Exit()之后整个模块会进入低功耗,经过测试这个功耗基本为0;
|
||||
|
||||
\lib\GUI\:此目录为一些基本的图像处理函数,在GUI_Paint.c(.h)中:
|
||||
常用图像处理:创建图形、翻转图形、镜像图形、设置像素点、清屏等;
|
||||
常用画图处理:画点、线、框、圆、中文字符、英文字符、数字等;
|
||||
常用时间显示:提供一个常用的显示时间函数;
|
||||
常用显示图片:提供一个显示位图的函数;
|
||||
|
||||
\lib\Fonts\:为一些常用的字体:
|
||||
Ascii:
|
||||
font8: 5*8
|
||||
font12: 7*12
|
||||
font16: 11*16
|
||||
font20: 14*20
|
||||
font24: 17*24
|
||||
中文:
|
||||
font12CN: 16*21
|
||||
font24CN: 32*41
|
||||
|
||||
\lib\e-paper\:此目录下为墨水屏驱动函数;
|
||||
Examples\:此目录下为墨水屏的测试程序,你可在其中看到具体的使用方法;
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd1in54_V2
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd1in54_V2 Demo")
|
||||
|
||||
epd = epd1in54_V2.EPD()
|
||||
print("init and Clear")
|
||||
epd.init()
|
||||
epd.Clear(0xFF)
|
||||
time.sleep(1)
|
||||
|
||||
# Drawing on the image
|
||||
print("1.Drawing on the image...")
|
||||
image = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
|
||||
draw = ImageDraw.Draw(image)
|
||||
font = ImageFont.truetype('../lib/Font.ttc', 24)
|
||||
draw.rectangle((0, 10, 200, 34), fill = 0)
|
||||
draw.text((8, 12), 'hello world', font = font, fill = 255)
|
||||
draw.text((8, 36), u'微雪电子', font = font, fill = 0)
|
||||
draw.line((16, 60, 56, 60), fill = 0)
|
||||
draw.line((56, 60, 56, 110), fill = 0)
|
||||
draw.line((16, 110, 56, 110), fill = 0)
|
||||
draw.line((16, 110, 16, 60), fill = 0)
|
||||
draw.line((16, 60, 56, 110), fill = 0)
|
||||
draw.line((56, 60, 16, 110), fill = 0)
|
||||
draw.arc((90, 60, 150, 120), 0, 360, fill = 0)
|
||||
draw.rectangle((16, 130, 56, 180), fill = 0)
|
||||
draw.chord((90, 130, 150, 190), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(image.rotate(90)))
|
||||
time.sleep(2)
|
||||
|
||||
# read bmp file
|
||||
print("2.read bmp file...")
|
||||
image = Image.open('../pic/1in54.bmp')
|
||||
epd.display(epd.getbuffer(image))
|
||||
time.sleep(2)
|
||||
|
||||
# read bmp file on window
|
||||
print("3.read bmp file on window...")
|
||||
epd.Clear(0xFF)
|
||||
image1 = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
bmp = Image.open('../pic/100x100.bmp')
|
||||
image1.paste(bmp, (50,50))
|
||||
epd.display(epd.getbuffer(image1))
|
||||
time.sleep(2)
|
||||
|
||||
# partial update
|
||||
print("4.show time...")
|
||||
time_image = Image.new('1', (epd.width, epd.height), 255)
|
||||
epd.displayPartBaseImage(epd.getbuffer(time_image))
|
||||
|
||||
time_draw = ImageDraw.Draw(time_image)
|
||||
num = 0
|
||||
while (True):
|
||||
time_draw.rectangle((10, 10, 120, 50), fill = 255)
|
||||
time_draw.text((10, 10), time.strftime('%H:%M:%S'), font = font, fill = 0)
|
||||
newimage = time_image.crop([10, 10, 120, 50])
|
||||
time_image.paste(newimage, (10,10))
|
||||
epd.displayPart(epd.getbuffer(time_image))
|
||||
num = num + 1
|
||||
if(num == 10):
|
||||
break
|
||||
|
||||
print("Clear...")
|
||||
epd.init()
|
||||
epd.Clear(0xFF)
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd1in54
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd1in54 Demo")
|
||||
|
||||
epd = epd1in54.EPD()
|
||||
print("init and Clear")
|
||||
epd.init(epd.lut_full_update)
|
||||
epd.Clear(0xFF)
|
||||
|
||||
# Drawing on the image
|
||||
print("1.Drawing on the image...")
|
||||
image = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
|
||||
draw = ImageDraw.Draw(image)
|
||||
font = ImageFont.truetype('../lib/Font.ttc', 24)
|
||||
draw.rectangle((0, 10, 200, 34), fill = 0)
|
||||
draw.text((8, 12), 'hello world', font = font, fill = 255)
|
||||
draw.text((8, 36), u'微雪电子', font = font, fill = 0)
|
||||
draw.line((16, 60, 56, 60), fill = 0)
|
||||
draw.line((56, 60, 56, 110), fill = 0)
|
||||
draw.line((16, 110, 56, 110), fill = 0)
|
||||
draw.line((16, 110, 16, 60), fill = 0)
|
||||
draw.line((16, 60, 56, 110), fill = 0)
|
||||
draw.line((56, 60, 16, 110), fill = 0)
|
||||
draw.arc((90, 60, 150, 120), 0, 360, fill = 0)
|
||||
draw.rectangle((16, 130, 56, 180), fill = 0)
|
||||
draw.chord((90, 130, 150, 190), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(image.rotate(90)))
|
||||
time.sleep(2)
|
||||
|
||||
# read bmp file
|
||||
print("2.read bmp file...")
|
||||
image = Image.open('../pic/1in54.bmp')
|
||||
epd.display(epd.getbuffer(image))
|
||||
time.sleep(2)
|
||||
|
||||
# read bmp file on window
|
||||
print("3.read bmp file on window...")
|
||||
epd.Clear(0xFF)
|
||||
image1 = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
bmp = Image.open('../pic/100x100.bmp')
|
||||
image1.paste(bmp, (50,50))
|
||||
epd.display(epd.getbuffer(image1))
|
||||
time.sleep(2)
|
||||
|
||||
# # partial update
|
||||
print("4.show time...")
|
||||
epd.init(epd.lut_partial_update)
|
||||
epd.Clear(0xFF)
|
||||
|
||||
time_image = Image.new('1', (epd.width, epd.height), 255)
|
||||
time_draw = ImageDraw.Draw(time_image)
|
||||
num = 0
|
||||
while (True):
|
||||
time_draw.rectangle((10, 10, 120, 50), fill = 255)
|
||||
time_draw.text((10, 10), time.strftime('%H:%M:%S'), font = font, fill = 0)
|
||||
newimage = time_image.crop([10, 10, 120, 50])
|
||||
time_image.paste(newimage, (10,10))
|
||||
epd.display(epd.getbuffer(time_image))
|
||||
num = num + 1
|
||||
if(num == 10):
|
||||
break
|
||||
|
||||
print("Clear...")
|
||||
epd.Clear(0xFF)
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd2in13_V2
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd2in13_V2 Demo")
|
||||
|
||||
epd = epd2in13_V2.EPD()
|
||||
print("init and Clear")
|
||||
epd.init(epd.FULL_UPDATE)
|
||||
epd.Clear(0xFF)
|
||||
|
||||
# Drawing on the image
|
||||
font15 = ImageFont.truetype('../lib/Font.ttc', 15)
|
||||
font24 = ImageFont.truetype('../lib/Font.ttc', 24)
|
||||
|
||||
print("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)
|
||||
epd.display(epd.getbuffer(image))
|
||||
time.sleep(2)
|
||||
|
||||
# read bmp file
|
||||
print("2.read bmp file...")
|
||||
image = Image.open('../pic/2in13.bmp')
|
||||
epd.display(epd.getbuffer(image))
|
||||
time.sleep(2)
|
||||
|
||||
# read bmp file on window
|
||||
print("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('../pic/100x100.bmp')
|
||||
image1.paste(bmp, (2,2))
|
||||
epd.display(epd.getbuffer(image1))
|
||||
time.sleep(2)
|
||||
|
||||
# # partial update
|
||||
print("4.show time...")
|
||||
time_image = Image.new('1', (epd.height, epd.width), 255)
|
||||
time_draw = ImageDraw.Draw(time_image)
|
||||
|
||||
epd.init(epd.FULL_UPDATE)
|
||||
epd.displayPartBaseImage(epd.getbuffer(time_image))
|
||||
|
||||
epd.init(epd.PART_UPDATE)
|
||||
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
|
||||
|
||||
print("Clear...")
|
||||
epd.init(epd.FULL_UPDATE)
|
||||
epd.Clear(0xFF)
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd2in13
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd2in13 Demo")
|
||||
|
||||
epd = epd2in13.EPD()
|
||||
print("init and Clear")
|
||||
epd.init(epd.lut_full_update)
|
||||
epd.Clear(0xFF)
|
||||
|
||||
# Drawing on the image
|
||||
font15 = ImageFont.truetype('../lib/Font.ttc', 15)
|
||||
font24 = ImageFont.truetype('../lib/Font.ttc', 24)
|
||||
|
||||
print("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)
|
||||
epd.display(epd.getbuffer(image))
|
||||
time.sleep(2)
|
||||
|
||||
# read bmp file
|
||||
print("2.read bmp file...")
|
||||
image = Image.open('../pic/2in13.bmp')
|
||||
epd.display(epd.getbuffer(image))
|
||||
time.sleep(2)
|
||||
|
||||
# read bmp file on window
|
||||
print("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('../pic/100x100.bmp')
|
||||
image1.paste(bmp, (2,2))
|
||||
epd.display(epd.getbuffer(image1))
|
||||
time.sleep(2)
|
||||
|
||||
# # partial update
|
||||
print("4.show time...")
|
||||
epd.init(epd.lut_partial_update)
|
||||
epd.Clear(0xFF)
|
||||
|
||||
time_image = Image.new('1', (epd.height, epd.width), 255)
|
||||
time_draw = ImageDraw.Draw(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.display(epd.getbuffer(time_image))
|
||||
num = num + 1
|
||||
if(num == 10):
|
||||
break
|
||||
|
||||
print("Clear...")
|
||||
epd.init(epd.lut_full_update)
|
||||
epd.Clear(0xFF)
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd2in13bc
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd2in13bc Demo")
|
||||
|
||||
epd = epd2in13bc.EPD()
|
||||
print("init and Clear")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
time.sleep(1)
|
||||
|
||||
# Drawing on the image
|
||||
print("Drawing")
|
||||
font20 = ImageFont.truetype('../lib/Font.ttc', 20)
|
||||
font18 = ImageFont.truetype('../lib/Font.ttc', 18)
|
||||
|
||||
# Drawing on the Horizontal image
|
||||
print("1.Drawing on the Horizontal image...")
|
||||
HBlackimage = Image.new('1', (epd.height, epd.width), 255) # 298*126
|
||||
HRYimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 ryimage: red or yellow image
|
||||
drawblack = ImageDraw.Draw(HBlackimage)
|
||||
drawry = ImageDraw.Draw(HRYimage)
|
||||
drawblack.text((10, 0), 'hello world', font = font20, fill = 0)
|
||||
drawblack.text((10, 20), '2.13inch e-Paper bc', font = font20, fill = 0)
|
||||
drawblack.text((120, 0), u'微雪电子', font = font20, fill = 0)
|
||||
drawblack.line((20, 50, 70, 100), fill = 0)
|
||||
drawblack.line((70, 50, 20, 100), fill = 0)
|
||||
drawblack.rectangle((20, 50, 70, 100), outline = 0)
|
||||
drawry.line((165, 50, 165, 100), fill = 0)
|
||||
drawry.line((140, 75, 190, 75), fill = 0)
|
||||
drawry.arc((140, 50, 190, 100), 0, 360, fill = 0)
|
||||
drawry.rectangle((80, 50, 130, 100), fill = 0)
|
||||
drawry.chord((85, 55, 125, 95), 0, 360, fill =1)
|
||||
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
|
||||
time.sleep(2)
|
||||
|
||||
# Drawing on the Vertical image
|
||||
print("2.Drawing on the Vertical image...")
|
||||
LBlackimage = Image.new('1', (epd.width, epd.height), 255) # 126*298
|
||||
LRYimage = Image.new('1', (epd.width, epd.height), 255) # 126*298
|
||||
drawblack = ImageDraw.Draw(LBlackimage)
|
||||
drawry = ImageDraw.Draw(LRYimage)
|
||||
|
||||
drawblack.text((2, 0), 'hello world', font = font18, fill = 0)
|
||||
drawblack.text((2, 20), '2.13 epd b', font = font18, fill = 0)
|
||||
drawblack.text((20, 50), u'微雪电子', font = font18, fill = 0)
|
||||
drawblack.line((10, 90, 60, 140), fill = 0)
|
||||
drawblack.line((60, 90, 10, 140), fill = 0)
|
||||
drawblack.rectangle((10, 90, 60, 140), outline = 0)
|
||||
drawry.rectangle((10, 150, 60, 200), fill = 0)
|
||||
drawry.arc((15, 95, 55, 135), 0, 360, fill = 0)
|
||||
drawry.chord((15, 155, 55, 195), 0, 360, fill =1)
|
||||
epd.display(epd.getbuffer(LBlackimage), epd.getbuffer(LRYimage))
|
||||
time.sleep(2)
|
||||
|
||||
print("3.read bmp file")
|
||||
HBlackimage = Image.open('../pic/2in13bc-b.bmp')
|
||||
HRYimage = Image.open('../pic/2in13bc-ry.bmp')
|
||||
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
|
||||
time.sleep(2)
|
||||
|
||||
print("4.read bmp file on window")
|
||||
blackimage1 = Image.new('1', (epd.height, epd.width), 255) # 298*126
|
||||
redimage1 = Image.new('1', (epd.height, epd.width), 255) # 298*126
|
||||
newimage = Image.open('../pic/100x100.bmp')
|
||||
blackimage1.paste(newimage, (10,10))
|
||||
epd.display(epd.getbuffer(blackimage1), epd.getbuffer(redimage1))
|
||||
|
||||
print("Clear...")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd2in13d
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd2in13d Demo")
|
||||
|
||||
epd = epd2in13d.EPD()
|
||||
print("init and Clear")
|
||||
epd.init()
|
||||
epd.Clear(0xFF)
|
||||
|
||||
font15 = ImageFont.truetype('../lib/Font.ttc', 15)
|
||||
|
||||
# Drawing on the Horizontal image
|
||||
print("1.Drawing on the Horizontal image...")
|
||||
Himage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
draw = ImageDraw.Draw(Himage)
|
||||
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((110, 60), 'e-Paper demo', font = font15, fill = 0)
|
||||
draw.text((110, 80), u'微雪电子', font = font15, fill = 0)
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(2)
|
||||
|
||||
print("3.read bmp file")
|
||||
Himage = Image.open('../pic/2in13d.bmp')
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(2)
|
||||
|
||||
print("4.read bmp file on window")
|
||||
Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
bmp = Image.open('../pic/100x100.bmp')
|
||||
Himage2.paste(bmp, (20,20))
|
||||
epd.display(epd.getbuffer(Himage2))
|
||||
time.sleep(2)
|
||||
|
||||
# # partial update
|
||||
print("5.show time...")
|
||||
epd.init()
|
||||
epd.Clear(0xFF)
|
||||
|
||||
time_image = Image.new('1', (epd.width, epd.height), 255)
|
||||
time_draw = ImageDraw.Draw(time_image)
|
||||
num = 0
|
||||
while (True):
|
||||
time_draw.rectangle((10, 10, 120, 50), fill = 255)
|
||||
time_draw.text((10, 10), time.strftime('%H:%M:%S'), font = font24, fill = 0)
|
||||
newimage = time_image.crop([10, 10, 120, 50])
|
||||
time_image.paste(newimage, (10,10))
|
||||
epd.DisplayPartial(epd.getbuffer(time_image))
|
||||
num = num + 1
|
||||
if(num == 10):
|
||||
break
|
||||
|
||||
print("Clear...")
|
||||
epd.Clear(0xFF)
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd2in7
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd2in7 Demo")
|
||||
|
||||
epd = epd2in7.EPD()
|
||||
print("init and Clear")
|
||||
epd.init()
|
||||
epd.Clear(0xFF)
|
||||
|
||||
font24 = ImageFont.truetype('../lib/Font.ttc', 24)
|
||||
font18 = ImageFont.truetype('../lib/Font.ttc', 18)
|
||||
|
||||
# Drawing on the Horizontal image
|
||||
print("1.Drawing on the Horizontal image...")
|
||||
Himage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
draw = ImageDraw.Draw(Himage)
|
||||
draw.text((10, 0), 'hello world', font = font24, fill = 0)
|
||||
draw.text((150, 0), u'微雪电子', font = font24, fill = 0)
|
||||
draw.line((20, 50, 70, 100), fill = 0)
|
||||
draw.line((70, 50, 20, 100), fill = 0)
|
||||
draw.rectangle((20, 50, 70, 100), outline = 0)
|
||||
draw.line((165, 50, 165, 100), fill = 0)
|
||||
draw.line((140, 75, 190, 75), fill = 0)
|
||||
draw.arc((140, 50, 190, 100), 0, 360, fill = 0)
|
||||
draw.rectangle((80, 50, 130, 100), fill = 0)
|
||||
draw.chord((200, 50, 250, 100), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(2)
|
||||
|
||||
# Drawing on the Vertical image
|
||||
print("2.Drawing on the Vertical image...")
|
||||
Limage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
draw = ImageDraw.Draw(Limage)
|
||||
draw.text((2, 0), 'hello world', font = font18, fill = 0)
|
||||
draw.text((20, 50), u'微雪电子', font = font18, fill = 0)
|
||||
draw.line((10, 90, 60, 140), fill = 0)
|
||||
draw.line((60, 90, 10, 140), fill = 0)
|
||||
draw.rectangle((10, 90, 60, 140), outline = 0)
|
||||
draw.line((95, 90, 95, 140), fill = 0)
|
||||
draw.line((70, 115, 120, 115), fill = 0)
|
||||
draw.arc((70, 90, 120, 140), 0, 360, fill = 0)
|
||||
draw.rectangle((10, 150, 60, 200), fill = 0)
|
||||
draw.chord((70, 150, 120, 200), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(Limage))
|
||||
time.sleep(2)
|
||||
|
||||
print("3.read bmp file")
|
||||
Himage = Image.open('../pic/2in7.bmp')
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(2)
|
||||
|
||||
print("4.read bmp file on window")
|
||||
Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
bmp = Image.open('../pic/100x100.bmp')
|
||||
Himage2.paste(bmp, (50,10))
|
||||
epd.display(epd.getbuffer(Himage2))
|
||||
time.sleep(2)
|
||||
|
||||
print("Clear...")
|
||||
epd.Clear(0xFF)
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd2in7b
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd2in7b Demo")
|
||||
|
||||
epd = epd2in7b.EPD()
|
||||
print("init and Clear")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
time.sleep(1)
|
||||
|
||||
# Drawing on the image
|
||||
print("Drawing")
|
||||
blackimage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
redimage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
|
||||
font24 = ImageFont.truetype('../lib/Font.ttc', 24)
|
||||
font18 = ImageFont.truetype('../lib/Font.ttc', 18)
|
||||
|
||||
|
||||
# Drawing on the Horizontal image
|
||||
print("1.Drawing on the Horizontal image...")
|
||||
HBlackimage = Image.new('1', (epd.height, epd.width), 255) # 298*126
|
||||
HRedimage = Image.new('1', (epd.height, epd.width), 255) # 298*126
|
||||
|
||||
drawblack = ImageDraw.Draw(HBlackimage)
|
||||
drawred = ImageDraw.Draw(HRedimage)
|
||||
drawblack.text((10, 0), 'hello world', font = font24, fill = 0)
|
||||
drawblack.text((10, 20), '2.9inch e-Paper', font = font24, fill = 0)
|
||||
drawblack.text((150, 0), u'微雪电子', font = font24, fill = 0)
|
||||
drawblack.line((20, 50, 70, 100), fill = 0)
|
||||
drawblack.line((70, 50, 20, 100), fill = 0)
|
||||
drawblack.rectangle((20, 50, 70, 100), outline = 0)
|
||||
drawred.line((165, 50, 165, 100), fill = 0)
|
||||
drawred.line((140, 75, 190, 75), fill = 0)
|
||||
drawred.arc((140, 50, 190, 100), 0, 360, fill = 0)
|
||||
drawred.rectangle((80, 50, 130, 100), fill = 0)
|
||||
drawred.chord((200, 50, 250, 100), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage))
|
||||
time.sleep(2)
|
||||
|
||||
# Drawing on the Vertical image
|
||||
print("2.Drawing on the Vertical image...")
|
||||
LBlackimage = Image.new('1', (epd.width, epd.height), 255) # 126*298
|
||||
LRedimage = Image.new('1', (epd.width, epd.height), 255) # 126*298
|
||||
drawblack = ImageDraw.Draw(LBlackimage)
|
||||
drawred = ImageDraw.Draw(LRedimage)
|
||||
|
||||
drawblack.text((2, 0), 'hello world', font = font18, fill = 0)
|
||||
drawblack.text((2, 20), '2.9inch epd', font = font18, fill = 0)
|
||||
drawblack.text((20, 50), u'微雪电子', font = font18, fill = 0)
|
||||
drawblack.line((10, 90, 60, 140), fill = 0)
|
||||
drawblack.line((60, 90, 10, 140), fill = 0)
|
||||
drawblack.rectangle((10, 90, 60, 140), outline = 0)
|
||||
drawred.line((95, 90, 95, 140), fill = 0)
|
||||
drawred.line((70, 115, 120, 115), fill = 0)
|
||||
drawred.arc((70, 90, 120, 140), 0, 360, fill = 0)
|
||||
drawred.rectangle((10, 150, 60, 200), fill = 0)
|
||||
drawred.chord((70, 150, 120, 200), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(LBlackimage), epd.getbuffer(LRedimage))
|
||||
time.sleep(2)
|
||||
|
||||
print("3.read bmp file")
|
||||
HBlackimage = Image.open('../pic/2in7b-b.bmp')
|
||||
HRedimage = Image.open('../pic/2in7b-r.bmp')
|
||||
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage))
|
||||
time.sleep(2)
|
||||
|
||||
print("4.read bmp file on window")
|
||||
blackimage1 = Image.new('1', (epd.height, epd.width), 255) # 298*126
|
||||
redimage1 = Image.new('1', (epd.height, epd.width), 255) # 298*126
|
||||
newimage = Image.open('../pic/100x100.bmp')
|
||||
blackimage1.paste(newimage, (50,10))
|
||||
epd.display(epd.getbuffer(blackimage1), epd.getbuffer(redimage1))
|
||||
|
||||
print("Clear...")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd2in9
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd2in9 Demo")
|
||||
|
||||
epd = epd2in9.EPD()
|
||||
print("init and Clear")
|
||||
epd.init(epd.lut_full_update)
|
||||
epd.Clear(0xFF)
|
||||
|
||||
font24 = ImageFont.truetype('../lib/Font.ttc', 24)
|
||||
font18 = ImageFont.truetype('../lib/Font.ttc', 18)
|
||||
|
||||
# Drawing on the Horizontal image
|
||||
print("1.Drawing on the Horizontal image...")
|
||||
Himage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
draw = ImageDraw.Draw(Himage)
|
||||
draw.text((10, 0), 'hello world', font = font24, fill = 0)
|
||||
draw.text((10, 20), '2.9inch e-Paper', font = font24, fill = 0)
|
||||
draw.text((150, 0), u'微雪电子', font = font24, fill = 0)
|
||||
draw.line((20, 50, 70, 100), fill = 0)
|
||||
draw.line((70, 50, 20, 100), fill = 0)
|
||||
draw.rectangle((20, 50, 70, 100), outline = 0)
|
||||
draw.line((165, 50, 165, 100), fill = 0)
|
||||
draw.line((140, 75, 190, 75), fill = 0)
|
||||
draw.arc((140, 50, 190, 100), 0, 360, fill = 0)
|
||||
draw.rectangle((80, 50, 130, 100), fill = 0)
|
||||
draw.chord((200, 50, 250, 100), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(2)
|
||||
|
||||
# Drawing on the Vertical image
|
||||
print("2.Drawing on the Vertical image...")
|
||||
Limage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
draw = ImageDraw.Draw(Limage)
|
||||
draw.text((2, 0), 'hello world', font = font18, fill = 0)
|
||||
draw.text((2, 20), '2.9inch epd', font = font18, fill = 0)
|
||||
draw.text((20, 50), u'微雪电子', font = font18, fill = 0)
|
||||
draw.line((10, 90, 60, 140), fill = 0)
|
||||
draw.line((60, 90, 10, 140), fill = 0)
|
||||
draw.rectangle((10, 90, 60, 140), outline = 0)
|
||||
draw.line((95, 90, 95, 140), fill = 0)
|
||||
draw.line((70, 115, 120, 115), fill = 0)
|
||||
draw.arc((70, 90, 120, 140), 0, 360, fill = 0)
|
||||
draw.rectangle((10, 150, 60, 200), fill = 0)
|
||||
draw.chord((70, 150, 120, 200), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(Limage))
|
||||
time.sleep(2)
|
||||
|
||||
print("3.read bmp file")
|
||||
Himage = Image.open('../pic/2in9.bmp')
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(2)
|
||||
|
||||
print("4.read bmp file on window")
|
||||
Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
bmp = Image.open('../pic/100x100.bmp')
|
||||
Himage2.paste(bmp, (50,10))
|
||||
epd.display(epd.getbuffer(Himage2))
|
||||
time.sleep(2)
|
||||
|
||||
# partial update
|
||||
print("5.show time")
|
||||
epd.init(epd.lut_partial_update)
|
||||
epd.Clear(0xFF)
|
||||
time_image = Image.new('1', (epd.height, epd.width), 255)
|
||||
time_draw = ImageDraw.Draw(time_image)
|
||||
num = 0
|
||||
while (True):
|
||||
time_draw.rectangle((10, 10, 120, 50), fill = 255)
|
||||
time_draw.text((10, 10), time.strftime('%H:%M:%S'), font = font24, fill = 0)
|
||||
newimage = time_image.crop([10, 10, 120, 50])
|
||||
time_image.paste(newimage, (10,10))
|
||||
epd.display(epd.getbuffer(time_image))
|
||||
|
||||
num = num + 1
|
||||
if(num == 10):
|
||||
break
|
||||
|
||||
print("Clear...")
|
||||
epd.init(epd.lut_full_update)
|
||||
epd.Clear(0xFF)
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd2in9bc
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd2in9bc Demo")
|
||||
|
||||
epd = epd2in9bc.EPD()
|
||||
print("init and Clear")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
time.sleep(1)
|
||||
|
||||
# Drawing on the image
|
||||
print("Drawing")
|
||||
font24 = ImageFont.truetype('../lib/Font.ttc', 24)
|
||||
font18 = ImageFont.truetype('../lib/Font.ttc', 18)
|
||||
|
||||
# Drawing on the Horizontal image
|
||||
print("1.Drawing on the Horizontal image...")
|
||||
HBlackimage = Image.new('1', (epd.height, epd.width), 255) # 298*126
|
||||
HRYimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 ryimage: red or yellow image
|
||||
drawblack = ImageDraw.Draw(HBlackimage)
|
||||
drawry = ImageDraw.Draw(HRYimage)
|
||||
drawblack.text((10, 0), 'hello world', font = font24, fill = 0)
|
||||
drawblack.text((10, 20), '2.9inch e-Paper bc', font = font24, fill = 0)
|
||||
drawblack.text((150, 0), u'微雪电子', font = font24, fill = 0)
|
||||
drawblack.line((20, 50, 70, 100), fill = 0)
|
||||
drawblack.line((70, 50, 20, 100), fill = 0)
|
||||
drawblack.rectangle((20, 50, 70, 100), outline = 0)
|
||||
drawry.line((165, 50, 165, 100), fill = 0)
|
||||
drawry.line((140, 75, 190, 75), fill = 0)
|
||||
drawry.arc((140, 50, 190, 100), 0, 360, fill = 0)
|
||||
drawry.rectangle((80, 50, 130, 100), fill = 0)
|
||||
drawry.chord((200, 50, 250, 100), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
|
||||
time.sleep(2)
|
||||
|
||||
# Drawing on the Vertical image
|
||||
print("2.Drawing on the Vertical image...")
|
||||
LBlackimage = Image.new('1', (epd.width, epd.height), 255) # 126*298
|
||||
LRYimage = Image.new('1', (epd.width, epd.height), 255) # 126*298
|
||||
drawblack = ImageDraw.Draw(LBlackimage)
|
||||
drawry = ImageDraw.Draw(LRYimage)
|
||||
|
||||
drawblack.text((2, 0), 'hello world', font = font18, fill = 0)
|
||||
drawblack.text((2, 20), '2.9inch epd bc', font = font18, fill = 0)
|
||||
drawblack.text((20, 50), u'微雪电子', font = font18, fill = 0)
|
||||
drawblack.line((10, 90, 60, 140), fill = 0)
|
||||
drawblack.line((60, 90, 10, 140), fill = 0)
|
||||
drawblack.rectangle((10, 90, 60, 140), outline = 0)
|
||||
drawry.line((95, 90, 95, 140), fill = 0)
|
||||
drawry.line((70, 115, 120, 115), fill = 0)
|
||||
drawry.arc((70, 90, 120, 140), 0, 360, fill = 0)
|
||||
drawry.rectangle((10, 150, 60, 200), fill = 0)
|
||||
drawry.chord((70, 150, 120, 200), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(LBlackimage), epd.getbuffer(LRYimage))
|
||||
time.sleep(2)
|
||||
|
||||
print("3.read bmp file")
|
||||
HBlackimage = Image.open('../pic/2in9bc-b.bmp')
|
||||
HRYimage = Image.open('../pic/2in9bc-ry.bmp')
|
||||
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
|
||||
time.sleep(2)
|
||||
|
||||
print("4.read bmp file on window")
|
||||
blackimage1 = Image.new('1', (epd.height, epd.width), 255) # 298*126
|
||||
redimage1 = Image.new('1', (epd.height, epd.width), 255) # 298*126
|
||||
newimage = Image.open('../pic/100x100.bmp')
|
||||
blackimage1.paste(newimage, (50,10))
|
||||
epd.display(epd.getbuffer(blackimage1), epd.getbuffer(redimage1))
|
||||
|
||||
print("Clear...")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd2in9d
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd2in9d Demo")
|
||||
|
||||
epd = epd2in9d.EPD()
|
||||
print("init and Clear")
|
||||
epd.init()
|
||||
epd.Clear(0xFF)
|
||||
|
||||
font24 = ImageFont.truetype('../lib/Font.ttc', 24)
|
||||
font18 = ImageFont.truetype('../lib/Font.ttc', 18)
|
||||
|
||||
# Drawing on the Horizontal image
|
||||
print("1.Drawing on the Horizontal image...")
|
||||
Himage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
draw = ImageDraw.Draw(Himage)
|
||||
draw.text((10, 0), 'hello world', font = font24, fill = 0)
|
||||
draw.text((10, 20), '2.9inch e-Paper d', font = font24, fill = 0)
|
||||
draw.text((150, 0), u'微雪电子', font = font24, fill = 0)
|
||||
draw.line((20, 50, 70, 100), fill = 0)
|
||||
draw.line((70, 50, 20, 100), fill = 0)
|
||||
draw.rectangle((20, 50, 70, 100), outline = 0)
|
||||
draw.line((165, 50, 165, 100), fill = 0)
|
||||
draw.line((140, 75, 190, 75), fill = 0)
|
||||
draw.arc((140, 50, 190, 100), 0, 360, fill = 0)
|
||||
draw.rectangle((80, 50, 130, 100), fill = 0)
|
||||
draw.chord((200, 50, 250, 100), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(2)
|
||||
|
||||
# Drawing on the Vertical image
|
||||
print("2.Drawing on the Vertical image...")
|
||||
Limage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
draw = ImageDraw.Draw(Limage)
|
||||
draw.text((2, 0), 'hello world', font = font18, fill = 0)
|
||||
draw.text((2, 20), '2.9inch epd d', font = font18, fill = 0)
|
||||
draw.text((20, 50), u'微雪电子', font = font18, fill = 0)
|
||||
draw.line((10, 90, 60, 140), fill = 0)
|
||||
draw.line((60, 90, 10, 140), fill = 0)
|
||||
draw.rectangle((10, 90, 60, 140), outline = 0)
|
||||
draw.line((95, 90, 95, 140), fill = 0)
|
||||
draw.line((70, 115, 120, 115), fill = 0)
|
||||
draw.arc((70, 90, 120, 140), 0, 360, fill = 0)
|
||||
draw.rectangle((10, 150, 60, 200), fill = 0)
|
||||
draw.chord((70, 150, 120, 200), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(Limage))
|
||||
time.sleep(2)
|
||||
|
||||
print("3.read bmp file")
|
||||
Himage = Image.open('../pic/2in9d.bmp')
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(2)
|
||||
|
||||
print("4.read bmp file on window")
|
||||
Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
bmp = Image.open('../pic/100x100.bmp')
|
||||
Himage2.paste(bmp, (50,10))
|
||||
epd.display(epd.getbuffer(Himage2))
|
||||
time.sleep(2)
|
||||
|
||||
# # partial update
|
||||
print("5.show time...")
|
||||
epd.init()
|
||||
epd.Clear(0xFF)
|
||||
|
||||
time_image = Image.new('1', (epd.width, epd.height), 255)
|
||||
time_draw = ImageDraw.Draw(time_image)
|
||||
num = 0
|
||||
while (True):
|
||||
time_draw.rectangle((10, 10, 120, 50), fill = 255)
|
||||
time_draw.text((10, 10), time.strftime('%H:%M:%S'), font = font24, fill = 0)
|
||||
newimage = time_image.crop([10, 10, 120, 50])
|
||||
time_image.paste(newimage, (10,10))
|
||||
epd.display(epd.getbuffer(time_image))
|
||||
num = num + 1
|
||||
if(num == 10):
|
||||
break
|
||||
|
||||
print("Clear...")
|
||||
epd.Clear(0xFF)
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd4in2
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd4in2 Demo")
|
||||
|
||||
epd = epd4in2.EPD()
|
||||
print("init and Clear")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
|
||||
font24 = ImageFont.truetype('../lib/Font.ttc', 24)
|
||||
font18 = ImageFont.truetype('../lib/Font.ttc', 18)
|
||||
|
||||
# Drawing on the Horizontal image
|
||||
print("1.Drawing on the Horizontal image...")
|
||||
Himage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
draw = ImageDraw.Draw(Himage)
|
||||
draw.text((10, 0), 'hello world', font = font24, fill = 0)
|
||||
draw.text((10, 20), '4.2inch e-Paper', font = font24, fill = 0)
|
||||
draw.text((150, 0), u'微雪电子', font = font24, fill = 0)
|
||||
draw.line((20, 50, 70, 100), fill = 0)
|
||||
draw.line((70, 50, 20, 100), fill = 0)
|
||||
draw.rectangle((20, 50, 70, 100), outline = 0)
|
||||
draw.line((165, 50, 165, 100), fill = 0)
|
||||
draw.line((140, 75, 190, 75), fill = 0)
|
||||
draw.arc((140, 50, 190, 100), 0, 360, fill = 0)
|
||||
draw.rectangle((80, 50, 130, 100), fill = 0)
|
||||
draw.chord((200, 50, 250, 100), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(2)
|
||||
|
||||
# Drawing on the Vertical image
|
||||
print("2.Drawing on the Vertical image...")
|
||||
Limage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
draw = ImageDraw.Draw(Limage)
|
||||
draw.text((2, 0), 'hello world', font = font18, fill = 0)
|
||||
draw.text((2, 20), '4.2inch epd', font = font18, fill = 0)
|
||||
draw.text((20, 50), u'微雪电子', font = font18, fill = 0)
|
||||
draw.line((10, 90, 60, 140), fill = 0)
|
||||
draw.line((60, 90, 10, 140), fill = 0)
|
||||
draw.rectangle((10, 90, 60, 140), outline = 0)
|
||||
draw.line((95, 90, 95, 140), fill = 0)
|
||||
draw.line((70, 115, 120, 115), fill = 0)
|
||||
draw.arc((70, 90, 120, 140), 0, 360, fill = 0)
|
||||
draw.rectangle((10, 150, 60, 200), fill = 0)
|
||||
draw.chord((70, 150, 120, 200), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(Limage))
|
||||
time.sleep(2)
|
||||
|
||||
print("3.read bmp file")
|
||||
Himage = Image.open('../pic/4in2.bmp')
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(2)
|
||||
|
||||
print("4.read bmp file on window")
|
||||
Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
bmp = Image.open('../pic/100x100.bmp')
|
||||
Himage2.paste(bmp, (50,10))
|
||||
epd.display(epd.getbuffer(Himage2))
|
||||
time.sleep(2)
|
||||
|
||||
print("Clear...")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd4in2bc
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd4in2bc Demo")
|
||||
|
||||
epd = epd4in2bc.EPD()
|
||||
print("init and Clear")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
time.sleep(1)
|
||||
|
||||
# Drawing on the image
|
||||
print("Drawing")
|
||||
font24 = ImageFont.truetype('../lib/Font.ttc', 24)
|
||||
font18 = ImageFont.truetype('../lib/Font.ttc', 18)
|
||||
|
||||
# Drawing on the Horizontal image
|
||||
print("1.Drawing on the Horizontal image...")
|
||||
HBlackimage = Image.new('1', (epd.width, epd.height), 255) # 298*126
|
||||
HRYimage = Image.new('1', (epd.width, epd.height), 255) # 298*126 ryimage: red or yellow image
|
||||
drawblack = ImageDraw.Draw(HBlackimage)
|
||||
drawry = ImageDraw.Draw(HRYimage)
|
||||
drawblack.text((10, 0), 'hello world', font = font24, fill = 0)
|
||||
drawblack.text((10, 20), '4.2inch e-Paper bc', font = font24, fill = 0)
|
||||
drawblack.text((150, 0), u'微雪电子', font = font24, fill = 0)
|
||||
drawblack.line((20, 50, 70, 100), fill = 0)
|
||||
drawblack.line((70, 50, 20, 100), fill = 0)
|
||||
drawblack.rectangle((20, 50, 70, 100), outline = 0)
|
||||
drawry.line((165, 50, 165, 100), fill = 0)
|
||||
drawry.line((140, 75, 190, 75), fill = 0)
|
||||
drawry.arc((140, 50, 190, 100), 0, 360, fill = 0)
|
||||
drawry.rectangle((80, 50, 130, 100), fill = 0)
|
||||
drawry.chord((200, 50, 250, 100), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
|
||||
time.sleep(2)
|
||||
|
||||
# Drawing on the Vertical image
|
||||
print("2.Drawing on the Vertical image...")
|
||||
LBlackimage = Image.new('1', (epd.height, epd.width), 255) # 126*298
|
||||
LRYimage = Image.new('1', (epd.height, epd.width), 255) # 126*298
|
||||
drawblack = ImageDraw.Draw(LBlackimage)
|
||||
drawry = ImageDraw.Draw(LRYimage)
|
||||
|
||||
drawblack.text((2, 0), 'hello world', font = font18, fill = 0)
|
||||
drawblack.text((2, 20), '4.2inch epd bc', font = font18, fill = 0)
|
||||
drawblack.text((20, 50), u'微雪电子', font = font18, fill = 0)
|
||||
drawblack.line((10, 90, 60, 140), fill = 0)
|
||||
drawblack.line((60, 90, 10, 140), fill = 0)
|
||||
drawblack.rectangle((10, 90, 60, 140), outline = 0)
|
||||
drawry.line((95, 90, 95, 140), fill = 0)
|
||||
drawry.line((70, 115, 120, 115), fill = 0)
|
||||
drawry.arc((70, 90, 120, 140), 0, 360, fill = 0)
|
||||
drawry.rectangle((10, 150, 60, 200), fill = 0)
|
||||
drawry.chord((70, 150, 120, 200), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(LBlackimage), epd.getbuffer(LRYimage))
|
||||
time.sleep(2)
|
||||
|
||||
print("3.read bmp file")
|
||||
HBlackimage = Image.open('../pic/4in2b-b.bmp')
|
||||
HRYimage = Image.open('../pic/4in2b-r.bmp')
|
||||
# HBlackimage = Image.open('../pic/4in2c-b.bmp')
|
||||
# HRYimage = Image.open('../pic/4in2c-y.bmp')
|
||||
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
|
||||
time.sleep(2)
|
||||
|
||||
print("4.read bmp file on window")
|
||||
blackimage1 = Image.new('1', (epd.width, epd.height), 255) # 298*126
|
||||
redimage1 = Image.new('1', (epd.width, epd.height), 255) # 298*126
|
||||
newimage = Image.open('../pic/100x100.bmp')
|
||||
blackimage1.paste(newimage, (50,10))
|
||||
epd.display(epd.getbuffer(blackimage1), epd.getbuffer(redimage1))
|
||||
|
||||
print("Clear...")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd7in5
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd7in5 Demo")
|
||||
|
||||
epd = epd7in5.EPD()
|
||||
print("init and Clear")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
|
||||
font24 = ImageFont.truetype('../lib/Font.ttc', 24)
|
||||
font18 = ImageFont.truetype('../lib/Font.ttc', 18)
|
||||
|
||||
# Drawing on the Horizontal image
|
||||
print("1.Drawing on the Horizontal image...")
|
||||
Himage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
draw = ImageDraw.Draw(Himage)
|
||||
draw.text((10, 0), 'hello world', font = font24, fill = 0)
|
||||
draw.text((10, 20), '7.5inch e-Paper', font = font24, fill = 0)
|
||||
draw.text((150, 0), u'微雪电子', font = font24, fill = 0)
|
||||
draw.line((20, 50, 70, 100), fill = 0)
|
||||
draw.line((70, 50, 20, 100), fill = 0)
|
||||
draw.rectangle((20, 50, 70, 100), outline = 0)
|
||||
draw.line((165, 50, 165, 100), fill = 0)
|
||||
draw.line((140, 75, 190, 75), fill = 0)
|
||||
draw.arc((140, 50, 190, 100), 0, 360, fill = 0)
|
||||
draw.rectangle((80, 50, 130, 100), fill = 0)
|
||||
draw.chord((200, 50, 250, 100), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(2)
|
||||
|
||||
# Drawing on the Vertical image
|
||||
print("2.Drawing on the Vertical image...")
|
||||
Limage = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
draw = ImageDraw.Draw(Limage)
|
||||
draw.text((2, 0), 'hello world', font = font18, fill = 0)
|
||||
draw.text((2, 20), '7.5inch epd', font = font18, fill = 0)
|
||||
draw.text((20, 50), u'微雪电子', font = font18, fill = 0)
|
||||
draw.line((10, 90, 60, 140), fill = 0)
|
||||
draw.line((60, 90, 10, 140), fill = 0)
|
||||
draw.rectangle((10, 90, 60, 140), outline = 0)
|
||||
draw.line((95, 90, 95, 140), fill = 0)
|
||||
draw.line((70, 115, 120, 115), fill = 0)
|
||||
draw.arc((70, 90, 120, 140), 0, 360, fill = 0)
|
||||
draw.rectangle((10, 150, 60, 200), fill = 0)
|
||||
draw.chord((70, 150, 120, 200), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(Limage))
|
||||
time.sleep(2)
|
||||
|
||||
print("3.read bmp file")
|
||||
Himage = Image.open('../pic/7in5.bmp')
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(2)
|
||||
|
||||
print("4.read bmp file on window")
|
||||
Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
bmp = Image.open('../pic/100x100.bmp')
|
||||
Himage2.paste(bmp, (50,10))
|
||||
epd.display(epd.getbuffer(Himage2))
|
||||
time.sleep(2)
|
||||
|
||||
print("Clear...")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
@ -1,254 +0,0 @@
|
|||
# /*****************************************************************************
|
||||
# * | File : epd1in54.py
|
||||
# * | Author : Waveshare team
|
||||
# * | Function : Electronic paper driver
|
||||
# * | Info :
|
||||
# *----------------
|
||||
# * | This version: V3.1
|
||||
# * | Date : 2019-06-18
|
||||
# # | Info : python2 demo
|
||||
# -----------------------------------------------------------------------------
|
||||
# V3.1(2019-06-18):
|
||||
# 2.remove commands define:
|
||||
# #define PANEL_SETTING 0x00
|
||||
# #define POWER_SETTING 0x01
|
||||
# #define POWER_OFF 0x02
|
||||
# #define POWER_OFF_SEQUENCE_SETTING 0x03
|
||||
# #define POWER_ON 0x04
|
||||
# #define POWER_ON_MEASURE 0x05
|
||||
# #define BOOSTER_SOFT_START 0x06
|
||||
# #define DEEP_SLEEP 0x07
|
||||
# #define DATA_START_TRANSMISSION_1 0x10
|
||||
# #define DATA_STOP 0x11
|
||||
# #define DISPLAY_REFRESH 0x12
|
||||
# #define DATA_START_TRANSMISSION_2 0x13
|
||||
# #define PLL_CONTROL 0x30
|
||||
# #define TEMPERATURE_SENSOR_COMMAND 0x40
|
||||
# #define TEMPERATURE_SENSOR_CALIBRATION 0x41
|
||||
# #define TEMPERATURE_SENSOR_WRITE 0x42
|
||||
# #define TEMPERATURE_SENSOR_READ 0x43
|
||||
# #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
|
||||
# #define LOW_POWER_DETECTION 0x51
|
||||
# #define TCON_SETTING 0x60
|
||||
# #define TCON_RESOLUTION 0x61
|
||||
# #define SOURCE_AND_GATE_START_SETTING 0x62
|
||||
# #define GET_STATUS 0x71
|
||||
# #define AUTO_MEASURE_VCOM 0x80
|
||||
# #define VCOM_VALUE 0x81
|
||||
# #define VCM_DC_SETTING_REGISTER 0x82
|
||||
# #define PROGRAM_MODE 0xA0
|
||||
# #define ACTIVE_PROGRAM 0xA1
|
||||
# #define READ_OTP_DATA 0xA2
|
||||
# -----------------------------------------------------------------------------
|
||||
# V3.0(2018-11-01):
|
||||
# # 1.Remove:
|
||||
# digital_write(self, pin, value)
|
||||
# digital_read(self, pin)
|
||||
# delay_ms(self, delaytime)
|
||||
# set_lut(self, lut)
|
||||
# self.lut = self.lut_full_update
|
||||
# * 2.Change:
|
||||
# display_frame -> TurnOnDisplay
|
||||
# set_memory_area -> SetWindow
|
||||
# set_memory_pointer -> SetCursor
|
||||
# * 3.How to use
|
||||
# epd = epd1in54.EPD()
|
||||
# epd.init(epd.lut_full_update)
|
||||
# image = Image.new('1', (epd1in54.EPD_WIDTH, epd1in54.EPD_HEIGHT), 255)
|
||||
# ...
|
||||
# drawing ......
|
||||
# ...
|
||||
# epd.display(getbuffer(image))
|
||||
# ******************************************************************************/
|
||||
# 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 epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 200
|
||||
EPD_HEIGHT = 200
|
||||
|
||||
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_full_update = [
|
||||
0x02, 0x02, 0x01, 0x11, 0x12, 0x12, 0x22, 0x22,
|
||||
0x66, 0x69, 0x69, 0x59, 0x58, 0x99, 0x99, 0x88,
|
||||
0x00, 0x00, 0x00, 0x00, 0xF8, 0xB4, 0x13, 0x51,
|
||||
0x35, 0x51, 0x51, 0x19, 0x01, 0x00
|
||||
]
|
||||
|
||||
lut_partial_update = [
|
||||
0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
]
|
||||
|
||||
# Hardware reset
|
||||
def reset(self):
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
epdconfig.digital_write(self.reset_pin, 0) # module reset
|
||||
epdconfig.delay_ms(10)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
def ReadBusy(self):
|
||||
print("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
print("e-Paper busy release")
|
||||
|
||||
def TurnOnDisplay(self):
|
||||
self.send_command(0x22) # DISPLAY_UPDATE_CONTROL_2
|
||||
self.send_data(0xC4)
|
||||
self.send_command(0x20) # MASTER_ACTIVATION
|
||||
self.send_command(0xFF) # TERMINATE_FRAME_READ_WRITE
|
||||
|
||||
self.ReadBusy()
|
||||
|
||||
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)
|
||||
|
||||
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 >> 3) & 0xFF)
|
||||
|
||||
self.send_command(0x4F) # SET_RAM_Y_ADDRESS_COUNTER
|
||||
self.send_data(y & 0xFF)
|
||||
self.send_data((y >> 8) & 0xFF)
|
||||
# self.ReadBusy()
|
||||
|
||||
def init(self, lut):
|
||||
if (epdconfig.module_init() != 0):
|
||||
return -1
|
||||
# EPD hardware init start
|
||||
self.reset()
|
||||
|
||||
self.send_command(0x01) # DRIVER_OUTPUT_CONTROL
|
||||
self.send_data((EPD_HEIGHT - 1) & 0xFF)
|
||||
self.send_data(((EPD_HEIGHT - 1) >> 8) & 0xFF)
|
||||
self.send_data(0x00) # GD = 0 SM = 0 TB = 0
|
||||
|
||||
self.send_command(0x0C) # BOOSTER_SOFT_START_CONTROL
|
||||
self.send_data(0xD7)
|
||||
self.send_data(0xD6)
|
||||
self.send_data(0x9D)
|
||||
|
||||
self.send_command(0x2C) # WRITE_VCOM_REGISTER
|
||||
self.send_data(0xA8) # VCOM 7C
|
||||
|
||||
self.send_command(0x3A) # SET_DUMMY_LINE_PERIOD
|
||||
self.send_data(0x1A) # 4 dummy lines per gate
|
||||
|
||||
self.send_command(0x3B) # SET_GATE_TIME
|
||||
self.send_data(0x08) # 2us per line
|
||||
|
||||
self.send_command(0x11) # DATA_ENTRY_MODE_SETTING
|
||||
self.send_data(0x03) # X increment Y increment
|
||||
|
||||
# set the look-up table register
|
||||
self.send_command(0x32)
|
||||
for i in range(0, len(lut)):
|
||||
self.send_data(lut[i])
|
||||
# EPD hardware init end
|
||||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
buf = [0xFF] * ((self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
print("Horizontal")
|
||||
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[(x + y * self.width) / 8] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
print("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
newy = self.height - x - 1
|
||||
if pixels[x, y] == 0:
|
||||
buf[(newx + newy*self.width) / 8] &= ~(0x80 >> (y % 8))
|
||||
return buf
|
||||
|
||||
def display(self, image):
|
||||
if (image == None):
|
||||
return
|
||||
|
||||
self.SetWindow(0, 0, self.width, self.height)
|
||||
for j in range(0, self.height):
|
||||
self.SetCursor(0, j)
|
||||
self.send_command(0x24)
|
||||
for i in range(0, self.width / 8):
|
||||
self.send_data(image[i + j * (self.width / 8)])
|
||||
self.TurnOnDisplay()
|
||||
|
||||
def Clear(self, color):
|
||||
# self.SetWindow(0, 0, self.width - 1, self.height - 1)
|
||||
# send the color data
|
||||
self.SetWindow(0, 0, self.width, self.height)
|
||||
for j in range(0, self.height):
|
||||
self.SetCursor(0, j)
|
||||
self.send_command(0x24)
|
||||
for i in range(0, self.width / 8):
|
||||
self.send_data(color)
|
||||
self.TurnOnDisplay()
|
||||
|
||||
def sleep(self):
|
||||
self.send_command(0x10) # DEEP_SLEEP_MODE
|
||||
self.send_data(0x01)
|
||||
|
||||
epdconfig.module_exit()
|
||||
|
||||
### END OF FILE ###
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -1,218 +0,0 @@
|
|||
# /*****************************************************************************
|
||||
# * | File : epd1in54b.py
|
||||
# * | Author : Waveshare team
|
||||
# * | Function : Electronic paper driver
|
||||
# * | Info :
|
||||
# *----------------
|
||||
# * | This version: V4.0
|
||||
# * | Date : 2019-06-18
|
||||
# * | Info : python2 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 epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 200
|
||||
EPD_HEIGHT = 200
|
||||
|
||||
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_vcom0 = [0x0E, 0x14, 0x01, 0x0A, 0x06, 0x04, 0x0A, 0x0A, 0x0F, 0x03, 0x03, 0x0C, 0x06, 0x0A, 0x00]
|
||||
lut_w = [0x0E, 0x14, 0x01, 0x0A, 0x46, 0x04, 0x8A, 0x4A, 0x0F, 0x83, 0x43, 0x0C, 0x86, 0x0A, 0x04]
|
||||
lut_b = [0x0E, 0x14, 0x01, 0x8A, 0x06, 0x04, 0x8A, 0x4A, 0x0F, 0x83, 0x43, 0x0C, 0x06, 0x4A, 0x04]
|
||||
lut_g1 = [0x8E, 0x94, 0x01, 0x8A, 0x06, 0x04, 0x8A, 0x4A, 0x0F, 0x83, 0x43, 0x0C, 0x06, 0x0A, 0x04]
|
||||
lut_g2 = [0x8E, 0x94, 0x01, 0x8A, 0x06, 0x04, 0x8A, 0x4A, 0x0F, 0x83, 0x43, 0x0C, 0x06, 0x0A, 0x04]
|
||||
lut_vcom1 = [0x03, 0x1D, 0x01, 0x01, 0x08, 0x23, 0x37, 0x37, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
lut_red0 = [0x83, 0x5D, 0x01, 0x81, 0x48, 0x23, 0x77, 0x77, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
lut_red1 = [0x03, 0x1D, 0x01, 0x01, 0x08, 0x23, 0x37, 0x37, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
|
||||
# Hardware reset
|
||||
def reset(self):
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
epdconfig.digital_write(self.reset_pin, 0) # module reset
|
||||
epdconfig.delay_ms(10)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
def ReadBusy(self):
|
||||
print("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0):
|
||||
epdconfig.delay_ms(100)
|
||||
print("e-Paper busy release")
|
||||
|
||||
def set_lut_bw(self):
|
||||
self.send_command(0x20) # vcom
|
||||
for count in range(0, 15):
|
||||
self.send_data(self.lut_vcom0[count])
|
||||
self.send_command(0x21) # ww --
|
||||
for count in range(0, 15):
|
||||
self.send_data(self.lut_w[count])
|
||||
self.send_command(0x22) # bw r
|
||||
for count in range(0, 15):
|
||||
self.send_data(self.lut_b[count])
|
||||
self.send_command(0x23) # wb w
|
||||
for count in range(0, 15):
|
||||
self.send_data(self.lut_g1[count])
|
||||
self.send_command(0x24) # bb b
|
||||
for count in range(0, 15):
|
||||
self.send_data(self.lut_g2[count])
|
||||
|
||||
def set_lut_red(self):
|
||||
self.send_command(0x25)
|
||||
for count in range(0, 15):
|
||||
self.send_data(self.lut_vcom1[count])
|
||||
self.send_command(0x26)
|
||||
for count in range(0, 15):
|
||||
self.send_data(self.lut_red0[count])
|
||||
self.send_command(0x27)
|
||||
for count in range(0, 15):
|
||||
self.send_data(self.lut_red1[count])
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
return -1
|
||||
# EPD hardware init start
|
||||
self.reset()
|
||||
|
||||
self.send_command(0x01) # POWER_SETTING
|
||||
self.send_data(0x07)
|
||||
self.send_data(0x00)
|
||||
self.send_data(0x08)
|
||||
self.send_data(0x00)
|
||||
self.send_command(0x06) # BOOSTER_SOFT_START
|
||||
self.send_data(0x07)
|
||||
self.send_data(0x07)
|
||||
self.send_data(0x07)
|
||||
self.send_command(0x04) # POWER_ON
|
||||
|
||||
self.ReadBusy()
|
||||
|
||||
self.send_command(0X00) # PANEL_SETTING
|
||||
self.send_data(0xCF)
|
||||
self.send_command(0X50) # VCOM_AND_DATA_INTERVAL_SETTING
|
||||
self.send_data(0x17)
|
||||
self.send_command(0x30) # PLL_CONTROL
|
||||
self.send_data(0x39)
|
||||
self.send_command(0x61) # TCON_RESOLUTION set x and y
|
||||
self.send_data(0xC8)
|
||||
self.send_data(0x00)
|
||||
self.send_data(0xC8)
|
||||
self.send_command(0x82) # VCM_DC_SETTING_REGISTER
|
||||
self.send_data(0x0E)
|
||||
|
||||
self.set_lut_bw()
|
||||
self.set_lut_red()
|
||||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
buf = [0xFF] * (self.width * self.height / 8)
|
||||
# Set buffer to value of Python Imaging Library image.
|
||||
# Image must be in mode 1.
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
if imwidth != self.width or imheight != self.height:
|
||||
raise ValueError('Image must be same dimensions as display \
|
||||
({0}x{1}).' .format(self.width, self.height))
|
||||
|
||||
pixels = image_monocolor.load()
|
||||
for y in range(self.height):
|
||||
for x in range(self.width):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[(x + y * self.width) / 8] &= ~(0x80 >> (x % 8))
|
||||
return buf
|
||||
|
||||
def display(self, blackimage, redimage):
|
||||
# send black data
|
||||
if (blackimage != None):
|
||||
self.send_command(0x10) # DATA_START_TRANSMISSION_1
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
temp = 0x00
|
||||
for bit in range(0, 4):
|
||||
if (blackimage[i] & (0x80 >> bit) != 0):
|
||||
temp |= 0xC0 >> (bit * 2)
|
||||
self.send_data(temp)
|
||||
temp = 0x00
|
||||
for bit in range(4, 8):
|
||||
if (blackimage[i] & (0x80 >> bit) != 0):
|
||||
temp |= 0xC0 >> ((bit - 4) * 2)
|
||||
self.send_data(temp)
|
||||
|
||||
# send red data
|
||||
if (redimage != None):
|
||||
self.send_command(0x13) # DATA_START_TRANSMISSION_2
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(redimage[i])
|
||||
|
||||
self.send_command(0x12) # DISPLAY_REFRESH
|
||||
self.ReadBusy()
|
||||
|
||||
def Clear(self):
|
||||
self.send_command(0x10) # DATA_START_TRANSMISSION_1
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(0xFF)
|
||||
self.send_data(0xFF)
|
||||
|
||||
self.send_command(0x13) # DATA_START_TRANSMISSION_2
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(0xFF)
|
||||
|
||||
self.send_command(0x12) # DISPLAY_REFRESH
|
||||
self.ReadBusy()
|
||||
|
||||
def sleep(self):
|
||||
self.send_command(0x50) # VCOM_AND_DATA_INTERVAL_SETTING
|
||||
self.send_data(0x17)
|
||||
self.send_command(0x82) # to solve Vcom drop
|
||||
self.send_data(0x00)
|
||||
self.send_command(0x01) # power setting
|
||||
self.send_data(0x02) # gate switch to external
|
||||
self.send_data(0x00)
|
||||
self.send_data(0x00)
|
||||
self.send_data(0x00)
|
||||
self.ReadBusy()
|
||||
|
||||
self.send_command(0x02) # power off
|
||||
|
||||
epdconfig.module_exit()
|
||||
|
||||
### END OF FILE ###
|
||||
|
||||
Binary file not shown.
|
|
@ -1,152 +0,0 @@
|
|||
# /*****************************************************************************
|
||||
# * | File : epd1in54c.py
|
||||
# * | Author : Waveshare team
|
||||
# * | Function : Electronic paper driver
|
||||
# * | Info :
|
||||
# *----------------
|
||||
# * | This version: V4.0
|
||||
# * | Date : 2019-06-18
|
||||
# * | Info : python2 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 epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 152
|
||||
EPD_HEIGHT = 152
|
||||
|
||||
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
|
||||
|
||||
# Hardware reset
|
||||
def reset(self):
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(10)
|
||||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
epdconfig.delay_ms(1)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
def ReadBusy(self):
|
||||
print("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(200)
|
||||
print("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
return -1
|
||||
# EPD hardware init start
|
||||
self.reset()
|
||||
|
||||
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(0x0f) # LUT from OTP,160x296
|
||||
self.send_data(0x0d) # VCOM to 0V fast
|
||||
|
||||
self.send_command(0x61) # resolution setting
|
||||
self.send_data(0x98)
|
||||
self.send_data(0x00)
|
||||
self.send_data(0x98)
|
||||
|
||||
self.send_command(0x50)
|
||||
self.send_data(0x77)
|
||||
|
||||
def getbuffer(self, image):
|
||||
buf = [0xFF] * ((self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
print("Horizontal")
|
||||
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[(x + y * self.width) / 8] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
print("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
newy = self.height - x - 1
|
||||
if pixels[x, y] == 0:
|
||||
buf[(newx + newy*self.width) / 8] &= ~(0x80 >> (y % 8))
|
||||
return buf
|
||||
|
||||
def display(self, blackimage, yellowimage):
|
||||
self.send_command(0x10)
|
||||
print("blackimage")
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(blackimage[i])
|
||||
self.send_command(0x13)
|
||||
print("yellowimage")
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(yellowimage[i])
|
||||
|
||||
self.send_command(0x12)
|
||||
self.ReadBusy()
|
||||
|
||||
def Clear(self):
|
||||
self.send_command(0x10)
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(0xFF)
|
||||
self.send_command(0x13)
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(0xFF)
|
||||
|
||||
self.send_command(0x12)
|
||||
self.ReadBusy()
|
||||
|
||||
# after this, call epd.init() to awaken the module
|
||||
def sleep(self):
|
||||
self.send_command(0X02) # power off
|
||||
self.ReadBusy()
|
||||
self.send_command(0X07) # deep sleep
|
||||
self.send_data(0xA5)
|
||||
|
||||
epdconfig.module_exit()
|
||||
### END OF FILE ###
|
||||
|
||||
Binary file not shown.
|
|
@ -1,224 +0,0 @@
|
|||
# /*****************************************************************************
|
||||
# * | File : epd2in13.py
|
||||
# * | Author : Waveshare team
|
||||
# * | Function : Electronic paper driver
|
||||
# * | Info :
|
||||
# *----------------
|
||||
# * | This version: V4.0
|
||||
# * | Date : 2019-06-19
|
||||
# * | Info : python2 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 epdconfig
|
||||
import numpy as np
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 122
|
||||
EPD_HEIGHT = 250
|
||||
|
||||
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_full_update = [
|
||||
0x22, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x11,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
]
|
||||
|
||||
lut_partial_update = [
|
||||
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
]
|
||||
|
||||
# Hardware reset
|
||||
def reset(self):
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
epdconfig.delay_ms(10)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
def ReadBusy(self):
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
|
||||
def TurnOnDisplay(self):
|
||||
self.send_command(0x22) # DISPLAY_UPDATE_CONTROL_2
|
||||
self.send_data(0xC4)
|
||||
self.send_command(0x20) # MASTER_ACTIVATION
|
||||
self.send_command(0xFF) # TERMINATE_FRAME_READ_WRITE
|
||||
|
||||
print("e-Paper busy")
|
||||
self.ReadBusy()
|
||||
print("e-Paper busy release")
|
||||
|
||||
def init(self, lut):
|
||||
if (epdconfig.module_init() != 0):
|
||||
return -1
|
||||
# EPD hardware init start
|
||||
self.reset()
|
||||
self.send_command(0x01) # DRIVER_OUTPUT_CONTROL
|
||||
self.send_data((EPD_HEIGHT - 1) & 0xFF)
|
||||
self.send_data(((EPD_HEIGHT - 1) >> 8) & 0xFF)
|
||||
self.send_data(0x00) # GD = 0 SM = 0 TB = 0
|
||||
|
||||
self.send_command(0x0C) # BOOSTER_SOFT_START_CONTROL
|
||||
self.send_data(0xD7)
|
||||
self.send_data(0xD6)
|
||||
self.send_data(0x9D)
|
||||
|
||||
self.send_command(0x2C) # WRITE_VCOM_REGISTER
|
||||
self.send_data(0xA8) # VCOM 7C
|
||||
|
||||
self.send_command(0x3A) # SET_DUMMY_LINE_PERIOD
|
||||
self.send_data(0x1A) # 4 dummy lines per gate
|
||||
|
||||
self.send_command(0x3B) # SET_GATE_TIME
|
||||
self.send_data(0x08) # 2us per line
|
||||
|
||||
self.send_command(0X3C) # BORDER_WAVEFORM_CONTROL
|
||||
self.send_data(0x03)
|
||||
|
||||
self.send_command(0X11) # DATA_ENTRY_MODE_SETTING
|
||||
self.send_data(0x03) # X increment; Y increment
|
||||
|
||||
# WRITE_LUT_REGISTER
|
||||
self.send_command(0x32)
|
||||
for count in range(30):
|
||||
self.send_data(lut[count])
|
||||
|
||||
return 0
|
||||
|
||||
##
|
||||
# @brief: specify the memory area for data R/W
|
||||
##
|
||||
def SetWindows(self, x_start, y_start, x_end, y_end):
|
||||
self.send_command(0x44) # SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
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)
|
||||
|
||||
##
|
||||
# @brief: specify the start point for data R/W
|
||||
##
|
||||
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 >> 3) & 0xFF)
|
||||
self.send_command(0x4F) # SET_RAM_Y_ADDRESS_COUNTER
|
||||
self.send_data(y & 0xFF)
|
||||
self.send_data((y >> 8) & 0xFF)
|
||||
self.ReadBusy()
|
||||
|
||||
def getbuffer(self, image):
|
||||
if self.width%8 == 0:
|
||||
linewidth = self.width/8
|
||||
else:
|
||||
linewidth = self.width/8 + 1
|
||||
|
||||
buf = [0xFF] * (linewidth * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
print("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
if pixels[x, y] == 0:
|
||||
# x = imwidth - x
|
||||
buf[x / 8 + y * linewidth] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
print("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
newy = self.height - x - 1
|
||||
if pixels[x, y] == 0:
|
||||
# newy = imwidth - newy - 1
|
||||
buf[newx / 8 + newy*linewidth] &= ~(0x80 >> (y % 8))
|
||||
return buf
|
||||
|
||||
|
||||
def display(self, image):
|
||||
if self.width%8 == 0:
|
||||
linewidth = self.width/8
|
||||
else:
|
||||
linewidth = self.width/8 + 1
|
||||
|
||||
self.SetWindows(0, 0, self.width, self.height);
|
||||
for j in range(0, self.height):
|
||||
self.SetCursor(0, j);
|
||||
self.send_command(0x24);
|
||||
for i in range(0, linewidth):
|
||||
self.send_data(image[i + j * linewidth])
|
||||
self.TurnOnDisplay()
|
||||
|
||||
def Clear(self, color):
|
||||
if self.width%8 == 0:
|
||||
linewidth = self.width/8
|
||||
else:
|
||||
linewidth = self.width/8 + 1
|
||||
|
||||
self.SetWindows(0, 0, self.width, self.height);
|
||||
for j in range(0, self.height):
|
||||
self.SetCursor(0, j);
|
||||
self.send_command(0x24);
|
||||
for i in range(0, linewidth):
|
||||
self.send_data(color)
|
||||
self.TurnOnDisplay()
|
||||
|
||||
def sleep(self):
|
||||
self.send_command(0x10) #enter deep sleep
|
||||
self.send_data(0x01)
|
||||
epdconfig.delay_ms(100)
|
||||
|
||||
epdconfig.module_exit()
|
||||
|
||||
### END OF FILE ###
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -1,158 +0,0 @@
|
|||
# /*****************************************************************************
|
||||
# * | File : epd2in13bc.py
|
||||
# * | Author : Waveshare team
|
||||
# * | Function : Electronic paper driver
|
||||
# * | Info :
|
||||
# *----------------
|
||||
# * | This version: V4.0
|
||||
# * | Date : 2019-06-20
|
||||
# * | Info : python2 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 epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 104
|
||||
EPD_HEIGHT = 212
|
||||
|
||||
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
|
||||
|
||||
# Hardware reset
|
||||
def reset(self):
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
epdconfig.delay_ms(10)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
def ReadBusy(self):
|
||||
print("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
print("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
return -1
|
||||
|
||||
self.reset()
|
||||
|
||||
self.send_command(0x06) # BOOSTER_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(0x8F)
|
||||
|
||||
self.send_command(0x50) # VCOM_AND_DATA_INTERVAL_SETTING
|
||||
self.send_data(0xF0)
|
||||
|
||||
self.send_command(0x61) # RESOLUTION_SETTING
|
||||
self.send_data(self.width & 0xff)
|
||||
self.send_data(self.height >> 8)
|
||||
self.send_data(self.height & 0xff)
|
||||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# print "bufsiz = ",(self.width/8) * self.height
|
||||
buf = [0xFF] * ((self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# print "imwidth = %d, imheight = %d",imwidth,imheight
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
print("Vertical")
|
||||
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[(x + y * self.width) / 8] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
print("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
newy = self.height - x - 1
|
||||
if pixels[x, y] == 0:
|
||||
buf[(newx + newy*self.width) / 8] &= ~(0x80 >> (y % 8))
|
||||
return buf
|
||||
|
||||
def display(self, imageblack, imagered):
|
||||
self.send_command(0x10)
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(imageblack[i])
|
||||
self.send_command(0x92)
|
||||
|
||||
self.send_command(0x13)
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(imagered[i])
|
||||
self.send_command(0x92)
|
||||
|
||||
self.send_command(0x12) # REFRESH
|
||||
self.ReadBusy()
|
||||
|
||||
def Clear(self):
|
||||
self.send_command(0x10)
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(0xFF)
|
||||
self.send_command(0x92)
|
||||
|
||||
self.send_command(0x13)
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(0xFF)
|
||||
self.send_command(0x92)
|
||||
|
||||
self.send_command(0x12) # REFRESH
|
||||
self.ReadBusy()
|
||||
|
||||
def sleep(self):
|
||||
self.send_command(0x02) # POWER_OFF
|
||||
self.ReadBusy()
|
||||
self.send_command(0x07) # DEEP_SLEEP
|
||||
self.send_data(0xA5) # check code
|
||||
|
||||
epdconfig.module_exit()
|
||||
### END OF FILE ###
|
||||
|
||||
Binary file not shown.
|
|
@ -1,357 +0,0 @@
|
|||
# /*****************************************************************************
|
||||
# * | File : epd2in13d.py
|
||||
# * | Author : Waveshare team
|
||||
# * | Function : Electronic paper driver
|
||||
# * | Info :
|
||||
# *----------------
|
||||
# * | This version: V4.0
|
||||
# * | Date : 2019-06-20
|
||||
# * | Info : python2 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 epdconfig
|
||||
from PIL import Image
|
||||
import RPi.GPIO as GPIO
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 104
|
||||
EPD_HEIGHT = 212
|
||||
|
||||
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_vcomDC = [
|
||||
0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
]
|
||||
|
||||
lut_ww = [
|
||||
0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
]
|
||||
|
||||
lut_bw = [
|
||||
0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x0F, 0x0F, 0x00, 0x00, 0x03,
|
||||
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01,
|
||||
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
]
|
||||
|
||||
lut_wb = [
|
||||
0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
]
|
||||
|
||||
lut_bb = [
|
||||
0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
]
|
||||
|
||||
lut_vcom1 = [
|
||||
0x00, 0x19, 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,
|
||||
0x00, 0x00,
|
||||
]
|
||||
|
||||
lut_ww1 = [
|
||||
0x00, 0x19, 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,
|
||||
]
|
||||
|
||||
lut_bw1 = [
|
||||
0x80, 0x19, 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,
|
||||
]
|
||||
|
||||
lut_wb1 = [
|
||||
0x40, 0x19, 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,
|
||||
]
|
||||
|
||||
lut_bb1 = [
|
||||
0x00, 0x19, 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,
|
||||
]
|
||||
|
||||
# Hardware reset
|
||||
def reset(self):
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
epdconfig.delay_ms(10)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
def ReadBusy(self):
|
||||
print("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
self.send_command(0x71)
|
||||
epdconfig.delay_ms(100)
|
||||
print("e-Paper busy release")
|
||||
|
||||
def TurnOnDisplay(self):
|
||||
self.send_command(0x12)
|
||||
epdconfig.delay_ms(10)
|
||||
self.ReadBusy()
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
return -1
|
||||
# EPD hardware init start
|
||||
self.reset()
|
||||
|
||||
self.send_command(0x01) # POWER SETTING
|
||||
self.send_data(0x03)
|
||||
self.send_data(0x00)
|
||||
self.send_data(0x2b)
|
||||
self.send_data(0x2b)
|
||||
self.send_data(0x03)
|
||||
|
||||
self.send_command(0x06) # boost soft start
|
||||
self.send_data(0x17) # A
|
||||
self.send_data(0x17) # B
|
||||
self.send_data(0x17) # C
|
||||
|
||||
self.send_command(0x04)
|
||||
self.ReadBusy()
|
||||
|
||||
self.send_command(0x00) # panel setting
|
||||
self.send_data(0xbf) # LUT from OTP,128x296
|
||||
self.send_data(0x0d) # VCOM to 0V fast
|
||||
|
||||
self.send_command(0x30) # PLL setting
|
||||
self.send_data(0x3a) # 3a 100HZ 29 150Hz 39 200HZ 31 171HZ
|
||||
|
||||
self.send_command(0x61) # resolution setting
|
||||
self.send_data(self.width)
|
||||
self.send_data((self.height >> 8) & 0xff)
|
||||
self.send_data(self.height& 0xff)
|
||||
|
||||
self.send_command(0x82) # vcom_DC setting
|
||||
self.send_data(0x28)
|
||||
return 0
|
||||
|
||||
def SetFullReg(self):
|
||||
self.send_command(0x82)
|
||||
self.send_data(0x00)
|
||||
self.send_command(0X50)
|
||||
self.send_data(0x97)
|
||||
|
||||
self.send_command(0x20) # vcom
|
||||
for count in range(0, 44):
|
||||
self.send_data(self.lut_vcomDC[count])
|
||||
self.send_command(0x21) # ww --
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_ww[count])
|
||||
self.send_command(0x22) # bw r
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_bw[count])
|
||||
self.send_command(0x23) # wb w
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_wb[count])
|
||||
self.send_command(0x24) # bb b
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_bb[count])
|
||||
|
||||
def SetPartReg(self):
|
||||
self.send_command(0x82)
|
||||
self.send_data(0x03)
|
||||
self.send_command(0X50)
|
||||
self.send_data(0x47)
|
||||
|
||||
self.send_command(0x20) # vcom
|
||||
for count in range(0, 44):
|
||||
self.send_data(self.lut_vcom1[count])
|
||||
self.send_command(0x21) # ww --
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_ww1[count])
|
||||
self.send_command(0x22) # bw r
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_bw1[count])
|
||||
self.send_command(0x23) # wb w
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_wb1[count])
|
||||
self.send_command(0x24) # bb b
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_bb1[count])
|
||||
|
||||
def getbuffer(self, image):
|
||||
# print "bufsiz = ",(self.width/8) * self.height
|
||||
buf = [0xFF] * ((self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# print "imwidth = %d, imheight = %d",imwidth,imheight
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
print "Vertical"
|
||||
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[(x + y * self.width) / 8] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
print "Horizontal"
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
newy = self.height - x - 1
|
||||
if pixels[x, y] == 0:
|
||||
buf[(newx + newy*self.width) / 8] &= ~(0x80 >> (y % 8))
|
||||
return buf
|
||||
|
||||
def display(self, image):
|
||||
if (Image == None):
|
||||
return
|
||||
|
||||
self.send_command(0x10)
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(0x00)
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.send_command(0x13)
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(image[i])
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.SetFullReg()
|
||||
self.TurnOnDisplay()
|
||||
|
||||
def DisplayPartial(self, image):
|
||||
if (Image == None):
|
||||
return
|
||||
|
||||
self.SetPartReg()
|
||||
self.send_command(0x91)
|
||||
self.send_command(0x90)
|
||||
self.send_data(0)
|
||||
self.send_data(self.width - 1)
|
||||
|
||||
self.send_data(0)
|
||||
self.send_data(0)
|
||||
self.send_data(self.height / 256)
|
||||
self.send_data(self.height % 256 - 1)
|
||||
self.send_data(0x28)
|
||||
|
||||
self.send_command(0x10)
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(image[i])
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.send_command(0x13)
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(~image[i])
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.TurnOnDisplay()
|
||||
|
||||
def Clear(self, color):
|
||||
self.send_command(0x10)
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(0x00)
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.send_command(0x13)
|
||||
for i in range(0, self.width * self.height / 8):
|
||||
self.send_data(0xFF)
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.SetFullReg()
|
||||
self.TurnOnDisplay()
|
||||
|
||||
def sleep(self):
|
||||
self.send_command(0X50)
|
||||
self.send_data(0xf7)
|
||||
self.send_command(0X02) # power off
|
||||
self.send_command(0X07) # deep sleep
|
||||
self.send_data(0xA5)
|
||||
|
||||
epdconfig.module_exit()
|
||||
|
||||
### END OF FILE ###
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue