acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

EPD_Support.h (4173B)

      1 /*  Support definitions and functions for ePaper examples
      2  *  These tailor the library and screen settings
      3  *  Must be a header file to ensure #defines are established first
      4  *  
      5  *  Created by Bodmer 30/3/18 for TFT_eSPI library:
      6  *  https://github.com/Bodmer/TFT_eSPI
      7  */
      8 
      9 /*
     10     EPD_WIDTH and EPD_HEIGHT are automatically defined here based on the library selected
     11 
     12     For 2 colour ePaper displays create one frame pointer in sketch:
     13     uint8_t* framePtr;
     14     
     15     For 3 colour ePaper displays create two frame pointers in sketch:
     16     uint8_t* blackFramePtr;
     17     uint8_t* redFramePtr;
     18     
     19     Call this function to update whole display:
     20     updateDisplay();
     21 */
     22 // Install the ePaper library for your own display size and type
     23 // from here:
     24 // https://github.com/Bodmer/EPD_Libraries
     25 
     26  
     27 //------------------------------------------------------------------------------------
     28 // Define which colour values are paper and ink
     29 //------------------------------------------------------------------------------------
     30 #if defined (EPD2IN7B_H)
     31   #define COLORED     1 // EPD2IN7B is opposite to all others!
     32   #define UNCOLORED   0
     33 #else
     34   #define COLORED     0
     35   #define UNCOLORED   1
     36 #endif
     37 
     38 
     39 //------------------------------------------------------------------------------------
     40 // Define the width and height of the different displays
     41 //------------------------------------------------------------------------------------
     42 #if defined (EPD1IN54_H) || defined (EPD1IN54B_H)
     43   #define EPD_WIDTH       200 // Frame buffer is 5000 bytes
     44   #define EPD_HEIGHT      200
     45   #define INIT_LUT        lut_full_update
     46 
     47 #elif defined (EPD1IN54C_H)
     48   #define EPD_WIDTH       152 // 2 frame buffers of 2888 bytes each
     49   #define EPD_HEIGHT      152
     50   #define INIT_LUT
     51 
     52 #elif defined (EPD2IN7_H) || defined (EPD2IN7B_H)
     53   #define EPD_WIDTH       176 // Frame buffer is 5808 bytes
     54   #define EPD_HEIGHT      264
     55   #define INIT_LUT
     56 
     57 #elif defined (EPD2IN9_H)
     58   #define EPD_WIDTH       128 // Frame buffer is 4736 bytes
     59   #define EPD_HEIGHT      296
     60   #define INIT_LUT        lut_full_update
     61 
     62 #elif defined (EPD2IN9B_H)
     63   #define EPD_WIDTH       128 // Frame buffer is 4736 bytes
     64   #define EPD_HEIGHT      296
     65   #define INIT_LUT
     66 
     67 #elif defined (EPD2IN13_H)
     68   #define EPD_WIDTH       122 // Frame buffer is 4000 bytes
     69   #define EPD_HEIGHT      250
     70   #define INIT_LUT        lut_full_update
     71 
     72 #elif defined (EPD2IN13B_H)
     73   #define EPD_WIDTH       104 // 2 frame buffers of 2756 bytes each
     74   #define EPD_HEIGHT      212
     75   #define INIT_LUT
     76 
     77 #elif defined (EPD4IN2_H) || defined (EPD4IN2B_H)
     78   #define EPD_WIDTH       400 // Frame buffer is 15000 bytes
     79   #define EPD_HEIGHT      300
     80   #define INIT_LUT
     81 
     82 // ESP8266 has just enough RAM for a 2 color 7.5" display full screen buffer
     83 // ESP32 has just enough RAM for 2 or 3 color 7.5" display
     84 // (Without using partial screen updates)
     85 #elif defined (EPD7IN5_H) || defined (EPD7IN5B_H)
     86   #define EPD_WIDTH       640  // 2 colour frame buffer is 30720 bytes
     87   #define EPD_HEIGHT      384  // 2 colour frame buffer is 61440 bytes
     88   #define INIT_LUT
     89 
     90 #else
     91   # error "Selected ePaper library is not supported"
     92 
     93 #endif
     94 
     95 
     96 //------------------------------------------------------------------------------------
     97 // Update display - different displays have different function names in the default
     98 // Waveshare libraries  :-(
     99 //------------------------------------------------------------------------------------
    100 #if defined (EPD1IN54B_H) || defined(EPD1IN54C_H) || defined(EPD2IN13B_H) || defined(EPD2IN7B_H) || defined(EPD2IN9B_H) || defined(EPD4IN2_H)
    101   void updateDisplay(uint8_t* blackFrame = blackFramePtr, uint8_t* redFrame = redFramePtr)
    102   {
    103     ePaper.DisplayFrame(blackFrame, redFrame);  // Update 3 colour display
    104 #else
    105   void updateDisplay(uint8_t* blackFrame = framePtr)
    106   {
    107   #if defined (EPD2IN7_H) || defined(EPD4IN2_H)
    108     ePaper.DisplayFrame(blackFrame);            // Update 2 color display
    109 
    110   #elif defined (EPD1IN54_H) || defined(EPD2IN13_H) || defined(EPD2IN9_H)
    111     ePaper.SetFrameMemory(blackFrame);
    112     ePaper.DisplayFrame();            // Update 2 color display
    113   #else
    114     # error "Selected ePaper library is not supported"
    115   #endif
    116 #endif
    117 }