summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-04-02 22:16:14 +0000
committerJens Arnold <amiconn@rockbox.org>2008-04-02 22:16:14 +0000
commit5c87a98b97b9ab6bd9647bb0bb8d00f58d5f179b (patch)
treeb61feaa66d26f63df09f03d0cb6921ac80edf560 /firmware
parentcdae493f96150808007883a7fb0b582d46af4a1a (diff)
downloadrockbox-5c87a98b97b9ab6bd9647bb0bb8d00f58d5f179b.tar.gz
rockbox-5c87a98b97b9ab6bd9647bb0bb8d00f58d5f179b.tar.bz2
rockbox-5c87a98b97b9ab6bd9647bb0bb8d00f58d5f179b.zip
Greyscale library: * Implement linearisation curve flipping for 1st/2nd Gen iPods (LCD is inverted when backlight is on, so the curve is also inverted). This needs a slight extension of is_backlight_on() functionality in the core. * Thorough recalibration of all reachable greyscale targets, and #ifdef cleanup. * Reduce on-target gamma a bit, because the displayable contrast range of a monochrome/greyscale isn't that high.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16936 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/backlight.c24
-rw-r--r--firmware/drivers/button.c9
-rw-r--r--firmware/export/backlight.h4
3 files changed, 19 insertions, 18 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c
index 0f66fbf574..19e6933fca 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -631,13 +631,13 @@ void backlight_off(void)
queue_post(&backlight_queue, BACKLIGHT_OFF, 0);
}
-/* returns true when the backlight is on OR when it's set to always off */
-bool is_backlight_on(void)
+/* returns true when the backlight is on,
+ * and optionally when it's set to always off. */
+bool is_backlight_on(bool ignore_always_off)
{
- if (backlight_timer || backlight_timeout <= 0)
- return true;
- else
- return false;
+ return (backlight_timer > 0) /* countdown */
+ || (backlight_timeout == 0) /* always on */
+ || ((backlight_timeout < 0) && !ignore_always_off);
}
/* return value in ticks; 0 means always on, <0 means always off */
@@ -752,13 +752,13 @@ int remote_backlight_get_current_timeout(void)
return remote_backlight_timeout;
}
-/* returns true when the backlight is on OR when it's set to always off */
-bool is_remote_backlight_on(void)
+/* returns true when the backlight is on, and
+ * optionally when it's set to always off */
+bool is_remote_backlight_on(bool ignore_always_off)
{
- if (remote_backlight_timer != 0 || remote_backlight_timeout <= 0)
- return true;
- else
- return false;
+ return (remote_backlight_timer > 0) /* countdown */
+ || (remote_backlight_timeout == 0) /* always on */
+ || ((remote_backlight_timeout < 0) && !ignore_always_off);
}
#endif /* HAVE_REMOTE_LCD */
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index d38306b3ca..90ff800c88 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -247,9 +247,10 @@ static void button_tick(void)
#ifdef HAVE_BACKLIGHT
#ifdef HAVE_REMOTE_LCD
if (btn & BUTTON_REMOTE) {
- if (!remote_filter_first_keypress || is_remote_backlight_on()
+ if (!remote_filter_first_keypress
+ || is_remote_backlight_on(false)
#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
- || (remote_type()==REMOTETYPE_H300_NONLCD)
+ || (remote_type()==REMOTETYPE_H300_NONLCD)
#endif
)
queue_post(&button_queue, btn, data);
@@ -258,9 +259,9 @@ static void button_tick(void)
}
else
#endif
- if (!filter_first_keypress || is_backlight_on()
+ if (!filter_first_keypress || is_backlight_on(false)
#if BUTTON_REMOTE
- || (btn&BUTTON_REMOTE)
+ || (btn & BUTTON_REMOTE)
#endif
)
queue_post(&button_queue, btn, data);
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h
index 3ee46c1485..35c0f86178 100644
--- a/firmware/export/backlight.h
+++ b/firmware/export/backlight.h
@@ -21,7 +21,7 @@
#include "config.h"
-bool is_backlight_on(void);
+bool is_backlight_on(bool ignore_always_off);
void backlight_on(void);
void backlight_off(void);
void backlight_set_timeout(int value);
@@ -57,7 +57,7 @@ void remote_backlight_on(void);
void remote_backlight_off(void);
void remote_backlight_set_timeout(int value);
void remote_backlight_set_timeout_plugged(int value);
-bool is_remote_backlight_on(void);
+bool is_remote_backlight_on(bool ignore_always_off);
#ifdef HAS_REMOTE_BUTTON_HOLD
void remote_backlight_hold_changed(bool rc_hold_button);