1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-23 21:17:31 +02:00

ubb-la/gui.c: show division size (in samples and seconds)

This commit is contained in:
Werner Almesberger 2013-01-31 01:21:56 -03:00
parent 8d81b584a0
commit cdcfb6c181

View File

@ -65,6 +65,10 @@
#define FREQ_Y 220
#define INTERVAL_X 0
#define INTERVAL_Y 230
#define DIV_SAMP_X (80-8)
#define DIV_SAMP_Y FREQ_Y
#define DIV_INT_X 80
#define DIV_INT_Y INTERVAL_Y
#define REPEAT_DELAY_MS 300
#define REPEAT_INTERVAL_MS 30
@ -340,10 +344,15 @@ static void si_text(int x, int y, double v, const char *unit)
}
static void show_freq(double freq)
static void show_freq(double freq, int zoom)
{
int div;
si_text(FREQ_X, FREQ_Y, freq, "Sa/s");
si_text(INTERVAL_X, INTERVAL_Y, 1/freq, "s/Sa");
div = (DIV_X >> MAX_ZOOM) << (MAX_ZOOM-zoom);
textf(DIV_SAMP_X, DIV_SAMP_Y, TEXT_RGBA, "%4dSa/div", div);
si_text(DIV_INT_X, DIV_INT_Y, div/freq, "s/div");
}
@ -387,7 +396,7 @@ void gui(const uint8_t *buf, int skip, int nibbles, double freq)
textf(0, ch_y(i, 1), LABEL_RGBA, "CH%d", i);
show_divisions();
show_buffer(buf, skip, nibbles, CH_XOFF, XRES, zoom, pos);
show_freq(freq);
show_freq(freq, zoom);
update();
while (1) {