Library to control the EM027BS013 ePaper display from Pervasive Display.
Dependents: app_epaper_EM027BS013_LPC1549 lpc4088_ebb_epaper EaEpaper_EM027BS013 app_epaper_EM027BS013 ... more
EPD_COG_process.h
00001 /** 00002 * \file 00003 * 00004 * \brief The definition of COG driving data and process 00005 * 00006 * Copyright (c) 2012-2014 Pervasive Displays Inc. All rights reserved. 00007 * 00008 * Authors: Pervasive Displays Inc. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 00014 * 1. Redistributions of source code must retain the above copyright 00015 * notice, this list of conditions and the following disclaimer. 00016 * 2. Redistributions in binary form must reproduce the above copyright 00017 * notice, this list of conditions and the following disclaimer in 00018 * the documentation and/or other materials provided with the 00019 * distribution. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00024 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00025 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00026 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00027 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00028 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00029 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 */ 00033 00034 #ifndef DISPLAY_COG_PROCESS__H_INCLUDED 00035 #define DISPLAY_COG_PROCESS__H_INCLUDED 00036 00037 #include "Pervasive_Displays_small_EPD.h" 00038 /** 00039 * \brief The definition for driving stage to compare with for getting Odd and Even data */ 00040 #define BLACK0 (uint8_t)(0x03) /**< getting bit1 or bit0 as black color(11) */ 00041 #define BLACK1 (uint8_t)(0x0C) /**< getting bit3 or bit2 as black color(11) */ 00042 #define BLACK2 (uint8_t)(0x30) /**< getting bit5 or bit4 as black color(11) */ 00043 #define BLACK3 (uint8_t)(0xC0) /**< getting bit7 or bit6 as black color(11) */ 00044 #define WHITE0 (uint8_t)(0x02) /**< getting bit1 or bit0 as white color(10) */ 00045 #define WHITE1 (uint8_t)(0x08) /**< getting bit3 or bit2 as white color(10) */ 00046 #define WHITE2 (uint8_t)(0x20) /**< getting bit5 or bit4 as white color(10) */ 00047 #define WHITE3 (uint8_t)(0x80) /**< getting bit7 or bit6 as white color(10) */ 00048 #define NOTHING0 (uint8_t)(0x01) /**< getting bit1 or bit0 as nothing input(01) */ 00049 #define NOTHING1 (uint8_t)(0x04) /**< getting bit3 or bit2 as nothing input(01) */ 00050 #define NOTHING2 (uint8_t)(0x10) /**< getting bit5 or bit4 as nothing input(01) */ 00051 #define NOTHING3 (uint8_t)(0x40) /**< getting bit7 or bit6 as nothing input(01) */ 00052 #define NOTHING (uint8_t)(0x55) /**< sending Nothing frame, 01=Nothing, 0101=0x5 */ 00053 00054 00055 #define ALL_BLACK (uint8_t)(0xFF) 00056 #define ALL_WHITE (uint8_t)(0xAA) 00057 #define BORDER_BYTE_B (uint8_t)(0xFF) 00058 #define BORDER_BYTE_W (uint8_t)(0xAA) 00059 #define ERROR_BUSY (uint8_t)(0xF0) 00060 #define ERROR_COG_ID (uint8_t)(0xF1) 00061 #define ERROR_BREAKAGE (uint8_t)(0xF2) 00062 #define ERROR_DC (uint8_t)(0xF3) 00063 #define ERROR_CHARGEPUMP (uint8_t)(0xF4) 00064 #define RES_OK (uint8_t)(0x00) 00065 00066 /** 00067 * \brief The COG Driver uses a buffer to update the EPD line by line. 00068 \note Use the 2.7" maximum data(66)+scan(44)+dummy(1) bytes as line buffer size=111.*/ 00069 #define LINE_BUFFER_DATA_SIZE 33 00070 #define COG_line_Max_Size 33 00071 /** 00072 * \brief Support 1.44", 2" and 2.7" three type EPD currently */ 00073 #define COUNT_OF_EPD_TYPE 3 00074 00075 /** 00076 * \brief Four driving stages */ 00077 enum Stage { 00078 Stage1, /**< Inverse previous image */ 00079 Stage2, /**< White */ 00080 Stage3, /**< Inverse new image */ 00081 Stage4 /**< New image */ 00082 }; 00083 00084 #if (defined COG_V110_G1) 00085 /** 00086 * \brief Line data structure of 1.44 inch EPD 00087 * \note 00088 * 1.44 inch needs to put border_control byte at the front of data line. 00089 * Refer to COG document Section 5.2 - 1.44" Input Data Order. 00090 */ 00091 struct COG_144_line_data_t { 00092 uint8_t border_byte; /**< Internal border_control, for 1.44" EPD only */ 00093 uint8_t even[16]; /**< 1.44" even byte array */ 00094 uint8_t scan[24]; /**< 1.44" scan byte array */ 00095 uint8_t odd [16]; /**< 1.44" odd byte array */ 00096 } ; 00097 00098 /** 00099 * \brief Line data structure of 2 inch EPD 00100 * \note 00101 * Add one byte x00 to complete a line 00102 * Refer to COG document Section 5.2 - 2" Input Data Order. 00103 */ 00104 struct COG_200_line_data_t { 00105 uint8_t even[25]; /**< 2" even byte array */ 00106 uint8_t scan[24]; /**< 2" scan byte array */ 00107 uint8_t odd [25]; /**< 2" odd byte array */ 00108 uint8_t dummy_data; /**< dummy byte 0x00 */ 00109 } ; 00110 00111 /** 00112 * \brief Line data structure of 2.7 inch EPD 00113 * \note 00114 * Add one byte x00 to complete a line 00115 * Refer to COG document Section 5.2 - 2.7" Input Data Order. 00116 */ 00117 struct COG_270_line_data_t { 00118 uint8_t even[33]; /**< 2.7" even byte array */ 00119 uint8_t scan[44]; /**< 2.7" scan byte array */ 00120 uint8_t odd [33]; /**< 2.7" odd byte array */ 00121 uint8_t dummy_data; /**< dummy byte 0x00 */ 00122 } ; 00123 00124 00125 #elif (defined COG_V230_G2) 00126 /** 00127 * \brief Line data structure of 1.44 inch V230 EPD with G2 COG 00128 * \note 00129 * 1.44 inch needs to put border_control byte at the front of data line. 00130 * Refer to COG document Section 5.2 - 1.44" Input Data Order. 00131 */ 00132 struct COG_144_line_data_t { 00133 uint8_t even[16]; /**< 1.44" even byte array */ 00134 uint8_t scan[24]; /**< 1.44" scan byte array */ 00135 uint8_t odd [16]; /**< 1.44" odd byte array */ 00136 uint8_t border_byte; /**< Internal border_control*/ 00137 } ; 00138 00139 /** 00140 * \brief Line data structure of 2 inch V230 EPD with G2 COG 00141 * \note 00142 * Add one byte x00 to complete a line 00143 * Refer to COG document Section 5.2 - 2" Input Data Order. 00144 */ 00145 struct COG_200_line_data_t { 00146 uint8_t border_byte; /**< Internal border_control*/ 00147 uint8_t even[25]; /**< 2" even byte array */ 00148 uint8_t scan[24]; /**< 2" scan byte array */ 00149 uint8_t odd [25]; /**< 2" odd byte array */ 00150 } ; 00151 00152 /** 00153 * \brief Line data structure of 2.7 inch V230 EPD with G2 COG 00154 * \note 00155 * Add one byte x00 to complete a line 00156 * Refer to COG document Section 5.2 - 2.7" Input Data Order. 00157 */ 00158 struct COG_270_line_data_t { 00159 uint8_t border_byte; /**< Internal border_control*/ 00160 uint8_t even[33]; /**< 2.7" even byte array */ 00161 uint8_t scan[44]; /**< 2.7" scan byte array */ 00162 uint8_t odd [33]; /**< 2.7" odd byte array */ 00163 } ; 00164 00165 /** 00166 * \brief Define waveform stages for V230 EPD with G2 COG 00167 */ 00168 struct EPD_WaveformTable_Struct 00169 { 00170 uint8_t stage1_frame1; 00171 uint8_t stage1_block1; 00172 uint8_t stage1_step1; 00173 00174 uint16_t stage2_t1; 00175 uint16_t stage2_t2; 00176 uint8_t stage2_cycle; 00177 00178 uint8_t stage3_frame3; 00179 uint8_t stage3_block3; 00180 uint8_t stage3_step3; 00181 }; 00182 00183 /** 00184 * \brief Define the Block type waveform structure 00185 */ 00186 struct EPD_V230_G2_Struct 00187 { 00188 int16_t frame_y0; 00189 int16_t frame_y1; 00190 int16_t block_y0; 00191 int16_t block_y1; 00192 int16_t block_size; 00193 int16_t step_size; 00194 int16_t frame_cycle; 00195 int16_t step_y0; 00196 int16_t step_y1; 00197 int16_t number_of_steps; 00198 }; 00199 #else 00200 #error "ERROR: The EPD's COG type is not defined." 00201 #endif 00202 00203 /** 00204 * \brief Packet structure of a line data */ 00205 typedef union { 00206 union { 00207 struct COG_144_line_data_t line_data_for_144; /**< line data structure of 1.44" EPD */ 00208 struct COG_200_line_data_t line_data_for_200; /**< line data structure of 2" EPD */ 00209 struct COG_270_line_data_t line_data_for_270; /**< line data structure of 2.7" EPD */ 00210 } line_data_by_size; /**< the line data of specific EPD size */ 00211 uint8_t uint8[LINE_BUFFER_DATA_SIZE]; /**< the maximum line buffer data size as length */ 00212 } COG_line_data_packet_type; 00213 00214 /** 00215 * \brief Define the COG driver's parameters */ 00216 struct COG_parameters_t { 00217 uint8_t channel_select[8]; /**< the SPI register data of Channel Select */ 00218 uint8_t voltage_level; /**< the SPI register data of Voltage Level */ 00219 uint16_t horizontal_size; /**< the bytes of width of EPD */ 00220 uint16_t vertical_size; /**< the bytes of height of EPD */ 00221 uint8_t data_line_size; /**< Data + Scan + Dummy bytes */ 00222 uint16_t frame_time_offset; /**< the rest of frame time in a stage */ 00223 uint16_t stage_time; /**< defined stage time */ 00224 } ; 00225 00226 extern const struct COG_parameters_t COG_parameters[COUNT_OF_EPD_TYPE]; 00227 extern const uint8_t SCAN_TABLE[4]; 00228 void EPD_init(void); 00229 void EPD_power_on (void); 00230 uint8_t EPD_initialize_driver (uint8_t EPD_type_index); 00231 void EPD_display_from_array_prt (uint8_t EPD_type_index, uint8_t *previous_image_ptr, 00232 uint8_t *new_image_ptr); 00233 void EPD_display_from_flash_prt (uint8_t EPD_type_index, long previous_image_flash_address, 00234 long new_image_flash_address,EPD_read_flash_handler On_EPD_read_flash); 00235 uint8_t EPD_power_off (uint8_t EPD_type_index); 00236 void COG_driver_EPDtype_select(uint8_t EPD_type_index); 00237 00238 #endif //DISPLAY_COG_PROCESS__H_INCLUDED 00239 00240 00241
Generated on Thu Jul 14 2022 17:10:35 by 1.7.2