E_paper, E_ink, Screen size 1.54", resolution 200x200, 4 wire spi, Waveshare, Black and White, Kl25Z, 8 wire print connector, supply 3.3 Volt, IL0373 Controller, font size is 8, 12, 16 and 24.

Dependencies:   mbed

Committer:
GerritPathuis
Date:
Sat Mar 31 08:40:16 2018 +0000
Revision:
10:08e026240a5f
Parent:
6:469fb6b0d26d
Minor text update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GerritPathuis 0:665e04c85d8d 1 /**
GerritPathuis 0:665e04c85d8d 2 * @filename : epd1in54.h
GerritPathuis 0:665e04c85d8d 3 * @brief : Header file for e-paper display library epd1in54.cpp
GerritPathuis 0:665e04c85d8d 4 * @author : Yehui from Waveshare
GerritPathuis 6:469fb6b0d26d 5 *
GerritPathuis 0:665e04c85d8d 6 * Copyright (C) Waveshare September 5 2017
GerritPathuis 0:665e04c85d8d 7 *
GerritPathuis 0:665e04c85d8d 8 * Permission is hereby granted, free of charge, to any person obtaining a copy
GerritPathuis 0:665e04c85d8d 9 * of this software and associated documnetation files (the "Software"), to deal
GerritPathuis 0:665e04c85d8d 10 * in the Software without restriction, including without limitation the rights
GerritPathuis 0:665e04c85d8d 11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
GerritPathuis 0:665e04c85d8d 12 * copies of the Software, and to permit persons to whom the Software is
GerritPathuis 0:665e04c85d8d 13 * furished to do so, subject to the following conditions:
GerritPathuis 0:665e04c85d8d 14 *
GerritPathuis 0:665e04c85d8d 15 * The above copyright notice and this permission notice shall be included in
GerritPathuis 0:665e04c85d8d 16 * all copies or substantial portions of the Software.
GerritPathuis 0:665e04c85d8d 17 *
GerritPathuis 0:665e04c85d8d 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
GerritPathuis 0:665e04c85d8d 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
GerritPathuis 0:665e04c85d8d 20 * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
GerritPathuis 0:665e04c85d8d 21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
GerritPathuis 0:665e04c85d8d 22 * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
GerritPathuis 0:665e04c85d8d 23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
GerritPathuis 0:665e04c85d8d 24 * THE SOFTWARE.
GerritPathuis 0:665e04c85d8d 25 */
GerritPathuis 0:665e04c85d8d 26
GerritPathuis 5:3b7204bd6832 27 #ifndef EPD1IN54_H_
GerritPathuis 5:3b7204bd6832 28 #define EPD1IN54_H_
GerritPathuis 0:665e04c85d8d 29
GerritPathuis 0:665e04c85d8d 30 #include "epdif.h"
GerritPathuis 0:665e04c85d8d 31
GerritPathuis 0:665e04c85d8d 32 // Display resolution
GerritPathuis 0:665e04c85d8d 33 #define EPD_WIDTH 200
GerritPathuis 0:665e04c85d8d 34 #define EPD_HEIGHT 200
GerritPathuis 0:665e04c85d8d 35
GerritPathuis 0:665e04c85d8d 36 // EPD1IN54 commands
GerritPathuis 0:665e04c85d8d 37 #define DRIVER_OUTPUT_CONTROL 0x01
GerritPathuis 0:665e04c85d8d 38 #define BOOSTER_SOFT_START_CONTROL 0x0C
GerritPathuis 0:665e04c85d8d 39 #define GATE_SCAN_START_POSITION 0x0F
GerritPathuis 0:665e04c85d8d 40 #define DEEP_SLEEP_MODE 0x10
GerritPathuis 0:665e04c85d8d 41 #define DATA_ENTRY_MODE_SETTING 0x11
GerritPathuis 0:665e04c85d8d 42 #define SW_RESET 0x12
GerritPathuis 0:665e04c85d8d 43 #define TEMPERATURE_SENSOR_CONTROL 0x1A
GerritPathuis 0:665e04c85d8d 44 #define MASTER_ACTIVATION 0x20
GerritPathuis 0:665e04c85d8d 45 #define DISPLAY_UPDATE_CONTROL_1 0x21
GerritPathuis 0:665e04c85d8d 46 #define DISPLAY_UPDATE_CONTROL_2 0x22
GerritPathuis 0:665e04c85d8d 47 #define WRITE_RAM 0x24
GerritPathuis 0:665e04c85d8d 48 #define WRITE_VCOM_REGISTER 0x2C
GerritPathuis 0:665e04c85d8d 49 #define WRITE_LUT_REGISTER 0x32
GerritPathuis 0:665e04c85d8d 50 #define SET_DUMMY_LINE_PERIOD 0x3A
GerritPathuis 0:665e04c85d8d 51 #define SET_GATE_TIME 0x3B
GerritPathuis 0:665e04c85d8d 52 #define BORDER_WAVEFORM_CONTROL 0x3C
GerritPathuis 0:665e04c85d8d 53 #define SET_RAM_X_ADDRESS_START_END_POSITION 0x44
GerritPathuis 0:665e04c85d8d 54 #define SET_RAM_Y_ADDRESS_START_END_POSITION 0x45
GerritPathuis 0:665e04c85d8d 55 #define SET_RAM_X_ADDRESS_COUNTER 0x4E
GerritPathuis 0:665e04c85d8d 56 #define SET_RAM_Y_ADDRESS_COUNTER 0x4F
GerritPathuis 0:665e04c85d8d 57 #define TERMINATE_FRAME_READ_WRITE 0xFF
GerritPathuis 0:665e04c85d8d 58
GerritPathuis 0:665e04c85d8d 59 #define LOW 0
GerritPathuis 6:469fb6b0d26d 60 #define HIGH 1
GerritPathuis 2:d7fc318a1528 61
GerritPathuis 0:665e04c85d8d 62 extern const unsigned char lut_full_update[];
GerritPathuis 0:665e04c85d8d 63 extern const unsigned char lut_partial_update[];
GerritPathuis 0:665e04c85d8d 64
GerritPathuis 6:469fb6b0d26d 65 class Epd : EpdIf
GerritPathuis 6:469fb6b0d26d 66 {
GerritPathuis 0:665e04c85d8d 67 public:
GerritPathuis 6:469fb6b0d26d 68 unsigned int reset_pin_no;
GerritPathuis 6:469fb6b0d26d 69 unsigned int dc_pin_no;
GerritPathuis 6:469fb6b0d26d 70 unsigned int cs_pin_no;
GerritPathuis 6:469fb6b0d26d 71 unsigned int busy_pin_no;
GerritPathuis 6:469fb6b0d26d 72
GerritPathuis 0:665e04c85d8d 73 unsigned long width;
GerritPathuis 0:665e04c85d8d 74 unsigned long height;
GerritPathuis 0:665e04c85d8d 75
GerritPathuis 0:665e04c85d8d 76 Epd();
GerritPathuis 0:665e04c85d8d 77 ~Epd();
GerritPathuis 0:665e04c85d8d 78 int Init(const unsigned char* lut);
GerritPathuis 0:665e04c85d8d 79 void SendCommand(unsigned char command);
GerritPathuis 0:665e04c85d8d 80 void SendData(unsigned char data);
GerritPathuis 0:665e04c85d8d 81 void WaitUntilIdle(void);
GerritPathuis 0:665e04c85d8d 82 void Reset(void);
GerritPathuis 0:665e04c85d8d 83 void SetFrameMemory(
GerritPathuis 0:665e04c85d8d 84 const unsigned char* image_buffer,
GerritPathuis 0:665e04c85d8d 85 int x,
GerritPathuis 0:665e04c85d8d 86 int y,
GerritPathuis 0:665e04c85d8d 87 int image_width,
GerritPathuis 0:665e04c85d8d 88 int image_height
GerritPathuis 0:665e04c85d8d 89 );
GerritPathuis 0:665e04c85d8d 90 void SetFrameMemory(const unsigned char* image_buffer);
GerritPathuis 0:665e04c85d8d 91 void ClearFrameMemory(unsigned char color);
GerritPathuis 0:665e04c85d8d 92 void DisplayFrame(void);
GerritPathuis 0:665e04c85d8d 93 void Sleep(void);
GerritPathuis 0:665e04c85d8d 94
GerritPathuis 1:d27a7e06c233 95 //private:
GerritPathuis 1:d27a7e06c233 96 public:
GerritPathuis 0:665e04c85d8d 97 const unsigned char* lut;
GerritPathuis 0:665e04c85d8d 98
GerritPathuis 0:665e04c85d8d 99 void SetLut(const unsigned char* lut);
GerritPathuis 0:665e04c85d8d 100 void SetMemoryArea(int x_start, int y_start, int x_end, int y_end);
GerritPathuis 0:665e04c85d8d 101 void SetMemoryPointer(int x, int y);
GerritPathuis 0:665e04c85d8d 102 };
GerritPathuis 0:665e04c85d8d 103
GerritPathuis 0:665e04c85d8d 104 #endif /* EPD1IN54_H */
GerritPathuis 0:665e04c85d8d 105
GerritPathuis 0:665e04c85d8d 106 /* END OF FILE */
GerritPathuis 0:665e04c85d8d 107