summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-02-25 22:36:04 +0000
committerJens Arnold <amiconn@rockbox.org>2007-02-25 22:36:04 +0000
commit7d718a8064177a879423de7a78999a64126c79dc (patch)
treece4e6aab4c39eb6884463007899be2431094879b /firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c
parentd528e54b619007ec30bfbbe9dca6c0886c822b74 (diff)
X5: Move the remote tick to target tree.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12486 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c')
-rw-r--r--firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c
index bd1fb19727..139ebbc2a3 100644
--- a/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c
@@ -58,6 +58,8 @@ static int cached_contrast = DEFAULT_REMOTE_CONTRAST_SETTING;
bool remote_initialized = false;
+static void remote_tick(void);
+
/* Standard low-level byte writer. Requires CLK high on entry */
static inline void _write_byte(unsigned data)
{
@@ -335,6 +337,9 @@ void lcd_remote_init_device(void)
and_l(~0x01000000, &GPIO_OUT);
and_l(~0x01000000, &GPIO_ENABLE);
or_l(0x01000000, &GPIO_FUNCTION);
+
+ lcd_remote_clear_display();
+ tick_add_task(remote_tick);
}
void lcd_remote_on(void)
@@ -392,6 +397,49 @@ void lcd_remote_poweroff(void)
lcd_remote_write_command(LCD_SET_POWER_SAVE | 1);
}
+/* Monitor remote hotswap */
+static void remote_tick(void)
+{
+ static bool last_status = false;
+ static int countdown = 0;
+ static int init_delay = 0;
+ bool current_status;
+
+ current_status = remote_detect();
+
+ /* Only report when the status has changed */
+ if (current_status != last_status)
+ {
+ last_status = current_status;
+ countdown = current_status ? 20*HZ : 1;
+ }
+ else
+ {
+ /* Count down until it gets negative */
+ if (countdown >= 0)
+ countdown--;
+
+ if (current_status)
+ {
+ if (!(countdown % 8))
+ {
+ if (--init_delay <= 0)
+ {
+ queue_post(&remote_scroll_queue, REMOTE_INIT_LCD, 0);
+ init_delay = 6;
+ }
+ }
+ }
+ else
+ {
+ if (countdown == 0)
+ {
+ queue_post(&remote_scroll_queue, REMOTE_DEINIT_LCD, 0);
+ }
+ }
+ }
+}
+
/* Update the display.
This must be called after all other LCD functions that change the display. */
void lcd_remote_update(void) ICODE_ATTR;