diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 1 | ||||
-rw-r--r-- | firmware/export/config-clip.h | 13 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clip/backlight-clip.c | 58 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clip/backlight-target.h | 16 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c | 19 |
5 files changed, 97 insertions, 10 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index b17bb0c115..36ee9e4cb4 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -1045,6 +1045,7 @@ target/arm/pcm-telechips.c | |||
1045 | #ifndef SIMULATOR | 1045 | #ifndef SIMULATOR |
1046 | target/arm/as3525/sansa-clip/lcd-ssd1303.c | 1046 | target/arm/as3525/sansa-clip/lcd-ssd1303.c |
1047 | target/arm/as3525/sansa-clip/button-clip.c | 1047 | target/arm/as3525/sansa-clip/button-clip.c |
1048 | target/arm/as3525/sansa-clip/backlight-clip.c | ||
1048 | target/arm/as3525/as3525-codec.c | 1049 | target/arm/as3525/as3525-codec.c |
1049 | #endif /* !SIMULATOR */ | 1050 | #endif /* !SIMULATOR */ |
1050 | #endif /* SANSA_CLIP */ | 1051 | #endif /* SANSA_CLIP */ |
diff --git a/firmware/export/config-clip.h b/firmware/export/config-clip.h index 591ec1012a..95a708efef 100644 --- a/firmware/export/config-clip.h +++ b/firmware/export/config-clip.h | |||
@@ -29,7 +29,7 @@ | |||
29 | #define HAVE_LCD_BITMAP | 29 | #define HAVE_LCD_BITMAP |
30 | 30 | ||
31 | /* define this if you have a light associated with the buttons */ | 31 | /* define this if you have a light associated with the buttons */ |
32 | //#define HAVE_BUTTON_LIGHT | 32 | #define HAVE_BUTTON_LIGHT |
33 | 33 | ||
34 | /* define this if you have access to the quickscreen */ | 34 | /* define this if you have access to the quickscreen */ |
35 | //#define HAVE_QUICKSCREEN | 35 | //#define HAVE_QUICKSCREEN |
@@ -47,12 +47,11 @@ | |||
47 | #define LCD_PIXELFORMAT VERTICAL_PACKING | 47 | #define LCD_PIXELFORMAT VERTICAL_PACKING |
48 | 48 | ||
49 | /* define this if you have LCD enable function */ | 49 | /* define this if you have LCD enable function */ |
50 | //#define HAVE_LCD_ENABLE | 50 | #define HAVE_LCD_ENABLE |
51 | 51 | ||
52 | #ifndef BOOTLOADER | 52 | #ifndef BOOTLOADER |
53 | 53 | /* Define this if your LCD can be put to sleep. | |
54 | /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE | 54 | * HAVE_LCD_ENABLE should be defined as well. */ |
55 | should be defined as well. */ | ||
56 | //#define HAVE_LCD_SLEEP | 55 | //#define HAVE_LCD_SLEEP |
57 | //#define HAVE_LCD_SLEEP_SETTING | 56 | //#define HAVE_LCD_SLEEP_SETTING |
58 | #endif | 57 | #endif |
@@ -91,6 +90,10 @@ | |||
91 | //#define CONFIG_TUNER LV24020LP | 90 | //#define CONFIG_TUNER LV24020LP |
92 | //#define HAVE_TUNER_PWR_CTRL | 91 | //#define HAVE_TUNER_PWR_CTRL |
93 | 92 | ||
93 | /* Define this for LCD backlight available */ | ||
94 | #define HAVE_BACKLIGHT | ||
95 | //#define HAVE_BACKLIGHT_BRIGHTNESS /* TODO */ | ||
96 | |||
94 | /* define this if you have a flash memory storage */ | 97 | /* define this if you have a flash memory storage */ |
95 | #define HAVE_FLASH_STORAGE | 98 | #define HAVE_FLASH_STORAGE |
96 | 99 | ||
diff --git a/firmware/target/arm/as3525/sansa-clip/backlight-clip.c b/firmware/target/arm/as3525/sansa-clip/backlight-clip.c new file mode 100644 index 0000000000..2064f0992f --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clip/backlight-clip.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright © 2008 Rafaël Carré | ||
11 | * | ||
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. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "backlight-target.h" | ||
23 | #include "as3525.h" | ||
24 | |||
25 | /* TODO : backlight brightness */ | ||
26 | |||
27 | /* XXX : xpd is used for SD/MCI interface | ||
28 | * If interrupts are used to access this interface, they should be | ||
29 | * disabled in _buttonlight_on/off () | ||
30 | */ | ||
31 | |||
32 | void _buttonlight_on(void) | ||
33 | { | ||
34 | int saved_ccu_io; | ||
35 | |||
36 | saved_ccu_io = CCU_IO; /* save XPD setting */ | ||
37 | |||
38 | CCU_IO &= ~(3<<2); /* setup xpd as GPIO */ | ||
39 | |||
40 | GPIOD_DIR |= (1<<7); | ||
41 | GPIOD_PIN(7) = (1<<7); /* set pin d7 high */ | ||
42 | |||
43 | CCU_IO = saved_ccu_io; /* restore the previous XPD setting */ | ||
44 | } | ||
45 | |||
46 | void _buttonlight_off(void) | ||
47 | { | ||
48 | int saved_ccu_io; | ||
49 | |||
50 | saved_ccu_io = CCU_IO; /* save XPD setting */ | ||
51 | |||
52 | CCU_IO &= ~(3<<2); /* setup xpd as GPIO */ | ||
53 | |||
54 | GPIOD_DIR |= (1<<7); | ||
55 | GPIOD_PIN(7) = 0; /* set pin d7 low */ | ||
56 | |||
57 | CCU_IO = saved_ccu_io; /* restore the previous XPD setting */ | ||
58 | } | ||
diff --git a/firmware/target/arm/as3525/sansa-clip/backlight-target.h b/firmware/target/arm/as3525/sansa-clip/backlight-target.h index 9533d0a6b5..5a6ae34728 100644 --- a/firmware/target/arm/as3525/sansa-clip/backlight-target.h +++ b/firmware/target/arm/as3525/sansa-clip/backlight-target.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2008 ?? | 10 | * Copyright © 2008 Rafaël Carré |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 13 | * modify it under the terms of the GNU General Public License |
@@ -21,17 +21,23 @@ | |||
21 | #ifndef BACKLIGHT_TARGET_H | 21 | #ifndef BACKLIGHT_TARGET_H |
22 | #define BACKLIGHT_TARGET_H | 22 | #define BACKLIGHT_TARGET_H |
23 | 23 | ||
24 | static inline bool _backlight_init(void) | 24 | #include "stdbool.h" |
25 | { | 25 | #include "lcd.h" |
26 | return true; | 26 | #include "backlight.h" |
27 | } | 27 | |
28 | #define _backlight_init() true | ||
28 | 29 | ||
29 | static inline void _backlight_on(void) | 30 | static inline void _backlight_on(void) |
30 | { | 31 | { |
32 | lcd_enable(true); | ||
31 | } | 33 | } |
32 | 34 | ||
33 | static inline void _backlight_off(void) | 35 | static inline void _backlight_off(void) |
34 | { | 36 | { |
37 | lcd_enable(false); | ||
35 | } | 38 | } |
36 | 39 | ||
40 | void _buttonlight_on(void); | ||
41 | void _buttonlight_off(void); | ||
42 | |||
37 | #endif | 43 | #endif |
diff --git a/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c b/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c index ed4bcc7be9..a794589647 100644 --- a/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c +++ b/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c | |||
@@ -149,6 +149,9 @@ void lcd_set_flip(bool yesno) | |||
149 | 149 | ||
150 | void lcd_enable(bool enable) | 150 | void lcd_enable(bool enable) |
151 | { | 151 | { |
152 | if(display_on == enable) | ||
153 | return; | ||
154 | |||
152 | if( (display_on = enable) ) /* simple '=' is not a typo ! */ | 155 | if( (display_on = enable) ) /* simple '=' is not a typo ! */ |
153 | lcd_write_command(LCD_SET_DISPLAY_ON); | 156 | lcd_write_command(LCD_SET_DISPLAY_ON); |
154 | else | 157 | else |
@@ -240,6 +243,9 @@ void lcd_init_device(void) | |||
240 | void lcd_blit_mono(const unsigned char *data, int x, int by, int width, | 243 | void lcd_blit_mono(const unsigned char *data, int x, int by, int width, |
241 | int bheight, int stride) | 244 | int bheight, int stride) |
242 | { | 245 | { |
246 | if(!display_on) | ||
247 | return; | ||
248 | |||
243 | /* Copy display bitmap to hardware */ | 249 | /* Copy display bitmap to hardware */ |
244 | while (bheight--) | 250 | while (bheight--) |
245 | { | 251 | { |
@@ -258,6 +264,13 @@ void lcd_blit_mono(const unsigned char *data, int x, int by, int width, | |||
258 | void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases, | 264 | void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases, |
259 | int x, int by, int width, int bheight, int stride) | 265 | int x, int by, int width, int bheight, int stride) |
260 | { | 266 | { |
267 | /* TODO */ | ||
268 | |||
269 | #if 0 | ||
270 | if(!display_on) | ||
271 | return; | ||
272 | #endif | ||
273 | |||
261 | (void)values; | 274 | (void)values; |
262 | (void)phases; | 275 | (void)phases; |
263 | (void)x; | 276 | (void)x; |
@@ -274,6 +287,9 @@ void lcd_update(void) | |||
274 | { | 287 | { |
275 | int y; | 288 | int y; |
276 | 289 | ||
290 | if(!display_on) | ||
291 | return; | ||
292 | |||
277 | /* Copy display bitmap to hardware */ | 293 | /* Copy display bitmap to hardware */ |
278 | for (y = 0; y < LCD_FBHEIGHT; y++) | 294 | for (y = 0; y < LCD_FBHEIGHT; y++) |
279 | { | 295 | { |
@@ -291,6 +307,9 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
291 | { | 307 | { |
292 | int ymax; | 308 | int ymax; |
293 | 309 | ||
310 | if(!display_on) | ||
311 | return; | ||
312 | |||
294 | /* The Y coordinates have to work on even 8 pixel rows */ | 313 | /* The Y coordinates have to work on even 8 pixel rows */ |
295 | ymax = (y + height-1) >> 3; | 314 | ymax = (y + height-1) >> 3; |
296 | y >>= 3; | 315 | y >>= 3; |