Example #1
0
void display_menu(uint8_t line) {
  DEBUGP("display menu");
  
  screenmutex++;

  glcdClearScreen();
  
  //Dataman - Mode Menu Option
  //glcdSetAddress(0, 0);
  //glcdPutStr("Configuration Menu", NORMAL);
  glcdSetAddress(MENU_INDENT, 0);
  glcdPutStr("Mode:", NORMAL);
  print_style_setting(NORMAL);
 
  print_alarmline(SET_ALARM);
  
  print_time(time_h,time_m,time_s,SET_TIME);
  print_date(date_m,date_d,date_y,SET_DATE);
  print_region_setting(NORMAL);
  
#ifdef BACKLIGHT_ADJUST
  print_backlight(SET_BRIGHTNESS);

  if(displaymode == SET_BRIGHTNESS)
#else
  if(displaymode == SET_REGION)
#endif
  	  print_menu_exit();
  else
  	print_menu_advance();

  drawArrow(0, (line*8)+3, MENU_INDENT -1);
  screenmutex--;
}
Example #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);
 }
}
Example #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));
}
Example #4
0
void drawmidline(uint8_t inverted) {
    uint8_t i;
    for (i=0; i < (SCREEN_H/8 - 1); i++) {
        glcdSetAddress((SCREEN_W-MIDLINE_W)/2, i);
        if (inverted) {
            glcdDataWrite(0xF0);
        } else {
            glcdDataWrite(0x0F);
        }
    }
    glcdSetAddress((SCREEN_W-MIDLINE_W)/2, i);
    if (inverted) {
        glcdDataWrite(0x20);
    } else {
        glcdDataWrite(0xCF);
    }
}
Example #5
0
void set_backlight(void) {
  uint8_t mode = SET_BRIGHTNESS;

  display_menu();
  
  screenmutex++;
  glcdSetAddress(0, 6);
  glcdPutStr("Press MENU to exit   ", NORMAL);

  // put a small arrow next to 'set 12h/24h'
  drawArrow(0, 43, MENU_INDENT -1);
  screenmutex--;
  
  timeoutcounter = INACTIVITYTIMEOUT;  

  while (1) {
    if (just_pressed & 0x1) { // mode change
      return;
    }
    if (just_pressed || pressed) {
      timeoutcounter = INACTIVITYTIMEOUT;  
      // timeout w/no buttons pressed after 3 seconds?
    } else if (!timeoutcounter) {
      //timed out!
      displaymode = SHOW_TIME;     
      return;
    }
  
    if (just_pressed & 0x2) {
      just_pressed = 0;
      screenmutex++;

      if (mode == SET_BRIGHTNESS) {
	DEBUG(putstring("Setting backlight"));
	// ok now its selected
	mode = SET_BRT;
	// print the region 
	glcdSetAddress(MENU_INDENT + 15*6, 5);
	printnumber(OCR2B>>OCR2B_BITSHIFT,INVERTED);
	
	// display instructions below
	glcdSetAddress(0, 6);
	glcdPutStr("Press + to change   ", NORMAL);
	glcdSetAddress(0, 7);
	glcdPutStr("Press SET to save   ", NORMAL);
      } else {
Example #6
0
void glcdHome(void)
{
	// initialize addresses/positions
	glcdStartLine(0);
	glcdSetAddress(0,0);
	// initialize local data structures
	GrLcdState.ctrlr[0].xAddr = GrLcdState.ctrlr[0].yAddr = 0;
	GrLcdState.ctrlr[1].xAddr = GrLcdState.ctrlr[1].yAddr = 0;
}
Example #7
0
void print_style_setting(uint8_t inverted) {
glcdSetAddress(43, 0);
  uint16_t i=0;
  uint8_t j=0;
  while((j!=displaystyle)&&(j!=0xFF))
  	  j=pgm_read_byte(&style_setting_str[i++]);
  if(j==0xFF)
  	  return;
  glcdPutStr_rom(&style_setting_str[i],inverted);
}
Example #8
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);
  }
}
Example #9
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;   
}
Example #10
0
void glcdHome(void)
{
	uint8_t i;
	// initialize addresses/positions
	glcdStartLine(0);
	glcdSetAddress(0,0);
	// initialize local data structures
	for(i=0; i<GLCD_NUM_CONTROLLERS; i++)
	{
		GrLcdState.ctrlr[i].xAddr = 0;
		GrLcdState.ctrlr[i].yAddr = 0;
	}
}
Example #11
0
static 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);
    printnumber(month, (mode == SET_MONTH)?INVERTED:NORMAL);
    glcdWriteChar('/', NORMAL);
    printnumber(day, (mode == SET_DAY)?INVERTED:NORMAL);
    glcdWriteChar('/', NORMAL);
  } else if (region == REGION_EU) {
  	glcdPutStr("     ",NORMAL);
    printnumber(day, (mode == SET_DAY)?INVERTED:NORMAL);
    glcdWriteChar('/', NORMAL);
    printnumber(month, (mode == SET_MONTH)?INVERTED:NORMAL);
    glcdWriteChar('/', NORMAL);
  } else if ( region == DOW_REGION_US) {
  	glcdWriteChar(' ', NORMAL);
  	print_dow(NORMAL,month,day,year);
  	printnumber(month, (mode == SET_MONTH)?INVERTED:NORMAL);
    glcdWriteChar('/', NORMAL);
    printnumber(day, (mode == SET_DAY)?INVERTED:NORMAL);
    glcdWriteChar('/', NORMAL);
  } else if ( region == DOW_REGION_EU) {
  	glcdWriteChar(' ', NORMAL);
  	print_dow(NORMAL,month,day,year);
  	printnumber(day, (mode == SET_DAY)?INVERTED:NORMAL);
    glcdWriteChar('/', NORMAL);
    printnumber(month, (mode == SET_MONTH)?INVERTED:NORMAL);
    glcdWriteChar('/', 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);
  }
  printnumber(20,(mode == SET_YEAR)?INVERTED:NORMAL);
  printnumber(year, (mode == SET_YEAR)?INVERTED:NORMAL);
}
Example #12
0
void glcdClearScreen(void)
{
	u08 pageAddr;
	u08 xAddr;

	// clear LCD
	// loop through all pages
	for(pageAddr=0; pageAddr<(GLCD_YPIXELS>>3); pageAddr++)
	{
		// set page address
		glcdSetAddress(0, pageAddr);
		// clear all lines of this page of display memory
		for(xAddr=0; xAddr<GLCD_XPIXELS; xAddr++)
		{
			glcdDataWrite(0x00);
		}
	}
}
Example #13
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));
    }
  }
}
Example #14
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--;
}
Example #15
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);	
		}   
	}
}
Example #16
0
void set_date(void) {
  uint8_t mode = SET_DATE;
  uint8_t day, month, year;
    
  day = date_d;
  month = date_m;
  year = date_y;

  display_menu();

  screenmutex++;
  // put a small arrow next to 'set date'
  drawArrow(0, 27, MENU_INDENT -1);
  screenmutex--;
  
  timeoutcounter = INACTIVITYTIMEOUT;  

  while (1) {
    if (just_pressed & 0x1) { // mode change
      return;
    }
    if (just_pressed || pressed) {
      timeoutcounter = INACTIVITYTIMEOUT;  
      // timeout w/no buttons pressed after 3 seconds?
    } else if (!timeoutcounter) {
      //timed out!
      displaymode = SHOW_TIME;     
      return;
    }
    if (just_pressed & 0x2) {
      just_pressed = 0;
      screenmutex++;

      if ((mode == SET_DATE) && ((region == REGION_US) || (region == DOW_REGION_US) || (region == DATELONG) || (region == DATELONG_DOW))) {
	DEBUG(putstring("Set date month"));
	// ok now its selected
	mode = SET_MONTH;

	// print the month inverted
	print_date(month,day,year,mode);
	// display instructions below
	glcdSetAddress(0, 6);
	glcdPutStr("Press + to change mon", NORMAL);
	glcdSetAddress(0, 7);
	glcdPutStr("Press SET to set mon.", NORMAL);
      } else if ((mode == SET_DATE) && ((region == REGION_EU) || (region == DOW_REGION_EU))) {
	DEBUG(putstring("Set date month"));
	// ok now its selected
	mode = SET_DAY;

	// print the day inverted
	print_date(month,day,year,mode);
	// display instructions below
	glcdSetAddress(0, 6);
	glcdPutStr("Press + to change day", NORMAL);
	glcdSetAddress(0, 7);
	glcdPutStr("Press SET to set date", NORMAL);
      } else if ((mode == SET_MONTH) && ((region == REGION_US) || (region == DOW_REGION_US) || (region == DATELONG) || (region == DATELONG_DOW))) {
	DEBUG(putstring("Set date day"));
	mode = SET_DAY;

	print_date(month,day,year,mode);
	// display instructions below
	glcdSetAddress(0, 6);
	glcdPutStr("Press + to change day", NORMAL);
	glcdSetAddress(0, 7);
	glcdPutStr("Press SET to set date", NORMAL);
      }else if ((mode == SET_DAY) && ((region == REGION_EU) || (region == DOW_REGION_EU))) {
	DEBUG(putstring("Set date month"));
	mode = SET_MONTH;

	print_date(month,day,year,mode);
	// display instructions below
	glcdSetAddress(0, 6);
	glcdPutStr("Press + to change mon", NORMAL);
	glcdSetAddress(0, 7);
	glcdPutStr("Press SET to set mon.", NORMAL);
      } else if ( ((mode == SET_DAY) && ((region == REGION_US) || (region == DOW_REGION_US) || (region == DATELONG) || (region == DATELONG_DOW))) ||
		  ((mode == SET_MONTH) && ((region == REGION_EU) || (region == DOW_REGION_EU))) )  {
	DEBUG(putstring("Set year"));
	mode = SET_YEAR;
	// print the date normal

	print_date(month,day,year,mode);
	// display instructions below
	glcdSetAddress(0, 6);
	glcdPutStr("Press + to change yr.", NORMAL);
	glcdSetAddress(0, 7);
	glcdPutStr("Press SET to set year", NORMAL);
      } else {
	// done!
	DEBUG(putstring("done setting date"));
	mode = SET_DATE;
	// print the seconds normal
	print_date(month,day,year,mode);
	// display instructions below
	glcdSetAddress(0, 6);
	glcdPutStr("Press MENU to advance", NORMAL);
	glcdSetAddress(0, 7);
	glcdPutStr("Press SET to set", NORMAL);
	
	date_y = year;
	date_m = month;
	date_d = day;
	writei2ctime(time_s, time_m, time_h, 0, date_d, date_m, date_y);
	init_crand();
      }
      screenmutex--;
    }
    if ((just_pressed & 0x4) || (pressed & 0x4)) {
      just_pressed = 0;

      screenmutex++;

      if (mode == SET_MONTH) {
	month++;
	if (month >= 13)
	  month = 1;
	if(month == 2) {
	  if(leapyear(year) && (day > 29))
	  	day = 29;
	  else if (!leapyear(year) && (day > 28))
	  	day = 28;
	} else if ((month == 4) || (month == 6) || (month == 9) || (month == 11)) {
      if(day > 30)
      	day = 30;
	}
	print_date(month,day,year,mode);
	
      }
      if (mode == SET_DAY) {
	day++;
	if (day > 31)
	  day = 1;
	if(month == 2) {
	  if(leapyear(year) && (day > 29))
	  	day = 1;
	  else if (!leapyear(year) && (day > 28))
	  	day = 1;
	} else if ((month == 4) || (month == 6) || (month == 9) || (month == 11)) {
      if(day > 30)
      	day = 1;
	}
	print_date(month,day,year,mode);
      }
      if (mode == SET_YEAR) {
	year = (year+1) % 100;
	print_date(month,day,year,mode);
      }
      screenmutex--;

      if (pressed & 0x4)
	_delay_ms(200);  
    }
  }

}
Example #17
0
void glcdGotoChar(u08 line, u08 col)
{
  glcdSetAddress(col*6, line);
}
Example #18
0
void glcdGotoChar(uint8_t line, uint8_t col)
{
	glcdSetAddress(col*6, line);
}
Example #19
0
void print_backlight(uint8_t mode)
{
  glcdSetAddress(MENU_INDENT, 5);
  glcdPutStr("Set Backlight: ", NORMAL);
  printnumber(OCR2B>>OCR2B_BITSHIFT,((mode==SET_BRT)?INVERTED:NORMAL));
}
Example #20
0
void print_region_setting(uint8_t inverted) {
  glcdSetAddress(MENU_INDENT, 4);
  glcdPutStr("Region: ", NORMAL);
  glcdPutStr_rom(&region_setting_table[(region * 2) + time_format][0], inverted);
}