mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
Add software backlight fading for E100/H300/X5/D2, by Thomas Martitz and others - see FS#6800 for credits.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19221 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
756bcc4bd5
commit
f684726580
18 changed files with 304 additions and 39 deletions
|
|
@ -24,27 +24,20 @@
|
|||
#include "pcf50606.h"
|
||||
#include "tcc780x.h"
|
||||
|
||||
static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
|
||||
|
||||
int _backlight_init(void)
|
||||
{
|
||||
_backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING);
|
||||
/* set backlight on by default, since the screen is unreadable without it */
|
||||
_backlight_on();
|
||||
return true;
|
||||
}
|
||||
|
||||
void _backlight_set_brightness(int brightness)
|
||||
{
|
||||
backlight_brightness = brightness;
|
||||
|
||||
int level = disable_irq_save();
|
||||
pcf50606_write(PCF5060X_PWMC1, 0xe1 | (14-backlight_brightness)<<1);
|
||||
pcf50606_write(PCF5060X_PWMC1, 0xe1 | (MAX_BRIGHTNESS_SETTING-brightness)<<1);
|
||||
pcf50606_write(PCF5060X_GPOC1, 0x3);
|
||||
restore_irq(level);
|
||||
|
||||
if (brightness > 0)
|
||||
_backlight_on();
|
||||
else
|
||||
_backlight_off();
|
||||
}
|
||||
|
||||
void _backlight_on(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue