Example #1
0
//
// Function: spotCommonInit
//
// Draw static Spotfire form visualization layout template
//
void spotCommonInit(char *label, u08 mode)
{
  u08 i;
  char *sliderLabel;

  // Either clear everything or only the chart area
  if (mode == DRAW_INIT_PARTIAL)
  {
    u08 pxDone;

    // Partial init: clear only the chart area
    glcdFillRectangle(0, 16, 100, 48, mcBgColor);

    // Visualization title bar
    pxDone = glcdPutStr2(2, 9, FONT_5X5P, label, mcFgColor);
    if (pxDone + 2 < AD_X_START)
      glcdFillRectangle(pxDone + 2, 9, AD_X_START - pxDone - 2, 5, mcBgColor);
  }
  else
  {
    // Full init: start from scratch

    // Draw main lines for menu bar, vis title bar and filter panel
    glcdFillRectangle(0, 7, GLCD_XPIXELS, 1, mcFgColor);
    glcdFillRectangle(0, 15, GLCD_XPIXELS, 1, mcFgColor);
    glcdFillRectangle(101, 7, 1, GLCD_YPIXELS - 7, mcFgColor);

    // Init the Menu bar
    menuBarId = 255;
    spotMenuBarUpdate();

    // Init the visualization Title bar label
    glcdPutStr2(2, 9, FONT_5X5P, label, mcFgColor);

    // Filter panel label
    glcdPutStr2(104, 9, FONT_5X5P, "FILTERS", mcFgColor);

    // There are three filter sliders; hour + min + sec
    for (i = 0; i <= 2; i++)
    {
      if (i == 0)
        sliderLabel = animHour;
      else if (i == 1)
        sliderLabel = animMin;
      else
        sliderLabel = animSec;

      // Paint filter slider
      glcdPutStr2(FP_X_START, FP_Y_START + i * FP_Y_OFFSET_SIZE, FONT_5X5P,
        sliderLabel, mcFgColor);
      glcdRectangle(FP_X_START + FP_RF_X_OFFSET,
        FP_Y_START + i * FP_Y_OFFSET_SIZE + FP_RF_Y_OFFSET, FP_RF_WIDTH,
        FP_RF_HEIGHT, mcFgColor);
      glcdFillRectangle(FP_X_START + FP_RS_X_OFFSET,
        FP_Y_START + i * FP_Y_OFFSET_SIZE + FP_RS_Y_OFFSET, FP_RS_WIDTH,
        FP_RS_HEIGHT, mcFgColor);
    }
  }
}
Example #2
0
//
// Function: spotBarUpdate
//
// Update a single bar (used in Spotfire bar chart and cascade)
//
void spotBarUpdate(u08 x, u08 width, u08 oldVal, u08 newVal, s08 valXOffset,
  u08 fillType)
{
  u08 oldBarHeight;
  u08 newBarHeight;
  char barValue[3];

  // See if there's any need to update a bar
  if (oldVal == newVal && mcClockInit == GLCD_FALSE)
    return;

  // Get height of old bar and new bar
  oldBarHeight =
    (u08)((SPOT_BAR_HEIGHT_MAX / (float)SPOT_BAR_VAL_STEPS) * oldVal + 0.5);
  newBarHeight =
    (u08)((SPOT_BAR_HEIGHT_MAX / (float)SPOT_BAR_VAL_STEPS) * newVal + 0.5);

  // If there are no changes in barheight there's no need to repaint the bar
  if (oldBarHeight != newBarHeight || mcClockInit == GLCD_TRUE)
  {
    // Paint new bar
    if (fillType == FILL_BLANK)
    {
      // A FILL_BLANK is in fact drawing the outline of the bar first and
      // then fill it with blank
      glcdRectangle(x, SPOT_BAR_Y_START - newBarHeight, width,
        newBarHeight + 1, mcFgColor);
      if (newBarHeight > 1)
        glcdFillRectangle2(x + 1, SPOT_BAR_Y_START - newBarHeight + 1,
          width - 2, newBarHeight - 1, ALIGN_TOP, fillType, mcFgColor);
    }
    else
    {
      glcdFillRectangle2(x, SPOT_BAR_Y_START - newBarHeight, width,
        newBarHeight + 1, ALIGN_BOTTOM, fillType, mcFgColor);
    }
  }

  // Add the bar value (depending on bar value font size)
  animValToStr(newVal, barValue);
  glcdPutStr2(x + valXOffset, SPOT_BAR_Y_START - newBarHeight +
    SPOT_BAR_VAL_Y_OFFSET, FONT_5X7N, barValue, mcFgColor);

  // Clear the first line between the bar and the bar value
  glcdFillRectangle(x, SPOT_BAR_Y_START - newBarHeight - 1, width, 1,
    mcBgColor);

  // Clear the space left and right of the bar value
  glcdFillRectangle(x, SPOT_BAR_Y_START - newBarHeight + SPOT_BAR_VAL_Y_OFFSET,
    valXOffset, -SPOT_BAR_VAL_Y_OFFSET - 1, mcBgColor);
  glcdFillRectangle(x + width - valXOffset + 1,
    SPOT_BAR_Y_START - newBarHeight + SPOT_BAR_VAL_Y_OFFSET, valXOffset - 1,
    -SPOT_BAR_VAL_Y_OFFSET - 1, mcBgColor);

  // Clear what was above it (if any)
  if (oldBarHeight > newBarHeight)
    glcdFillRectangle(x, SPOT_BAR_Y_START - oldBarHeight +
      SPOT_BAR_VAL_Y_OFFSET, width, oldBarHeight - newBarHeight, mcBgColor);
}
Example #3
0
void lcdtest(void)
{
	unsigned char key = 0;

	glcdClearScreen();

	glcdSetAddress(4,LINE2);
	glcdPutStr("Graphic LCD Test");
	glcdSetAddress(4,LINE3);
	glcdPutStr("HD61202/3 controller");
	glcdSetAddress(4,LINE4);
	glcdPutStr("KS0108/7 controller");
	glcdSetAddress(4,LINE5);
	glcdPutStr("Press buttons to");
	glcdSetAddress(4,LINE6);
	glcdPutStr("test functions...");
	glcdRectangle(0, 0, 64, 128);
  
	while(1)
	{
		timerPause(10);
		key = ~inb(PINA);
		glcdSetAddress(4,LINE7);
		rprintf("Button status: %x  ", key);

		if(key == KEY1)
		{
			unsigned char i ;
			glcdClearScreen();	
			for ( i=0; i<128; i+=3)
			{
				glcdSetDot(i,63 - i/2);
  				glcdDelay(0x5fff);
			}
			for ( i=0; i<128; i+=3)
			{
				glcdClearDot(i,63 - i/2);
  				glcdDelay(0x5fff);
			}
		}
		
		if(key == KEY2)
		{
			glcdClearScreen();	
  			glcdCircle(25,20,17);
  			glcdDelay(0xffff);
  			glcdCircle(90,30,15);
  			glcdDelay(0xffff);
  			glcdCircle(55,30,23);
  			glcdDelay(0xffff);
  			glcdCircle(100,48,15);
  			glcdDelay(0xffff);
  			glcdCircle(34,50,10);
  			glcdDelay(0xffff);
  			glcdCircle(60,55,8);
		}
      
		if(key == KEY3)
		{
			glcdClearScreen();	
			glcdRectangle(54, 41, 6 , 12);
  			glcdDelay(0xffff);
			glcdRectangle(34, 12, 32, 2);
  			glcdDelay(0xffff);
			glcdRectangle(23, 34, 17, 21);
  			glcdDelay(0xffff);
			glcdRectangle(62, 20, 42, 58);
  			glcdDelay(0xffff);
			glcdRectangle(4 , 30, 12, 12);
		}
		
		if(key == KEY4)
		{
			glcdClearScreen();	
			glcdSetAddress(0,LINE1);	
			glcdPutStr("LINE 1"); glcdDelay(0xffff);
			glcdSetAddress(5,LINE2);
			glcdPutStr("LINE 2"); glcdDelay(0xffff);
			glcdSetAddress(10,LINE3);
			glcdPutStr("LINE 3"); glcdDelay(0xffff);
			glcdSetAddress(15,LINE4);
			glcdPutStr("LINE 4"); glcdDelay(0xffff);
			glcdSetAddress(20,LINE5);
			glcdPutStr("LINE 5"); glcdDelay(0xffff);
			glcdSetAddress(25,LINE6);
			glcdPutStr("LINE 6"); glcdDelay(0xffff);
			glcdSetAddress(30,LINE7);
			glcdPutStr("LINE 7"); glcdDelay(0xffff);
			glcdSetAddress(35,LINE8);
			glcdPutStr("LINE 8"); glcdDelay(0xffff);
		}

		if(key == KEY5)
		{
			glcdClearScreen();	
			glcdSetAddress(0,LINE2);
  			glcdPutStr(" !");
  			glcdWriteChar('"');
  			glcdPutStr("#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  			glcdPutStr("[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");
		}
		
		if(key == KEY6)
		{
			unsigned char i;
			for (i=0; i<64; i++)
			{
				glcdStartLine(64- i - 1);
  				glcdDelay(0x5fff);
			}
		}
		
		if(key == KEY7)
		{
			unsigned char i;
			for (i=0; i<64; i++)
			{
				glcdStartLine(i + 1);
  				glcdDelay(0x5fff);
			}
		}
		
		if (key == KEY8)
		{
			//	glcdBackLight(OFF);	
			//	glcdBackLight(ON);	
		}   
	}
}