summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2011-09-02 19:57:29 +0000
committerBertrik Sikken <bertrik@sikken.nl>2011-09-02 19:57:29 +0000
commit5b7a150807f7a709c335d3cc25d1f0cfc678cb46 (patch)
tree1a4404d2601f829d29f926ba5e486a4eee893645
parent194bc59478751a951bd23eb55bf9cae467211be4 (diff)
downloadrockbox-5b7a150807f7a709c335d3cc25d1f0cfc678cb46.zip
rockbox-5b7a150807f7a709c335d3cc25d1f0cfc678cb46.tar.gz
rockbox-5b7a150807f7a709c335d3cc25d1f0cfc678cb46.tar.bz2
rockbox-5b7a150807f7a709c335d3cc25d1f0cfc678cb46.tar.xz
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
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c19
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/lcd-target.h27
2 files changed, 45 insertions, 1 deletions
diff --git a/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c b/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c
index 49241c1..c3f81fb 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 0000000..137e973
--- /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 <stdint.h>
+#include "config.h"
+
+/* target-specific OLED brightness function */
+void lcd_brightness(uint8_t red, uint8_t green, uint8_t blue);
+