diff options
| author | Catalin Patulea <cat@vv.carleton.ca> | 2007-11-02 06:13:43 +0000 |
|---|---|---|
| committer | Catalin Patulea <cat@vv.carleton.ca> | 2007-11-02 06:13:43 +0000 |
| commit | f57ea9acd751d955cc25f88724f25a5f28ccc083 (patch) | |
| tree | 65c0167557fb684e6b29cbae3a198380305cfd51 | |
| parent | 38548c71185a3563b55f43b069fb7b5408691645 (diff) | |
| download | rockbox-f57ea9acd751d955cc25f88724f25a5f28ccc083.zip rockbox-f57ea9acd751d955cc25f88724f25a5f28ccc083.tar.gz rockbox-f57ea9acd751d955cc25f88724f25a5f28ccc083.tar.bz2 rockbox-f57ea9acd751d955cc25f88724f25a5f28ccc083.tar.xz | |
m:robe 500i port: Add backlight support to the main build.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15404 a1c6a512-1295-4272-9138-f99709370657
| -rwxr-xr-x | bootloader/mrobe500.c | 17 | ||||
| -rw-r--r-- | firmware/export/config-mrobe500.h | 13 | ||||
| -rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c | 11 |
3 files changed, 25 insertions, 16 deletions
diff --git a/bootloader/mrobe500.c b/bootloader/mrobe500.c index 34814ba..3663612 100755 --- a/bootloader/mrobe500.c +++ b/bootloader/mrobe500.c @@ -98,8 +98,8 @@ void touchpad_calibrate_screen(void) set_calibration_points(&tl, &br);
}
#endif
-static const uint8_t bl_low [] = {0xa4, 0x00, 0x55, 0xbb};
-static const uint8_t bl_high[] = {0xa4, 0x00, 0x19, 0xbb};
+static uint8_t bl_command[] = {0xa4, 0x00, 0x00, 0xbb};
+int brightness = 0;
void mrdebug(void)
{
@@ -130,10 +130,15 @@ void mrdebug(void) address+=0x1000;
else if (button==BUTTON_RC_REW)
address-=0x1000;
- else if (button==BUTTON_RC_VOL_DOWN)
- spi_block_transfer(SPI_target_BACKLIGHT, bl_low, 4, 0, 0);
- else if (button==BUTTON_RC_VOL_UP)
- spi_block_transfer(SPI_target_BACKLIGHT, bl_high, 4, 0, 0);
+ else if (button==BUTTON_RC_VOL_DOWN) {
+ brightness = (brightness - 5) & 0x7f;
+ bl_command[2] = brightness;
+ spi_block_transfer(SPI_target_BACKLIGHT, bl_command, 4, 0, 0);
+ } else if (button==BUTTON_RC_VOL_UP) {
+ brightness = (brightness + 5) & 0x7f;
+ bl_command[2] = brightness;
+ spi_block_transfer(SPI_target_BACKLIGHT, bl_command, 4, 0, 0);
+ }
// {
// short x,y,z1,z2;
// tsc2100_read_values(&x, &y, &z1, &z2);
diff --git a/firmware/export/config-mrobe500.h b/firmware/export/config-mrobe500.h index 4a8834c..850a2e8 100644 --- a/firmware/export/config-mrobe500.h +++ b/firmware/export/config-mrobe500.h @@ -92,11 +92,10 @@ #define HAVE_BACKLIGHT_BRIGHTNESS /* Main LCD backlight brightness range and defaults */ -#define MIN_BRIGHTNESS_SETTING 0 /* 0.5 mA */ -#define MAX_DIM_BRIGHTNESS_SETTING 15 /* highest 'dimness' */ -#define MAX_BRIGHTNESS_SETTING 63 /* 32 mA */ -#define DEFAULT_BRIGHTNESS_SETTING 39 /* 20 mA */ -#define DEFAULT_DIMNESS_SETTING 9 /* 5 mA */ +#define MIN_BRIGHTNESS_SETTING 0 +#define MAX_BRIGHTNESS_SETTING 127 +#define DEFAULT_BRIGHTNESS_SETTING 85 /* OF "full brightness" */ +#define DEFAULT_DIMNESS_SETTING 22 /* OF "most dim" */ /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF @@ -104,9 +103,7 @@ /* The number of bytes reserved for loadable codecs */ #define CODEC_SIZE 0x80000 -/* The number of bytes reserved for loadable plugins - * - larger than other targets due to screen size - */ +/* The number of bytes reserved for loadable plugins */ #define PLUGIN_BUFFER_SIZE 0x100000 /* Define this if you have the WM8975 audio codec */ diff --git a/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c index 3c80ede..b570f3e 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c @@ -24,27 +24,34 @@ #include "backlight.h" #include "lcd.h" #include "power.h" +#include "spi-target.h" void __backlight_on(void) { + __backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING); } void __backlight_off(void) { + __backlight_set_brightness(0); } /* Assumes that the backlight has been initialized */ void __backlight_set_brightness(int brightness) { - (void) brightness; + uint8_t bl_command[] = {0xa4, 0x00, brightness, 0xbb}; + spi_block_transfer(SPI_target_BACKLIGHT, bl_command, 4, 0, 0); } void __backlight_dim(bool dim_now) { - (void) dim_now; + __backlight_set_brightness(dim_now ? + DEFAULT_BRIGHTNESS_SETTING : + DEFAULT_DIMNESS_SETTING); } bool __backlight_init(void) { + __backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING); return true; } |