Dolda2000 GitWeb
/
kokare.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
cd17a21
)
Use only one version of getticks.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Wed, 4 Jul 2007 15:19:44 +0000
(15:19 +0000)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Wed, 4 Jul 2007 15:19:44 +0000
(15:19 +0000)
kokare.c
patch
|
blob
|
blame
|
history
diff --git
a/kokare.c
b/kokare.c
index
8d151df
..
38662bb
100644
(file)
--- a/
kokare.c
+++ b/
kokare.c
@@
-147,36
+147,18
@@
void disphex(unsigned char num)
dsp[1] = font[num & 0x0f];
}
dsp[1] = font[num & 0x0f];
}
-/*
- * This version is used outside interrupts.
- * It spins until no overflow has happened.
- */
unsigned long getticks(void)
{
uint16_t v;
unsigned long r;
unsigned long getticks(void)
{
uint16_t v;
unsigned long r;
- do {
- v = oticks;
- r = TCNT1 + (((unsigned long)oticks) << 16);
- } while(v != oticks);
- return(r);
-}
-
-/*
- * This version is used in interrupts
- */
-unsigned long getticks2(void)
-{
- uint16_t v;
- unsigned long r;
-
+ cli();
v = TCNT1;
r = v + (((unsigned long)oticks) << 16);
if((TIFR1 & 0x01) && !(v & 0x8000))
v = TCNT1;
r = v + (((unsigned long)oticks) << 16);
if((TIFR1 & 0x01) && !(v & 0x8000))
- r
eturn(r + 0x10000)
;
- else
-
return(r);
+ r
+= 0x10000
;
+ sei();
+ return(r);
}
void ledcycle(void)
}
void ledcycle(void)
@@
-475,7
+457,7
@@
ISR(SIG_INTERRUPT1)
{
unsigned long now;
{
unsigned long now;
- now = getticks
2
();
+ now = getticks();
if(tstate == 0) {
tstate = 1;
if(tlock != 2)
if(tstate == 0) {
tstate = 1;
if(tlock != 2)