void draw(void) { if ( u8g_GetMode(&u8g) == U8G_MODE_HICOLOR || u8g_GetMode(&u8g) == U8G_MODE_R3G3B2) { COLOR_BOX(); } if ( u8g_GetMode(&u8g) == U8G_MODE_HICOLOR || u8g_GetMode(&u8g) == U8G_MODE_R3G3B2) { u8g_SetRGB(&u8g, 0x080, 0x040, 0); draw_logo(2); u8g_SetRGB(&u8g, 0x080, 0x080, 0); draw_logo(1); u8g_SetRGB(&u8g, 0x0ff, 0x0ff, 0); } else { u8g_SetColorIndex(&u8g, 1); if ( U8G_MODE_GET_BITS_PER_PIXEL(u8g_GetMode(&u8g)) > 1 ) { draw_logo(2); u8g_SetColorIndex(&u8g, 2); draw_logo(1); u8g_SetColorIndex(&u8g, 3); } } draw_logo(0); draw_url(); }
uint8_t u8g_GetDefaultMidColor(u8g_t *u8g) { uint8_t mode; mode = u8g_GetMode(u8g); if ( mode == U8G_MODE_R3G3B2 ) return 0x06d; /* gray: 01101101 */ else if ( u8g_GetMode(u8g) == U8G_MODE_GRAY2BIT ) return 1; /* low mid intensity */ else /* if ( u8g.getMode() == U8G_MODE_BW ) */ return 1; /* pixel on */ return 1; /* default */ }
uint8_t u8g_GetDefaultForegroundColor(u8g_t *u8g) { uint8_t mode; mode = u8g_GetMode(u8g); if ( mode == U8G_MODE_R3G3B2 ) return 255; /* white */ else if ( u8g_GetMode(u8g) == U8G_MODE_GRAY2BIT ) return 3; /* max intensity */ else /* if ( u8g.getMode() == U8G_MODE_BW ) */ return 1; /* pixel on */ return 1; }
// Lua: int = u8g.getMode( self ) static int lu8g_getMode( lua_State *L ) { lu8g_userdata_t *lud; if ((lud = get_lud( L )) == NULL) return 0; lua_pushinteger( L, u8g_GetMode( LU8G ) ); return 1; }