Cosmetics
[opentx.git] / radio / src / gui / 480x272 / splash.cpp
blob54170957a36cd6db1719dcd084761eea54427f6c
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #include "opentx.h"
23 #if defined(SPLASH)
25 const uint8_t __bmp_splash[] __ALIGNED(4) {
26 #include "bmp_splash.lbm"
28 Bitmap BMP_SPLASH(BMP_RGB565, (const uint16_t *)__bmp_splash);
30 void drawSplash()
32 static bool loadImgFromSD = true;
33 static BitmapBuffer * splashImg = nullptr;
35 if (loadImgFromSD && splashImg == nullptr) {
36 bool sd_mounted = sdMounted();
37 if (!sd_mounted)
38 sdInit();
39 splashImg = BitmapBuffer::load(BITMAPS_PATH "/" SPLASH_FILE);
40 loadImgFromSD = false;
41 if (!sd_mounted)
42 sdDone();
45 lcd->clear();
47 if (splashImg) {
48 lcd->drawBitmap((LCD_W - splashImg->getWidth())/2,
49 (LCD_H - splashImg->getHeight())/2,
50 splashImg);
52 else {
53 lcd->drawBitmap((LCD_W - BMP_SPLASH.getWidth())/2,
54 (LCD_H - BMP_SPLASH.getHeight())/2,
55 &BMP_SPLASH);
58 lcdRefresh();
60 #endif