diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-11-21 23:55:39 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-11-21 23:55:39 +0000 |
commit | b51f7dfc9b507ab9db12fe90b2ddad708f435e06 (patch) | |
tree | efcef3411689401da21795d700a0741f8ab1072b /uisimulator/win32 | |
parent | e68680ac310adb8373c9f3a5194466766d64cf37 (diff) | |
download | rockbox-b51f7dfc9b507ab9db12fe90b2ddad708f435e06.tar.gz rockbox-b51f7dfc9b507ab9db12fe90b2ddad708f435e06.zip |
Backlight handling: * Added 'Caption Backlight' and 'Backlight On When Charging' for the iriver remote LCD. * Enabled the backlight code for the simulator, and prepared backlight simulation. It's only a stub atm, writing messages to the console window. * Added tick task handling to the simulators for this to work. * Code cleanup in backlight.c, less dead code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8034 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/win32')
-rw-r--r-- | uisimulator/win32/button.c | 8 | ||||
-rw-r--r-- | uisimulator/win32/kernel.c | 51 | ||||
-rw-r--r-- | uisimulator/win32/uisw32.c | 11 |
3 files changed, 67 insertions, 3 deletions
diff --git a/uisimulator/win32/button.c b/uisimulator/win32/button.c index 08ef5e15d8..47adbb485f 100644 --- a/uisimulator/win32/button.c +++ b/uisimulator/win32/button.c | |||
@@ -202,7 +202,13 @@ void button_event(int key, bool pressed) | |||
202 | else | 202 | else |
203 | queue_post(&button_queue, btn, NULL); | 203 | queue_post(&button_queue, btn, NULL); |
204 | 204 | ||
205 | backlight_on(); | 205 | #ifdef HAVE_REMOTE_LCD |
206 | if(btn & BUTTON_REMOTE) | ||
207 | remote_backlight_on(); | ||
208 | else | ||
209 | #endif | ||
210 | backlight_on(); | ||
211 | |||
206 | } | 212 | } |
207 | } | 213 | } |
208 | else | 214 | else |
diff --git a/uisimulator/win32/kernel.c b/uisimulator/win32/kernel.c index 8e7bb88546..eb55bf7a72 100644 --- a/uisimulator/win32/kernel.c +++ b/uisimulator/win32/kernel.c | |||
@@ -22,12 +22,15 @@ | |||
22 | #include "kernel.h" | 22 | #include "kernel.h" |
23 | #include "thread-win32.h" | 23 | #include "thread-win32.h" |
24 | #include "thread.h" | 24 | #include "thread.h" |
25 | #include "debug.h" | ||
25 | 26 | ||
26 | /* (Daniel 2002-10-31) Mingw32 requires this errno variable to be present. | 27 | /* (Daniel 2002-10-31) Mingw32 requires this errno variable to be present. |
27 | I'm not quite sure why and I don't know if this breaks the MSVC compile. | 28 | I'm not quite sure why and I don't know if this breaks the MSVC compile. |
28 | If it does, we should put this within #ifdef __MINGW32__ */ | 29 | If it does, we should put this within #ifdef __MINGW32__ */ |
29 | int errno; | 30 | int errno; |
30 | 31 | ||
32 | static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void); | ||
33 | |||
31 | int set_irq_level (int level) | 34 | int set_irq_level (int level) |
32 | { | 35 | { |
33 | static int _lv = 0; | 36 | static int _lv = 0; |
@@ -99,6 +102,54 @@ void switch_thread (void) | |||
99 | yield (); | 102 | yield (); |
100 | } | 103 | } |
101 | 104 | ||
105 | void sim_tick_tasks(void) | ||
106 | { | ||
107 | int i; | ||
108 | |||
109 | /* Run through the list of tick tasks */ | ||
110 | for(i = 0;i < MAX_NUM_TICK_TASKS;i++) | ||
111 | { | ||
112 | if(tick_funcs[i]) | ||
113 | { | ||
114 | tick_funcs[i](); | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | |||
119 | int tick_add_task(void (*f)(void)) | ||
120 | { | ||
121 | int i; | ||
122 | |||
123 | /* Add a task if there is room */ | ||
124 | for(i = 0;i < MAX_NUM_TICK_TASKS;i++) | ||
125 | { | ||
126 | if(tick_funcs[i] == NULL) | ||
127 | { | ||
128 | tick_funcs[i] = f; | ||
129 | return 0; | ||
130 | } | ||
131 | } | ||
132 | DEBUGF("Error! tick_add_task(): out of tasks"); | ||
133 | return -1; | ||
134 | } | ||
135 | |||
136 | int tick_remove_task(void (*f)(void)) | ||
137 | { | ||
138 | int i; | ||
139 | |||
140 | /* Remove a task if it is there */ | ||
141 | for(i = 0;i < MAX_NUM_TICK_TASKS;i++) | ||
142 | { | ||
143 | if(tick_funcs[i] == f) | ||
144 | { | ||
145 | tick_funcs[i] = NULL; | ||
146 | return 0; | ||
147 | } | ||
148 | } | ||
149 | |||
150 | return -1; | ||
151 | } | ||
152 | |||
102 | /* TODO: Implement mutexes for win32 */ | 153 | /* TODO: Implement mutexes for win32 */ |
103 | void mutex_init(struct mutex *m) | 154 | void mutex_init(struct mutex *m) |
104 | { | 155 | { |
diff --git a/uisimulator/win32/uisw32.c b/uisimulator/win32/uisw32.c index d098c6ef24..b31eccf794 100644 --- a/uisimulator/win32/uisw32.c +++ b/uisimulator/win32/uisw32.c | |||
@@ -36,7 +36,8 @@ | |||
36 | 36 | ||
37 | // extern functions | 37 | // extern functions |
38 | extern void app_main (void *); // mod entry point | 38 | extern void app_main (void *); // mod entry point |
39 | extern void new_key(int key); | 39 | extern void new_key(int key); |
40 | extern void sim_tick_tasks(void); | ||
40 | 41 | ||
41 | void button_event(int key, bool pressed); | 42 | void button_event(int key, bool pressed); |
42 | 43 | ||
@@ -67,12 +68,18 @@ LRESULT CALLBACK GUIWndProc ( | |||
67 | static HDC hMemDc; | 68 | static HDC hMemDc; |
68 | 69 | ||
69 | static LARGE_INTEGER persec, tick1, ticknow; | 70 | static LARGE_INTEGER persec, tick1, ticknow; |
71 | long new_tick; | ||
70 | 72 | ||
71 | switch (uMsg) | 73 | switch (uMsg) |
72 | { | 74 | { |
73 | case WM_TIMER: | 75 | case WM_TIMER: |
74 | QueryPerformanceCounter(&ticknow); | 76 | QueryPerformanceCounter(&ticknow); |
75 | current_tick = ((ticknow.QuadPart-tick1.QuadPart)*HZ)/persec.QuadPart; | 77 | new_tick = ((ticknow.QuadPart-tick1.QuadPart)*HZ)/persec.QuadPart; |
78 | if (new_tick != current_tick) | ||
79 | { | ||
80 | sim_tick_tasks(); | ||
81 | current_tick = new_tick; | ||
82 | } | ||
76 | return TRUE; | 83 | return TRUE; |
77 | case WM_ACTIVATE: | 84 | case WM_ACTIVATE: |
78 | if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) | 85 | if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) |