test

Dependents:   Datarecorder2

Committer:
joschaihl
Date:
Sun May 28 11:16:02 2017 +0000
Revision:
0:a9366f354506
Library for logging on STM32F7 DISCO

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joschaihl 0:a9366f354506 1 #include <stdio.h>
joschaihl 0:a9366f354506 2 #include "lcd_log.h"
joschaihl 0:a9366f354506 3
joschaihl 0:a9366f354506 4
joschaihl 0:a9366f354506 5 LCD_LOG_line LCD_CacheBuffer [LCD_CACHE_DEPTH];
joschaihl 0:a9366f354506 6 uint32_t LCD_LineColor;
joschaihl 0:a9366f354506 7 uint16_t LCD_CacheBuffer_xptr;
joschaihl 0:a9366f354506 8 uint16_t LCD_CacheBuffer_yptr_top;
joschaihl 0:a9366f354506 9 uint16_t LCD_CacheBuffer_yptr_bottom;
joschaihl 0:a9366f354506 10
joschaihl 0:a9366f354506 11 uint16_t LCD_CacheBuffer_yptr_top_bak;
joschaihl 0:a9366f354506 12 uint16_t LCD_CacheBuffer_yptr_bottom_bak;
joschaihl 0:a9366f354506 13
joschaihl 0:a9366f354506 14 FunctionalState LCD_CacheBuffer_yptr_invert;
joschaihl 0:a9366f354506 15 FunctionalState LCD_ScrollActive;
joschaihl 0:a9366f354506 16 FunctionalState LCD_Lock;
joschaihl 0:a9366f354506 17 FunctionalState LCD_Scrolled;
joschaihl 0:a9366f354506 18 uint16_t LCD_ScrollBackStep;
joschaihl 0:a9366f354506 19 /**
joschaihl 0:a9366f354506 20 * @brief Initializes the LCD Log module
joschaihl 0:a9366f354506 21 * @param None
joschaihl 0:a9366f354506 22 * @retval None
joschaihl 0:a9366f354506 23 */
joschaihl 0:a9366f354506 24
joschaihl 0:a9366f354506 25 void LCD_LOG_Init ( void)
joschaihl 0:a9366f354506 26 {
joschaihl 0:a9366f354506 27 /* Deinit LCD cache */
joschaihl 0:a9366f354506 28 LCD_LOG_DeInit();
joschaihl 0:a9366f354506 29
joschaihl 0:a9366f354506 30 /* Clear the LCD */
joschaihl 0:a9366f354506 31 BSP_LCD_Clear(LCD_LOG_BACKGROUND_COLOR);
joschaihl 0:a9366f354506 32 }
joschaihl 0:a9366f354506 33
joschaihl 0:a9366f354506 34 /**
joschaihl 0:a9366f354506 35 * @brief DeInitializes the LCD Log module.
joschaihl 0:a9366f354506 36 * @param None
joschaihl 0:a9366f354506 37 * @retval None
joschaihl 0:a9366f354506 38 */
joschaihl 0:a9366f354506 39 void LCD_LOG_DeInit(void)
joschaihl 0:a9366f354506 40 {
joschaihl 0:a9366f354506 41 LCD_LineColor = LCD_LOG_TEXT_COLOR;
joschaihl 0:a9366f354506 42 LCD_CacheBuffer_xptr = 0;
joschaihl 0:a9366f354506 43 LCD_CacheBuffer_yptr_top = 0;
joschaihl 0:a9366f354506 44 LCD_CacheBuffer_yptr_bottom = 0;
joschaihl 0:a9366f354506 45
joschaihl 0:a9366f354506 46 LCD_CacheBuffer_yptr_top_bak = 0;
joschaihl 0:a9366f354506 47 LCD_CacheBuffer_yptr_bottom_bak = 0;
joschaihl 0:a9366f354506 48
joschaihl 0:a9366f354506 49 LCD_CacheBuffer_yptr_invert= ENABLE;
joschaihl 0:a9366f354506 50 LCD_ScrollActive = DISABLE;
joschaihl 0:a9366f354506 51 LCD_Lock = DISABLE;
joschaihl 0:a9366f354506 52 LCD_Scrolled = DISABLE;
joschaihl 0:a9366f354506 53 LCD_ScrollBackStep = 0;
joschaihl 0:a9366f354506 54 }
joschaihl 0:a9366f354506 55
joschaihl 0:a9366f354506 56 /**
joschaihl 0:a9366f354506 57 * @brief Display the application header on the LCD screen
joschaihl 0:a9366f354506 58 * @param header: pointer to the string to be displayed
joschaihl 0:a9366f354506 59 * @retval None
joschaihl 0:a9366f354506 60 */
joschaihl 0:a9366f354506 61 void LCD_LOG_SetHeader (uint8_t *header)
joschaihl 0:a9366f354506 62 {
joschaihl 0:a9366f354506 63 /* Set the LCD Font */
joschaihl 0:a9366f354506 64 BSP_LCD_SetFont (&LCD_LOG_HEADER_FONT);
joschaihl 0:a9366f354506 65
joschaihl 0:a9366f354506 66 BSP_LCD_SetTextColor(LCD_LOG_SOLID_BACKGROUND_COLOR);
joschaihl 0:a9366f354506 67 BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), LCD_LOG_HEADER_FONT.Height);
joschaihl 0:a9366f354506 68
joschaihl 0:a9366f354506 69 /* Set the LCD Text Color */
joschaihl 0:a9366f354506 70 BSP_LCD_SetTextColor(LCD_LOG_SOLID_TEXT_COLOR);
joschaihl 0:a9366f354506 71 BSP_LCD_SetBackColor(LCD_LOG_SOLID_BACKGROUND_COLOR);
joschaihl 0:a9366f354506 72
joschaihl 0:a9366f354506 73 BSP_LCD_DisplayStringAt(0, 0, header, CENTER_MODE);
joschaihl 0:a9366f354506 74
joschaihl 0:a9366f354506 75 BSP_LCD_SetBackColor(LCD_LOG_BACKGROUND_COLOR);
joschaihl 0:a9366f354506 76 BSP_LCD_SetTextColor(LCD_LOG_TEXT_COLOR);
joschaihl 0:a9366f354506 77 BSP_LCD_SetFont (&LCD_LOG_TEXT_FONT);
joschaihl 0:a9366f354506 78 }
joschaihl 0:a9366f354506 79
joschaihl 0:a9366f354506 80 /**
joschaihl 0:a9366f354506 81 * @brief Display the application footer on the LCD screen
joschaihl 0:a9366f354506 82 * @param footer: pointer to the string to be displayed
joschaihl 0:a9366f354506 83 * @retval None
joschaihl 0:a9366f354506 84 */
joschaihl 0:a9366f354506 85 void LCD_LOG_SetFooter(uint8_t *footer)
joschaihl 0:a9366f354506 86 {
joschaihl 0:a9366f354506 87 /* Set the LCD Font */
joschaihl 0:a9366f354506 88 BSP_LCD_SetFont (&LCD_LOG_FOOTER_FONT);
joschaihl 0:a9366f354506 89
joschaihl 0:a9366f354506 90 BSP_LCD_SetTextColor(LCD_LOG_SOLID_BACKGROUND_COLOR);
joschaihl 0:a9366f354506 91 BSP_LCD_FillRect(0, BSP_LCD_GetYSize() - LCD_LOG_FOOTER_FONT.Height - 4, BSP_LCD_GetXSize(), LCD_LOG_FOOTER_FONT.Height + 4);
joschaihl 0:a9366f354506 92
joschaihl 0:a9366f354506 93 /* Set the LCD Text Color */
joschaihl 0:a9366f354506 94 BSP_LCD_SetTextColor(LCD_LOG_SOLID_TEXT_COLOR);
joschaihl 0:a9366f354506 95 BSP_LCD_SetBackColor(LCD_LOG_SOLID_BACKGROUND_COLOR);
joschaihl 0:a9366f354506 96
joschaihl 0:a9366f354506 97 BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - LCD_LOG_FOOTER_FONT.Height, footer, CENTER_MODE);
joschaihl 0:a9366f354506 98
joschaihl 0:a9366f354506 99 BSP_LCD_SetBackColor(LCD_LOG_BACKGROUND_COLOR);
joschaihl 0:a9366f354506 100 BSP_LCD_SetTextColor(LCD_LOG_TEXT_COLOR);
joschaihl 0:a9366f354506 101 BSP_LCD_SetFont (&LCD_LOG_TEXT_FONT);
joschaihl 0:a9366f354506 102 }
joschaihl 0:a9366f354506 103
joschaihl 0:a9366f354506 104 /**
joschaihl 0:a9366f354506 105 * @brief Clear the Text Zone
joschaihl 0:a9366f354506 106 * @param None
joschaihl 0:a9366f354506 107 * @retval None
joschaihl 0:a9366f354506 108 */
joschaihl 0:a9366f354506 109 void LCD_LOG_ClearTextZone(void)
joschaihl 0:a9366f354506 110 {
joschaihl 0:a9366f354506 111 uint8_t i=0;
joschaihl 0:a9366f354506 112
joschaihl 0:a9366f354506 113 for (i= 0 ; i < YWINDOW_SIZE; i++)
joschaihl 0:a9366f354506 114 {
joschaihl 0:a9366f354506 115 BSP_LCD_ClearStringLine(i + YWINDOW_MIN);
joschaihl 0:a9366f354506 116 }
joschaihl 0:a9366f354506 117
joschaihl 0:a9366f354506 118 LCD_LOG_DeInit();
joschaihl 0:a9366f354506 119 }
joschaihl 0:a9366f354506 120
joschaihl 0:a9366f354506 121 /**
joschaihl 0:a9366f354506 122 * @brief Redirect the printf to the LCD
joschaihl 0:a9366f354506 123 * @param c: character to be displayed
joschaihl 0:a9366f354506 124 * @param f: output file pointer
joschaihl 0:a9366f354506 125 * @retval None
joschaihl 0:a9366f354506 126 */
joschaihl 0:a9366f354506 127 LCD_LOG_PUTCHAR
joschaihl 0:a9366f354506 128 {
joschaihl 0:a9366f354506 129
joschaihl 0:a9366f354506 130 sFONT *cFont = BSP_LCD_GetFont();
joschaihl 0:a9366f354506 131 uint32_t idx;
joschaihl 0:a9366f354506 132
joschaihl 0:a9366f354506 133 if(LCD_Lock == DISABLE)
joschaihl 0:a9366f354506 134 {
joschaihl 0:a9366f354506 135 if(LCD_ScrollActive == ENABLE)
joschaihl 0:a9366f354506 136 {
joschaihl 0:a9366f354506 137 LCD_CacheBuffer_yptr_bottom = LCD_CacheBuffer_yptr_bottom_bak;
joschaihl 0:a9366f354506 138 LCD_CacheBuffer_yptr_top = LCD_CacheBuffer_yptr_top_bak;
joschaihl 0:a9366f354506 139 LCD_ScrollActive = DISABLE;
joschaihl 0:a9366f354506 140 LCD_Scrolled = DISABLE;
joschaihl 0:a9366f354506 141 LCD_ScrollBackStep = 0;
joschaihl 0:a9366f354506 142
joschaihl 0:a9366f354506 143 }
joschaihl 0:a9366f354506 144
joschaihl 0:a9366f354506 145 if(( LCD_CacheBuffer_xptr < (BSP_LCD_GetXSize()) /cFont->Width ) && ( ch != '\n'))
joschaihl 0:a9366f354506 146 {
joschaihl 0:a9366f354506 147 LCD_CacheBuffer[LCD_CacheBuffer_yptr_bottom].line[LCD_CacheBuffer_xptr++] = (uint16_t)ch;
joschaihl 0:a9366f354506 148 }
joschaihl 0:a9366f354506 149 else
joschaihl 0:a9366f354506 150 {
joschaihl 0:a9366f354506 151 if(LCD_CacheBuffer_yptr_top >= LCD_CacheBuffer_yptr_bottom)
joschaihl 0:a9366f354506 152 {
joschaihl 0:a9366f354506 153
joschaihl 0:a9366f354506 154 if(LCD_CacheBuffer_yptr_invert == DISABLE)
joschaihl 0:a9366f354506 155 {
joschaihl 0:a9366f354506 156 LCD_CacheBuffer_yptr_top++;
joschaihl 0:a9366f354506 157
joschaihl 0:a9366f354506 158 if(LCD_CacheBuffer_yptr_top == LCD_CACHE_DEPTH)
joschaihl 0:a9366f354506 159 {
joschaihl 0:a9366f354506 160 LCD_CacheBuffer_yptr_top = 0;
joschaihl 0:a9366f354506 161 }
joschaihl 0:a9366f354506 162 }
joschaihl 0:a9366f354506 163 else
joschaihl 0:a9366f354506 164 {
joschaihl 0:a9366f354506 165 LCD_CacheBuffer_yptr_invert= DISABLE;
joschaihl 0:a9366f354506 166 }
joschaihl 0:a9366f354506 167 }
joschaihl 0:a9366f354506 168
joschaihl 0:a9366f354506 169 for(idx = LCD_CacheBuffer_xptr ; idx < (BSP_LCD_GetXSize()) /cFont->Width; idx++)
joschaihl 0:a9366f354506 170 {
joschaihl 0:a9366f354506 171 LCD_CacheBuffer[LCD_CacheBuffer_yptr_bottom].line[LCD_CacheBuffer_xptr++] = ' ';
joschaihl 0:a9366f354506 172 }
joschaihl 0:a9366f354506 173 LCD_CacheBuffer[LCD_CacheBuffer_yptr_bottom].color = LCD_LineColor;
joschaihl 0:a9366f354506 174
joschaihl 0:a9366f354506 175 LCD_CacheBuffer_xptr = 0;
joschaihl 0:a9366f354506 176
joschaihl 0:a9366f354506 177 LCD_LOG_UpdateDisplay ();
joschaihl 0:a9366f354506 178
joschaihl 0:a9366f354506 179 LCD_CacheBuffer_yptr_bottom ++;
joschaihl 0:a9366f354506 180
joschaihl 0:a9366f354506 181 if (LCD_CacheBuffer_yptr_bottom == LCD_CACHE_DEPTH)
joschaihl 0:a9366f354506 182 {
joschaihl 0:a9366f354506 183 LCD_CacheBuffer_yptr_bottom = 0;
joschaihl 0:a9366f354506 184 LCD_CacheBuffer_yptr_top = 1;
joschaihl 0:a9366f354506 185 LCD_CacheBuffer_yptr_invert = ENABLE;
joschaihl 0:a9366f354506 186 }
joschaihl 0:a9366f354506 187
joschaihl 0:a9366f354506 188 if( ch != '\n')
joschaihl 0:a9366f354506 189 {
joschaihl 0:a9366f354506 190 LCD_CacheBuffer[LCD_CacheBuffer_yptr_bottom].line[LCD_CacheBuffer_xptr++] = (uint16_t)ch;
joschaihl 0:a9366f354506 191 }
joschaihl 0:a9366f354506 192
joschaihl 0:a9366f354506 193 }
joschaihl 0:a9366f354506 194 }
joschaihl 0:a9366f354506 195 return ch;
joschaihl 0:a9366f354506 196 }
joschaihl 0:a9366f354506 197
joschaihl 0:a9366f354506 198 /**
joschaihl 0:a9366f354506 199 * @brief Update the text area display
joschaihl 0:a9366f354506 200 * @param None
joschaihl 0:a9366f354506 201 * @retval None
joschaihl 0:a9366f354506 202 */
joschaihl 0:a9366f354506 203 void LCD_LOG_UpdateDisplay (void)
joschaihl 0:a9366f354506 204 {
joschaihl 0:a9366f354506 205 uint8_t cnt = 0 ;
joschaihl 0:a9366f354506 206 uint16_t length = 0 ;
joschaihl 0:a9366f354506 207 uint16_t ptr = 0, index = 0;
joschaihl 0:a9366f354506 208
joschaihl 0:a9366f354506 209 if((LCD_CacheBuffer_yptr_bottom < (YWINDOW_SIZE -1)) &&
joschaihl 0:a9366f354506 210 (LCD_CacheBuffer_yptr_bottom >= LCD_CacheBuffer_yptr_top))
joschaihl 0:a9366f354506 211 {
joschaihl 0:a9366f354506 212 BSP_LCD_SetTextColor(LCD_CacheBuffer[cnt + LCD_CacheBuffer_yptr_bottom].color);
joschaihl 0:a9366f354506 213 BSP_LCD_DisplayStringAtLine ((YWINDOW_MIN + LCD_CacheBuffer_yptr_bottom),
joschaihl 0:a9366f354506 214 (uint8_t *)(LCD_CacheBuffer[cnt + LCD_CacheBuffer_yptr_bottom].line));
joschaihl 0:a9366f354506 215 }
joschaihl 0:a9366f354506 216 else
joschaihl 0:a9366f354506 217 {
joschaihl 0:a9366f354506 218
joschaihl 0:a9366f354506 219 if(LCD_CacheBuffer_yptr_bottom < LCD_CacheBuffer_yptr_top)
joschaihl 0:a9366f354506 220 {
joschaihl 0:a9366f354506 221 /* Virtual length for rolling */
joschaihl 0:a9366f354506 222 length = LCD_CACHE_DEPTH + LCD_CacheBuffer_yptr_bottom ;
joschaihl 0:a9366f354506 223 }
joschaihl 0:a9366f354506 224 else
joschaihl 0:a9366f354506 225 {
joschaihl 0:a9366f354506 226 length = LCD_CacheBuffer_yptr_bottom;
joschaihl 0:a9366f354506 227 }
joschaihl 0:a9366f354506 228
joschaihl 0:a9366f354506 229 ptr = length - YWINDOW_SIZE + 1;
joschaihl 0:a9366f354506 230
joschaihl 0:a9366f354506 231 for (cnt = 0 ; cnt < YWINDOW_SIZE ; cnt ++)
joschaihl 0:a9366f354506 232 {
joschaihl 0:a9366f354506 233
joschaihl 0:a9366f354506 234 index = (cnt + ptr )% LCD_CACHE_DEPTH ;
joschaihl 0:a9366f354506 235
joschaihl 0:a9366f354506 236 BSP_LCD_SetTextColor(LCD_CacheBuffer[index].color);
joschaihl 0:a9366f354506 237 BSP_LCD_DisplayStringAtLine ((cnt + YWINDOW_MIN),
joschaihl 0:a9366f354506 238 (uint8_t *)(LCD_CacheBuffer[index].line));
joschaihl 0:a9366f354506 239
joschaihl 0:a9366f354506 240 }
joschaihl 0:a9366f354506 241 }
joschaihl 0:a9366f354506 242
joschaihl 0:a9366f354506 243 }
joschaihl 0:a9366f354506 244
joschaihl 0:a9366f354506 245 #if( LCD_SCROLL_ENABLED == 1)
joschaihl 0:a9366f354506 246 /**
joschaihl 0:a9366f354506 247 * @brief Display previous text frame
joschaihl 0:a9366f354506 248 * @param None
joschaihl 0:a9366f354506 249 * @retval Status
joschaihl 0:a9366f354506 250 */
joschaihl 0:a9366f354506 251 ErrorStatus LCD_LOG_ScrollBack(void)
joschaihl 0:a9366f354506 252 {
joschaihl 0:a9366f354506 253
joschaihl 0:a9366f354506 254 if(LCD_ScrollActive == DISABLE)
joschaihl 0:a9366f354506 255 {
joschaihl 0:a9366f354506 256
joschaihl 0:a9366f354506 257 LCD_CacheBuffer_yptr_bottom_bak = LCD_CacheBuffer_yptr_bottom;
joschaihl 0:a9366f354506 258 LCD_CacheBuffer_yptr_top_bak = LCD_CacheBuffer_yptr_top;
joschaihl 0:a9366f354506 259
joschaihl 0:a9366f354506 260
joschaihl 0:a9366f354506 261 if(LCD_CacheBuffer_yptr_bottom > LCD_CacheBuffer_yptr_top)
joschaihl 0:a9366f354506 262 {
joschaihl 0:a9366f354506 263
joschaihl 0:a9366f354506 264 if ((LCD_CacheBuffer_yptr_bottom - LCD_CacheBuffer_yptr_top) <= YWINDOW_SIZE)
joschaihl 0:a9366f354506 265 {
joschaihl 0:a9366f354506 266 LCD_Lock = DISABLE;
joschaihl 0:a9366f354506 267 return ERROR;
joschaihl 0:a9366f354506 268 }
joschaihl 0:a9366f354506 269 }
joschaihl 0:a9366f354506 270 LCD_ScrollActive = ENABLE;
joschaihl 0:a9366f354506 271
joschaihl 0:a9366f354506 272 if((LCD_CacheBuffer_yptr_bottom > LCD_CacheBuffer_yptr_top)&&
joschaihl 0:a9366f354506 273 (LCD_Scrolled == DISABLE ))
joschaihl 0:a9366f354506 274 {
joschaihl 0:a9366f354506 275 LCD_CacheBuffer_yptr_bottom--;
joschaihl 0:a9366f354506 276 LCD_Scrolled = ENABLE;
joschaihl 0:a9366f354506 277 }
joschaihl 0:a9366f354506 278
joschaihl 0:a9366f354506 279 }
joschaihl 0:a9366f354506 280
joschaihl 0:a9366f354506 281 if(LCD_ScrollActive == ENABLE)
joschaihl 0:a9366f354506 282 {
joschaihl 0:a9366f354506 283 LCD_Lock = ENABLE;
joschaihl 0:a9366f354506 284
joschaihl 0:a9366f354506 285 if(LCD_CacheBuffer_yptr_bottom > LCD_CacheBuffer_yptr_top)
joschaihl 0:a9366f354506 286 {
joschaihl 0:a9366f354506 287
joschaihl 0:a9366f354506 288 if((LCD_CacheBuffer_yptr_bottom - LCD_CacheBuffer_yptr_top) < YWINDOW_SIZE )
joschaihl 0:a9366f354506 289 {
joschaihl 0:a9366f354506 290 LCD_Lock = DISABLE;
joschaihl 0:a9366f354506 291 return ERROR;
joschaihl 0:a9366f354506 292 }
joschaihl 0:a9366f354506 293
joschaihl 0:a9366f354506 294 LCD_CacheBuffer_yptr_bottom --;
joschaihl 0:a9366f354506 295 }
joschaihl 0:a9366f354506 296 else if(LCD_CacheBuffer_yptr_bottom <= LCD_CacheBuffer_yptr_top)
joschaihl 0:a9366f354506 297 {
joschaihl 0:a9366f354506 298
joschaihl 0:a9366f354506 299 if((LCD_CACHE_DEPTH - LCD_CacheBuffer_yptr_top + LCD_CacheBuffer_yptr_bottom) < YWINDOW_SIZE)
joschaihl 0:a9366f354506 300 {
joschaihl 0:a9366f354506 301 LCD_Lock = DISABLE;
joschaihl 0:a9366f354506 302 return ERROR;
joschaihl 0:a9366f354506 303 }
joschaihl 0:a9366f354506 304 LCD_CacheBuffer_yptr_bottom --;
joschaihl 0:a9366f354506 305
joschaihl 0:a9366f354506 306 if(LCD_CacheBuffer_yptr_bottom == 0xFFFF)
joschaihl 0:a9366f354506 307 {
joschaihl 0:a9366f354506 308 LCD_CacheBuffer_yptr_bottom = LCD_CACHE_DEPTH - 2;
joschaihl 0:a9366f354506 309 }
joschaihl 0:a9366f354506 310 }
joschaihl 0:a9366f354506 311 LCD_ScrollBackStep++;
joschaihl 0:a9366f354506 312 LCD_LOG_UpdateDisplay();
joschaihl 0:a9366f354506 313 LCD_Lock = DISABLE;
joschaihl 0:a9366f354506 314 }
joschaihl 0:a9366f354506 315 return SUCCESS;
joschaihl 0:a9366f354506 316 }
joschaihl 0:a9366f354506 317
joschaihl 0:a9366f354506 318 /**
joschaihl 0:a9366f354506 319 * @brief Display next text frame
joschaihl 0:a9366f354506 320 * @param None
joschaihl 0:a9366f354506 321 * @retval Status
joschaihl 0:a9366f354506 322 */
joschaihl 0:a9366f354506 323 ErrorStatus LCD_LOG_ScrollForward(void)
joschaihl 0:a9366f354506 324 {
joschaihl 0:a9366f354506 325
joschaihl 0:a9366f354506 326 if(LCD_ScrollBackStep != 0)
joschaihl 0:a9366f354506 327 {
joschaihl 0:a9366f354506 328 if(LCD_ScrollActive == DISABLE)
joschaihl 0:a9366f354506 329 {
joschaihl 0:a9366f354506 330
joschaihl 0:a9366f354506 331 LCD_CacheBuffer_yptr_bottom_bak = LCD_CacheBuffer_yptr_bottom;
joschaihl 0:a9366f354506 332 LCD_CacheBuffer_yptr_top_bak = LCD_CacheBuffer_yptr_top;
joschaihl 0:a9366f354506 333
joschaihl 0:a9366f354506 334 if(LCD_CacheBuffer_yptr_bottom > LCD_CacheBuffer_yptr_top)
joschaihl 0:a9366f354506 335 {
joschaihl 0:a9366f354506 336
joschaihl 0:a9366f354506 337 if ((LCD_CacheBuffer_yptr_bottom - LCD_CacheBuffer_yptr_top) <= YWINDOW_SIZE)
joschaihl 0:a9366f354506 338 {
joschaihl 0:a9366f354506 339 LCD_Lock = DISABLE;
joschaihl 0:a9366f354506 340 return ERROR;
joschaihl 0:a9366f354506 341 }
joschaihl 0:a9366f354506 342 }
joschaihl 0:a9366f354506 343 LCD_ScrollActive = ENABLE;
joschaihl 0:a9366f354506 344
joschaihl 0:a9366f354506 345 if((LCD_CacheBuffer_yptr_bottom > LCD_CacheBuffer_yptr_top)&&
joschaihl 0:a9366f354506 346 (LCD_Scrolled == DISABLE ))
joschaihl 0:a9366f354506 347 {
joschaihl 0:a9366f354506 348 LCD_CacheBuffer_yptr_bottom--;
joschaihl 0:a9366f354506 349 LCD_Scrolled = ENABLE;
joschaihl 0:a9366f354506 350 }
joschaihl 0:a9366f354506 351
joschaihl 0:a9366f354506 352 }
joschaihl 0:a9366f354506 353
joschaihl 0:a9366f354506 354 if(LCD_ScrollActive == ENABLE)
joschaihl 0:a9366f354506 355 {
joschaihl 0:a9366f354506 356 LCD_Lock = ENABLE;
joschaihl 0:a9366f354506 357 LCD_ScrollBackStep--;
joschaihl 0:a9366f354506 358
joschaihl 0:a9366f354506 359 if(++LCD_CacheBuffer_yptr_bottom == LCD_CACHE_DEPTH)
joschaihl 0:a9366f354506 360 {
joschaihl 0:a9366f354506 361 LCD_CacheBuffer_yptr_bottom = 0;
joschaihl 0:a9366f354506 362 }
joschaihl 0:a9366f354506 363
joschaihl 0:a9366f354506 364 LCD_LOG_UpdateDisplay();
joschaihl 0:a9366f354506 365 LCD_Lock = DISABLE;
joschaihl 0:a9366f354506 366
joschaihl 0:a9366f354506 367 }
joschaihl 0:a9366f354506 368 return SUCCESS;
joschaihl 0:a9366f354506 369 }
joschaihl 0:a9366f354506 370 else // LCD_ScrollBackStep == 0
joschaihl 0:a9366f354506 371 {
joschaihl 0:a9366f354506 372 LCD_Lock = DISABLE;
joschaihl 0:a9366f354506 373 return ERROR;
joschaihl 0:a9366f354506 374 }
joschaihl 0:a9366f354506 375 }
joschaihl 0:a9366f354506 376 #endif /* LCD_SCROLL_ENABLED */
joschaihl 0:a9366f354506 377
joschaihl 0:a9366f354506 378 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/