summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c
index 9df857ec31..2c188a584e 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c
@@ -28,6 +28,14 @@
28#include "power.h" 28#include "power.h"
29#include "spi-target.h" 29#include "spi-target.h"
30 30
31int _backlight_brightness=DEFAULT_BRIGHTNESS_SETTING;
32
33static void _backlight_write_brightness(int brightness)
34{
35 uint8_t bl_command[] = {0xa4, 0x00, brightness, 0xbb};
36 spi_block_transfer(SPI_target_BACKLIGHT, bl_command, 4, 0, 0);
37}
38
31void _backlight_on(void) 39void _backlight_on(void)
32{ 40{
33#if defined(HAVE_LCD_SLEEP) && !defined(BOOTLOADER) 41#if defined(HAVE_LCD_SLEEP) && !defined(BOOTLOADER)
@@ -36,12 +44,12 @@ void _backlight_on(void)
36#ifdef HAVE_LCD_ENABLE 44#ifdef HAVE_LCD_ENABLE
37 lcd_enable(true); /* power on lcd + visible display */ 45 lcd_enable(true); /* power on lcd + visible display */
38#endif 46#endif
39 _backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING); 47 _backlight_write_brightness(_backlight_brightness);
40} 48}
41 49
42void _backlight_off(void) 50void _backlight_off(void)
43{ 51{
44 _backlight_set_brightness(0); 52 _backlight_write_brightness(0);
45#if defined(HAVE_LCD_SLEEP) && !defined(BOOTLOADER) 53#if defined(HAVE_LCD_SLEEP) && !defined(BOOTLOADER)
46 /* Disable lcd after fade completes (when lcd_sleep timeout expires) */ 54 /* Disable lcd after fade completes (when lcd_sleep timeout expires) */
47 backlight_lcd_sleep_countdown(true); /* start countdown */ 55 backlight_lcd_sleep_countdown(true); /* start countdown */
@@ -51,8 +59,8 @@ void _backlight_off(void)
51/* Assumes that the backlight has been initialized */ 59/* Assumes that the backlight has been initialized */
52void _backlight_set_brightness(int brightness) 60void _backlight_set_brightness(int brightness)
53{ 61{
54 uint8_t bl_command[] = {0xa4, 0x00, brightness, 0xbb}; 62 _backlight_brightness=brightness;
55 spi_block_transfer(SPI_target_BACKLIGHT, bl_command, 4, 0, 0); 63 _backlight_write_brightness(brightness);
56} 64}
57 65
58void __backlight_dim(bool dim_now) 66void __backlight_dim(bool dim_now)
@@ -64,6 +72,6 @@ void __backlight_dim(bool dim_now)
64 72
65bool _backlight_init(void) 73bool _backlight_init(void)
66{ 74{
67 _backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING); 75 _backlight_set_brightness(_backlight_brightness);
68 return true; 76 return true;
69} 77}