summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-10-11 20:15:22 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-10-11 20:15:22 +0000
commit33adade0d5da4d2cf3c8778111984524ad98e047 (patch)
treeb74dc3cd61254a7be287d69921042c767320447b
parent9e64e8ee17e71c5c676715b56f92f377d13209e0 (diff)
downloadrockbox-33adade0d5da4d2cf3c8778111984524ad98e047.tar.gz
rockbox-33adade0d5da4d2cf3c8778111984524ad98e047.zip
Added an analogue clock to the screen. Adds a perfect excuse for running
this a little more often!! ;-) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2588 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/recorder/bounce.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/apps/recorder/bounce.c b/apps/recorder/bounce.c
index cfb194e7ec..fdf7fcd4f9 100644
--- a/apps/recorder/bounce.c
+++ b/apps/recorder/bounce.c
@@ -27,6 +27,7 @@
27#include "kernel.h" 27#include "kernel.h"
28#include "menu.h" 28#include "menu.h"
29#include "sprintf.h" 29#include "sprintf.h"
30#include "rtc.h"
30 31
31#ifdef SIMULATOR 32#ifdef SIMULATOR
32#include <stdio.h> 33#include <stdio.h>
@@ -176,6 +177,55 @@ struct counter values[]={
176 {"ydistt", -6}, 177 {"ydistt", -6},
177}; 178};
178 179
180static unsigned char yminute[]={
18153,53,52,52,51,50,49,47,46,44,42,40,38,36,34,32,29,27,25,23,21,19,17,16,14,13,12,11,11,10,10,10,11,11,12,13,14,16,17,19,21,23,25,27,29,31,34,36,38,40,42,44,46,47,49,50,51,52,52,53,
182};
183static unsigned char yhour[]={
18442,42,42,42,41,41,40,39,39,38,37,36,35,34,33,32,30,29,28,27,26,25,24,24,23,22,22,21,21,21,21,21,21,21,22,22,23,24,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,39,40,41,41,42,42,42,
185};
186
187static unsigned char xminute[]={
18856,59,63,67,71,74,77,80,83,86,88,90,91,92,93,93,93,92,91,90,88,86,83,80,77,74,71,67,63,59,56,52,48,44,40,37,34,31,28,25,23,21,20,19,18,18,18,19,20,21,23,25,28,31,34,37,40,44,48,52,
189};
190static unsigned char xhour[]={
19156,57,59,61,63,65,66,68,69,71,72,73,73,74,74,74,74,74,73,73,72,71,69,68,66,65,63,61,59,57,56,54,52,50,48,46,45,43,42,40,39,38,38,37,37,37,37,37,38,38,39,40,42,43,45,46,48,50,52,54,
192};
193
194static void addclock(void)
195{
196 int i;
197 int hour;
198 int minute;
199 int pos;
200
201 hour = rtc_read(3);
202 hour = (((hour & 0x30) >> 4) * 10 + (hour & 0x0f))%12;
203 minute = rtc_read(2);
204 minute = ((minute & 0x70) >> 4) * 10 + (minute & 0x0f);
205
206 pos = 90-minute;
207 if(pos >= 60)
208 pos -= 60;
209
210 lcd_drawline(LCD_WIDTH/2, LCD_HEIGHT/2, xminute[pos], yminute[pos]);
211
212 hour = hour*5 + minute/12;
213 pos = 90-hour;
214 if(pos >= 60)
215 pos -= 60;
216
217 lcd_drawline(LCD_WIDTH/2, LCD_HEIGHT/2, xhour[pos], yhour[pos]);
218
219 /* draw a circle */
220 for(i=0; i < 60; i+=3) {
221 lcd_drawline( xminute[i],
222 yminute[i],
223 xminute[(i+1)%60],
224 yminute[(i+1)%60]);
225 }
226}
227
228
179static void loopit(void) 229static void loopit(void)
180{ 230{
181 int b; 231 int b;
@@ -205,6 +255,9 @@ static void loopit(void)
205 x+= speed[xsanke&15] + values[NUM_XADD].num; 255 x+= speed[xsanke&15] + values[NUM_XADD].num;
206 256
207 lcd_clear_display(); 257 lcd_clear_display();
258
259 addclock();
260
208 if(timeout) { 261 if(timeout) {
209 switch(b) { 262 switch(b) {
210 case BUTTON_LEFT: 263 case BUTTON_LEFT: