mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
Patch No 1387627 by Peter D'Hoye: Backlight Brightness setting for H300
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8280 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
9d67765cae
commit
9b83c6c4bd
9 changed files with 77 additions and 1 deletions
|
|
@ -3550,3 +3550,10 @@ desc: in radio screen / menu
|
|||
eng: "Mode:"
|
||||
voice: ""
|
||||
new:
|
||||
|
||||
id: LANG_BRIGHTNESS
|
||||
desc: in settings_menu
|
||||
eng: "Brightness"
|
||||
voice: "Brightness"
|
||||
new:
|
||||
|
||||
|
|
|
|||
|
|
@ -488,6 +488,10 @@ static const struct bit_entry hd_bits[] =
|
|||
#endif
|
||||
{4, S_O(default_codepage), 0, "default codepage", "iso8859-1,iso8859-7,iso8859-8,cp1251,iso8859-11,iso8859-6,iso8859-9,iso8859-2,sjis,gb2312,ksx1001,big5,utf-8" },
|
||||
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
{4, S_O(brightness), 9, "brightness", "2,3,4,5,6,7,8,9,10,11,12,13,14,15"},
|
||||
#endif
|
||||
|
||||
/* If values are just added to the end, no need to bump the version. */
|
||||
/* new stuff to be added at the end */
|
||||
|
||||
|
|
@ -891,6 +895,9 @@ void settings_apply(void)
|
|||
backlight_set_fade_in(global_settings.backlight_fade_in);
|
||||
backlight_set_fade_out(global_settings.backlight_fade_out);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
backlight_set_brightness(global_settings.brightness);
|
||||
#endif
|
||||
ata_spindown(global_settings.disk_spindown);
|
||||
#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR)
|
||||
|
|
|
|||
|
|
@ -381,6 +381,10 @@ struct user_settings
|
|||
#ifdef HAVE_REMOTE_LCD
|
||||
unsigned char rwps_file[MAX_FILENAME+1]; /* last remote-wps */
|
||||
#endif
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
int brightness; /* iriver h300: backlight PWM value: 2..15
|
||||
(0 and 1 are black) */
|
||||
#endif
|
||||
};
|
||||
|
||||
enum optiontype { INT, BOOL };
|
||||
|
|
@ -442,6 +446,11 @@ extern const char rec_base_directory[];
|
|||
#endif
|
||||
#define MIN_CONTRAST_SETTING 5
|
||||
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
#define MIN_BRIGHTNESS_SETTING 2
|
||||
#define MAX_BRIGHTNESS_SETTING 15
|
||||
#endif
|
||||
|
||||
/* argument bits for settings_load() */
|
||||
#define SETTINGS_RTC 1 /* only the settings from the RTC nonvolatile RAM */
|
||||
#define SETTINGS_HD 2 /* only the settings fron the disk sector */
|
||||
|
|
|
|||
|
|
@ -214,6 +214,16 @@ static bool backlight_fade_out(void)
|
|||
#endif
|
||||
#endif /* CONFIG_BACKLIGHT */
|
||||
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
static bool brightness(void)
|
||||
{
|
||||
return set_int( str(LANG_BRIGHTNESS), "", UNIT_INT,
|
||||
&global_settings.brightness,
|
||||
backlight_set_brightness, 1, MIN_BRIGHTNESS_SETTING,
|
||||
MAX_BRIGHTNESS_SETTING, NULL );
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
|
||||
static bool remote_backlight_timer(void)
|
||||
|
|
@ -1525,6 +1535,9 @@ static bool lcd_settings_menu(void)
|
|||
{ ID2P(LANG_BACKLIGHT_FADE_IN), backlight_fade_in },
|
||||
{ ID2P(LANG_BACKLIGHT_FADE_OUT), backlight_fade_out },
|
||||
#endif
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
{ ID2P(LANG_BRIGHTNESS), brightness },
|
||||
#endif
|
||||
#endif /* CONFIG_BACKLIGHT */
|
||||
{ ID2P(LANG_CONTRAST), contrast },
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@
|
|||
#include "timer.h"
|
||||
#include "backlight.h"
|
||||
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
#include "pcf50606.h" /* iRiver brightness */
|
||||
#endif
|
||||
|
||||
#if CONFIG_BACKLIGHT == BL_IRIVER_H300
|
||||
#include "lcd.h" /* for lcd_enable() */
|
||||
#endif
|
||||
|
|
@ -538,3 +542,13 @@ void remote_backlight_set_timeout(int index) {(void)index;}
|
|||
#endif
|
||||
#endif /* #ifdef CONFIG_BACKLIGHT */
|
||||
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
void backlight_set_brightness(int val)
|
||||
{
|
||||
/* set H300 brightness by changing the PWM
|
||||
accepts 0..15 but note that 0 and 1 give a black display! */
|
||||
unsigned char ucVal = (unsigned char)(val & 0x0F);
|
||||
pcf50606_set_bl_pwm(ucVal);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
/* delay loop to achieve 400kHz at 120MHz CPU frequency */
|
||||
#define DELAY do { int _x; for(_x=0;_x<22;_x++);} while(0)
|
||||
|
||||
void pcf50606_set_bl_pwm(unsigned char ucVal);
|
||||
|
||||
static void pcf50606_i2c_start(void)
|
||||
{
|
||||
|
|
@ -281,5 +282,23 @@ void pcf50606_init(void)
|
|||
set_voltages();
|
||||
|
||||
/* Backlight PWM = 512Hz 50/50 */
|
||||
pcf50606_write(0x35, 0x13);
|
||||
/*pcf50606_write(0x35, 0x13);*/
|
||||
pcf50606_set_bl_pwm(9);
|
||||
}
|
||||
|
||||
void pcf50606_set_bl_pwm(unsigned char ucVal)
|
||||
{
|
||||
/* set the backlight PWM */
|
||||
/* range is 0 - 15 */
|
||||
|
||||
/* limit incoming value */
|
||||
ucVal = ucVal & 0x0F;
|
||||
|
||||
/* shift one bit left */
|
||||
ucVal = ucVal << 1;
|
||||
ucVal = ucVal | 0x01;
|
||||
|
||||
/* 0x00 = 512Hz */
|
||||
ucVal = ucVal | 0x00;
|
||||
pcf50606_write(0x35, ucVal);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,3 +49,7 @@ void sim_backlight(int value);
|
|||
void sim_remote_backlight(int value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
void backlight_set_brightness(int val);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -100,4 +100,6 @@
|
|||
#define BOOTFILE_EXT "iriver"
|
||||
#define BOOTFILE "rockbox." BOOTFILE_EXT
|
||||
|
||||
#define HAVE_BACKLIGHT_BRIGHTNESS
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ int pcf50606_write_multiple(int address, const unsigned char* buf, int count);
|
|||
int pcf50606_write(int address, unsigned char val);
|
||||
int pcf50606_read_multiple(int address, unsigned char* buf, int count);
|
||||
int pcf50606_read(int address);
|
||||
void pcf50606_set_bl_pwm(unsigned char ucVal);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue