From 5b7a150807f7a709c335d3cc25d1f0cfc678cb46 Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Fri, 2 Sep 2011 19:57:29 +0000 Subject: [PATCH] sansa clipzip: add lcd_brightness function (to be used later to set the 'backlight' brightness) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30410 a1c6a512-1295-4272-9138-f99709370657 --- .../arm/as3525/sansa-clipzip/lcd-clipzip.c | 19 ++++++++++++- .../arm/as3525/sansa-clipzip/lcd-target.h | 27 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 firmware/target/arm/as3525/sansa-clipzip/lcd-target.h diff --git a/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c b/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c index 49241c10d2..c3f81fb989 100644 --- a/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c +++ b/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c @@ -22,6 +22,7 @@ #include "config.h" #include "lcd.h" +#include "lcd-target.h" #include "system.h" #include "cpu.h" @@ -154,7 +155,7 @@ static void lcd_init_type0(void) /* writes a table entry (for type 1 LCDs) */ static void lcd_write_table(uint8_t val) { - lcd_write_dat((val >> 4) & 0x07); + lcd_write_dat((val >> 4) & 0x0F); lcd_write_dat((val >> 0) & 0x0F); } @@ -354,6 +355,22 @@ static void lcd_setup_rect(int x, int x_end, int y, int y_end) } } +/* sets the brightness of the OLED */ +void lcd_brightness(uint8_t red, uint8_t green, uint8_t blue) +{ + if (lcd_type == 0) { + lcd_write(0x40, red); + lcd_write(0x41, green); + lcd_write(0x42, blue); + } + else { + lcd_write_cmd(0x0E); + lcd_write_table(red); + lcd_write_table(green); + lcd_write_table(blue); + } +} + /* Updates a fraction of the display. */ void lcd_update_rect(int x, int y, int width, int height) { diff --git a/firmware/target/arm/as3525/sansa-clipzip/lcd-target.h b/firmware/target/arm/as3525/sansa-clipzip/lcd-target.h new file mode 100644 index 0000000000..137e9731dd --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clipzip/lcd-target.h @@ -0,0 +1,27 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2011 Bertrik Sikken + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include +#include "config.h" + +/* target-specific OLED brightness function */ +void lcd_brightness(uint8_t red, uint8_t green, uint8_t blue); +