summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalin Patulea <cat@vv.carleton.ca>2007-11-02 06:13:43 +0000
committerCatalin Patulea <cat@vv.carleton.ca>2007-11-02 06:13:43 +0000
commitf57ea9acd751d955cc25f88724f25a5f28ccc083 (patch)
tree65c0167557fb684e6b29cbae3a198380305cfd51
parent38548c71185a3563b55f43b069fb7b5408691645 (diff)
downloadrockbox-f57ea9acd751d955cc25f88724f25a5f28ccc083.tar.gz
rockbox-f57ea9acd751d955cc25f88724f25a5f28ccc083.tar.bz2
rockbox-f57ea9acd751d955cc25f88724f25a5f28ccc083.zip
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-xbootloader/mrobe500.c17
-rw-r--r--firmware/export/config-mrobe500.h13
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c11
3 files changed, 25 insertions, 16 deletions
diff --git a/bootloader/mrobe500.c b/bootloader/mrobe500.c
index 34814ba8d5..3663612c74 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 4a8834c1a2..850a2e83a1 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 3c80ede00d..b570f3e8fc 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;
}