Ejemplo n.º 1
0
void print_timehour(uint8_t h, uint8_t inverted) {
  if (time_format == TIME_12H) {
    if (((h + 23)%12 + 1) >= 10 ) {
      printnumber((h + 23)%12 + 1, inverted);
    } else {
      glcdWriteChar(' ', NORMAL);
      glcdWriteChar('0' + (h + 23)%12 + 1, inverted);
    }
  } else {
    glcdWriteChar(' ', NORMAL);
    glcdWriteChar(' ', NORMAL);
    printnumber(h, inverted);
  }
}
Ejemplo n.º 2
0
void initanim_abo(void){
 uint8_t k, b, line, eof;
 uint16_t ix, lineix;
 ix=0;
#ifdef DEATHCHRON
 glcdFillRectangle(0, 0, GLCD_XPIXELS, GLCD_YPIXELS, 1);
 death_blitsegs_rom(36,0,logo_p, 57, 64, 1);
 uint8_t i = (time_s + 5) % 60;
 while(i != time_s);
#endif
 while (1) {
  glcdClearScreen();
  for (eof=0, lineix=0, line=0; line<8; line++) {
   if (!eof) {
    b = eeprom_read_byte(&about[ix++]);
    if (b==255) {
     eof = 1;
     if (!line) {displaystyle = eeprom_read_byte(&EE_STYLE); initanim(); return;}
     continue;
    } 
    if (!line) {lineix = ix + b;}
    k = ((128 - (b * 6))/2)-1;
    if (k<0) {k=0;}
    glcdSetAddress(k,line);
    for(;b>0;b--) {
     glcdWriteChar(eeprom_read_byte(&about[ix++]),0);
    }
   }
  }
  ix = lineix;
  delay_ms(500);
 }
}
Ejemplo n.º 3
0
void print_alarmline(uint8_t mode)
{
  glcdSetAddress(MENU_INDENT, 1);
  glcdPutStr("Set Alarm:  ", NORMAL);
  print_alarmhour(alarm_h, ((mode==SET_HOUR)?INVERTED:NORMAL));
  glcdWriteChar(':', NORMAL);
  printnumber(alarm_m, ((mode==SET_MIN)?INVERTED:NORMAL));
}
Ejemplo n.º 4
0
void print_time(uint8_t hour, uint8_t min, uint8_t sec, uint8_t mode)
{
  glcdSetAddress(MENU_INDENT, 2);
  glcdPutStr("Set Time: ", NORMAL);
  print_timehour(hour, ((mode==SET_HOUR)?INVERTED:NORMAL));
  glcdWriteChar(':', NORMAL);
  printnumber(min, ((mode==SET_MIN)?INVERTED:NORMAL));
  glcdWriteChar(':', NORMAL);
  printnumber(sec, ((mode==SET_SEC)?INVERTED:NORMAL));
  if (time_format == TIME_12H) {
    glcdWriteChar(' ', NORMAL);
    if (hour >= 12) {
      glcdWriteChar('P', ((mode==SET_HOUR)?INVERTED:NORMAL));
    } else {
      glcdWriteChar('A', ((mode==SET_HOUR)?INVERTED:NORMAL));
    }
  }
}
Ejemplo n.º 5
0
void print_alarmhour(uint8_t h, uint8_t inverted) {
  if (time_format == TIME_12H) {
    glcdSetAddress(MENU_INDENT + 18*6, 1);
    if (h >= 12) 
      glcdWriteChar('P', NORMAL);
    else
      glcdWriteChar('A', NORMAL);
    glcdWriteChar('M', NORMAL);
    glcdSetAddress(MENU_INDENT + 12*6, 1);

    if (((h + 23)%12 + 1) >= 10 ) {
      printnumber((h + 23)%12 + 1, inverted);
    } else {
      glcdWriteChar(' ', NORMAL);
      glcdWriteChar('0' + (h + 23)%12 + 1, inverted);
    }
   } else {
    glcdSetAddress(MENU_INDENT + 12*6, 1);
    printnumber(h, inverted);
  }
}
Ejemplo n.º 6
0
int main (void)
{
	// initialize
	uartInit();
	timerInit();
	a2dInit();
	glcdInit();
	outb(DDRA, 0x00);
	
	// send rprintf output to serial port
	rprintfInit(uartSendByte);
	// print welcome message to serial port
	rprintfProgStrM("\r\nWelcome to glcdtest...\r\n");
	// send rprintf output to lcd display
	rprintfInit(glcdWriteChar);

	// perform basic functionality tests
	rprintfProgStrM("All initialized...");

	glcdSetAddress(4,LINE2);
	glcdWriteChar('H');
	glcdWriteChar('E');
	glcdWriteChar('L');
	glcdWriteChar('L');
	glcdWriteChar('O');

	glcdSetAddress(4,LINE3);
	rprintfProgStrM("line 3");
	glcdSetAddress(4,LINE4);
	rprintfProgStrM("line 4");
	glcdSetAddress(4,LINE5);
	rprintfProgStrM("line 5");

	// run application program
	//oscope();
	lcdtest();

	return 0;   
}
Ejemplo n.º 7
0
void display_menu(void) {
  DEBUGP("display menu");
  
  screenmutex++;

  glcdClearScreen();
  
  glcdSetAddress(0, 0);
  glcdPutStr("Configuration Menu", NORMAL);
  
  glcdSetAddress(MENU_INDENT, 1);
  glcdPutStr("Set Alarm:  ", NORMAL);
  print_alarmhour(alarm_h, NORMAL);
  glcdWriteChar(':', NORMAL);
  printnumber(alarm_m, NORMAL);
  
  glcdSetAddress(MENU_INDENT, 2);
  glcdPutStr("Set Time: ", NORMAL);
  print_timehour(time_h, NORMAL);
  glcdWriteChar(':', NORMAL);
  printnumber(time_m, NORMAL);
  glcdWriteChar(':', NORMAL);
  printnumber(time_s, NORMAL);
  if (time_format == TIME_12H) {
    glcdWriteChar(' ', NORMAL);
    if (time_h >= 12) {
      glcdWriteChar('P', NORMAL);
    } else {
      glcdWriteChar('A', NORMAL);
    }
  }
  
  print_date(date_m,date_d,date_y,SET_DATE);
  print_region_setting(NORMAL);
  
#ifdef BACKLIGHT_ADJUST
  glcdSetAddress(MENU_INDENT, 5);
  glcdPutStr("Set Backlight: ", NORMAL);
  printnumber(OCR2B>>OCR2B_BITSHIFT,NORMAL);
#endif
  
  glcdSetAddress(0, 6);
  glcdPutStr("Press MENU to advance", NORMAL);
  glcdSetAddress(0, 7);
  glcdPutStr("Press SET to set", NORMAL);

  screenmutex--;
}
Ejemplo n.º 8
0
void print_date(uint8_t month, uint8_t day, uint8_t year, uint8_t mode) {
  glcdSetAddress(MENU_INDENT, 3);
  glcdPutStr("Date:", NORMAL);
  if (region == REGION_US) {
  	glcdPutStr("     ",NORMAL);
  	print_number_slash(month,(mode == SET_MONTH)?INVERTED:NORMAL);
  	print_number_slash(day, (mode == SET_DAY)?INVERTED:NORMAL);
  } else if (region == REGION_EU) {
  	glcdPutStr("     ",NORMAL);
  	print_number_slash(day, (mode == SET_DAY)?INVERTED:NORMAL);
  	print_number_slash(month,(mode == SET_MONTH)?INVERTED:NORMAL);
  }
#ifdef OPTION_DOW_DATELONG 
  else if ( region == DOW_REGION_US) {
  	glcdWriteChar(' ', NORMAL);
  	print_dow(NORMAL,month,day,year);
  	print_number_slash(month,(mode == SET_MONTH)?INVERTED:NORMAL);
  	print_number_slash(day, (mode == SET_DAY)?INVERTED:NORMAL);
  } else if ( region == DOW_REGION_EU) {
  	glcdWriteChar(' ', NORMAL);
  	print_dow(NORMAL,month,day,year);
  	print_number_slash(day, (mode == SET_DAY)?INVERTED:NORMAL);
  	print_number_slash(month,(mode == SET_MONTH)?INVERTED:NORMAL);
  } else if ( region == DATELONG) {
  	glcdPutStr("   ",NORMAL);
  	print_month((mode == SET_MONTH)?INVERTED:NORMAL,month);
  	glcdWriteChar(' ', NORMAL);
  	printnumber(day, (mode == SET_DAY)?INVERTED:NORMAL);
  	glcdWriteChar(',', NORMAL);
  	glcdWriteChar(' ', NORMAL);
  } else {
  	print_dow(NORMAL,month,day,year);
  	print_month((mode == SET_MONTH)?INVERTED:NORMAL,month);
  	glcdWriteChar(' ', NORMAL);
  	printnumber(day, (mode == SET_DAY)?INVERTED:NORMAL);
  	glcdWriteChar(',', NORMAL);
  }
#endif
  printnumber(20,(mode == SET_YEAR)?INVERTED:NORMAL);
  printnumber(year, (mode == SET_YEAR)?INVERTED:NORMAL);
}
Ejemplo n.º 9
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);	
		}   
	}
}
Ejemplo n.º 10
0
void print_number_slash(uint8_t number, uint8_t inverted)
{
	printnumber(number, inverted);
	glcdWriteChar('/', NORMAL);
}
Ejemplo n.º 11
0
void print_dow(uint8_t inverted, uint8_t mon, uint8_t day, uint8_t yr) {
 uint8_t t = dotw(mon,day,yr);
 glcdWriteChar(sdotw(t,0),inverted);
 glcdWriteChar(sdotw(t,1),inverted);
 glcdWriteChar(sdotw(t,2),inverted);
}  
Ejemplo n.º 12
0
void print_month(uint8_t inverted, uint8_t month) {
  glcdWriteChar(smon(month,0),inverted);
  glcdWriteChar(smon(month,1),inverted);
  glcdWriteChar(smon(month,2),inverted);
}
Ejemplo n.º 13
0
void glcdPutStr(char *data, uint8_t color){
	while (*data){
		glcdWriteChar(*data, color);
		data++;
	}
}
Ejemplo n.º 14
0
void glcdPutStr(char *data){
	while (*data){
		glcdWriteChar(*data);
		data++;
	}
}