Barry Wardell | 536d2fe | 2008-05-05 12:12:55 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2008 by Barry Wardell |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame] | 12 | * 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 Wardell | 536d2fe | 2008-05-05 12:12:55 +0000 | [diff] [blame] | 16 | * |
| 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é | 5d236b2 | 2010-05-27 09:41:46 +0000 | [diff] [blame] | 26 | #include "version.h" |
Barry Wardell | 536d2fe | 2008-05-05 12:12:55 +0000 | [diff] [blame] | 27 | |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 28 | #include "bitmaps/rockboxlogo.h" |
Barry Wardell | 536d2fe | 2008-05-05 12:12:55 +0000 | [diff] [blame] | 29 | |
Dave Chapman | da8bff1 | 2008-10-12 16:46:01 +0000 | [diff] [blame] | 30 | #if LCD_WIDTH <= 128 |
Michael Sevakis | 95a4c3a | 2014-08-28 10:26:45 -0400 | [diff] [blame] | 31 | #define BOOT_VERFMT "Boot %s" |
Dave Chapman | da8bff1 | 2008-10-12 16:46:01 +0000 | [diff] [blame] | 32 | #else |
Michael Sevakis | 95a4c3a | 2014-08-28 10:26:45 -0400 | [diff] [blame] | 33 | #define BOOT_VERFMT "Boot Ver. %s" |
Dave Chapman | da8bff1 | 2008-10-12 16:46:01 +0000 | [diff] [blame] | 34 | #endif |
Barry Wardell | 536d2fe | 2008-05-05 12:12:55 +0000 | [diff] [blame] | 35 | |
Dave Chapman | 5134612 | 2008-10-12 22:35:03 +0000 | [diff] [blame] | 36 | /* Ensure TEXT_XPOS is >= 0 */ |
Michael Sevakis | 95a4c3a | 2014-08-28 10:26:45 -0400 | [diff] [blame] | 37 | #define TEXT_WIDTH(l) ((l)*SYSFONT_WIDTH) |
| 38 | #define TEXT_XPOS(w) (((w) > LCD_WIDTH) ? 0 : ((LCD_WIDTH - (w)) / 2)) |
Marcin Bukat | 69978d7 | 2012-03-07 09:27:31 +0100 | [diff] [blame] | 39 | #define LOGO_XPOS ((LCD_WIDTH - BMPWIDTH_rockboxlogo) / 2) |
Dave Chapman | 5134612 | 2008-10-12 22:35:03 +0000 | [diff] [blame] | 40 | |
Bertrik Sikken | 7e3a3f4 | 2011-09-08 18:31:15 +0000 | [diff] [blame] | 41 | void show_logo( void ) |
Dave Chapman | 5134612 | 2008-10-12 22:35:03 +0000 | [diff] [blame] | 42 | { |
Barry Wardell | 536d2fe | 2008-05-05 12:12:55 +0000 | [diff] [blame] | 43 | lcd_clear_display(); |
Barry Wardell | 536d2fe | 2008-05-05 12:12:55 +0000 | [diff] [blame] | 44 | lcd_setfont(FONT_SYSFIXED); |
Dave Chapman | 5134612 | 2008-10-12 22:35:03 +0000 | [diff] [blame] | 45 | |
Michael Sevakis | 95a4c3a | 2014-08-28 10:26:45 -0400 | [diff] [blame] | 46 | 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é | 12af292 | 2010-02-05 12:40:25 +0000 | [diff] [blame] | 51 | #if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS) |
Dave Chapman | 5134612 | 2008-10-12 22:35:03 +0000 | [diff] [blame] | 52 | /* 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 Sevakis | 95a4c3a | 2014-08-28 10:26:45 -0400 | [diff] [blame] | 54 | lcd_putsxy(text_xpos, 0, verstr); |
Marcin Bukat | 69978d7 | 2012-03-07 09:27:31 +0100 | [diff] [blame] | 55 | lcd_bmp(&bm_rockboxlogo, LOGO_XPOS, 16); |
Dave Chapman | 5134612 | 2008-10-12 22:35:03 +0000 | [diff] [blame] | 56 | #else |
Marcin Bukat | 69978d7 | 2012-03-07 09:27:31 +0100 | [diff] [blame] | 57 | lcd_bmp(&bm_rockboxlogo, LOGO_XPOS, 10); |
Michael Sevakis | 95a4c3a | 2014-08-28 10:26:45 -0400 | [diff] [blame] | 58 | lcd_putsxy(text_xpos, LCD_HEIGHT-SYSFONT_HEIGHT, verstr); |
Dave Chapman | 5134612 | 2008-10-12 22:35:03 +0000 | [diff] [blame] | 59 | #endif |
Barry Wardell | 536d2fe | 2008-05-05 12:12:55 +0000 | [diff] [blame] | 60 | |
| 61 | lcd_update(); |
Barry Wardell | 536d2fe | 2008-05-05 12:12:55 +0000 | [diff] [blame] | 62 | } |