Oops:) Make the brightness setting purely numerical

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8281 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Hristo Kovachev 2005-12-22 13:31:14 +00:00
parent 9b83c6c4bd
commit b1a230353e
4 changed files with 9 additions and 5 deletions

View file

@ -489,7 +489,7 @@ static const struct bit_entry hd_bits[] =
{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" }, {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 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
{4, S_O(brightness), 9, "brightness", "2,3,4,5,6,7,8,9,10,11,12,13,14,15"}, {4, S_O(brightness), 9, "brightness", NULL },
#endif #endif
/* If values are just added to the end, no need to bump the version. */ /* If values are just added to the end, no need to bump the version. */

View file

@ -27,6 +27,10 @@
#include "timefuncs.h" #include "timefuncs.h"
#include "abrepeat.h" #include "abrepeat.h"
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
#include "backlight.h" /* for [MIN|MAX]_BRIGHTNESS_SETTING */
#endif
#define ROCKBOX_DIR "/.rockbox" #define ROCKBOX_DIR "/.rockbox"
#define ROCKBOX_DIR_LEN 9 #define ROCKBOX_DIR_LEN 9
#define FONT_DIR "/fonts" #define FONT_DIR "/fonts"
@ -446,10 +450,6 @@ extern const char rec_base_directory[];
#endif #endif
#define MIN_CONTRAST_SETTING 5 #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() */ /* argument bits for settings_load() */
#define SETTINGS_RTC 1 /* only the settings from the RTC nonvolatile RAM */ #define SETTINGS_RTC 1 /* only the settings from the RTC nonvolatile RAM */

View file

@ -548,6 +548,8 @@ void backlight_set_brightness(int val)
/* set H300 brightness by changing the PWM /* set H300 brightness by changing the PWM
accepts 0..15 but note that 0 and 1 give a black display! */ accepts 0..15 but note that 0 and 1 give a black display! */
unsigned char ucVal = (unsigned char)(val & 0x0F); unsigned char ucVal = (unsigned char)(val & 0x0F);
if(val<MIN_BRIGHTNESS_SETTING)
val=MIN_BRIGHTNESS_SETTING;
pcf50606_set_bl_pwm(ucVal); pcf50606_set_bl_pwm(ucVal);
} }
#endif #endif

View file

@ -51,5 +51,7 @@ void sim_remote_backlight(int value);
#endif #endif
#ifdef HAVE_BACKLIGHT_BRIGHTNESS #ifdef HAVE_BACKLIGHT_BRIGHTNESS
#define MIN_BRIGHTNESS_SETTING 2
#define MAX_BRIGHTNESS_SETTING 15
void backlight_set_brightness(int val); void backlight_set_brightness(int val);
#endif #endif