blob: 7091580028393e55af03d890e2cf1a1731bed0bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include <graphics/lfb.h>
#include <symbols.h>
char* ulong_to_string(unsigned long value, char* data)
{
unsigned long t = value;
unsigned long c;
char* dptr = data + 9;
for (int i = 0; i <= 10; i++) {
c = t%10;
*dptr = 0x30 + (c&0xF);
t /= 10;
if (t==0)
break;
dptr -= 1;
}
return dptr;
}
void main(void)
{
static char str[13];
static unsigned long previous = 0;
char* start;
unsigned long current = *(volatile unsigned long*)SYS_TIMER_CHI;
start = ulong_to_string(current, str);
draw_string(0, 10, start);
start = ulong_to_string(current - previous, str);
draw_string(0, 11, " ");
draw_string(0, 11, start);
previous = current;
}
|