summaryrefslogtreecommitdiff
path: root/firmware/export/scroll_engine.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export/scroll_engine.h')
-rw-r--r--firmware/export/scroll_engine.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/firmware/export/scroll_engine.h b/firmware/export/scroll_engine.h
new file mode 100644
index 0000000000..aa11a9ba1f
--- /dev/null
+++ b/firmware/export/scroll_engine.h
@@ -0,0 +1,92 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Michael Sevakis
11 *
12 * LCD scrolling driver and scheduler
13 *
14 * Much collected and combined from the various Rockbox LCD drivers.
15 *
16 * All files in this archive are subject to the GNU General Public License.
17 * See the file COPYING in the source tree root for full license agreement.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23#ifndef __SCROLL_ENGINE_H__
24#define __SCROLL_ENGINE_H__
25
26void scroll_init(void);
27void lcd_scroll_fn(void);
28void lcd_remote_scroll_fn(void);
29
30/* internal usage, but in multiple drivers */
31#define SCROLL_SPACING 3
32#ifdef HAVE_LCD_BITMAP
33#define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH/2 + 2)
34#else
35#define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH + 2)
36#endif
37
38struct scrollinfo
39{
40 char line[SCROLL_LINE_SIZE];
41 int len; /* length of line in chars */
42 int offset;
43 int startx;
44#ifdef HAVE_LCD_BITMAP
45 int width; /* length of line in pixels */
46 bool invert; /* invert the scrolled text */
47#endif
48 bool backward; /* scroll presently forward or backward? */
49 bool bidir;
50 long start_tick;
51#ifdef HAVE_LCD_COLOR
52 int line_color;
53#endif
54};
55
56struct scroll_screen_info
57{
58 struct scrollinfo * const scroll;
59 const int num_scroll; /* number of scrollable lines (also number of scroll structs) */
60 int lines; /* Bitpattern of which lines are scrolling */
61 long ticks; /* # of ticks between updates*/
62 long delay; /* ticks delay before start */
63 int bidir_limit; /* percent */
64#ifdef HAVE_LCD_CHARCELLS
65 long jump_scroll_delay; /* delay between jump scroll jumps */
66 int jump_scroll; /* 0=off, 1=once, ..., JUMP_SCROLL_ALWAYS */
67#endif
68#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
69 int step; /* pixels per scroll step */
70#endif
71#if defined(HAVE_REMOTE_LCD)
72 long last_scroll;
73#endif
74};
75
76/** main lcd **/
77#ifdef HAVE_LCD_BITMAP
78#define LCD_SCROLLABLE_LINES ((LCD_HEIGHT+4)/5 < 32 ? (LCD_HEIGHT+4)/5 : 32)
79#else
80#define LCD_SCROLLABLE_LINES LCD_HEIGHT
81#endif
82
83extern struct scroll_screen_info lcd_scroll_info;
84
85/** remote lcd **/
86#ifdef HAVE_REMOTE_LCD
87#define LCD_REMOTE_SCROLLABLE_LINES \
88 (((LCD_REMOTE_HEIGHT+4)/5 < 32) ? (LCD_REMOTE_HEIGHT+4)/5 : 32)
89extern struct scroll_screen_info lcd_remote_scroll_info;
90#endif
91
92#endif /* __SCROLL_ENGINE_H__ */