예제 #1
0
/**
* @brief  Display the application header (title) on the LCD screen 
* @param  Title :  pointer to the string to be displayed
* @retval None
*/
void LCD_LOG_SetHeader (uint8_t *Title)
{
  sFONT *cFont;

  uint32_t size = 0 , idx,cnt=LCD_PIXEL_WIDTH/cFont->Width+1; 
  uint8_t  *ptr = Title;
  uint8_t  tmp[80];
// #ifdef inch_4
//   uint8_t  tmp[66];
// #endif
// #ifdef inch_7
//   uint8_t  tmp[66];
// #endif	
	
  LCD_SetFont (&Font12x12);
  cFont = LCD_GetFont();
	cnt=LCD_PIXEL_WIDTH/cFont->Width+1;
  /* center the header */
  while (*ptr++) size ++ ;

  /* truncate extra text */
  if(size > cnt)
  {
     size = cnt;
  }
  
  for (idx = 0 ; idx <cnt ; idx ++)
  { 
    tmp[idx] = ' '; 
  }

  for (idx = 0 ; idx < size ; idx ++)
  { 
    tmp[idx + (cnt - size)/2] = Title[idx];
  }
  
  /* Clear the LCD */
  LCD_Clear(Black);
    
  /* Set the LCD Font */
 

  cFont = LCD_GetFont();  
  /* Set the LCD Text Color */
  LCD_SetTextColor(White);
  LCD_SetBackColor(Blue);
  LCD_ClearLine(0);
  LCD_DisplayStringLine(cFont->Height, tmp);
  LCD_ClearLine(2 * cFont->Height);

  LCD_SetBackColor(Black);
  LCD_SetFont (&Font8x12);
}
예제 #2
0
u8 LCD_SetFont(unsigned int idx)
{
    u8 old = LCD_GetFont();
    if (old == idx)
        return old;
    if (! open_font(idx))
        open_font(old);
    return old;
}
예제 #3
0
/**
* @brief  Clear the Text Zone 
* @param  None 
* @retval None
*/
void LCD_LOG_ClearTextZone(void)
{
  uint8_t i=0;
  sFONT *cFont = LCD_GetFont();
  
  for (i= 0 ; i < YWINDOW_SIZE; i++)
  {
    LCD_ClearLine((i + YWINDOW_MIN) * cFont->Height);
  }
  
  LCD_LOG_DeInit();
}
예제 #4
0
파일: main.c 프로젝트: calcem/Tron3TA4
void LCD_DisplayString(uint16_t LineNumber, uint16_t ColumnNumber, uint8_t *ptr)
{  
  //here the LineNumber and the ColumnNumber are NOT  pixel numbers!!!
		while (*ptr!=NULL)
    {
				LCD_DisplayChar(LINE(LineNumber), COLUMN(ColumnNumber), *ptr);
				ColumnNumber++;
			 //to avoid wrapping on the same line and replacing chars 
				if (ColumnNumber*(((sFONT *)LCD_GetFont())->Width)>=LCD_PIXEL_WIDTH ){
					ColumnNumber=0;
					LineNumber++;
				}
					
				ptr++;
		}
}
예제 #5
0
/**
* @brief  Display the application footer (status) on the LCD screen 
* @param  Status :  pointer to the string to be displayed
* @retval None
*/
void LCD_LOG_SetFooter(uint8_t *Status)
{
  sFONT *cFont;
  uint8_t  tmp[40], i;
  LCD_SetBackColor(Blue);
  cFont = LCD_GetFont();
  
  for (i= 0; i< (320/cFont->Width)-1 ; i++)
  {
    tmp[i] = ' ';
  }
  
  tmp[(320/cFont->Width)-1] = 0;
  LCD_DisplayStringLine(LCD_PIXEL_HEIGHT - cFont->Height, tmp);
  LCD_DisplayStringLine(LCD_PIXEL_HEIGHT - cFont->Height, Status);
  LCD_SetBackColor(Black);  
}
예제 #6
0
파일: redbull.c 프로젝트: flodur1/redbull
void printRight(int line, char* text)
{
  int l = strlen(text);
  int col = 40 - l;
  for (; *text; text++, col++)
  {
    int c = 319 - (col * LCD_GetFont()->Width);
    if (c > 0)
    {
      LCD_DisplayChar(LINE(line), c, *text);
    }
    else
    {
      break;
    }
  }
}
예제 #7
0
/**
* @brief  Update the text area display
* @param  None
* @retval None
*/
static void LCD_LOG_UpdateDisplay (void)
{
  uint8_t cnt = 0 ;
  uint16_t length = 0 ;
  uint16_t ptr = 0, index = 0;
  
  sFONT *cFont = LCD_GetFont();
  
  if((LCD_CacheBuffer_yptr_bottom  < (YWINDOW_SIZE -1)) && 
     (LCD_CacheBuffer_yptr_bottom  >= LCD_CacheBuffer_yptr_top))
  {
    LCD_SetTextColor(LCD_CacheBuffer[cnt + LCD_CacheBuffer_yptr_bottom].color);
    LCD_DisplayStringLine ((YWINDOW_MIN + LCD_CacheBuffer_yptr_bottom) * cFont->Height,
                           (uint8_t *)(LCD_CacheBuffer[cnt + LCD_CacheBuffer_yptr_bottom].line));
  }
  else
  {
    
    if(LCD_CacheBuffer_yptr_bottom < LCD_CacheBuffer_yptr_top)
    {
      /* Virtual length for rolling */
      length = LCD_CACHE_DEPTH + LCD_CacheBuffer_yptr_bottom ;
    }
    else
    {
      length = LCD_CacheBuffer_yptr_bottom;
    }
    
    ptr = length - YWINDOW_SIZE + 1;
    
    for  (cnt = 0 ; cnt < YWINDOW_SIZE ; cnt ++)
    {
      
      index = (cnt + ptr )% LCD_CACHE_DEPTH ;
      
      LCD_SetTextColor(LCD_CacheBuffer[index].color);
      LCD_DisplayStringLine ((cnt + YWINDOW_MIN) * cFont->Height, 
                             (uint8_t *)(LCD_CacheBuffer[index].line));
      
    }
  }
  
}
예제 #8
0
/**
* @brief  Display the application header (title) on the LCD screen 
* @param  Title :  pointer to the string to be displayed
* @retval None
*/
void LCD_LOG_SetHeader (uint8_t *Title)
{
  sFONT *cFont;
  uint32_t size = 0 , idx; 
  uint8_t  *ptr = Title;
  uint8_t  tmp[27];
  
  /* center the header */
  while (*ptr++) size ++ ;

  /* truncate extra text */
  if(size > 26)
  {
     size = 26;
  }
  
  for (idx = 0 ; idx < 27 ; idx ++)
  { 
    tmp[idx] = ' '; 
  }

  for (idx = 0 ; idx < size ; idx ++)
  { 
    tmp[idx + (27 - size)/2] = Title[idx];
  }
  
  /* Clear the LCD */
  LCD_Clear(Black);
    
  /* Set the LCD Font */
  LCD_SetFont (&Font12x12);

  cFont = LCD_GetFont();  
  /* Set the LCD Text Color */
  LCD_SetTextColor(White);
  LCD_SetBackColor(Blue);
  LCD_ClearLine(0);
  LCD_DisplayStringLine(cFont->Height, tmp);
  LCD_ClearLine(2 * cFont->Height);

  LCD_SetBackColor(Black);
  LCD_SetFont (&Font8x12);
}
예제 #9
0
u8 LCD_SetFont(unsigned int idx)
{
    u8 old = LCD_GetFont();
    if (old == idx)
        return old;
    if (idx == 0) {
        close_font();
        cur_str.font_idx = 0;
        return 0;
    } else if (! open_font(FontNames[idx - 1])){
        if (old == 0)
            close_font();
        else
            open_font(FontNames[old - 1]);
    }
    else
        cur_str.font_idx = idx;
    return old;
}
예제 #10
0
파일: menu.cpp 프로젝트: yallawalla/stm32
/*******************************************************************************
* Function Name	:
* Description		:
* Output				:
* Return				: None
*******************************************************************************/
void _MENU::Refresh() {
	if (item < 0) {
		if (str) {
			
#ifdef USE_LCD
			LCD_SetFont(&Font8x12);
			sFONT *f = LCD_GetFont();
			LCD_SetTextColor(LCD_COLOR_GREY);
			LCD_DisplayStringLine(LCD_PIXEL_HEIGHT - 5 * f->Height / 2, (uint8_t *)str);
			for (int i = 0; i<4; ++i)
				LCD_DrawRect((9 * i + 1)*f->Width,
				LCD_PIXEL_HEIGHT - 3 * f->Height,
				9 * f->Width,
				2 * f->Height);
#endif		
//			printf("%s\r", str);
		}
	}
	else
		next[item]->Refresh();
}
예제 #11
0
파일: main.c 프로젝트: peterliu2/FreeRTOS
static void prvLCDTask( void *pvParameters )
{
    xQueueMessage xReceivedMessage;
    long lLine = Line1;
    const long lFontHeight = (((sFONT *)LCD_GetFont())->Height);

    /* Buffer into which strings are formatted and placed ready for display on the
    LCD.  Note this is a static variable to prevent it being allocated on the task
    stack, which is too small to hold such a variable.  The stack size is configured
    when the task is created. */
    static char cBuffer[ 512 ];

    /* This function is the only function that uses printf().  If printf() is
    used from any other function then some sort of mutual exclusion on stdout
    will be necessary.

    This is also the only function that is permitted to access the LCD.

    First print out the number of bytes that remain in the FreeRTOS heap.  This
    can be viewed in the terminal IO window within the IAR Embedded Workbench. */
    printf( "%d bytes of heap space remain unallocated\n", xPortGetFreeHeapSize() );

    for( ;; ) {
        /* Wait for a message to be received.  Using portMAX_DELAY as the block
        time will result in an indefinite wait provided INCLUDE_vTaskSuspend is
        set to 1 in FreeRTOSConfig.h, therefore there is no need to check the
        function return value and the function will only return when a value
        has been received. */
        xQueueReceive( xLCDQueue, &xReceivedMessage, portMAX_DELAY );

        /* Clear the LCD if no room remains for any more text output. */
        if( lLine > Line9 ) {
            LCD_Clear( Blue );
            lLine = 0;
        }

        /* What is this message?  What does it contain? */
        switch( xReceivedMessage.cMessageID ) {
            case mainMESSAGE_BUTTON_UP		:	/* The button poll task has just
												informed this task that the up
												button on the joystick input has
												been pressed or released. */
                sprintf( cBuffer, "Button up = %d", xReceivedMessage.lMessageValue );
                break;

            case mainMESSAGE_BUTTON_SEL		:	/* The select button interrupt
												just informed this task that the
												select button was pressed.
												Generate a table of task run time
												statistics and output this to
												the terminal IO window in the IAR
												embedded workbench. */
                printf( "\nTask\t     Abs Time\t     %%Time\n*****************************************" );
                vTaskGetRunTimeStats( cBuffer );
                printf( cBuffer );

                /* Also print out a message to
                the LCD - in this case the
                pointer to the string to print
                is sent directly in the
                lMessageValue member of the
                message.  This just demonstrates
                a different communication
                technique. */
                sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.lMessageValue );
                break;

            case mainMESSAGE_STATUS			:	/* The tick interrupt hook
												function has just informed this
												task of the system status.
												Generate a string in accordance
												with the status value. */
                prvGenerateStatusMessage( cBuffer, xReceivedMessage.lMessageValue );
                break;

            default							:
                sprintf( cBuffer, "Unknown message" );
                break;
        }

        /* Output the message that was placed into the cBuffer array within the
        switch statement above. */
        LCD_DisplayStringLine( lLine, ( uint8_t * ) cBuffer );

        /* Move onto the next LCD line, ready for the next iteration of this
        loop. */
        lLine += lFontHeight;
    }
}