コード例 #1
0
void NumberEditRepaint()
{
	if (text)
	{
		LcdGotoXYFont(1, 1);
		LcdStr(FONT_1X, text);
	}

	printRX2(value, 2);

	LcdGotoXYFont(1, 6);
	LcdStr(FONT_1X, "+-");
	printR(GetCurDelta(), FONT_1X);
}
コード例 #2
0
ファイル: custom_menu.c プロジェクト: shtormus/autoComp
void iconClear (void)
{
    LcdGotoXYFont(3,1);
    CharPrint(4,6*IconSize,icon,0,0);
    CharPrint(4,6*IconSize,icon,0,0);
    CharPrint(4,6*IconSize,icon,0,0);
}
コード例 #3
0
ファイル: DA7.c プロジェクト: hotyboty59/cpe301--yu
int main()
{

        LcdInit();	//initialize  LCD
        LcdContrast(0x7F);	 //display image
        _delay_ms(1000);
        LcdClear();
       
        LcdContrast(0x3F);	//adjust contrast
        _delay_ms(1000);
        LcdClear();
        
        LcdImage(waitImage);	//wait image
        LcdUpdate();
        _delay_ms(4000);
		
		ADCSRA |= (1<<ADEN)|(1<<ADPS0)|(1<<ADPS1)|(1<<ADPS2);   //enable ADC and select clk/128
		ADMUX |= (1<<REFS0)|(1<<ADLAR);							//Vref, ADC0 as input
		DDRC = 0x00;
		
		uint16_t temp, temp1, temp2, temp3;

        while (1)
        {
				ADCSRA |= (1<<ADSC);	//begin conversion
				while(!(ADCSRA &(1<<ADSC))==0);		//wait for end of conversion
				temp=(ADCH<<8)|ADCL;
				//calculation for temperature
                temp1 = temp%10;
                temp2 = temp%100/10;
                temp3 = temp%1000/100;
                char digit[4];
                sprintf(digit, "%d%d.%d ", temp1, temp2, temp3); //display temperature
                LcdClear();
                LcdGotoXYFont(1,1);
                LcdFStr(FONT_1X,(unsigned char*)digit);
                LcdGotoXYFont(1,2);
                LcdFStr(FONT_1X,(unsigned char*)PSTR ("Fahrenheit"));
                LcdUpdate();
                _delay_ms(1000);
        }
        return 0;
}
コード例 #4
0
void formatPrintX2(uint8_t y, char* aBuffer, float aValue, const char*const* aSuffix, uint8_t aSuffixCount, int8_t aSuffixMin)
{
	char* startBuffer = aBuffer;
	float mul = 1;
	int8_t iSuffix = 0;

	if(aValue<0)
	{
		LcdSingleBar  ( 0, y*8+2, 2, 5, PIXEL_ON);
		aValue = -aValue;
	}

	if(aValue>=1)
	{
		for(iSuffix = -aSuffixMin; iSuffix<(int8_t)aSuffixCount; iSuffix++)
		{
			float mul1 = mul*1000;
			if(aValue<mul1)
				goto FormatValue;
			mul = mul1; 
		}

		*aBuffer++ = 'i';
		*aBuffer++ = 'n';
		*aBuffer++ = 'f';
		iSuffix = -aSuffixMin;
		goto AddSufix;
	}else
	{
		for(iSuffix = -aSuffixMin; iSuffix>0; iSuffix--)
		{
			if(aValue>=mul)
				break;
			mul *= 1e-3f;
		}
	}


FormatValue:;
	aValue /= mul;

	{
		int value;

		if(aValue>=200)
		{
			value = (int)(aValue+0.5f);
			char c = (value/1000);
			if(c)
				*aBuffer++ = '0'+c;
			*aBuffer++ = '0'+((value/100)%10);
			*aBuffer++ = '0'+(char)((value/10)%10);
			*aBuffer++ = '0'+(char)(value%10);
		} else
		if(aValue>=20)
		{
			value = (int)(aValue*10+0.5f);
			char c = (value/1000);
			if(c)
				*aBuffer++ = '0'+c;
			*aBuffer++ = '0'+(value/100)%10;
			*aBuffer++ = '0'+(char)((value/10)%10);
			*aBuffer++ = '.';
			*aBuffer++ = '0'+(char)(value%10);
		} else
		if(aValue>=9)
		{
			value = (int)(aValue*100+0.5f);
			char c = (value/1000);
			if(c)
				*aBuffer++ = '0'+c;
			*aBuffer++ = '0'+(value/100)%10;
			*aBuffer++ = '.';
			*aBuffer++ = '0'+(char)((value/10)%10);
			*aBuffer++ = '0'+(char)(value%10);
		} else
		{
			value = (int)(aValue*1000+0.5f);
			char c = (value/1000);
			*aBuffer++ = '0'+c;
			*aBuffer++ = '.';
			*aBuffer++ = '0'+(value/100)%10;
			*aBuffer++ = '0'+(char)((value/10)%10);
			*aBuffer++ = '0'+(char)(value%10);
		}
	}

AddSufix:;
	*aBuffer = 0;
	LcdGotoXYFont(2, y+1);
	LcdStr(FONT_2X, startBuffer);

	LcdGotoXYFont(12, y+1);
	LcdStr(FONT_1X, aSuffix[iSuffix]);
}
コード例 #5
0
ファイル: main.c プロジェクト: barons2015/rlc-meter-balmer
void mainPcd8544()
{
  //STM_EVAL_LEDInit(LED3);
  //STM_EVAL_LEDToggle(LED3);
  //QuadEncInit();
  
  LcdInit();

  LcdClear();
  LcdGotoXYFont ( 2, 2 );
  LcdStr( FONT_1X, "1234" );
  LcdUpdate();
  
/*
  HwLcdInit();

  while (1)
  {
    HwLcdPinRst(1);
    HwLcdPinDC(1);
    HwLcdPinCE(1);
    HwLcdSend(0xEEEE);
    Delay(2);
    HwLcdPinRst(0);
    HwLcdPinDC(0);
    HwLcdPinCE(0);
    Delay(2);
  }
*/
  for(int i=0; 1; i++)
  {
    LcdClear();
    LcdGotoXYFont ( 1, 1 );
    printInt(i, FONT_1X);
    LcdUpdate();
    Delay(100);
  }

  while (1)
  {
    STM_EVAL_LEDToggle(LED3);
    LcdClear();

    if(QuadEncButton())
    {
      LcdGotoXYFont ( 1, 1 );
      LcdStr(FONT_1X, "PRESSED!");
    }
    
    LcdGotoXYFont ( 1, 3 );
    LcdStr(FONT_1X, "Q=");
    printInt(QuadEncValue(), FONT_2X);
    
    LcdUpdate();

    Delay(20);
  }
/*
  while (1)
  {

    //uint16_t temp_lo = PressureRead(0x20);
    //uint16_t temp_hi = PressureRead(0x0F);
    STM_EVAL_LEDToggle(LED3);
    LcdClear();
    LcdGotoXYFont ( 1, 3 );
    LcdStr(FONT_1X, "P=");
    printInt(PressureReadPressure(), FONT_1X);
    LcdGotoXYFont ( 1, 5 );
    LcdStr(FONT_1X, "T=");
    printIntFixed(PressureReadTemp(), FONT_1X, 3, 1);
    LcdUpdate();

    Delay(200);
  }
*/

}