view src/cs/drivers/drv_app/r2d/lcd_functions.c @ 600:8f50b202e81f

board preprocessor conditionals: prep for more FC hw in the future This change eliminates the CONFIG_TARGET_FCDEV3B preprocessor symbol and all preprocessor conditionals throughout the code base that tested for it, replacing them with CONFIG_TARGET_FCFAM or CONFIG_TARGET_FCMODEM. These new symbols are specified as follows: CONFIG_TARGET_FCFAM is intended to cover all hardware designs created by Mother Mychaela under the FreeCalypso trademark. This family will include modem products (repackagings of the FCDEV3B, possibly with RFFE or even RF transceiver changes), and also my desired FreeCalypso handset product. CONFIG_TARGET_FCMODEM is intended to cover all FreeCalypso modem products (which will be firmware-compatible with the FCDEV3B if they use TI Rita transceiver, or will require a different fw build if we switch to one of Silabs Aero transceivers), but not the handset product. Right now this CONFIG_TARGET_FCMODEM preprocessor symbol is used to conditionalize everything dealing with MCSI. At the present moment the future of FC hardware evolution is still unknown: it is not known whether we will ever have any beyond-FCDEV3B hardware at all (contingent on uncertain funding), and if we do produce further FC hardware designs, it is not known whether they will retain the same FIC modem core (triband), if we are going to have a quadband design that still retains the classic Rita transceiver, or if we are going to switch to Silabs Aero II or some other transceiver. If we produce a quadband modem that still uses Rita, it will run exactly the same fw as the FCDEV3B thanks to the way we define TSPACT signals for the RF_FAM=12 && CONFIG_TARGET_FCFAM combination, and the current fcdev3b build target will be renamed to fcmodem. OTOH, if that putative quadband modem will be Aero-based, then it will require a different fw build target, the fcdev3b target will stay as it is, and the two targets will both define CONFIG_TARGET_FCFAM and CONFIG_TARGET_FCMODEM, but will have different RF_FAM numbers. But no matter which way we are going to evolve, it is not right to have conditionals on CONFIG_TARGET_FCDEV3B in places like ACI, and the present change clears the way for future evolution.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 01 Apr 2019 01:05:24 +0000
parents 945cf7f506b2
children
line wrap: on
line source

/************************************************************************************
* lcd_functions.c :            contains low level driver for the lcd				*
*																					*	
*																					*
*	Author: Davide Carpegna															*
*																					*
*	version: 1.0																	*
*																					*
*	Date: 22/09/2000																*
*   (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved		*
*                                                                                   *
* --------------------------------------------------------------------------------- *
*                                                                                   *
*   History:                                                                        *
*                                                                                   *
*   10/18/2001 - Updated for R2D by Christophe Favergeon		                    * 
*                                                                                   *		
************************************************************************************/

#include "rv/general.h"
#include "rvf/rvf_api.h"
#include "r2d/r2d_config.h"
#include "r2d/r2d.h"
#include "r2d/lcd_functions.h"
#include <string.h>

extern T_R2D_GC_PTR r2d_g_lcd_gc;
extern T_RVF_MB_ID r2d_mb_id;


/********************  FUNCTIONS  **********************************************/
								


/********************************************************************************/
/*    Function Name: LCD_Clear_ll												*/
/*                                                                              */
/*    Purpose:low level driver to clear all the lcd								*/
/*																				*/		
/*                                                                              */
/*    Input Parameters:	None													*/
/*    Output Parameters: 				            							*/
/*        None		                                                            */
/********************************************************************************/

void LCD_Clear_ll (void)
{
   	if (r2d_g_lcd_gc!=NULL)
	  r2d_erase(r2d_g_lcd_gc);
}

/********************************************************************************/
/*    Function Name: LCD_Init_ll												*/
/*                                                                              */
/*    Purpose:low level driver to init the lcd		    						*/
/*    The LCD is initialized by R2D. This routine is now just only clearing     */
/*    the LCD                                                                   */
/*																				*/		
/*                                                                              */
/*    Input Parameters:	None													*/
/*    Output Parameters: 				            							*/
/*        None		                                                            */
/********************************************************************************/

void LCD_Init_ll(void)
{
	
  if (r2d_g_lcd_gc!=NULL)
	 r2d_erase(r2d_g_lcd_gc);
	
}

/********************************************************************************/
/*    Function Name: LCD_Set_Column												*/
/*                                                                              */
/*    Purpose:low level driver to revert the axis in the lcd		    	    */
/*			  revert the horizontal coordinate 									*/		
/*                                                                              */
/*    Input Parameters:	UINT8 x													*/
/*    Output Parameters: 				            							*/
/*        UINT8		                                                            */
/********************************************************************************/

UINT8 LCD_Set_Column(UINT8 x)
{
	return (83-x);
}

/********************************************************************************/
/*    Function Name: LCD_Set_Row_Pixel				    						*/
/*                                                                              */
/*    Purpose:low level driver to revert the axis in the lcd		    	    */
/*			   revert the vertical coordinates in pixel	    					*/		
/*                                                                              */
/*    Input Parameters:	UINT8 y													*/
/*    Output Parameters: 				            							*/
/*        UINT8		                                                            */
/********************************************************************************/

UINT8 LCD_Set_Row_Pixel(UINT8 y)
{
	return (47-y);
}
/********************************************************************************/
/*    Function Name: LCD_Set_Row							    				*/
/*                                                                              */
/*    Purpose:low level driver to revert the axis in the lcd		    	    */
/*			  revert the vertical coordinates in row							*/		
/*                                                                              */
/*    Input Parameters:	UINT8 y													*/
/*    Output Parameters: 				            							*/
/*        UINT8		                                                            */
/********************************************************************************/

UINT8 LCD_Set_Row(UINT8 y)
{
	return (5-y);
}


/********************************************************************************/
/*    Function Name: LCD_Write_String											*/
/*                                                                              */
/*    Purpose:low level driver to write a string in the lcd		        	    */
/*																				*/		
/*                                                                              */
/*    Input Parameters:	row,column,string videomode 							*/
/*    Output Parameters: 				            							*/
/*        None 		                                                            */
/********************************************************************************/

void LCD_Write_String(UINT8 row, UINT8 column, char *string, T_VIDEO_MODE mode)
{
//    UINT8 j,l,k,X,Y;
//	char asciicharacter;
//	char new_char;

	INT16 ascent,descent,leading;//,h;
	T_R2D_UTF16 *text;

	if (r2d_g_lcd_gc!=NULL)
	{

    r2d_get_font_info(r2d_g_lcd_gc,&ascent,&descent,&leading);
	
   
	r2d_set_drawing_mode(r2d_g_lcd_gc,R2D_COPY_MODE);
    
    text=r2d_new_unicode_from_cstring(r2d_mb_id,(unsigned char*)string);

	
	if (mode)
	{
		T_R2D_ARGB_COLOR bcol,fcol;
//		T_R2D_DRAWING_MODE mode;
		UINT16 text_width;

		bcol=r2d_get_background_color(r2d_g_lcd_gc);
		fcol=r2d_get_foreground_color(r2d_g_lcd_gc);
		r2d_set_background_color_with_argb(r2d_g_lcd_gc,0,0,0,0);
		r2d_set_foreground_color_with_argb(r2d_g_lcd_gc,0,255,255,255);
        
        r2d_get_text_width(r2d_g_lcd_gc,text,&text_width);

        r2d_draw_text(r2d_g_lcd_gc,(INT16)(column*6),(INT16)((row+1)*8),text);
		r2d_set_background_color(r2d_g_lcd_gc,bcol);
		r2d_set_foreground_color(r2d_g_lcd_gc,fcol);
	}
	else
        r2d_draw_text(r2d_g_lcd_gc,(INT16)(column*6),(INT16)((row+1)*8),text);
    rvf_free_buf((void*)text);
	}
}

/********************************************************************************/
/*    Function Name: LCD_Write_Center							    			*/
/*                                                                              */
/*    Purpose:low level driver to write a string in the screen center	   	    */
/*																				*/		
/*                                                                              */
/*    Input Parameters:	string													*/
/*    Output Parameters: 				            							*/
/*        None		                                                            */
/********************************************************************************/

void LCD_Write_Center( char *string)
{
  
  UINT16 i;
  INT16 j;
  char *p;
  j=0;
  p=string;
  while(*p!='\0')
  {
	  j++;
	  p++;
  }

  i=(R2D_WIDTH-((j<<2)+(j<<1)))>>1;
  if (i<0)
	  i=0;
  i=((i*0x2A)+0x80)>>8; // i/6 in Q8
  LCD_Write_String(Y_CENTER,(UINT8) i,string,NORMAL);
}