STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
lcd_log.c
Go to the documentation of this file.
1 
49 /* Includes ------------------------------------------------------------------*/
50 #include <stdio.h>
51 #include "lcd_log.h"
52 
86 /* Define the display window settings */
87 #define YWINDOW_MIN 4
88 
102 uint32_t LCD_LineColor;
106 
109 
115 
141 void LCD_LOG_Init ( void)
142 {
143  /* Deinit LCD cache */
144  LCD_LOG_DeInit();
145 
146  /* Clear the LCD */
148 }
149 
155 void LCD_LOG_DeInit(void)
156 {
161 
164 
167  LCD_Lock = DISABLE;
169  LCD_ScrollBackStep = 0;
170 }
171 
177 void LCD_LOG_SetHeader (uint8_t *header)
178 {
179  /* Set the LCD Font */
181 
184 
185  /* Set the LCD Text Color */
188 
190 
194 }
195 
201 void LCD_LOG_SetFooter(uint8_t *footer)
202 {
203  /* Set the LCD Font */
205 
208 
209  /* Set the LCD Text Color */
212 
214 
218 }
219 
226 {
227  uint8_t i=0;
228 
229  for (i= 0 ; i < YWINDOW_SIZE; i++)
230  {
232  }
233 
234  LCD_LOG_DeInit();
235 }
236 
244 {
245 
246  sFONT *cFont = BSP_LCD_GetFont();
247  uint32_t idx;
248 
250  {
251  if(LCD_ScrollActive == ENABLE)
252  {
257  LCD_ScrollBackStep = 0;
258 
259  }
260 
261  if(( LCD_CacheBuffer_xptr < (BSP_LCD_GetXSize()) /cFont->Width ) && ( ch != '\n'))
262  {
263  LCD_CacheBuffer[LCD_CacheBuffer_yptr_bottom].line[LCD_CacheBuffer_xptr++] = (uint16_t)ch;
264  }
265  else
266  {
268  {
269 
271  {
273 
275  {
277  }
278  }
279  else
280  {
282  }
283  }
284 
285  for(idx = LCD_CacheBuffer_xptr ; idx < (BSP_LCD_GetXSize()) /cFont->Width; idx++)
286  {
287  LCD_CacheBuffer[LCD_CacheBuffer_yptr_bottom].line[LCD_CacheBuffer_xptr++] = ' ';
288  }
289  LCD_CacheBuffer[LCD_CacheBuffer_yptr_bottom].color = LCD_LineColor;
290 
292 
294 
296 
298  {
302  }
303 
304  if( ch != '\n')
305  {
306  LCD_CacheBuffer[LCD_CacheBuffer_yptr_bottom].line[LCD_CacheBuffer_xptr++] = (uint16_t)ch;
307  }
308 
309  }
310  }
311  return ch;
312 }
313 
320 {
321  uint8_t cnt = 0 ;
322  uint16_t length = 0 ;
323  uint16_t ptr = 0, index = 0;
324 
327  {
328  BSP_LCD_SetTextColor(LCD_CacheBuffer[cnt + LCD_CacheBuffer_yptr_bottom].color);
330  (uint8_t *)(LCD_CacheBuffer[cnt + LCD_CacheBuffer_yptr_bottom].line));
331  }
332  else
333  {
334 
336  {
337  /* Virtual length for rolling */
339  }
340  else
341  {
343  }
344 
345  ptr = length - YWINDOW_SIZE + 1;
346 
347  for (cnt = 0 ; cnt < YWINDOW_SIZE ; cnt ++)
348  {
349 
350  index = (cnt + ptr )% LCD_CACHE_DEPTH ;
351 
352  BSP_LCD_SetTextColor(LCD_CacheBuffer[index].color);
354  (uint8_t *)(LCD_CacheBuffer[index].line));
355 
356  }
357  }
358 
359 }
360 
361 #if( LCD_SCROLL_ENABLED == 1)
362 
368 {
369 
371  {
372 
375 
376 
378  {
379 
381  {
382  LCD_Lock = DISABLE;
383  return ERROR;
384  }
385  }
387 
389  (LCD_Scrolled == DISABLE ))
390  {
393  }
394 
395  }
396 
397  if(LCD_ScrollActive == ENABLE)
398  {
399  LCD_Lock = ENABLE;
400 
402  {
403 
405  {
406  LCD_Lock = DISABLE;
407  return ERROR;
408  }
409 
411  }
413  {
414 
416  {
417  LCD_Lock = DISABLE;
418  return ERROR;
419  }
421 
422  if(LCD_CacheBuffer_yptr_bottom == 0xFFFF)
423  {
425  }
426  }
429  LCD_Lock = DISABLE;
430  }
431  return SUCCESS;
432 }
433 
440 {
441 
442  if(LCD_ScrollBackStep != 0)
443  {
445  {
446 
449 
451  {
452 
454  {
455  LCD_Lock = DISABLE;
456  return ERROR;
457  }
458  }
460 
462  (LCD_Scrolled == DISABLE ))
463  {
466  }
467 
468  }
469 
470  if(LCD_ScrollActive == ENABLE)
471  {
472  LCD_Lock = ENABLE;
474 
476  {
478  }
479 
481  LCD_Lock = DISABLE;
482 
483  }
484  return SUCCESS;
485  }
486  else // LCD_ScrollBackStep == 0
487  {
488  LCD_Lock = DISABLE;
489  return ERROR;
490  }
491 }
492 #endif /* LCD_SCROLL_ENABLED */
493 
515 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#define YWINDOW_SIZE
Definition: lcd_log_conf.h:90
ErrorStatus LCD_LOG_ScrollBack(void)
Display previous text frame.
Definition: lcd_log.c:367
#define LCD_LOG_SOLID_TEXT_COLOR
Definition: lcd_log_conf.h:86
uint32_t LCD_LineColor
Definition: lcd_log.c:102
void BSP_LCD_SetFont(sFONT *fonts)
Sets the LCD text font.
uint32_t idx
Definition: lcd_log.c:247
uint32_t color
Definition: lcd_log.h:87
ErrorStatus LCD_LOG_ScrollForward(void)
Display next text frame.
Definition: lcd_log.c:439
void LCD_LOG_Init(void)
Initializes the LCD Log module.
Definition: lcd_log.c:141
return ch
Definition: lcd_log.c:311
void BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
Draws a full rectangle in currently active layer.
void LCD_LOG_UpdateDisplay(void)
Update the text area display.
Definition: lcd_log.c:319
void BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr)
Displays a maximum of 60 characters on the LCD.
sFONT * BSP_LCD_GetFont(void)
Gets the LCD text font.
#define LCD_LOG_HEADER_FONT
Definition: lcd_log_conf.h:76
uint32_t BSP_LCD_GetXSize(void)
Gets the LCD X size.
uint16_t LCD_CacheBuffer_yptr_bottom_bak
Definition: lcd_log.c:108
LCD_LOG_PUTCHAR
Redirect the printf to the LCD.
Definition: lcd_log.c:244
#define LCD_LOG_TEXT_FONT
Definition: lcd_log_conf.h:78
ErrorStatus
Definition: stm32f7xx.h:165
void BSP_LCD_SetBackColor(uint32_t Color)
Sets the LCD background color.
uint16_t Width
Definition: fonts.h:71
void BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Text_AlignModeTypdef Mode)
Displays characters in currently active layer.
uint16_t LCD_ScrollBackStep
Definition: lcd_log.c:114
uint16_t LCD_CacheBuffer_xptr
Definition: lcd_log.c:103
FunctionalState
Definition: stm32f7xx.h:158
#define LCD_LOG_TEXT_COLOR
Definition: lcd_log_conf.h:82
Definition: fonts.h:68
void LCD_LOG_ClearTextZone(void)
Clear the Text Zone.
Definition: lcd_log.c:225
void BSP_LCD_Clear(uint32_t Color)
Clears the whole currently active layer of LTDC.
FunctionalState LCD_Scrolled
Definition: lcd_log.c:113
LCD_LOG_line LCD_CacheBuffer[LCD_CACHE_DEPTH]
Definition: lcd_log.c:101
void LCD_LOG_DeInit(void)
DeInitializes the LCD Log module.
Definition: lcd_log.c:155
uint8_t line[128]
Definition: lcd_log.h:86
#define LCD_LOG_FOOTER_FONT
Definition: lcd_log_conf.h:77
void LCD_LOG_SetFooter(uint8_t *footer)
Display the application footer on the LCD screen.
Definition: lcd_log.c:201
void BSP_LCD_ClearStringLine(uint32_t Line)
Clears the selected line in currently active layer.
#define YWINDOW_MIN
Definition: lcd_log.c:87
void BSP_LCD_SetTextColor(uint32_t Color)
Sets the LCD text color.
uint16_t LCD_CacheBuffer_yptr_top
Definition: lcd_log.c:104
header for the lcd_log.c file
uint32_t BSP_LCD_GetYSize(void)
Gets the LCD Y size.
FunctionalState LCD_ScrollActive
Definition: lcd_log.c:111
FunctionalState LCD_Lock
Definition: lcd_log.c:112
uint16_t LCD_CacheBuffer_yptr_bottom
Definition: lcd_log.c:105
uint16_t LCD_CacheBuffer_yptr_top_bak
Definition: lcd_log.c:107
FunctionalState LCD_CacheBuffer_yptr_invert
Definition: lcd_log.c:110
#define LCD_CACHE_DEPTH
Definition: lcd_log.h:73
void LCD_LOG_SetHeader(uint8_t *header)
Display the application header on the LCD screen.
Definition: lcd_log.c:177
#define LCD_LOG_BACKGROUND_COLOR
Definition: lcd_log_conf.h:81
#define LCD_LOG_SOLID_BACKGROUND_COLOR
Definition: lcd_log_conf.h:85