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
This commit is contained in:
parent
38548c7118
commit
f57ea9acd7
3 changed files with 25 additions and 16 deletions
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue