mirror of
git://projects.qi-hardware.com/antorcha.git
synced 2024-11-22 19:43:07 +02:00
fw/antorcha.c: add backward sweep
This commit is contained in:
parent
00180fb287
commit
cb846be507
@ -24,7 +24,7 @@
|
|||||||
#include "io.h"
|
#include "io.h"
|
||||||
|
|
||||||
|
|
||||||
static struct sweep sweep = {
|
static struct sweep fwd_sweep = {
|
||||||
.pixel_ticks = 1100, /* 1.1 ms */
|
.pixel_ticks = 1100, /* 1.1 ms */
|
||||||
.left = 0,
|
.left = 0,
|
||||||
.right = MAX_LINES-1,
|
.right = MAX_LINES-1,
|
||||||
@ -32,6 +32,14 @@ static struct sweep sweep = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static struct sweep bwd_sweep = {
|
||||||
|
.pixel_ticks = 1100, /* 1.1 ms */
|
||||||
|
.left = 0,
|
||||||
|
.right = MAX_LINES-1,
|
||||||
|
.forward = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static volatile enum sync_state {
|
static volatile enum sync_state {
|
||||||
IDLE, /* undecided */
|
IDLE, /* undecided */
|
||||||
BWD, /* backward sweep */
|
BWD, /* backward sweep */
|
||||||
@ -94,7 +102,7 @@ static void sync_sweep(bool x, uint16_t v)
|
|||||||
break;
|
break;
|
||||||
tR0 = t;
|
tR0 = t;
|
||||||
state = RIGHT;
|
state = RIGHT;
|
||||||
// wake = 1;
|
wake = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,11 +113,18 @@ static void submit_fwd_sweep(void)
|
|||||||
#if 0
|
#if 0
|
||||||
uint32_t tIMG;
|
uint32_t tIMG;
|
||||||
|
|
||||||
tIMG = (sweep.right-sweep.left+1)*(sweep.pixel_ticks)/2;
|
tIMG = (fwd_sweep.right-fwd_sweep.left+1)*(fwd_sweep.pixel_ticks)/2;
|
||||||
sweep.start_ticks = tL0+110000-tIMG/2;
|
fwd_sweep.start_ticks = tL0+110000-tIMG/2;
|
||||||
#endif
|
#endif
|
||||||
sweep.start_ticks = uptime()+70000;
|
fwd_sweep.start_ticks = tL0+70000;
|
||||||
sweep_image(&sweep);
|
sweep_image(&fwd_sweep);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void submit_bwd_sweep(void)
|
||||||
|
{
|
||||||
|
bwd_sweep.start_ticks = tR0+50000;
|
||||||
|
sweep_image(&bwd_sweep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -144,6 +159,8 @@ sei();
|
|||||||
wake = 0;
|
wake = 0;
|
||||||
if (state == LEFT)
|
if (state == LEFT)
|
||||||
submit_fwd_sweep();
|
submit_fwd_sweep();
|
||||||
|
else if (state == RIGHT)
|
||||||
|
submit_bwd_sweep();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user