summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/as3525/sansa-clip/backlight-clip.c58
-rw-r--r--firmware/target/arm/as3525/sansa-clip/backlight-target.h16
-rw-r--r--firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c19
3 files changed, 88 insertions, 5 deletions
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
32void _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
46void _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
24static 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
29static inline void _backlight_on(void) 30static inline void _backlight_on(void)
30{ 31{
32 lcd_enable(true);
31} 33}
32 34
33static inline void _backlight_off(void) 35static inline void _backlight_off(void)
34{ 36{
37 lcd_enable(false);
35} 38}
36 39
40void _buttonlight_on(void);
41void _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
150void lcd_enable(bool enable) 150void 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)
240void lcd_blit_mono(const unsigned char *data, int x, int by, int width, 243void 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,
258void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases, 264void 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;