Splash screen - Spirik/GEM GitHub Wiki

For AltSerialGraphicLCD version of library there are two consequent splash screens drawn on the display during initialization. The first one is being SparkFun logo (by default) which is drawn during glcd.reset() command. It is controlled by AltSerialGraphicLCD library and can be turned off or changed through GLCD object methods.

The second one is GEM logo with library version number and is drawn during menu.init() command. It can be customized through GEM object methods.

U8g2 and Adafruit GFX versions show only the latter splash screen.

GLCD splash

Displaying of AltSerialGraphicLCD splash can be customized in the following ways. Note that this setting is preserved in internal memory of SparkFun Graphic LCD Serial Backpack even after power off, so there is no need to call it every time the sketch runs.

Logo with information

This is default mode of AltSerialGraphicLCD splash. Run the following command with your glcd object before calling glcd.reset() prior initialization of the menu:

glcd.set(GLCD_ID_SPLASH, 1);


Just logo

Run the following command with your glcd object before calling glcd.reset() prior initialization of the menu:

glcd.set(GLCD_ID_SPLASH, 2);


Empty screen

Run the following command with your glcd object before calling glcd.reset() prior initialization of the menu:

glcd.set(GLCD_ID_SPLASH, 0);


Custom sprite

It is possible to overwrite default SparkFun logo with custom 32 byte sprite. Refer to the AltSerialGraphicLCD manual by Jon Green.

GEM splash

Displaying of GEM splash can be customized in the following ways.

Default splash

By default GEM splash features logo and library version number:


Hide version number

Version number can be turned off by calling the following command before menu.init():

menu.hideVersion();


Set splash screen delay (or disable splash screen)

By default splash screen is displayed for 1000ms. You can change this by calling menu.setSplashDelay() method and supplying it with required delay in ms. Maximum supported value is 65535ms. Setting to 0 will disable splash screen. Should be called before menu.init():

menu.setSplashDelay(0);

Custom splash (AltSerialGraphicLCD version)

It is possible to display custom sprite instead of GEM logo. The following is the format of the sprite as described in AltSerialGraphicLCD library documentation:

The sprite commences with two bytes which are the width and height of the image in pixels. The pixel data is organised as rows of 8 vertical pixels per byte where the least significant bit (LSB) is the top-left pixel and the most significant bit (MSB) tends towards the bottom-left pixel. A complete row of 8 vertical pixels across the image width comprises the first row, this is then followed by the next row of 8 vertical pixels and so on. Where the image height is not an exact multiple of 8 bits then any unused bits are typically set to zero (although this does not matter).

To define a custom sprite, create an array of bytes stored in flash (program) memory:

static const uint8_t customSprite [] PROGMEM = {
  15, 15,
  0,0,0,128,192,96,48,24,140,196,228,252,252,248,0,0,
  0,31,57,56,60,62,59,59,51,55,39,63,31,0,0,0
};

Then run the following command before menu.init():

menu.setSplash(customSprite);

This will result in custom sprite drawn in the center of the screen during initialization. Version number in the case of using custom sprite will be prepended with library name:

Version number can be hidden in this case as well:

menu.hideVersion();

Custom splash (U8g2 version)

It is possible to display custom image instead of GEM logo. The image should be presented in XBM format.

To define a custom XBM image, create an array of bytes stored in flash (program) memory (using an U8X8_PROGMEM alias from U8g2 library) and define two macro aliases for width and height of the image:

#define splash_width  12
#define splash_height 12
static const unsigned char splash_bits [] U8X8_PROGMEM = {
  0xc0,0xf7,0x60,0xfe,0x30,0xfe,0x18,0xff,0x8c,0xff,0xc6,0xff,
  0xe3,0xff,0xf1,0xff,0x19,0xff,0x7f,0xfc,0xff,0xfd,0xfe,0xf7
};

Then run the following command before menu.init():

menu.setSplash(splash_width, splash_height, splash_bits);

This will result in custom sprite drawn in the center of the screen during initialization. Version number in the case of using custom sprite will be prepended with library name:

Version number can be hidden in this case as well:

menu.hideVersion();

Custom splash (Adafruit GFX version)

For some controllers used with Adafruit GFX (for instance, not equipped with image buffer), it is possible to display custom image instead of GEM logo. The following is the format of the bitmap as described in Adafruit GFX library documentation:

A contiguous block of bits, where each 1 bit sets the corresponding pixel to 'color', while each 0 bit is skipped.

Bitmap must be presented as a byte array and located in program memory using the PROGMEM directive, width and height of the bitmap must be supplied as a first and second argument to the function respectively. Should be called before GEM_adafruit_gfx::init(). See Bitmaps section of Adafruit GFX documentation for more details and image2cpp webtool for online bitmap conversion.

To define a custom bitmap image, create an array of bytes stored in flash (program) memory and define two macro aliases for width and height of the image:

#define splash_width  12
#define splash_height 12
static const unsigned char splash_bits [] PROGMEM = {
  0x03, 0xe0, 0x06, 0x70, 0x0c, 0x70, 0x18, 0xf0, 0x31, 0xf0, 0x63, 0xf0, 0xc7, 0xf0, 0x8f, 0xf0, 
	0x98, 0xf0, 0xfe, 0x30, 0xff, 0xb0, 0x7f, 0xe0
};

Then run the following command before menu.init():

menu.setSplash(splash_width, splash_height, splash_bits);

This will result in custom sprite drawn in the center of the screen during initialization. Version number in the case of using custom sprite will be prepended with library name:

Version number can be hidden in this case as well:

menu.hideVersion();