Beispiel #1
0
void drawMainMenu(uint8_t menuPosition){
	char *mainMenuStrings[MAIN_MENU_ITEMS] = {"Last swim", "New Swim"};
	uint8_t i, h;
	u8g_uint_t w, d;
	u8g_SetFont(&u8g, u8g_font_6x13);
	u8g_SetFontRefHeightText(&u8g);
	u8g_SetFontPosTop(&u8g);
	h = u8g_GetFontAscent(&u8g) - u8g_GetFontDescent(&u8g);
	w = u8g_GetWidth(&u8g);
	
	char vccChar[10];
	my_itoa(vcc, vccChar, 10);

	// Doing the actual drawing
	u8g_FirstPage(&u8g);
	do{
		
		for (i = 0; i < MAIN_MENU_ITEMS; i++){
			d = (w - u8g_GetStrWidth(&u8g, mainMenuStrings[i])) / 2;
			u8g_SetDefaultForegroundColor(&u8g);
			if (i == menuPosition){
				u8g_DrawBox(&u8g, 0, i*h+1, w, h);
				u8g_SetDefaultBackgroundColor(&u8g);
			}
			u8g_DrawStr(&u8g, d, i*h, mainMenuStrings[i]);
		}
		u8g_SetDefaultForegroundColor(&u8g);
		u8g_DrawFrame(&u8g, 0, 0, 128, 64);
		
		u8g_DrawStr(&u8g, 5, 50, vccChar);
	} while (u8g_NextPage(&u8g));
}
Beispiel #2
0
int main(void)
{
    sys_setup_keys();
    u8g_setup();

    menu_redraw_required = 1;
    for(;;)
    {

        sys_debounce_key();

        if (  menu_redraw_required != 0 )
        {
            u8g_FirstPage(&u8g);
            do
            {
                draw_menu();

            } while ( u8g_NextPage(&u8g) );
            menu_redraw_required = 0;
        }

        update_menu();
    }
}
Beispiel #3
0
int main(void)
{
  /* setup controller */
  sys_init();
	
  /* setup u8g and m2 libraries */
  setup();

  /* application main loop */
  for(;;)
  {  
    m2_CheckKey();
    if ( m2_HandleKey() ) 
    {
      /* picture loop */
      u8g_FirstPage(&u8g);
      do
      {
	draw();
        m2_CheckKey();
      } while( u8g_NextPage(&u8g) );
    }
    set_next_state();
  }  
}
Beispiel #4
0
void display_draw( bool sleep ) {

    // Turn on the busy LED:
    display_busy( true );

    // Blank the display if requested:
    if ( sleep ) {
        u8g_SleepOn( &u8g );
    }

    // Render the image:
    u8g_FirstPage( &u8g );
    do {
        // Stop if the draw function doesn't want to continue:
        if ( ! ui_draw( &u8g ) ) {
            break;
        }
    } while ( u8g_NextPage( &u8g ) );
    u8g_Delay( 100 );

    // Turn the display back on if blanking was requested:
    if ( sleep ) {
        u8g_SleepOff( &u8g );
    }

    // Turn off the busy LED:
    display_busy( false );
}
Beispiel #5
0
void showHistoryTotal(void){
	EEOpen();
	
	uint8_t lengths = EEReadByte(2);
	history.totalLength = lengths;
	history.showLength = 255;
	// This will be wrong till I update the record length
	uint16_t totalTime = EEReadByte(3) << 8;
	totalTime += EEReadByte(4);
	
	// Creating the times for the history display
	char lengthStr[4], totalTimeStr[10];	
	itoa(lengths, lengthStr, 10);
	timeToString(totalTime, totalTimeStr);
	
	u8g_FirstPage(&u8g);
	u8g_SetDefaultForegroundColor(&u8g);
	do {
		u8g_DrawFrame(&u8g, 0, 0, 128, 64);
		u8g_DrawLine(&u8g, 64, 0, 64, 64);
		
		u8g_DrawStr(&u8g, (64 - u8g_GetStrWidth(&u8g, "Lengths"))/2, 5, "Lengths");
		u8g_DrawStr(&u8g, (64 - u8g_GetStrWidth(&u8g, lengthStr))/2, 5+20, lengthStr);
		
		u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, "Time"))/2, 5, "Time");
		u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, totalTimeStr))/2, 5+20, totalTimeStr);
		
	} while (u8g_NextPage(&u8g));
}
Beispiel #6
0
// Showing the record screen
void showRecordScreen(void){
	char lengthStr[4], totLenTimeStr[9], curLenTimeStr[9];
	itoa(currentLength, lengthStr, 10);
	timeToString(totLenTime, totLenTimeStr);
	timeToString(curLenTime, curLenTimeStr);

	u8g_FirstPage(&u8g);
	u8g_SetDefaultForegroundColor(&u8g);
	u8g_SetFont(&u8g, u8g_font_6x13);
	do{
		// Draw boxes
		u8g_DrawLine(&u8g, 64, 0, 64, 64);
		u8g_DrawLine(&u8g, 64, 32, 128, 32);
		
		// Draw text
		u8g_DrawFrame(&u8g, 0, 0, 128, 64);
		u8g_DrawStr(&u8g, (64 - u8g_GetStrWidth(&u8g, "Length"))/2, 5, "Length");		
		u8g_DrawStr(&u8g, (64 - u8g_GetStrWidth(&u8g, lengthStr))/2, 32+5, lengthStr);
		
		u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, "Total"))/2, 5, "Total");
		u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, totLenTimeStr))/2, 5+15, totLenTimeStr);
		
		u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, "Last len"))/2, 5+32, "Last len");
		//u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, timeToString(lastLengthTime, rS)))/2, 5+32+15, timeToString(lastLengthTime, rS));

	} while (u8g_NextPage(&u8g));
}
Beispiel #7
0
int main(void)
{
  uint32_t x;

  if ( u8g_Init(&u8g, &u8g_dev_sdl_1bit) == 0 )
    return 0;
  
  st_Setup(&u8g);
  
  uiSetup();
  
  for(x = 0; x < 4000; x++)
  {    
    u8g_FirstPage(&u8g);
    do
    {
      st_Draw(0);
    } while( u8g_NextPage(&u8g) );
    SDL_Delay(10);
    uiStep();
    st_Step(shipLocation, isAutoFire, isFire);
    
  }  
  return 0;
}
Beispiel #8
0
int main(void)
{
  u8g_uint_t w,h;
  u8g_t u8g;
  
  u8g_Init(&u8g, &u8g_dev_stdout);
  u8g_FirstPage(&u8g);
  do
  {
    u8g_SetColorIndex(&u8g, 1);
    u8g_SetFont(&u8g, u8g_font_10x20);
    w = u8g_GetFontBBXWidth(&u8g);
    h = u8g_GetFontBBXHeight(&u8g);
    u8g_DrawStr(&u8g, 0, h, 0, "ABCgdef");
    //u8g_DrawStr(&u8g, 0, 5, 0, "g");
    //u8g_DrawStr(&u8g, 10, 7, 0, "g");
    //u8g_DrawStr(&u8g, 20, 9, 0, "g");
    //u8g_DrawFrame(&u8g, 2, 2, 9, 3);
    //u8g_DrawFrame(&u8g, 0, 0, 13, 7);
    //u8g_DrawHLine( &u8g, 0, 16, 50 );   
    
    u8g_SetColorIndex(&u8g, 0);
    
    //u8g_DrawHLine( &u8g, 0, 17, 50 );   
    
    
  }while( u8g_NextPage(&u8g) );
  return 0;
}
Beispiel #9
0
void screenshot100(void)
{
  static int cnt = 0;
  
  u8g_t screenshot_u8g;
  /* 1. Setup and create device access */
  u8g_Init(&screenshot_u8g, &u8g_dev_pbm);
  /* 2. Connect the u8g display to m2. Note: M2 is setup later */
  m2_SetU8g(&screenshot_u8g, m2_u8g_font_icon);

  u8g_FirstPage(&screenshot_u8g);
  do{
    m2_Draw();
  } while( u8g_NextPage(&screenshot_u8g) );

  m2_SetU8g(&u8g, m2_u8g_font_icon);

  {
    char cmd[256*4];
    sprintf(cmd, "convert u8g.pbm -trim -scale '200%%' %s.png", "u8g" );

    sprintf(cmd, "convert u8g.pbm -crop '128x64+0+704' -extent '130x66-1-1' -draw 'line 0 0 129 0' -draw 'line 0 65 129 65'  -scale '100%%' %s.png", "u8g" );
    sprintf(cmd, "convert u8g.pbm -extent '130x66-1-1' -draw 'line 0 0 3 0' -draw 'line 126 0 129 0' -draw 'line 0 65 3 65' -draw 'line 126 65 129 65'  -draw 'line 0 0 0 3' -draw 'line 129 0 129 3'  -draw 'line 0 62 0 65' -draw 'line 129 62 129 65' -scale '200%%' %s.png", "u8g" );

    sprintf(cmd, "convert u8g.pbm -extent '128x64-0-0' -fill yellow -opaque white  -scale '100%%' %s%03d.png", "u8g", cnt );
    
    system(cmd);
  }
  cnt++;
}
Beispiel #10
0
int main(void)
{
  u8g_uint_t w,h;
  u8g_t u8g;
  
  u8g_Init(&u8g, &u8g_dev_sdl_1bit);
  u8g_SetCursorFont(&u8g, u8g_font_cursor);
  u8g_SetCursorStyle(&u8g, 34);
  u8g_SetCursorColor(&u8g, 1, 0);
  u8g_EnableCursor(&u8g);
  
  for(;;)
  {
    
    u8g_FirstPage(&u8g);
    do
    {
      u8g_SetColorIndex(&u8g, 1);
      u8g_SetFont(&u8g, u8g_font_10x20);
      //u8g_SetFont(&u8g, u8g_font_fur17);
      w = u8g_GetFontBBXWidth(&u8g);
      h = u8g_GetFontBBXHeight(&u8g);
      //u8g_DrawStr(&u8g, 0, 2*h, 0, "ABCgdef");
      u8g_DrawStrDir(&u8g, 0, 5, 0, "g");
      u8g_DrawStrDir(&u8g, 10, 7, 0, "g");
      u8g_DrawStrDir(&u8g, 20, 9, 0, "g");
      u8g_DrawStrDir(&u8g, 20, 9, 0, "ga");

      //u8g_DrawStr(&u8g, 40, 9, 0, "g");
      u8g_DrawStr(&u8g, 70+3, 25, "gabc");
      u8g_DrawStr90(&u8g, 70, 25+3, "gabc");
      u8g_DrawStr180(&u8g, 70-3, 25, "gabc");
      u8g_DrawStr270(&u8g, 70, 25-3, "gabc");

      
      //u8g_DrawFrame(&u8g, 2, 2, 9, 3);
      //u8g_DrawFrame(&u8g, 0, 0, 13, 7);
      //u8g_DrawHLine( &u8g, 0, 16, 50 );   
      
      u8g_SetColorIndex(&u8g, 1);
      
      u8g_DrawHLine( &u8g, 0, 3, 127 );   
      
      u8g_SetColorIndex(&u8g, 0);
      u8g_DrawHLine( &u8g, 0, 4, 127 );   

    }while( u8g_NextPage(&u8g) );

    while( uiStep(&u8g) == 0 )
      ;
    printf("%d %d\n", cursor_x, cursor_y);
    u8g_SetCursorPos(&u8g, cursor_x, cursor_y);
  }
  
  
  return 0;
}
Beispiel #11
0
int main(int argc, const char *argv[])
{
  u8g_linux_Init(&u8g, argc, argv);
  u8g_FirstPage(&u8g);
  do
  {
    draw();
  } while ( u8g_NextPage(&u8g) );
}
Beispiel #12
0
void u8g_DrawLogo(void) //,,Verschönerung" zum Zeit ,,schinden" am Anfang für UM6
{
    u8g_FirstPage(&u8g);
    do
    {
        u8g_DrawXBMP(&u8g, 1, 0, 126, 46, logo);
        u8g_SetFont(&u8g, u8g_font_6x10); //Schriftart
        u8g_DrawStr(&u8g, 20, 	60, "Kalibriere UM6...");
    } while(u8g_NextPage(&u8g));
}
Beispiel #13
0
void Display::Draw()
{
	u8g_FirstPage(&u8g);
	do
	{
		if (activeScreen == 0)
			DrawMainScreen();
		else
			DrawSecondScreen();
	} while ( u8g_NextPage(&u8g) );
}
Beispiel #14
0
int main(void)
{

    uint8_t keyCode = CHESS_KEY_NONE;
    uint8_t is_redraw = 1;

    u8g_t u8g;

    u8g_Init(&u8g, &u8g_dev_sdl_2bit);
    u8g_FirstPage(&u8g);
    chess_Init(&u8g, 0);

#ifdef PERFTEST
    chess_Step(CHESS_KEY_SELECT);
    chess_Step(CHESS_KEY_NONE);
    chess_Step(CHESS_KEY_NEXT);
    chess_Step(CHESS_KEY_NONE);
    chess_Step(CHESS_KEY_NEXT);
    chess_Step(CHESS_KEY_NONE);
#endif

    for(;;)
    {


        if ( is_redraw != 0 )
        {
#ifdef PERFTEST
            int i;
            for( i = 0; i < 500; i++ )
            {
#endif
                u8g_FirstPage(&u8g);
                do {
                    chess_Draw();
                } while( u8g_NextPage(&u8g) );
#ifdef PERFTEST
            }
#endif
            is_redraw--;
        }
#ifdef PERFTEST
        exit(0);
#endif

        keyCode = get_key_code();
        if ( keyCode != CHESS_KEY_NONE )
        {
            is_redraw = 2;
            chess_Step(keyCode);
        }
        chess_Step(CHESS_KEY_NONE);
    }
}
Beispiel #15
0
// Lua: bool = u8g.nextPage( self )
static int lu8g_nextPage( lua_State *L )
{
    lu8g_userdata_t *lud;

    if ((lud = get_lud( L )) == NULL)
        return 0;

    lua_pushboolean( L, u8g_NextPage( LU8G ) );

    return 1;
}
Beispiel #16
0
int main(void)
{
    //RCC_ClocksTypeDef Clocks;
    uint8_t pos = 128+64;
     
    SystemInit();
    SystemCoreClockUpdate(); //update the system clock variable
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
    GPIO_Init(GPIOA, &GPIOA_InitStruct);
     
    timercounter = 0;
    //set systick to 1 every 1uS 
    SysTick_Config(SystemCoreClock/8);
    initUSART1();
    GPIO_SetBits(GPIOA, GPIO_Pin_10);
   
    //initialize the watchdog
    
    IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
    IWDG_SetPrescaler(0x00);
    //while(IWDG_GetFlagStatus(IWDG_FLAG_PVU)==SET);
    IWDG_SetReload(0xFFFF);
    //while(IWDG_GetFlagStatus(IWDG_FLAG_RVU)==SET);
    //IWDG_SetWindowValue(0x0000);
    //while(IWDG_GetFlagStatus(IWDG_FLAG_PVU)==SET);
    IWDG_ReloadCounter();
    IWDG_Enable();

    static BitAction toggle = Bit_SET;
    
    int i =0;
   
    //init the u8g library
    u8g_InitComFn(&u8g,  &u8g_dev_ssd1306_128x64_i2c, u8g_com_hw_i2c_fn);
    u8g_SetDefaultForegroundColor(&u8g);
           
    while(1){
        u8g_FirstPage(&u8g);
        do
        {
          IWDG_ReloadCounter();
          draw(pos);
        } while ( u8g_NextPage(&u8g) );
         
         /* refresh screen after some delay */
         ///* update position */
        if(pos < 128+128){  
            pos--;
        }else
        { pos = 128+128;
        }
    }
}
Beispiel #17
0
void showChargingScreen(void){
	char vccChar[10];
	my_itoa(vcc, vccChar, 10);
	
	u8g_FirstPage(&u8g);
	u8g_SetDefaultForegroundColor(&u8g);
	do {
		u8g_DrawFrame(&u8g, 0, 0, 128, 64);
		
		// Show the first length
		u8g_DrawStr(&u8g, (124 - u8g_GetStrWidth(&u8g, "Charging"))/2, 5, "Charging");
		u8g_DrawStr(&u8g, 60, 20, vccChar);
	} while (u8g_NextPage(&u8g));
}
Beispiel #18
0
int main(void)
{
  
  u8g_Init(&u8g, &u8g_dev_sdl_1bit);
  u8g_FirstPage(&u8g);
  
  do
  {
      draw();
  } while( u8g_NextPage(&u8g) );

  while( u8g_sdl_get_key() < 0 )
    ;
}
Beispiel #19
0
int main(void)
{
  u8g_uint_t w,h;
  u8g_uint_t r, g, b, x, y;
  u8g_t u8g;
  
  u8g_Init(&u8g, &u8g_dev_sdl_8bit);
  u8g_FirstPage(&u8g);
  do
  {
    u8g_SetFont(&u8g, u8g_font_10x20);
    u8g_SetFont(&u8g, u8g_font_fur25);

    /*
  for ( x = 0; x < 128; x++ )
    for ( y = 0; y < 64; y++ )
    {
      u8g_SetColorIndex(&u8g, ((x&3)+y*4) & 255);
      u8g_DrawPixel(&u8g, x, y);
    }
    */
  w = 4;
  h = 4;
  for( b = 0; b < 4; b++ )
    for( g = 0; g < 8; g++ )
      for( r = 0; r < 8; r++ )
      {
        u8g_SetColorIndex(&u8g, (r<<5) |  (g<<2) | b );
        u8g_DrawBox(&u8g, g*w + b*w*8, r*h, w, h);
        u8g_DrawBox(&u8g, g*w + b*w*8, r*h+32, w, h);
      }

    
    w = u8g_GetFontBBXWidth(&u8g);
    h = u8g_GetFontBBXHeight(&u8g);
    u8g_SetColorIndex(&u8g, 1);
    u8g_DrawStr(&u8g, 20, 40, "U8glib");
    u8g_SetColorIndex(&u8g, 2);
    u8g_DrawStr(&u8g, 20+1, 40+1, "U8glib");
    u8g_SetColorIndex(&u8g, 3);
    u8g_DrawStr(&u8g, 20+2, 40+2, "U8glib");
    
  }while( u8g_NextPage(&u8g) );
  
  while( u8g_sdl_get_key() < 0 )
    ;
  
  return 0;
}
Beispiel #20
0
int main(void)
{
  uint8_t i;
  sys_init();
  u8g_setup();

  for(;;)
  {  
    
    /* 
      why do we need two conversons???  seen notes above
    */
    
    for( i = 0; i < 100; i++ )
    {
      adc_val1 = sys_adc7();
      //adc_val1 = sys_adc7();
      adc_val2 = sys_diff_adc_2_3(1);
      //adc_val2 = sys_diff_adc_2_3(1);
      
      sign = 0;
      val = adc_val2;
      if ( val >= 512 )
      {
	sign = 1;
	val = 1024-val ;
      }
      
      sval = val;
      if ( sign != 0 )
	sval = -sval;
      
      if ( min > sval )
	min = sval;
      
      if ( max < sval )
	max = sval;
    }
    
    
    u8g_FirstPage(&u8g);
    do
    {
      draw();
    } while ( u8g_NextPage(&u8g) );
    u8g_Delay(10);
  }
  
}
Beispiel #21
0
ICACHE_FLASH_ATTR
static void drawingDrawScreen(void *args) {
    DrawingState *state = (DrawingState *) args;
    if (!state->invalid)
        return;

    u8g_FirstPage(&(state->u8g));
    do {
        if (state->upgrade) {
            draw_upgrade(state);
        } else {
            draw_normal(state);
        }
    } while (u8g_NextPage(&(state->u8g)));
}
Beispiel #22
0
int main(void)
{
  sys_init();
  u8g_setup();

  for(;;)
  {  
    u8g_FirstPage(&u8g);
    do
    {
      draw();
    } while ( u8g_NextPage(&u8g) );
    u8g_Delay(100);
  }
  
}
Beispiel #23
0
int xmain(void)
{
  u8g_uint_t w,h;
  u8g_t u8g;
  
  u8g_Init(&u8g, &u8g_dev_sdl_1bit);
  u8g_FirstPage(&u8g);
  u8g_SetCursorFont(&u8g, u8g_font_cursor);
  do
  {
    u8g_SetColorIndex(&u8g, 1);
    u8g_SetFont(&u8g, u8g_font_9x18);
    //u8g_SetFont(&u8g, u8g_font_fur17);
    w = u8g_GetFontBBXWidth(&u8g);
    h = u8g_GetFontBBXHeight(&u8g);
    //u8g_DrawStr(&u8g, 0, 2*h, 0, "ABCgdef");
    u8g_DrawStrDir(&u8g, 0, 5, 0, "g");
    u8g_DrawStrDir(&u8g, 10, 7, 0, "g");
    u8g_DrawStrDir(&u8g, 20, 9, 0, "g");
    u8g_DrawStrDir(&u8g, 20, 9, 0, "ga");

    //u8g_DrawStr(&u8g, 40, 9, 0, "g");
    u8g_DrawStr(&u8g, 70+3, 25, "gabc");
    u8g_DrawStr90(&u8g, 70, 25+3, "gabc");
    u8g_DrawStr180(&u8g, 70-3, 25, "gabc");
    u8g_DrawStr270(&u8g, 70, 25-3, "gabc");

    
    //u8g_DrawFrame(&u8g, 2, 2, 9, 3);
    //u8g_DrawFrame(&u8g, 0, 0, 13, 7);
    //u8g_DrawHLine( &u8g, 0, 16, 50 );   
    
    u8g_SetColorIndex(&u8g, 1);
    
    u8g_DrawHLine( &u8g, 0, 3, 127 );   
    
    u8g_SetColorIndex(&u8g, 0);
    u8g_DrawHLine( &u8g, 0, 4, 127 );   
    
    
  }while( u8g_NextPage(&u8g) );
  
  while( u8g_sdl_get_key() < 0 )
    ;
  
  return 0;
}
Beispiel #24
0
int main(void)
{
  
  u8g_t u8g;
  u8g_Init(&u8g, &u8g_dev_sdl_1bit);
  u8g_FirstPage(&u8g);
  
  do
  {
    u8g_SetFont(&u8g, u8g_font_unifont);
    //u8g_SetFont(&u8g, u8g_font_osb18r);
    
    u8g_DrawStr(&u8g, 0, 20, "Hello World!");
  } while( u8g_NextPage(&u8g) );

  while( u8g_sdl_get_key() < 0 )
    ;
}
Beispiel #25
0
int main(void)
{  
  /* this is the setup sequence, steps 1..4 should be in this order */
  
  /* 1. Setup and create device access */
  u8g_Init(&u8g, &u8g_dev_sdl_1bit);
  
  /* 2. Now, setup m2 */
  m2_Init(&top_el_tlsm, m2_es_sdl, m2_eh_6bs, m2_gh_u8g_bfs);
  //m2_Init(&top_el_tlsm, m2_es_sdl, m2_eh_6bs, m2_gh_tty);
  //m2_Init(&el_top_fs, m2_es_sdl, m2_eh_6bs, m2_gh_u8g_bfs);

  /* 3. Connect the u8g display to m2.  */
  m2_SetU8g(&u8g, m2_u8g_box_icon);

  /* 4. And finally, set at least one font, use normal u8g_font's */
  m2_SetFont(0, (const void *)u8g_font_7x13);
  m2_SetFont(2, (const void *)u8g_font_fub25);

  m2_SetU8gToggleFontIcon(u8g_font_7x13_75r, active_encoding, inactive_encoding);
  m2_SetU8gRadioFontIcon(u8g_font_7x13_75r, active_encoding, inactive_encoding);

  // m2_SetU8gAdditionalReadOnlyXBorder(0);  
  /* set the font for the multi selection */
  m2_SetFont(3, (const void *)u8g_font_m2icon_7);

  mas_Init(mas_device_sim, 0);

  for(;;)
  {
    m2_CheckKey();
    if ( m2_HandleKey() ) {
      u8g_FirstPage(&u8g);
      do{
        //u8g_SetFont(&u8g, u8g_font_unifont);
        //u8g_DrawStr(&u8g, 0, 20, "Hello World!");
        m2_CheckKey();
        m2_Draw();
      } while( u8g_NextPage(&u8g) );
    }
  }
  return 0;
}
Beispiel #26
0
int main(void)
{
  int i;
  u8g_Init(&u8g, &u8g_dev_pbm_8h2);
  
  u8g_SetRot90(&u8g);

  
  //for( i = 0; i < 10000; i++ )
  for( i = 0; i < 1; i++ )
  {
    u8g_FirstPage(&u8g);
    do
    {
      draw_clip_test();
    }while( u8g_NextPage(&u8g) );
    
    u8g_dev_pbm_h2_enable = 0;
  }
  return 0;
}
Beispiel #27
0
void showLength(void){
	uint8_t curTime = EEReadByte(5+history.showLength);
	
	char lengthStr[4], timeStr[9];
	itoa(history.showLength+1, lengthStr, 10);
	timeToString(curTime, timeStr);
	
	u8g_FirstPage(&u8g);
	u8g_SetDefaultForegroundColor(&u8g);
	do {
		u8g_DrawFrame(&u8g, 0, 0, 128, 64);
		u8g_DrawLine(&u8g, 64, 0, 64, 64);
		
		u8g_DrawStr(&u8g, (64 - u8g_GetStrWidth(&u8g, "Length"))/2, 5, "Length");
		u8g_DrawStr(&u8g, (64 - u8g_GetStrWidth(&u8g, lengthStr))/2, 5+20, lengthStr);
		
		u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, "Time"))/2, 5, "Time");
		u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, timeStr))/2, 5+20, timeStr);
		
	} while (u8g_NextPage(&u8g));
}
Beispiel #28
0
void switchOff(void){
	//u8g_SleepOn(&u8g);
	//u8g_SleepOn(&u8g);
	u8g_FirstPage(&u8g);
	do {		
	} while (u8g_NextPage(&u8g));
	
	EIMSK = (1 << INT1) | (1 << INT0);
	EICRA = (1 << ISC11) | (1 << ISC10) | (1 << ISC01) | (1 << ISC00);
	sei();
	
	set_sleep_mode(SLEEP_MODE_PWR_DOWN);
	sleep_enable();	
	sleep_mode();
	//_delay_ms(100);

	sleep_disable();
	EIMSK = 0x00;		// Detach interrupt after waken up.
	EICRA = 0x00;
	//u8g_SleepOff(&u8g);
	_delay_ms(500);
}
Beispiel #29
0
int main(void)
{
  u8g_t u8g;
  
  u8g_Init(&u8g, &u8g_dev_sdl_1bit_h);
  u8g_FirstPage(&u8g);
  do
  {
    u8g_SetColorIndex(&u8g, 1);
    u8g_DrawPixel(&u8g,0,0);
    u8g_DrawPixel(&u8g,0,1);
    u8g_SetFont(&u8g, u8g_font_unifont);
    //u8g_SetFont(&u8g, u8g_font_10x20);
    //u8g_SetFont(&u8g, u8g_font_gdb17);
    u8g_SetFontRefHeightText(&u8g);
    //u8g_SetRefHeightAll(&u8g);
    
    //u8g_SetFontPosBaseline(&u8g);
    //u8g_SetFontPosCenter(&u8g);
    
    u8g_SetFontPosTop(&u8g);
    glyph(&u8g, 5,25, 'g');

    u8g_SetFontPosCenter(&u8g);
    glyph(&u8g, 5+25,25, 'g');
    
    u8g_SetFontPosBaseline(&u8g);
    glyph(&u8g, 5+2*25,25, 'g');

    u8g_SetFontPosBottom(&u8g);
    glyph(&u8g, 5+3*25,25, 'g');
    
  }while( u8g_NextPage(&u8g) );
  
  while( u8g_sdl_get_key() < 0 )
    ;
  
  return 0;
}
Beispiel #30
0
int main(int argc, const char *argv[])
{
    u8g_linux_Init(&u8g, argc, argv);

    menu_redraw_required = 1;

    for(;;)
    {

        if (  menu_redraw_required != 0 )
        {
            u8g_FirstPage(&u8g);
            do
            {
                draw_menu();
            } while( u8g_NextPage(&u8g) );
            menu_redraw_required = 0;
        }

        update_menu();
    }

}