diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-06-22 07:16:31 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-06-22 07:16:31 +0000 |
commit | e61f6fa5995780054760b44b35ef4f4d4a35afed (patch) | |
tree | 15c6088c7ec50acbcd807cbff555399108281ad1 | |
parent | 0907631464198e30235e1c628ba630bb73c498d2 (diff) | |
download | rockbox-e61f6fa5995780054760b44b35ef4f4d4a35afed.tar.gz rockbox-e61f6fa5995780054760b44b35ef4f4d4a35afed.zip |
Added reset_poweroff_timer(), which can be used to prevent idle poweroff. This is also available in the plugin API.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4787 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugin.c | 2 | ||||
-rw-r--r-- | apps/plugin.h | 2 | ||||
-rw-r--r-- | firmware/drivers/button.c | 10 | ||||
-rw-r--r-- | firmware/export/button.h | 1 | ||||
-rw-r--r-- | firmware/export/powermgmt.h | 1 | ||||
-rw-r--r-- | firmware/powermgmt.c | 9 | ||||
-rw-r--r-- | uisimulator/win32/button.c | 4 |
7 files changed, 18 insertions, 11 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index a990463b8c..b7646c021d 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -240,6 +240,8 @@ static struct plugin_api rockbox_api = { #ifdef HAVE_LCD_CHARCELLS lcd_icon, #endif + + reset_poweroff_timer, }; int plugin_load(char* plugin, void* parameter) diff --git a/apps/plugin.h b/apps/plugin.h index ec16376b11..1405ba3924 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -276,6 +276,8 @@ struct plugin_api { #ifdef HAVE_LCD_CHARCELLS void (*lcd_icon)(int icon, bool enable); #endif + + void (*reset_poweroff_timer)(void); }; /* defined by the plugin loader (plugin.c) */ diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index f3b90211cd..9f19bc0945 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -31,10 +31,10 @@ #include "serial.h" #include "power.h" #include "system.h" +#include "powermgmt.h" struct event_queue button_queue; -long last_keypress; static int lastbtn; #ifdef HAVE_RECORDER_KEYPAD static bool flipped; /* bottons can be flipped to match the LCD flip */ @@ -141,7 +141,7 @@ static void button_tick(void) queue_post(&button_queue, btn, NULL); backlight_on(); - last_keypress = current_tick; + reset_poweroff_timer(); } } else @@ -216,7 +216,7 @@ void button_init() queue_init(&button_queue); lastbtn = 0; tick_add_task(button_tick); - last_keypress = current_tick; + reset_poweroff_timer(); flipped = false; } @@ -359,7 +359,7 @@ void button_init(void) lastbtn = 0; tick_add_task(button_tick); - last_keypress = current_tick; + reset_poweroff_timer(); } static int button_read(void) @@ -396,7 +396,7 @@ void button_init(void) lastbtn = 0; tick_add_task(button_tick); - last_keypress = current_tick; + reset_poweroff_timer(); } int button_read(void) { diff --git a/firmware/export/button.h b/firmware/export/button.h index efe3684473..d1d5ddea5c 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h @@ -24,7 +24,6 @@ #include "config.h" extern struct event_queue button_queue; -extern long last_keypress; void button_init (void); int button_get (bool block); diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index 72a36b04bf..eb0ba29f28 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h @@ -100,5 +100,6 @@ void set_battery_capacity(int capacity); /* set local battery capacity value */ void set_sleep_timer(int seconds); int get_sleep_timer(void); void set_car_adapter_mode(bool setting); +void reset_poweroff_timer(void); #endif diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 61006459ff..aade687ba8 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -38,6 +38,13 @@ #include "fmradio.h" #endif +long last_event_tick; + +void reset_poweroff_timer(void) +{ + last_event_tick = current_tick; +} + #ifdef SIMULATOR int battery_level(void) @@ -316,7 +323,7 @@ static void handle_auto_poweroff(void) ((mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)) && !sleeptimer_active))) { - if(TIME_AFTER(current_tick, last_keypress + timeout) && + if(TIME_AFTER(current_tick, last_event_tick + timeout) && TIME_AFTER(current_tick, last_disk_activity + timeout) && TIME_AFTER(current_tick, last_charge_time + timeout)) { diff --git a/uisimulator/win32/button.c b/uisimulator/win32/button.c index 807e08fe22..c9bd1ad04e 100644 --- a/uisimulator/win32/button.c +++ b/uisimulator/win32/button.c @@ -33,7 +33,6 @@ /* speed repeat finishes at */ #define REPEAT_INTERVAL_FINISH 2 -long last_keypress; struct event_queue button_queue; void button_event(int key, bool pressed) @@ -160,8 +159,6 @@ void button_event(int key, bool pressed) queue_post(&button_queue, btn, NULL); backlight_on(); - - last_keypress = current_tick; } } else @@ -175,7 +172,6 @@ void button_event(int key, bool pressed) void button_init(void) { - last_keypress = 0; } /* Again copied from real button.c... */ |