Example #1
0
File: Hw_7Seg.c Project: oroca/srbd
/*---------------------------------------------------------------------------
     TITLE   : Hw_7Seg_Print
     WORK    : 
     ARG     : void
     RET     : void
---------------------------------------------------------------------------*/
void Hw_7Seg_Printf( u8 Index, char *format, ... )
{
	char Str[200];
	u32 StrSize;
	u32 i;
		
	Lb_va_list ap;

	Lb_va_start( ap, format );
		
	Lb_vsprintf(Str, format, ap);	
	
	StrSize = 0;
	
	for( i=0; i<100; i++ )
	{
		if( Str[i] == 0 ) break;
	}
	
	StrSize = i;
	
	if( StrSize > 0 && StrSize < 100 )
	{
		for( i=Index; i<HW_7SEG_MAX; i++)
		{
			if( i < StrSize ) 
				Hw_7Seg_SetNumber( i, Str[StrSize-i-Index-1] ); 
			else
				Hw_7Seg_SetNumber( i, ' ' ); 
		}
	} 
	
	Lb_va_end(ap);		
	
}
Example #2
0
/*---------------------------------------------------------------------------
     TITLE   : Ap_StrCmd_SendResp
     WORK    : 
     ARG     : void
     RET     : void   
---------------------------------------------------------------------------*/
void Ap_StrCmd_SendResp( u8 ErrCode, char *format, ... )
{
	char Str[200];
	char Ret;

	Lb_va_list ap;
	
	Lb_va_start( ap, format );

	Str[0] = AP_STRCMD_FRAME_RET;

	if( ErrCode == ERR_NONE )
	{
		Ret = AP_STRCMD_FRAME_OK;
	}
	else
	{
		Ret = AP_STRCMD_FRAME_FAIL;
	}

	Lb_sprintf( Str, "%c%c%02x ", 	AP_STRCMD_FRAME_RET 
								,	Ret
								,	ErrCode	);

	Lb_vsprintf( &Str[5], format, ap );	

	Lb_va_end(ap);	
	
	Ap_StrCmd_Print(Str);

	Ap_StrCmd_CmdClear();
}
Example #3
0
/*---------------------------------------------------------------------------
     TITLE   : Ap_StrCmd_Printf
     WORK    : 
     ARG     : void
     RET     : void   
---------------------------------------------------------------------------*/
void Ap_StrCmd_Printf( char *format, ... )
{
	char Str[200];
	Lb_va_list ap;
	
	Lb_va_start( ap, format );

	Lb_vsprintf( Str, format, ap );	

	Lb_va_end(ap);	
	
	Ap_StrCmd_Print(Str);
}
Example #4
0
/*---------------------------------------------------------------------------
     TITLE   : Hw_CLcd_Print
     WORK    : 
     ARG     : void
     RET     : void
---------------------------------------------------------------------------*/
u16 Hw_CLcd_Print( u8 x_str, u8 y_str,  char *format, ... )
{
	u16 Ret = ERR_NONE;
	char Str[200];
	Lb_va_list ap;

	Lb_va_start( ap, format );
		
	Lb_vsprintf(Str, format, ap);	

	Hw_CLcd_Goto( x_str, y_str );
	Hw_CLcd_WriteStr( Str );		
		
	Lb_va_end(ap);		
	
	return Ret;
}