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
This commit is contained in:
Bertrik Sikken 2011-09-02 19:57:29 +00:00
parent 194bc59478
commit 5b7a150807
2 changed files with 45 additions and 1 deletions

View file

@ -22,6 +22,7 @@
#include "config.h" #include "config.h"
#include "lcd.h" #include "lcd.h"
#include "lcd-target.h"
#include "system.h" #include "system.h"
#include "cpu.h" #include "cpu.h"
@ -154,7 +155,7 @@ static void lcd_init_type0(void)
/* writes a table entry (for type 1 LCDs) */ /* writes a table entry (for type 1 LCDs) */
static void lcd_write_table(uint8_t val) 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); 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. */ /* Updates a fraction of the display. */
void lcd_update_rect(int x, int y, int width, int height) void lcd_update_rect(int x, int y, int width, int height)
{ {

View file

@ -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);