summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2011-09-01 16:59:30 +0000
committerBertrik Sikken <bertrik@sikken.nl>2011-09-01 16:59:30 +0000
commit6a9aac7a5fd6dab96f8599be5f32ae4c1ddb3df6 (patch)
tree7deb418ea3efe07cc87b933c3e555b09ab845047 /firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c
parentd87f9fc90902722ad568649d9291ef2e299c1837 (diff)
downloadrockbox-6a9aac7a5fd6dab96f8599be5f32ae4c1ddb3df6.tar.gz
rockbox-6a9aac7a5fd6dab96f8599be5f32ae4c1ddb3df6.tar.bz2
rockbox-6a9aac7a5fd6dab96f8599be5f32ae4c1ddb3df6.zip
sansa clipzip: implement lcd_enable
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30407 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c')
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c b/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c
index 47d896a2f3..c828bab61c 100644
--- a/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c
+++ b/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c
@@ -29,6 +29,11 @@
/* the detected lcd type (0 or 1) */
static int lcd_type;
+#ifdef HAVE_LCD_ENABLE
+/* whether the lcd is currently enabled or not */
+static bool lcd_enabled;
+#endif
+
/* initialises the host lcd hardware, returns the lcd type */
int lcd_hw_init(void)
{
@@ -262,6 +267,57 @@ static void lcd_init_type1(void)
lcd_write_dat(0x00);
}
+#ifdef HAVE_LCD_ENABLE
+/* enables/disables the lcd */
+void lcd_enable(bool on)
+{
+ lcd_enabled = on;
+
+ if (lcd_type == 0) {
+ if (on) {
+ lcd_write(0x14, 0x00);
+ lcd_write(0x02, 0x01);
+ lcd_write(0xD2, 0x04);
+ lcd_write(0xD0, 0x80);
+ sleep(HZ * 100/1000);
+
+ lcd_write(0xD0, 0x00);
+ }
+ else {
+ lcd_write(0xD2, 0x05);
+ lcd_write(0xD0, 0x80);
+ sleep(HZ * 100/1000);
+
+ lcd_write(0x02, 0x00);
+ lcd_write(0xD0, 0x00);
+ lcd_write(0x14, 0x01);
+ }
+ }
+ else {
+ if (on) {
+ lcd_write_cmd(0x03);
+ lcd_write_dat(0x00);
+
+ lcd_write_cmd(0x02);
+ lcd_write_dat(0x01);
+ }
+ else {
+ lcd_write_cmd(0x02);
+ lcd_write_dat(0x00);
+
+ lcd_write_cmd(0x03);
+ lcd_write_dat(0x01);
+ }
+ }
+}
+
+/* returns true if the lcd is enabled */
+bool lcd_active(void)
+{
+ return lcd_enabled;
+}
+#endif /* HAVE_LCD_ENABLE */
+
/* initialises the lcd */
void lcd_init_device(void)
{
@@ -272,6 +328,7 @@ void lcd_init_device(void)
else {
lcd_init_type1();
}
+ lcd_enable(true);
}
/* sets up the lcd to receive frame buffer data */