mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-10 05:32:40 -05:00
YH820: implement LCD sleep
use sleep setting to keep transflective LCD active without backlight Change-Id: Iccd97e956d5e4a2a22abc90d15e9123782126ecb
This commit is contained in:
parent
60f60d9a12
commit
03e63da316
4 changed files with 57 additions and 8 deletions
|
|
@ -60,6 +60,10 @@ void backlight_set_on_button_hold(int index);
|
||||||
void lcd_set_sleep_after_backlight_off(int timeout_seconds);
|
void lcd_set_sleep_after_backlight_off(int timeout_seconds);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_SLEEP
|
||||||
|
void lcd_awake(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#else /* !HAVE_BACKLIGHT */
|
#else /* !HAVE_BACKLIGHT */
|
||||||
#define backlight_init()
|
#define backlight_init()
|
||||||
#endif /* !HAVE_BACKLIGHT */
|
#endif /* !HAVE_BACKLIGHT */
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,9 @@
|
||||||
#define LCD_DEPTH 16 /* 65536 colours */
|
#define LCD_DEPTH 16 /* 65536 colours */
|
||||||
#define LCD_PIXELFORMAT RGB565
|
#define LCD_PIXELFORMAT RGB565
|
||||||
|
|
||||||
|
/* LCD stays visible without backlight - simulator hint */
|
||||||
|
#define HAVE_TRANSFLECTIVE_LCD
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
|
|
||||||
/* define this if you have a real-time clock */
|
/* define this if you have a real-time clock */
|
||||||
|
|
@ -42,12 +45,16 @@
|
||||||
//#define HAVE_RTC_ALARM
|
//#define HAVE_RTC_ALARM
|
||||||
|
|
||||||
/* Define this if your LCD can be enabled/disabled */
|
/* Define this if your LCD can be enabled/disabled */
|
||||||
#define HAVE_LCD_ENABLE
|
/* #define HAVE_LCD_ENABLE */
|
||||||
|
|
||||||
/* Define this if your LCD can be put to sleep.
|
/* Define this if your LCD can be put to sleep.
|
||||||
HAVE_LCD_ENABLE should be defined as well. */
|
HAVE_LCD_ENABLE should be defined as well.
|
||||||
/* todo #define HAVE_LCD_SLEEP*/
|
Note: with a transflective display, HAVE_LCD_ENABLE shouldn't be defined.
|
||||||
/* todo #define HAVE_LCD_SLEEP_SETTING */
|
LCD gets disabled when setting to sleep. */
|
||||||
|
#define HAVE_LCD_SLEEP
|
||||||
|
#define HAVE_LCD_SLEEP_SETTING
|
||||||
|
/* The same code may also be used when shutting down */
|
||||||
|
#define HAVE_LCD_SHUTDOWN
|
||||||
#endif /* !BOOTLOADER */
|
#endif /* !BOOTLOADER */
|
||||||
|
|
||||||
/* Define this for LCD backlight available */
|
/* Define this for LCD backlight available */
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
void backlight_hw_on(void)
|
void backlight_hw_on(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_SLEEP
|
#ifdef HAVE_LCD_SLEEP
|
||||||
backlight_lcd_sleep_countdown(false); /* stop counter */
|
lcd_awake(); /* power on lcd + visible display */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(true); /* power on lcd + visible display */
|
lcd_enable(true); /* power on lcd + visible display */
|
||||||
|
|
@ -42,7 +42,4 @@ void backlight_hw_off(void)
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(false); /* power off visible display */
|
lcd_enable(false); /* power off visible display */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(true); /* start countdown */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,9 @@
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
#ifdef HAVE_LCD_SHUTDOWN
|
||||||
|
#include "backlight-target.h" /* included for backlight_hw_off() prototype */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Display status */
|
/* Display status */
|
||||||
static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
|
static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
|
||||||
|
|
@ -235,6 +238,28 @@ void lcd_enable(bool yesno)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_SLEEP
|
||||||
|
void lcd_sleep(void)
|
||||||
|
{
|
||||||
|
if (is_lcd_enabled)
|
||||||
|
{
|
||||||
|
is_lcd_enabled = false;
|
||||||
|
lcd_send_command(R_STANDBY_ON);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcd_awake(void)
|
||||||
|
{
|
||||||
|
if (!is_lcd_enabled)
|
||||||
|
{
|
||||||
|
is_lcd_enabled = true;
|
||||||
|
lcd_send_command(R_STANDBY_OFF);
|
||||||
|
lcd_send_command(R_DISPLAY_ON);
|
||||||
|
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
||||||
bool lcd_active(void)
|
bool lcd_active(void)
|
||||||
{
|
{
|
||||||
|
|
@ -242,6 +267,17 @@ bool lcd_active(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_LCD_SHUTDOWN)
|
||||||
|
void lcd_shutdown(void)
|
||||||
|
{
|
||||||
|
backlight_hw_off();
|
||||||
|
#ifndef HAVE_LCD_ENABLE
|
||||||
|
/* already done by backlight_hw_off() */
|
||||||
|
lcd_send_command(R_STANDBY_ON);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_FLIP
|
#ifdef HAVE_LCD_FLIP
|
||||||
/* turn the display upside down (call lcd_update() afterwards) */
|
/* turn the display upside down (call lcd_update() afterwards) */
|
||||||
/* Note: since the lcd is rotated, this will flip horiz instead of vert */
|
/* Note: since the lcd is rotated, this will flip horiz instead of vert */
|
||||||
|
|
@ -339,6 +375,11 @@ void lcd_update_rect(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
const fb_data *addr;
|
const fb_data *addr;
|
||||||
|
|
||||||
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
||||||
|
if (!is_lcd_enabled)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (x + width >= LCD_WIDTH)
|
if (x + width >= LCD_WIDTH)
|
||||||
width = LCD_WIDTH - x;
|
width = LCD_WIDTH - x;
|
||||||
if (y + height >= LCD_HEIGHT)
|
if (y + height >= LCD_HEIGHT)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue