1.1 --- a/Display_COG_Process.c Sun May 19 21:18:16 2013 +0000
1.2 +++ b/Display_COG_Process.c Sun May 19 21:42:23 2013 +0000
1.3 @@ -28,36 +28,36 @@
1.4 /******************************************************************************
1.5 * Defines and typedefs
1.6 *****************************************************************************/
1.7 -#define _GaugeFrameTimeMark 0
1.8 +#define _GaugeFrameTimeMark 0
1.9
1.10 const COG_Parameters_t COG_Parameters[3]= {
1.11 - { //for 1.44"
1.12 - {0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0x00},
1.13 - 0x03,
1.14 - (128/8),
1.15 - 96,
1.16 - (((128+96)*2)/8),
1.17 - (43),
1.18 - 480
1.19 - },
1.20 - { //for 2.0"
1.21 - {0x00,0x00,0x00,0x00,0x01,0xFF,0xE0,0x00},
1.22 - 0x03,
1.23 - (200/8),
1.24 - 96,
1.25 - (((200+96)*2)/8)+1,
1.26 - (53),
1.27 - 480
1.28 - },
1.29 - { //for 2.7"
1.30 - {0x00,0x00,0x00,0x7F,0xFF,0xFE,0x00,0x00},
1.31 - 0x00,
1.32 - (264/8),
1.33 - 176,
1.34 - (((264+176)*2)/8)+1,
1.35 - 105,
1.36 - 630
1.37 - },
1.38 + { //for 1.44"
1.39 + {0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0x00},
1.40 + 0x03,
1.41 + (128/8),
1.42 + 96,
1.43 + (((128+96)*2)/8),
1.44 + (43),
1.45 + 480
1.46 + },
1.47 + { //for 2.0"
1.48 + {0x00,0x00,0x00,0x00,0x01,0xFF,0xE0,0x00},
1.49 + 0x03,
1.50 + (200/8),
1.51 + 96,
1.52 + (((200+96)*2)/8)+1,
1.53 + (53),
1.54 + 480
1.55 + },
1.56 + { //for 2.7"
1.57 + {0x00,0x00,0x00,0x7F,0xFF,0xFE,0x00,0x00},
1.58 + 0x00,
1.59 + (264/8),
1.60 + 176,
1.61 + (((264+176)*2)/8)+1,
1.62 + 105,
1.63 + 630
1.64 + },
1.65 };
1.66
1.67 const uint8_t ScanTable[4] = {0xC0, 0x30, 0x0C, 0x03};
1.68 @@ -66,15 +66,15 @@
1.69 /******************************************************************************
1.70 * Local variables
1.71 *****************************************************************************/
1.72 -static uint32_t StageTime = 480;
1.73 +static uint32_t StageTime = 480;
1.74 static COG_LineDataPacket_t COG_Line;
1.75 -static uint16_t EPD_Type_Index = 0;
1.76 -static uint16_t cnt = 0;
1.77 -static uint32_t Currentframe;
1.78 -static uint8_t *DataLineEven;
1.79 -static uint8_t *DataLineOdd;
1.80 -static uint8_t *DataLineScan;
1.81 -static uint8_t *DisplayOrgPtr;
1.82 +static uint16_t EPD_Type_Index = 0;
1.83 +static uint16_t cnt = 0;
1.84 +static uint32_t Currentframe;
1.85 +static uint8_t *DataLineEven;
1.86 +static uint8_t *DataLineOdd;
1.87 +static uint8_t *DataLineScan;
1.88 +static uint8_t *DisplayOrgPtr;
1.89
1.90
1.91 /******************************************************************************
1.92 @@ -82,431 +82,431 @@
1.93 *****************************************************************************/
1.94 static void SetTemperature_Factor(uint8_t EPD_Type_Index)
1.95 {
1.96 - int16_t Temperature;
1.97 + int16_t Temperature;
1.98
1.99 - //Get current temperature
1.100 - Temperature = epd_get_temperature();
1.101 + //Get current temperature
1.102 + Temperature = epd_get_temperature();
1.103
1.104 - if (Temperature < -10)
1.105 - {
1.106 - StageTime = COG_Parameters[EPD_Type_Index].StageTime * 17;
1.107 - }
1.108 - else if (Temperature < -5)
1.109 - {
1.110 - StageTime = COG_Parameters[EPD_Type_Index].StageTime * 12;
1.111 - }
1.112 - else if (Temperature < 5)
1.113 - {
1.114 - StageTime = COG_Parameters[EPD_Type_Index].StageTime * 8;
1.115 - }
1.116 - else if (Temperature < 10)
1.117 - {
1.118 - StageTime = COG_Parameters[EPD_Type_Index].StageTime * 4;
1.119 - }
1.120 - else if (Temperature < 15)
1.121 - {
1.122 - StageTime = COG_Parameters[EPD_Type_Index].StageTime * 3;
1.123 - }
1.124 - else if (Temperature < 20)
1.125 - {
1.126 - StageTime = COG_Parameters[EPD_Type_Index].StageTime * 2;
1.127 - }
1.128 - else if (Temperature < 40)
1.129 - {
1.130 - StageTime = COG_Parameters[EPD_Type_Index].StageTime * 1;
1.131 - }
1.132 - else
1.133 - {
1.134 - StageTime = (COG_Parameters[EPD_Type_Index].StageTime * 7)/10;
1.135 - }
1.136 + if (Temperature < -10)
1.137 + {
1.138 + StageTime = COG_Parameters[EPD_Type_Index].StageTime * 17;
1.139 + }
1.140 + else if (Temperature < -5)
1.141 + {
1.142 + StageTime = COG_Parameters[EPD_Type_Index].StageTime * 12;
1.143 + }
1.144 + else if (Temperature < 5)
1.145 + {
1.146 + StageTime = COG_Parameters[EPD_Type_Index].StageTime * 8;
1.147 + }
1.148 + else if (Temperature < 10)
1.149 + {
1.150 + StageTime = COG_Parameters[EPD_Type_Index].StageTime * 4;
1.151 + }
1.152 + else if (Temperature < 15)
1.153 + {
1.154 + StageTime = COG_Parameters[EPD_Type_Index].StageTime * 3;
1.155 + }
1.156 + else if (Temperature < 20)
1.157 + {
1.158 + StageTime = COG_Parameters[EPD_Type_Index].StageTime * 2;
1.159 + }
1.160 + else if (Temperature < 40)
1.161 + {
1.162 + StageTime = COG_Parameters[EPD_Type_Index].StageTime * 1;
1.163 + }
1.164 + else
1.165 + {
1.166 + StageTime = (COG_Parameters[EPD_Type_Index].StageTime * 7)/10;
1.167 + }
1.168 }
1.169
1.170 static void Driver_TypeSelect(uint8_t typeIndex)
1.171 {
1.172 - switch(typeIndex)
1.173 - {
1.174 - case EPDType_144:
1.175 - DataLineEven=&COG_Line.LineDatas.COG_144LineData.Even[0];
1.176 - DataLineOdd=&COG_Line.LineDatas.COG_144LineData.Odd[0];
1.177 - DataLineScan=&COG_Line.LineDatas.COG_144LineData.Scan[0];
1.178 - break;
1.179 - case EPDType_200:
1.180 - DataLineEven=&COG_Line.LineDatas.COG_20LineData.Even[0];
1.181 - DataLineOdd=&COG_Line.LineDatas.COG_20LineData.Odd[0];
1.182 - DataLineScan=&COG_Line.LineDatas.COG_20LineData.Scan[0];
1.183 - break;
1.184 - case EPDType_270:
1.185 - DataLineEven=&COG_Line.LineDatas.COG_27LineData.Even[0];
1.186 - DataLineOdd=&COG_Line.LineDatas.COG_27LineData.Odd[0];
1.187 - DataLineScan=&COG_Line.LineDatas.COG_27LineData.Scan[0];
1.188 - break;
1.189 - }
1.190 + switch(typeIndex)
1.191 + {
1.192 + case EPDType_144:
1.193 + DataLineEven=&COG_Line.LineDatas.COG_144LineData.Even[0];
1.194 + DataLineOdd=&COG_Line.LineDatas.COG_144LineData.Odd[0];
1.195 + DataLineScan=&COG_Line.LineDatas.COG_144LineData.Scan[0];
1.196 + break;
1.197 + case EPDType_200:
1.198 + DataLineEven=&COG_Line.LineDatas.COG_20LineData.Even[0];
1.199 + DataLineOdd=&COG_Line.LineDatas.COG_20LineData.Odd[0];
1.200 + DataLineScan=&COG_Line.LineDatas.COG_20LineData.Scan[0];
1.201 + break;
1.202 + case EPDType_270:
1.203 + DataLineEven=&COG_Line.LineDatas.COG_27LineData.Even[0];
1.204 + DataLineOdd=&COG_Line.LineDatas.COG_27LineData.Odd[0];
1.205 + DataLineScan=&COG_Line.LineDatas.COG_27LineData.Scan[0];
1.206 + break;
1.207 + }
1.208 }
1.209
1.210 //#pragma GCC optimize ("-O3")
1.211 static void Display_Stage_1 (uint8_t *PreviousPicture)
1.212 {
1.213 - uint16_t i,j,k; // general counters
1.214 - uint8_t TempByte; // Temporary storage for image data check
1.215 - uint16_t StartClock;
1.216 + uint16_t i,j,k; // general counters
1.217 + uint8_t TempByte; // Temporary storage for image data check
1.218 + uint16_t StartClock;
1.219 #ifdef DISPLAY_180_DEGREE
1.220 - uint8_t *DataLinePrt;
1.221 + uint8_t *DataLinePrt;
1.222 DisplayOrgPtr = (PreviousPicture+(uint32_t)((COG_Parameters[EPD_Type_Index].VERTICAL-1)*COG_Parameters[EPD_Type_Index].HORIZONTAL));
1.223 #else
1.224 DisplayOrgPtr = PreviousPicture;
1.225 #endif
1.226 - Currentframe = (uint32_t)COG_Parameters[EPD_Type_Index].FrameTime;
1.227 + Currentframe = (uint32_t)COG_Parameters[EPD_Type_Index].FrameTime;
1.228 //TestPinTrigger();
1.229 - cnt = 0;
1.230 - StartClock = epd_GetCurrentTimeTick();
1.231 - do
1.232 - {
1.233 -// TestPin2Trigger();
1.234 - PreviousPicture = DisplayOrgPtr;
1.235 + cnt = 0;
1.236 + StartClock = epd_GetCurrentTimeTick();
1.237 + do
1.238 + {
1.239 +// TestPin2Trigger();
1.240 + PreviousPicture = DisplayOrgPtr;
1.241 #ifdef DISPLAY_180_DEGREE
1.242 - DataLinePrt = PreviousPicture;
1.243 + DataLinePrt = PreviousPicture;
1.244 #endif
1.245 - for (i = 0; i < COG_Parameters[EPD_Type_Index].VERTICAL; i++) // for every line
1.246 - {
1.247 - // SPI (0x04, ...)
1.248 - epd_SPI_Send_Byte(0x04, COG_Parameters[EPD_Type_Index].VoltageLevel);
1.249 - k = COG_Parameters[EPD_Type_Index].HORIZONTAL-1;
1.250 - for (j = 0; j < COG_Parameters[EPD_Type_Index].HORIZONTAL; j++) // check every bit in the line
1.251 - {
1.252 - TempByte = (*PreviousPicture++);
1.253 + for (i = 0; i < COG_Parameters[EPD_Type_Index].VERTICAL; i++) // for every line
1.254 + {
1.255 + // SPI (0x04, ...)
1.256 + epd_SPI_Send_Byte(0x04, COG_Parameters[EPD_Type_Index].VoltageLevel);
1.257 + k = COG_Parameters[EPD_Type_Index].HORIZONTAL-1;
1.258 + for (j = 0; j < COG_Parameters[EPD_Type_Index].HORIZONTAL; j++) // check every bit in the line
1.259 + {
1.260 + TempByte = (*PreviousPicture++);
1.261 #ifdef DISPLAY_180_DEGREE
1.262 - DataLineEven[j] = ((TempByte & 0x80) ? BLACK3 : WHITE3)
1.263 - | ((TempByte & 0x20) ? BLACK2 : WHITE2)
1.264 - | ((TempByte & 0x08) ? BLACK1 : WHITE1)
1.265 - | ((TempByte & 0x02) ? BLACK0 : WHITE0);
1.266 -
1.267 - DataLineOdd[k--] = ((TempByte & 0x01) ? BLACK3 : WHITE3)
1.268 - | ((TempByte & 0x04) ? BLACK2 : WHITE2)
1.269 - | ((TempByte & 0x10) ? BLACK1 : WHITE1)
1.270 - | ((TempByte & 0x40) ? BLACK0 : WHITE0);
1.271 - DataLinePrt--;
1.272 + DataLineEven[j] = ((TempByte & 0x80) ? BLACK3 : WHITE3)
1.273 + | ((TempByte & 0x20) ? BLACK2 : WHITE2)
1.274 + | ((TempByte & 0x08) ? BLACK1 : WHITE1)
1.275 + | ((TempByte & 0x02) ? BLACK0 : WHITE0);
1.276 +
1.277 + DataLineOdd[k--] = ((TempByte & 0x01) ? BLACK3 : WHITE3)
1.278 + | ((TempByte & 0x04) ? BLACK2 : WHITE2)
1.279 + | ((TempByte & 0x10) ? BLACK1 : WHITE1)
1.280 + | ((TempByte & 0x40) ? BLACK0 : WHITE0);
1.281 + DataLinePrt--;
1.282 #else
1.283 - DataLineOdd[j] = ((TempByte & 0x80) ? BLACK3 : WHITE3)
1.284 - | ((TempByte & 0x20) ? BLACK2 : WHITE2)
1.285 - | ((TempByte & 0x08) ? BLACK1 : WHITE1)
1.286 - | ((TempByte & 0x02) ? BLACK0 : WHITE0);
1.287 + DataLineOdd[j] = ((TempByte & 0x80) ? BLACK3 : WHITE3)
1.288 + | ((TempByte & 0x20) ? BLACK2 : WHITE2)
1.289 + | ((TempByte & 0x08) ? BLACK1 : WHITE1)
1.290 + | ((TempByte & 0x02) ? BLACK0 : WHITE0);
1.291
1.292 - DataLineEven[k--] = ((TempByte & 0x01) ? BLACK3 : WHITE3)
1.293 - | ((TempByte & 0x04) ? BLACK2 : WHITE2)
1.294 - | ((TempByte & 0x10) ? BLACK1 : WHITE1)
1.295 - | ((TempByte & 0x40) ? BLACK0 : WHITE0);
1.296 + DataLineEven[k--] = ((TempByte & 0x01) ? BLACK3 : WHITE3)
1.297 + | ((TempByte & 0x04) ? BLACK2 : WHITE2)
1.298 + | ((TempByte & 0x10) ? BLACK1 : WHITE1)
1.299 + | ((TempByte & 0x40) ? BLACK0 : WHITE0);
1.300 #endif
1.301 - }
1.302 + }
1.303 #ifdef DISPLAY_180_DEGREE
1.304 - PreviousPicture = DataLinePrt;
1.305 + PreviousPicture = DataLinePrt;
1.306 #endif
1.307 - DataLineScan[(i>>2)] = ScanTable[(i%4)];
1.308 - // SPI (0x0a, line data....)
1.309 - epd_SPI_Send(0x0a, (uint8_t *)&COG_Line.uint8, COG_Parameters[EPD_Type_Index].DataLineSize);
1.310 -
1.311 - // SPI (0x02, 0x25)
1.312 - epd_SPI_Send_Byte(0x02, 0x2F);
1.313 + DataLineScan[(i>>2)] = ScanTable[(i%4)];
1.314 + // SPI (0x0a, line data....)
1.315 + epd_SPI_Send(0x0a, (uint8_t *)&COG_Line.uint8, COG_Parameters[EPD_Type_Index].DataLineSize);
1.316 +
1.317 + // SPI (0x02, 0x25)
1.318 + epd_SPI_Send_Byte(0x02, 0x2F);
1.319
1.320 - DataLineScan[(i>>2)] = 0;
1.321 - }
1.322 -#if(!_GaugeFrameTimeMark)
1.323 - if(COG_Parameters[EPD_Type_Index].FrameTime>0)
1.324 - {
1.325 - while(Currentframe>(epd_GetCurrentTimeTick() - StartClock));
1.326 - }
1.327 + DataLineScan[(i>>2)] = 0;
1.328 + }
1.329 +#if(!_GaugeFrameTimeMark)
1.330 + if(COG_Parameters[EPD_Type_Index].FrameTime>0)
1.331 + {
1.332 + while(Currentframe>(epd_GetCurrentTimeTick() - StartClock));
1.333 + }
1.334 #endif
1.335 - //TestPin2Trigger();
1.336 - Currentframe=(uint32_t)(epd_GetCurrentTimeTick() - StartClock)+COG_Parameters[EPD_Type_Index].FrameTime ;
1.337 - cnt++;
1.338 - }while (StageTime>Currentframe);
1.339 -// TestPin2Trigger();
1.340 - while(StageTime>(epd_GetCurrentTimeTick() - StartClock));
1.341 -// TestPin2Trigger();
1.342 -// TestPinTrigger();
1.343 + //TestPin2Trigger();
1.344 + Currentframe=(uint32_t)(epd_GetCurrentTimeTick() - StartClock)+COG_Parameters[EPD_Type_Index].FrameTime ;
1.345 + cnt++;
1.346 + }while (StageTime>Currentframe);
1.347 +// TestPin2Trigger();
1.348 + while(StageTime>(epd_GetCurrentTimeTick() - StartClock));
1.349 +// TestPin2Trigger();
1.350 +// TestPinTrigger();
1.351 }
1.352
1.353 //#pragma GCC optimize ("-O3")
1.354 static void Display_Stage_2 (uint8_t *PreviousPicture)
1.355 {
1.356 - uint16_t i, j, k; // general counters
1.357 - uint8_t TempByte; // Temporary storage for image data check
1.358 - uint16_t StartClock;
1.359 + uint16_t i, j, k; // general counters
1.360 + uint8_t TempByte; // Temporary storage for image data check
1.361 + uint16_t StartClock;
1.362 #ifdef DISPLAY_180_DEGREE
1.363 - uint8_t *DataLinePrt;
1.364 - DisplayOrgPtr = (PreviousPicture+(uint32_t)((COG_Parameters[EPD_Type_Index].VERTICAL-1)*COG_Parameters[EPD_Type_Index].HORIZONTAL));
1.365 + uint8_t *DataLinePrt;
1.366 + DisplayOrgPtr = (PreviousPicture+(uint32_t)((COG_Parameters[EPD_Type_Index].VERTICAL-1)*COG_Parameters[EPD_Type_Index].HORIZONTAL));
1.367 #else
1.368 - DisplayOrgPtr = PreviousPicture;
1.369 + DisplayOrgPtr = PreviousPicture;
1.370 #endif
1.371
1.372 -// TestPinTrigger();
1.373 - cnt = 0;
1.374 - Currentframe = (uint32_t)COG_Parameters[EPD_Type_Index].FrameTime;
1.375 - StartClock = epd_GetCurrentTimeTick();
1.376 - do
1.377 - {
1.378 -// TestPin2Trigger();
1.379 - PreviousPicture = DisplayOrgPtr;
1.380 +// TestPinTrigger();
1.381 + cnt = 0;
1.382 + Currentframe = (uint32_t)COG_Parameters[EPD_Type_Index].FrameTime;
1.383 + StartClock = epd_GetCurrentTimeTick();
1.384 + do
1.385 + {
1.386 +// TestPin2Trigger();
1.387 + PreviousPicture = DisplayOrgPtr;
1.388 #ifdef DISPLAY_180_DEGREE
1.389 - DataLinePrt = PreviousPicture;
1.390 + DataLinePrt = PreviousPicture;
1.391 #endif
1.392 - for (i = 0; i < COG_Parameters[EPD_Type_Index].VERTICAL; i++) // for every line
1.393 - {
1.394 - // SPI (0x04, ...)
1.395 - epd_SPI_Send_Byte(0x04, COG_Parameters[EPD_Type_Index].VoltageLevel);
1.396 - k = COG_Parameters[EPD_Type_Index].HORIZONTAL-1;
1.397 - for (j = 0; j < COG_Parameters[EPD_Type_Index].HORIZONTAL; j++) // make every bit in the line black
1.398 - {
1.399 - TempByte =(*PreviousPicture++);
1.400 + for (i = 0; i < COG_Parameters[EPD_Type_Index].VERTICAL; i++) // for every line
1.401 + {
1.402 + // SPI (0x04, ...)
1.403 + epd_SPI_Send_Byte(0x04, COG_Parameters[EPD_Type_Index].VoltageLevel);
1.404 + k = COG_Parameters[EPD_Type_Index].HORIZONTAL-1;
1.405 + for (j = 0; j < COG_Parameters[EPD_Type_Index].HORIZONTAL; j++) // make every bit in the line black
1.406 + {
1.407 + TempByte =(*PreviousPicture++);
1.408 #ifdef DISPLAY_180_DEGREE
1.409 - DataLineEven[j] = ((TempByte & 0x80) ? WHITE3 : NOTHING)
1.410 - | ((TempByte & 0x20) ? WHITE2 : NOTHING)
1.411 - | ((TempByte & 0x08) ? WHITE1 : NOTHING)
1.412 - | ((TempByte & 0x02) ? WHITE0 : NOTHING);
1.413 - DataLineOdd[k--] = ((TempByte & 0x01) ? WHITE3 : NOTHING)
1.414 - | ((TempByte & 0x04) ? WHITE2 : NOTHING)
1.415 - | ((TempByte & 0x10) ? WHITE1 : NOTHING)
1.416 - | ((TempByte & 0x40) ? WHITE0 : NOTHING);
1.417 - DataLinePrt--;
1.418 + DataLineEven[j] = ((TempByte & 0x80) ? WHITE3 : NOTHING)
1.419 + | ((TempByte & 0x20) ? WHITE2 : NOTHING)
1.420 + | ((TempByte & 0x08) ? WHITE1 : NOTHING)
1.421 + | ((TempByte & 0x02) ? WHITE0 : NOTHING);
1.422 + DataLineOdd[k--] = ((TempByte & 0x01) ? WHITE3 : NOTHING)
1.423 + | ((TempByte & 0x04) ? WHITE2 : NOTHING)
1.424 + | ((TempByte & 0x10) ? WHITE1 : NOTHING)
1.425 + | ((TempByte & 0x40) ? WHITE0 : NOTHING);
1.426 + DataLinePrt--;
1.427 #else
1.428 - DataLineOdd[j] = ((TempByte & 0x80) ? WHITE3 : NOTHING)
1.429 - | ((TempByte & 0x20) ? WHITE2 : NOTHING)
1.430 - | ((TempByte & 0x08) ? WHITE1 : NOTHING)
1.431 - | ((TempByte & 0x02) ? WHITE0 : NOTHING);
1.432 - DataLineEven[k--] = ((TempByte & 0x01) ? WHITE3 : NOTHING)
1.433 - | ((TempByte & 0x04) ? WHITE2 : NOTHING)
1.434 - | ((TempByte & 0x10) ? WHITE1 : NOTHING)
1.435 - | ((TempByte & 0x40) ? WHITE0 : NOTHING);
1.436 + DataLineOdd[j] = ((TempByte & 0x80) ? WHITE3 : NOTHING)
1.437 + | ((TempByte & 0x20) ? WHITE2 : NOTHING)
1.438 + | ((TempByte & 0x08) ? WHITE1 : NOTHING)
1.439 + | ((TempByte & 0x02) ? WHITE0 : NOTHING);
1.440 + DataLineEven[k--] = ((TempByte & 0x01) ? WHITE3 : NOTHING)
1.441 + | ((TempByte & 0x04) ? WHITE2 : NOTHING)
1.442 + | ((TempByte & 0x10) ? WHITE1 : NOTHING)
1.443 + | ((TempByte & 0x40) ? WHITE0 : NOTHING);
1.444 #endif
1.445 - }
1.446 -
1.447 + }
1.448 +
1.449 #ifdef DISPLAY_180_DEGREE
1.450 - PreviousPicture = DataLinePrt;
1.451 + PreviousPicture = DataLinePrt;
1.452 #endif
1.453 - DataLineScan[(i>>2)] = ScanTable[(i%4)];
1.454 - // SPI (0x0a, line data....)
1.455 - epd_SPI_Send(0x0a, (uint8_t *)&COG_Line.uint8, COG_Parameters[EPD_Type_Index].DataLineSize);
1.456 -
1.457 - epd_SPI_Send_Byte(0x02, 0x25);
1.458 + DataLineScan[(i>>2)] = ScanTable[(i%4)];
1.459 + // SPI (0x0a, line data....)
1.460 + epd_SPI_Send(0x0a, (uint8_t *)&COG_Line.uint8, COG_Parameters[EPD_Type_Index].DataLineSize);
1.461 +
1.462 + epd_SPI_Send_Byte(0x02, 0x25);
1.463
1.464 - DataLineScan[(i>>2)] = 0;
1.465 - }
1.466 -#if(!_GaugeFrameTimeMark)
1.467 - if(COG_Parameters[EPD_Type_Index].FrameTime>0)
1.468 - {
1.469 - while(Currentframe>(epd_GetCurrentTimeTick() - StartClock));
1.470 - }
1.471 -#endif
1.472 - //TestPin2Trigger();
1.473 - Currentframe=(uint32_t)(epd_GetCurrentTimeTick() - StartClock)+COG_Parameters[EPD_Type_Index].FrameTime ;
1.474 - cnt++;
1.475 - }while (StageTime>Currentframe);
1.476 -// TestPin2Trigger();
1.477 - while(StageTime>(epd_GetCurrentTimeTick() - StartClock));
1.478 -// TestPin2Trigger();
1.479 -// TestPinTrigger();
1.480 + DataLineScan[(i>>2)] = 0;
1.481 + }
1.482 +#if(!_GaugeFrameTimeMark)
1.483 + if(COG_Parameters[EPD_Type_Index].FrameTime>0)
1.484 + {
1.485 + while(Currentframe>(epd_GetCurrentTimeTick() - StartClock));
1.486 + }
1.487 +#endif
1.488 + //TestPin2Trigger();
1.489 + Currentframe=(uint32_t)(epd_GetCurrentTimeTick() - StartClock)+COG_Parameters[EPD_Type_Index].FrameTime ;
1.490 + cnt++;
1.491 + }while (StageTime>Currentframe);
1.492 +// TestPin2Trigger();
1.493 + while(StageTime>(epd_GetCurrentTimeTick() - StartClock));
1.494 +// TestPin2Trigger();
1.495 +// TestPinTrigger();
1.496 }
1.497
1.498
1.499 //#pragma GCC optimize ("-O3")
1.500 static void Display_Stage_3 (uint8_t *Picture)
1.501 {
1.502 - uint16_t i, j,k; // general counters
1.503 - uint8_t TempByte; // Temporary storage for image data check
1.504 - uint16_t StartClock;
1.505 + uint16_t i, j,k; // general counters
1.506 + uint8_t TempByte; // Temporary storage for image data check
1.507 + uint16_t StartClock;
1.508 #ifdef DISPLAY_180_DEGREE
1.509 - uint8_t *DataLinePrt;
1.510 - DisplayOrgPtr = (Picture+(uint32_t)((COG_Parameters[EPD_Type_Index].VERTICAL-1)*COG_Parameters[EPD_Type_Index].HORIZONTAL));
1.511 + uint8_t *DataLinePrt;
1.512 + DisplayOrgPtr = (Picture+(uint32_t)((COG_Parameters[EPD_Type_Index].VERTICAL-1)*COG_Parameters[EPD_Type_Index].HORIZONTAL));
1.513 #else
1.514 - DisplayOrgPtr = Picture;
1.515 + DisplayOrgPtr = Picture;
1.516 #endif
1.517 - Currentframe = (uint32_t)COG_Parameters[EPD_Type_Index].FrameTime;
1.518 - cnt = 0;
1.519 -// TestPinTrigger();
1.520 - StartClock = epd_GetCurrentTimeTick();
1.521 - do
1.522 - {
1.523 -// TestPin2Trigger();
1.524 - Picture = DisplayOrgPtr;
1.525 + Currentframe = (uint32_t)COG_Parameters[EPD_Type_Index].FrameTime;
1.526 + cnt = 0;
1.527 +// TestPinTrigger();
1.528 + StartClock = epd_GetCurrentTimeTick();
1.529 + do
1.530 + {
1.531 +// TestPin2Trigger();
1.532 + Picture = DisplayOrgPtr;
1.533 #ifdef DISPLAY_180_DEGREE
1.534 - DataLinePrt = Picture;
1.535 + DataLinePrt = Picture;
1.536 #endif
1.537 - for (i = 0; i < COG_Parameters[EPD_Type_Index].VERTICAL; i++) // for every line
1.538 - {
1.539 - // SPI (0x04, 0x03)
1.540 - epd_SPI_Send_Byte(0x04, COG_Parameters[EPD_Type_Index].VoltageLevel);
1.541 - k = COG_Parameters[EPD_Type_Index].HORIZONTAL-1;
1.542 - for (j = 0; j < COG_Parameters[EPD_Type_Index].HORIZONTAL; j++) // check every bit in the line
1.543 - {
1.544 - TempByte = (*Picture++);
1.545 + for (i = 0; i < COG_Parameters[EPD_Type_Index].VERTICAL; i++) // for every line
1.546 + {
1.547 + // SPI (0x04, 0x03)
1.548 + epd_SPI_Send_Byte(0x04, COG_Parameters[EPD_Type_Index].VoltageLevel);
1.549 + k = COG_Parameters[EPD_Type_Index].HORIZONTAL-1;
1.550 + for (j = 0; j < COG_Parameters[EPD_Type_Index].HORIZONTAL; j++) // check every bit in the line
1.551 + {
1.552 + TempByte = (*Picture++);
1.553 #ifdef DISPLAY_180_DEGREE
1.554 - DataLineEven[j] = ((TempByte & 0x80) ? BLACK3 : NOTHING)
1.555 - | ((TempByte & 0x20) ? BLACK2 : NOTHING )
1.556 - | ((TempByte & 0x08) ? BLACK1 : NOTHING )
1.557 - | ((TempByte & 0x02) ? BLACK0 : NOTHING );
1.558 -
1.559 - DataLineOdd[k--] = ((TempByte & 0x01) ? BLACK3 : NOTHING)
1.560 - | ((TempByte & 0x04) ? BLACK2 : NOTHING )
1.561 - | ((TempByte & 0x10) ? BLACK1 : NOTHING )
1.562 - | ((TempByte & 0x40) ? BLACK0 : NOTHING );
1.563 - DataLinePrt--;
1.564 + DataLineEven[j] = ((TempByte & 0x80) ? BLACK3 : NOTHING)
1.565 + | ((TempByte & 0x20) ? BLACK2 : NOTHING )
1.566 + | ((TempByte & 0x08) ? BLACK1 : NOTHING )
1.567 + | ((TempByte & 0x02) ? BLACK0 : NOTHING );
1.568 +
1.569 + DataLineOdd[k--] = ((TempByte & 0x01) ? BLACK3 : NOTHING)
1.570 + | ((TempByte & 0x04) ? BLACK2 : NOTHING )
1.571 + | ((TempByte & 0x10) ? BLACK1 : NOTHING )
1.572 + | ((TempByte & 0x40) ? BLACK0 : NOTHING );
1.573 + DataLinePrt--;
1.574 #else
1.575 - DataLineOdd[j] = ((TempByte & 0x80) ? BLACK3 : NOTHING)
1.576 - | ((TempByte & 0x20) ? BLACK2 : NOTHING )
1.577 - | ((TempByte & 0x08) ? BLACK1 : NOTHING )
1.578 - | ((TempByte & 0x02) ? BLACK0 : NOTHING );
1.579 + DataLineOdd[j] = ((TempByte & 0x80) ? BLACK3 : NOTHING)
1.580 + | ((TempByte & 0x20) ? BLACK2 : NOTHING )
1.581 + | ((TempByte & 0x08) ? BLACK1 : NOTHING )
1.582 + | ((TempByte & 0x02) ? BLACK0 : NOTHING );
1.583
1.584 - DataLineEven[k--] = ((TempByte & 0x01) ? BLACK3 : NOTHING)
1.585 - | ((TempByte & 0x04) ? BLACK2 : NOTHING )
1.586 - | ((TempByte & 0x10) ? BLACK1 : NOTHING )
1.587 - | ((TempByte & 0x40) ? BLACK0 : NOTHING );
1.588 + DataLineEven[k--] = ((TempByte & 0x01) ? BLACK3 : NOTHING)
1.589 + | ((TempByte & 0x04) ? BLACK2 : NOTHING )
1.590 + | ((TempByte & 0x10) ? BLACK1 : NOTHING )
1.591 + | ((TempByte & 0x40) ? BLACK0 : NOTHING );
1.592 #endif
1.593 - }
1.594 + }
1.595 #ifdef DISPLAY_180_DEGREE
1.596 - Picture = DataLinePrt;
1.597 + Picture = DataLinePrt;
1.598 #endif
1.599 - DataLineScan[(i>>2)] = ScanTable[(i%4)];
1.600 - // SPI (0x0a, line data....)
1.601 - epd_SPI_Send(0x0a, (uint8_t *)&COG_Line.uint8, COG_Parameters[EPD_Type_Index].DataLineSize);
1.602 -
1.603 - epd_SPI_Send_Byte(0x02, 0x2F);
1.604 + DataLineScan[(i>>2)] = ScanTable[(i%4)];
1.605 + // SPI (0x0a, line data....)
1.606 + epd_SPI_Send(0x0a, (uint8_t *)&COG_Line.uint8, COG_Parameters[EPD_Type_Index].DataLineSize);
1.607 +
1.608 + epd_SPI_Send_Byte(0x02, 0x2F);
1.609
1.610 - DataLineScan[(i>>2)] = 0;
1.611 - }
1.612 -#if(!_GaugeFrameTimeMark)
1.613 - if(COG_Parameters[EPD_Type_Index].FrameTime>0)
1.614 - {
1.615 - while(Currentframe>(epd_GetCurrentTimeTick() - StartClock));
1.616 - }
1.617 -#endif
1.618 - //TestPin2Trigger();
1.619 - Currentframe=(uint32_t)(epd_GetCurrentTimeTick() - StartClock)+COG_Parameters[EPD_Type_Index].FrameTime ;
1.620 - cnt++;
1.621 - }while (StageTime>Currentframe);
1.622 -// TestPin2Trigger();
1.623 - while(StageTime>(epd_GetCurrentTimeTick() - StartClock));
1.624 -// TestPin2Trigger();
1.625 -// TestPinTrigger();
1.626 + DataLineScan[(i>>2)] = 0;
1.627 + }
1.628 +#if(!_GaugeFrameTimeMark)
1.629 + if(COG_Parameters[EPD_Type_Index].FrameTime>0)
1.630 + {
1.631 + while(Currentframe>(epd_GetCurrentTimeTick() - StartClock));
1.632 + }
1.633 +#endif
1.634 + //TestPin2Trigger();
1.635 + Currentframe=(uint32_t)(epd_GetCurrentTimeTick() - StartClock)+COG_Parameters[EPD_Type_Index].FrameTime ;
1.636 + cnt++;
1.637 + }while (StageTime>Currentframe);
1.638 +// TestPin2Trigger();
1.639 + while(StageTime>(epd_GetCurrentTimeTick() - StartClock));
1.640 +// TestPin2Trigger();
1.641 +// TestPinTrigger();
1.642 }
1.643
1.644 //#pragma GCC optimize ("-O3")
1.645 static void Display_Stage_4 (uint8_t *Picture)
1.646 {
1.647 - uint16_t i, j,k; // general counters
1.648 - uint8_t TempByte; // Temporary storage for image data check
1.649 - uint16_t StartClock;
1.650 + uint16_t i, j,k; // general counters
1.651 + uint8_t TempByte; // Temporary storage for image data check
1.652 + uint16_t StartClock;
1.653 #ifdef DISPLAY_180_DEGREE
1.654 - uint8_t *DataLinePrt;
1.655 - DisplayOrgPtr = (Picture+(uint32_t)((COG_Parameters[EPD_Type_Index].VERTICAL-1)*COG_Parameters[EPD_Type_Index].HORIZONTAL));
1.656 + uint8_t *DataLinePrt;
1.657 + DisplayOrgPtr = (Picture+(uint32_t)((COG_Parameters[EPD_Type_Index].VERTICAL-1)*COG_Parameters[EPD_Type_Index].HORIZONTAL));
1.658 #else
1.659 - DisplayOrgPtr = Picture;
1.660 + DisplayOrgPtr = Picture;
1.661 #endif
1.662 - Currentframe = (uint32_t)COG_Parameters[EPD_Type_Index].FrameTime;
1.663 - cnt = 0;
1.664 -// TestPinTrigger();
1.665 -
1.666 - StartClock = epd_GetCurrentTimeTick();
1.667 - do
1.668 - {
1.669 -// TestPin2Trigger();
1.670 - Picture = DisplayOrgPtr;
1.671 + Currentframe = (uint32_t)COG_Parameters[EPD_Type_Index].FrameTime;
1.672 + cnt = 0;
1.673 +// TestPinTrigger();
1.674 +
1.675 + StartClock = epd_GetCurrentTimeTick();
1.676 + do
1.677 + {
1.678 +// TestPin2Trigger();
1.679 + Picture = DisplayOrgPtr;
1.680 #ifdef DISPLAY_180_DEGREE
1.681 - DataLinePrt = Picture;
1.682 + DataLinePrt = Picture;
1.683 #endif
1.684 - for (i = 0; i < COG_Parameters[EPD_Type_Index].VERTICAL; i++) // for every line
1.685 - {
1.686 - // SPI (0x04, ...)
1.687 - epd_SPI_Send_Byte(0x04, COG_Parameters[EPD_Type_Index].VoltageLevel);
1.688 - k = COG_Parameters[EPD_Type_Index].HORIZONTAL-1;
1.689 - for (j = 0; j < COG_Parameters[EPD_Type_Index].HORIZONTAL; j++) // check every bit in the line
1.690 - {
1.691 - TempByte =(*Picture++);
1.692 + for (i = 0; i < COG_Parameters[EPD_Type_Index].VERTICAL; i++) // for every line
1.693 + {
1.694 + // SPI (0x04, ...)
1.695 + epd_SPI_Send_Byte(0x04, COG_Parameters[EPD_Type_Index].VoltageLevel);
1.696 + k = COG_Parameters[EPD_Type_Index].HORIZONTAL-1;
1.697 + for (j = 0; j < COG_Parameters[EPD_Type_Index].HORIZONTAL; j++) // check every bit in the line
1.698 + {
1.699 + TempByte =(*Picture++);
1.700 #ifdef DISPLAY_180_DEGREE
1.701 - DataLineEven[j] = ((TempByte & 0x80) ? WHITE3 : BLACK3 )
1.702 - | ((TempByte & 0x20) ? WHITE2 : BLACK2 )
1.703 - | ((TempByte & 0x08) ? WHITE1 : BLACK1 )
1.704 - | ((TempByte & 0x02) ? WHITE0 : BLACK0 );
1.705 -
1.706 - DataLineOdd[k--] = ((TempByte & 0x01) ? WHITE3 : BLACK3 )
1.707 - | ((TempByte & 0x04) ? WHITE2 : BLACK2 )
1.708 - | ((TempByte & 0x10) ? WHITE1 : BLACK1 )
1.709 - | ((TempByte & 0x40) ? WHITE0 : BLACK0 );
1.710 - DataLinePrt--;
1.711 + DataLineEven[j] = ((TempByte & 0x80) ? WHITE3 : BLACK3 )
1.712 + | ((TempByte & 0x20) ? WHITE2 : BLACK2 )
1.713 + | ((TempByte & 0x08) ? WHITE1 : BLACK1 )
1.714 + | ((TempByte & 0x02) ? WHITE0 : BLACK0 );
1.715 +
1.716 + DataLineOdd[k--] = ((TempByte & 0x01) ? WHITE3 : BLACK3 )
1.717 + | ((TempByte & 0x04) ? WHITE2 : BLACK2 )
1.718 + | ((TempByte & 0x10) ? WHITE1 : BLACK1 )
1.719 + | ((TempByte & 0x40) ? WHITE0 : BLACK0 );
1.720 + DataLinePrt--;
1.721 #else
1.722 - DataLineOdd[j] = ((TempByte & 0x80) ? WHITE3 : BLACK3 )
1.723 - | ((TempByte & 0x20) ? WHITE2 : BLACK2 )
1.724 - | ((TempByte & 0x08) ? WHITE1 : BLACK1 )
1.725 - | ((TempByte & 0x02) ? WHITE0 : BLACK0 );
1.726 + DataLineOdd[j] = ((TempByte & 0x80) ? WHITE3 : BLACK3 )
1.727 + | ((TempByte & 0x20) ? WHITE2 : BLACK2 )
1.728 + | ((TempByte & 0x08) ? WHITE1 : BLACK1 )
1.729 + | ((TempByte & 0x02) ? WHITE0 : BLACK0 );
1.730
1.731 - DataLineEven[k--] = ((TempByte & 0x01) ? WHITE3 : BLACK3 )
1.732 - | ((TempByte & 0x04) ? WHITE2 : BLACK2 )
1.733 - | ((TempByte & 0x10) ? WHITE1 : BLACK1 )
1.734 - | ((TempByte & 0x40) ? WHITE0 : BLACK0 );
1.735 + DataLineEven[k--] = ((TempByte & 0x01) ? WHITE3 : BLACK3 )
1.736 + | ((TempByte & 0x04) ? WHITE2 : BLACK2 )
1.737 + | ((TempByte & 0x10) ? WHITE1 : BLACK1 )
1.738 + | ((TempByte & 0x40) ? WHITE0 : BLACK0 );
1.739 #endif
1.740 - }
1.741 + }
1.742 #ifdef DISPLAY_180_DEGREE
1.743 - Picture = DataLinePrt;
1.744 + Picture = DataLinePrt;
1.745 #endif
1.746 - DataLineScan[(i>>2)] = ScanTable[(i%4)];
1.747 - // SPI (0x0a, line data....)
1.748 - epd_SPI_Send(0x0a, (uint8_t *)&COG_Line.uint8, COG_Parameters[EPD_Type_Index].DataLineSize);
1.749 -
1.750 - epd_SPI_Send_Byte(0x02, 0x2F);
1.751 + DataLineScan[(i>>2)] = ScanTable[(i%4)];
1.752 + // SPI (0x0a, line data....)
1.753 + epd_SPI_Send(0x0a, (uint8_t *)&COG_Line.uint8, COG_Parameters[EPD_Type_Index].DataLineSize);
1.754 +
1.755 + epd_SPI_Send_Byte(0x02, 0x2F);
1.756
1.757 - DataLineScan[(i>>2)] = 0;
1.758 - }
1.759 -#if(!_GaugeFrameTimeMark)
1.760 - if(COG_Parameters[EPD_Type_Index].FrameTime>0)
1.761 - {
1.762 - while(Currentframe>(epd_GetCurrentTimeTick() - StartClock));
1.763 - }
1.764 -#endif
1.765 - //TestPin2Trigger();
1.766 - Currentframe=(uint32_t)(epd_GetCurrentTimeTick() - StartClock)+COG_Parameters[EPD_Type_Index].FrameTime ;
1.767 - cnt++;
1.768 - }while (StageTime>Currentframe);
1.769 + DataLineScan[(i>>2)] = 0;
1.770 + }
1.771 +#if(!_GaugeFrameTimeMark)
1.772 + if(COG_Parameters[EPD_Type_Index].FrameTime>0)
1.773 + {
1.774 + while(Currentframe>(epd_GetCurrentTimeTick() - StartClock));
1.775 + }
1.776 +#endif
1.777 + //TestPin2Trigger();
1.778 + Currentframe=(uint32_t)(epd_GetCurrentTimeTick() - StartClock)+COG_Parameters[EPD_Type_Index].FrameTime ;
1.779 + cnt++;
1.780 + }while (StageTime>Currentframe);
1.781
1.782 -// TestPin2Trigger();
1.783 - while(StageTime>(epd_GetCurrentTimeTick() - StartClock));
1.784 -// TestPin2Trigger();
1.785 -// TestPinTrigger();
1.786 +// TestPin2Trigger();
1.787 + while(StageTime>(epd_GetCurrentTimeTick() - StartClock));
1.788 +// TestPin2Trigger();
1.789 +// TestPinTrigger();
1.790 }
1.791
1.792 static void Display_Nothing (void)
1.793 {
1.794 - uint16_t i; // general counters
1.795 + uint16_t i; // general counters
1.796
1.797 - for (i = 0; i < COG_Parameters[EPD_Type_Index].HORIZONTAL; i++) // make every bit in the line white
1.798 - {
1.799 - DataLineEven[i] = 0x00;
1.800 - DataLineOdd[i] = 0x00;
1.801 - }
1.802 + for (i = 0; i < COG_Parameters[EPD_Type_Index].HORIZONTAL; i++) // make every bit in the line white
1.803 + {
1.804 + DataLineEven[i] = 0x00;
1.805 + DataLineOdd[i] = 0x00;
1.806 + }
1.807
1.808 - for (i = 0; i < COG_Parameters[EPD_Type_Index].VERTICAL; i++) // for every line
1.809 - {
1.810 - epd_SPI_Send_Byte(0x04, 0x03);
1.811 - DataLineScan[(i>>2)] = ScanTable[(i%4)];
1.812 - // SPI (0x0a, line data....)
1.813 - epd_SPI_Send(0x0a, (uint8_t *)&COG_Line.uint8, COG_Parameters[EPD_Type_Index].DataLineSize);
1.814 + for (i = 0; i < COG_Parameters[EPD_Type_Index].VERTICAL; i++) // for every line
1.815 + {
1.816 + epd_SPI_Send_Byte(0x04, 0x03);
1.817 + DataLineScan[(i>>2)] = ScanTable[(i%4)];
1.818 + // SPI (0x0a, line data....)
1.819 + epd_SPI_Send(0x0a, (uint8_t *)&COG_Line.uint8, COG_Parameters[EPD_Type_Index].DataLineSize);
1.820
1.821 - epd_SPI_Send_Byte(0x02, 0x2F);
1.822 - }
1.823 + epd_SPI_Send_Byte(0x02, 0x2F);
1.824 + }
1.825 }
1.826
1.827 static void Dummy_line(void)
1.828 {
1.829 - uint16_t i;
1.830 + uint16_t i;
1.831
1.832 - for (i = 0; i < COG_Parameters[EPD_Type_Index].DataLineSize; i++)
1.833 - {
1.834 - COG_Line.uint8[i] = 0x00;
1.835 - }
1.836 + for (i = 0; i < COG_Parameters[EPD_Type_Index].DataLineSize; i++)
1.837 + {
1.838 + COG_Line.uint8[i] = 0x00;
1.839 + }
1.840
1.841 - epd_SPI_Send_Byte(0x04, 0x03);
1.842 + epd_SPI_Send_Byte(0x04, 0x03);
1.843
1.844 - // SPI (0x0a, line data....)
1.845 - epd_SPI_Send(0x0a, (uint8_t *)&COG_Line.uint8, COG_Parameters[EPD_Type_Index].DataLineSize);
1.846 + // SPI (0x0a, line data....)
1.847 + epd_SPI_Send(0x0a, (uint8_t *)&COG_Line.uint8, COG_Parameters[EPD_Type_Index].DataLineSize);
1.848
1.849 - epd_SPI_Send_Byte(0x02, 0x2F);
1.850 + epd_SPI_Send_Byte(0x02, 0x2F);
1.851 }
1.852
1.853
1.854 @@ -515,102 +515,102 @@
1.855 *****************************************************************************/
1.856 void epd_HwInit(void)
1.857 {
1.858 - epd_InitDisplayHardware();
1.859 + epd_InitDisplayHardware();
1.860 }
1.861
1.862 void epd_PowerOn(void)
1.863 {
1.864 - bsp_PowerOn();
1.865 + bsp_PowerOn();
1.866 }
1.867
1.868 void epd_InitializeDriver(uint8_t EPDIndex)
1.869 {
1.870 - uint8_t SendBuffer[2];
1.871 - uint16_t k;
1.872 + uint8_t SendBuffer[2];
1.873 + uint16_t k;
1.874
1.875 - EPD_Type_Index = EPDIndex;
1.876 + EPD_Type_Index = EPDIndex;
1.877
1.878 - //Data Line Clear
1.879 - for (k = 0; k <= __LineDataSize; k ++)
1.880 - {
1.881 - COG_Line.uint8[k] = 0x00;
1.882 - }
1.883 - Driver_TypeSelect(EPDIndex);
1.884 - k = 0;
1.885 + //Data Line Clear
1.886 + for (k = 0; k <= __LineDataSize; k ++)
1.887 + {
1.888 + COG_Line.uint8[k] = 0x00;
1.889 + }
1.890 + Driver_TypeSelect(EPDIndex);
1.891 + k = 0;
1.892
1.893 - SetTemperature_Factor(EPDIndex);
1.894 + SetTemperature_Factor(EPDIndex);
1.895
1.896 - /*while (DRIVERBUSY_Get())
1.897 - {
1.898 - delayT32B0Us(500);
1.899 - if((k++)>=1000) return;//wait 500 ms
1.900 - }
1.901 - */
1.902 + /*while (DRIVERBUSY_Get())
1.903 + {
1.904 + delayT32B0Us(500);
1.905 + if((k++)>=1000) return;//wait 500 ms
1.906 + }
1.907 + */
1.908
1.909 - // SPI (0x01, 0x0000, 0x0000, 0x01ff, 0xe000)
1.910 - epd_SPI_Send(0x01, (uint8_t *)&COG_Parameters[EPDIndex].ChannelSelect, 8);
1.911 + // SPI (0x01, 0x0000, 0x0000, 0x01ff, 0xe000)
1.912 + epd_SPI_Send(0x01, (uint8_t *)&COG_Parameters[EPDIndex].ChannelSelect, 8);
1.913
1.914 - epd_SPI_Send_Byte(0x06, 0xff);
1.915 - epd_SPI_Send_Byte(0x07, 0x9d);
1.916 - epd_SPI_Send_Byte(0x08, 0x00);
1.917 + epd_SPI_Send_Byte(0x06, 0xff);
1.918 + epd_SPI_Send_Byte(0x07, 0x9d);
1.919 + epd_SPI_Send_Byte(0x08, 0x00);
1.920
1.921 - // SPI (0x09, 0xd000)
1.922 - SendBuffer[0] = 0xd0;
1.923 - SendBuffer[1] = 0x00;
1.924 - epd_SPI_Send(0x09, SendBuffer, 2);
1.925 + // SPI (0x09, 0xd000)
1.926 + SendBuffer[0] = 0xd0;
1.927 + SendBuffer[1] = 0x00;
1.928 + epd_SPI_Send(0x09, SendBuffer, 2);
1.929
1.930 - epd_SPI_Send_Byte(0x04,COG_Parameters[EPDIndex].VoltageLevel);
1.931 + epd_SPI_Send_Byte(0x04,COG_Parameters[EPDIndex].VoltageLevel);
1.932
1.933 - epd_SPI_Send_Byte(0x03, 0x01);
1.934 - epd_SPI_Send_Byte(0x03, 0x00);
1.935 + epd_SPI_Send_Byte(0x03, 0x01);
1.936 + epd_SPI_Send_Byte(0x03, 0x00);
1.937
1.938 - epd_pwm_active(5);
1.939 + epd_pwm_active(5);
1.940
1.941 - epd_SPI_Send_Byte(0x05, 0x01);
1.942 + epd_SPI_Send_Byte(0x05, 0x01);
1.943
1.944 - epd_pwm_active(30);
1.945 + epd_pwm_active(30);
1.946
1.947 - epd_SPI_Send_Byte(0x05, 0x03);
1.948 - epd_delay_ms(30);
1.949 - epd_SPI_Send_Byte(0x05, 0x0f);
1.950 - epd_delay_ms(30);
1.951 - epd_SPI_Send_Byte(0x02, 0x24);
1.952 - printf("Done initialisation.\n");
1.953 + epd_SPI_Send_Byte(0x05, 0x03);
1.954 + epd_delay_ms(30);
1.955 + epd_SPI_Send_Byte(0x05, 0x0f);
1.956 + epd_delay_ms(30);
1.957 + epd_SPI_Send_Byte(0x02, 0x24);
1.958 + printf("Done initialisation.\n");
1.959 }
1.960
1.961 void epd_Display (uint8_t *pNewImg, uint8_t *pPrevImg)
1.962 -{
1.963 - //COG Process - update display in four steps
1.964 - Display_Stage_1(pPrevImg);
1.965 - Display_Stage_2(pPrevImg);
1.966 - Display_Stage_3(pNewImg);
1.967 - Display_Stage_4(pNewImg);
1.968 +{
1.969 + //COG Process - update display in four steps
1.970 + Display_Stage_1(pPrevImg);
1.971 + Display_Stage_2(pPrevImg);
1.972 + Display_Stage_3(pNewImg);
1.973 + Display_Stage_4(pNewImg);
1.974 }
1.975
1.976 void epd_PowerOff (void)
1.977 {
1.978 - Display_Nothing();
1.979 - Dummy_line();
1.980 - epd_delay_ms(25);
1.981 + Display_Nothing();
1.982 + Dummy_line();
1.983 + epd_delay_ms(25);
1.984
1.985 - //border_low();
1.986 - //epd_delay_ms(_30ms);
1.987 - //border_high();
1.988 -
1.989 - epd_SPI_Send_Byte(0x03, 0x01);
1.990 - epd_SPI_Send_Byte(0x02, 0x05);
1.991 - epd_SPI_Send_Byte(0x05, 0x0E);
1.992 - epd_SPI_Send_Byte(0x05, 0x02);
1.993 - epd_SPI_Send_Byte(0x04, 0x0C);
1.994 - epd_delay_ms(120);
1.995 - epd_SPI_Send_Byte(0x05, 0x00);
1.996 - epd_SPI_Send_Byte(0x07, 0x0D);
1.997 - epd_SPI_Send_Byte(0x04, 0x50);
1.998 - epd_delay_ms(40);
1.999 - epd_SPI_Send_Byte(0x04, 0xA0);
1.1000 - epd_delay_ms(40);
1.1001 - epd_SPI_Send_Byte(0x04, 0x00);
1.1002 + //border_low();
1.1003 + //epd_delay_ms(_30ms);
1.1004 + //border_high();
1.1005 +
1.1006 + epd_SPI_Send_Byte(0x03, 0x01);
1.1007 + epd_SPI_Send_Byte(0x02, 0x05);
1.1008 + epd_SPI_Send_Byte(0x05, 0x0E);
1.1009 + epd_SPI_Send_Byte(0x05, 0x02);
1.1010 + epd_SPI_Send_Byte(0x04, 0x0C);
1.1011 + epd_delay_ms(120);
1.1012 + epd_SPI_Send_Byte(0x05, 0x00);
1.1013 + epd_SPI_Send_Byte(0x07, 0x0D);
1.1014 + epd_SPI_Send_Byte(0x04, 0x50);
1.1015 + epd_delay_ms(40);
1.1016 + epd_SPI_Send_Byte(0x04, 0xA0);
1.1017 + epd_delay_ms(40);
1.1018 + epd_SPI_Send_Byte(0x04, 0x00);
1.1019
1.1020 - printf("Shutdown...\n");
1.1021 - bsp_Shutdown();
1.1022 + printf("Shutdown...\n");
1.1023 + bsp_Shutdown();
1.1024 }