Gerrit Pathuis / Mbed 2 deprecated Epaper_epd1in54_Waveshare

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers epd1in54.h Source File

epd1in54.h

00001 /**
00002  *  @filename   :   epd1in54.h
00003  *  @brief      :   Header file for e-paper display library epd1in54.cpp
00004  *  @author     :   Yehui from Waveshare
00005  *
00006  *  Copyright (C) Waveshare     September 5 2017
00007  *
00008  * Permission is hereby granted, free of charge, to any person obtaining a copy
00009  * of this software and associated documnetation files (the "Software"), to deal
00010  * in the Software without restriction, including without limitation the rights
00011  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00012  * copies of the Software, and to permit persons to  whom the Software is
00013  * furished to do so, subject to the following conditions:
00014  *
00015  * The above copyright notice and this permission notice shall be included in
00016  * all copies or substantial portions of the Software.
00017  *
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00019  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00020  * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00021  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00022  * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00023  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00024  * THE SOFTWARE.
00025  */
00026 
00027 #ifndef EPD1IN54_H_
00028 #define EPD1IN54_H_
00029 
00030 #include "epdif.h"
00031 
00032 // Display resolution
00033 #define EPD_WIDTH       200
00034 #define EPD_HEIGHT      200
00035 
00036 // EPD1IN54 commands
00037 #define DRIVER_OUTPUT_CONTROL                       0x01
00038 #define BOOSTER_SOFT_START_CONTROL                  0x0C
00039 #define GATE_SCAN_START_POSITION                    0x0F
00040 #define DEEP_SLEEP_MODE                             0x10
00041 #define DATA_ENTRY_MODE_SETTING                     0x11
00042 #define SW_RESET                                    0x12
00043 #define TEMPERATURE_SENSOR_CONTROL                  0x1A
00044 #define MASTER_ACTIVATION                           0x20
00045 #define DISPLAY_UPDATE_CONTROL_1                    0x21
00046 #define DISPLAY_UPDATE_CONTROL_2                    0x22
00047 #define WRITE_RAM                                   0x24
00048 #define WRITE_VCOM_REGISTER                         0x2C
00049 #define WRITE_LUT_REGISTER                          0x32
00050 #define SET_DUMMY_LINE_PERIOD                       0x3A
00051 #define SET_GATE_TIME                               0x3B
00052 #define BORDER_WAVEFORM_CONTROL                     0x3C
00053 #define SET_RAM_X_ADDRESS_START_END_POSITION        0x44
00054 #define SET_RAM_Y_ADDRESS_START_END_POSITION        0x45
00055 #define SET_RAM_X_ADDRESS_COUNTER                   0x4E
00056 #define SET_RAM_Y_ADDRESS_COUNTER                   0x4F
00057 #define TERMINATE_FRAME_READ_WRITE                  0xFF
00058 
00059 #define LOW         0
00060 #define HIGH        1
00061 
00062 extern const unsigned char lut_full_update[];
00063 extern const unsigned char lut_partial_update[];
00064 
00065 class Epd : EpdIf
00066 {
00067 public:
00068     unsigned int reset_pin_no;
00069     unsigned int dc_pin_no;
00070     unsigned int cs_pin_no;
00071     unsigned int busy_pin_no;
00072 
00073     unsigned long width;
00074     unsigned long height;
00075 
00076     Epd();
00077     ~Epd();
00078     int  Init(const unsigned char* lut);
00079     void SendCommand(unsigned char command);
00080     void SendData(unsigned char data);
00081     void WaitUntilIdle(void);
00082     void Reset(void);
00083     void SetFrameMemory(
00084         const unsigned char* image_buffer,
00085         int x,
00086         int y,
00087         int image_width,
00088         int image_height
00089     );
00090     void SetFrameMemory(const unsigned char* image_buffer);
00091     void ClearFrameMemory(unsigned char color);
00092     void DisplayFrame(void);
00093     void Sleep(void);
00094 
00095 //private:
00096 public:
00097     const unsigned char* lut;
00098 
00099     void SetLut(const unsigned char* lut);
00100     void SetMemoryArea(int x_start, int y_start, int x_end, int y_end);
00101     void SetMemoryPointer(int x, int y);
00102 };
00103 
00104 #endif /* EPD1IN54_H */
00105 
00106 /* END OF FILE */
00107