blob: 6584e3f24de682ea1f003e56f0b16d8bcb686478 [file] [log] [blame]
Barry Wardell536d2fe2008-05-05 12:12:55 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Barry Wardell
11 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
Barry Wardell536d2fe2008-05-05 12:12:55 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "lcd.h"
22#include "lcd-remote.h"
23#include "font.h"
24#include <stdio.h>
25#include <string.h>
Rafaël Carré5d236b22010-05-27 09:41:46 +000026#include "version.h"
Barry Wardell536d2fe2008-05-05 12:12:55 +000027
Björn Stenbergc6b3d382008-11-20 11:27:31 +000028#include "bitmaps/rockboxlogo.h"
Barry Wardell536d2fe2008-05-05 12:12:55 +000029
Dave Chapmanda8bff12008-10-12 16:46:01 +000030#if LCD_WIDTH <= 128
Michael Sevakis95a4c3a2014-08-28 10:26:45 -040031#define BOOT_VERFMT "Boot %s"
Dave Chapmanda8bff12008-10-12 16:46:01 +000032#else
Michael Sevakis95a4c3a2014-08-28 10:26:45 -040033#define BOOT_VERFMT "Boot Ver. %s"
Dave Chapmanda8bff12008-10-12 16:46:01 +000034#endif
Barry Wardell536d2fe2008-05-05 12:12:55 +000035
Dave Chapman51346122008-10-12 22:35:03 +000036/* Ensure TEXT_XPOS is >= 0 */
Michael Sevakis95a4c3a2014-08-28 10:26:45 -040037#define TEXT_WIDTH(l) ((l)*SYSFONT_WIDTH)
38#define TEXT_XPOS(w) (((w) > LCD_WIDTH) ? 0 : ((LCD_WIDTH - (w)) / 2))
Marcin Bukat69978d72012-03-07 09:27:31 +010039#define LOGO_XPOS ((LCD_WIDTH - BMPWIDTH_rockboxlogo) / 2)
Dave Chapman51346122008-10-12 22:35:03 +000040
Bertrik Sikken7e3a3f42011-09-08 18:31:15 +000041void show_logo( void )
Dave Chapman51346122008-10-12 22:35:03 +000042{
Barry Wardell536d2fe2008-05-05 12:12:55 +000043 lcd_clear_display();
Barry Wardell536d2fe2008-05-05 12:12:55 +000044 lcd_setfont(FONT_SYSFIXED);
Dave Chapman51346122008-10-12 22:35:03 +000045
Michael Sevakis95a4c3a2014-08-28 10:26:45 -040046 char verstr[strlen(rbversion) + sizeof (BOOT_VERFMT)];
47 int len = snprintf(verstr, sizeof(verstr), BOOT_VERFMT, rbversion);
48 int text_width = TEXT_WIDTH(len);
49 int text_xpos = TEXT_XPOS(text_width);
50
Rafaël Carré12af2922010-02-05 12:40:25 +000051#if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS)
Dave Chapman51346122008-10-12 22:35:03 +000052 /* The top 16 lines of the Sansa Clip screen are yellow, and the bottom 48
53 are blue, so we reverse the usual positioning */
Michael Sevakis95a4c3a2014-08-28 10:26:45 -040054 lcd_putsxy(text_xpos, 0, verstr);
Marcin Bukat69978d72012-03-07 09:27:31 +010055 lcd_bmp(&bm_rockboxlogo, LOGO_XPOS, 16);
Dave Chapman51346122008-10-12 22:35:03 +000056#else
Marcin Bukat69978d72012-03-07 09:27:31 +010057 lcd_bmp(&bm_rockboxlogo, LOGO_XPOS, 10);
Michael Sevakis95a4c3a2014-08-28 10:26:45 -040058 lcd_putsxy(text_xpos, LCD_HEIGHT-SYSFONT_HEIGHT, verstr);
Dave Chapman51346122008-10-12 22:35:03 +000059#endif
Barry Wardell536d2fe2008-05-05 12:12:55 +000060
61 lcd_update();
Barry Wardell536d2fe2008-05-05 12:12:55 +000062}