mirror of
git://projects.qi-hardware.com/antorcha.git
synced 2024-11-22 08:45:55 +02:00
tornado/fw/: display test text on positive zero crossing
This commit is contained in:
parent
c6bef66427
commit
f3c22bc6ab
@ -78,6 +78,11 @@ boot.elf: $(BOOT_OBJS)
|
|||||||
$(BUILD) $(OBJCOPY) -j .text -j .data -O ihex $< $@
|
$(BUILD) $(OBJCOPY) -j .text -j .data -O ihex $< $@
|
||||||
$(SIZE) $@
|
$(SIZE) $@
|
||||||
|
|
||||||
|
tornado.o: img.inc
|
||||||
|
|
||||||
|
img.inc: txt/t
|
||||||
|
(cd txt; ./t) >$@ || { rm -f $@; exit 1; }
|
||||||
|
|
||||||
# ----- Cleanup ---------------------------------------------------------------
|
# ----- Cleanup ---------------------------------------------------------------
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@ -86,6 +91,7 @@ clean:
|
|||||||
rm -f boot.hex boot.elf
|
rm -f boot.hex boot.elf
|
||||||
rm -f $(BOOT_OBJS) $(BOOT_OBJS:.o=.d)
|
rm -f $(BOOT_OBJS) $(BOOT_OBJS:.o=.d)
|
||||||
rm -f version.c version.d version.o
|
rm -f version.c version.d version.o
|
||||||
|
rm -f img.inc
|
||||||
|
|
||||||
# ----- Build version ---------------------------------------------------------
|
# ----- Build version ---------------------------------------------------------
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
#define F_CPU 8000000UL
|
#define F_CPU 8000000UL
|
||||||
#include <util/delay.h>
|
#include <util/delay.h>
|
||||||
|
|
||||||
@ -100,6 +101,11 @@ static uint16_t adc(bool x)
|
|||||||
#define HYSTERESIS 14
|
#define HYSTERESIS 14
|
||||||
|
|
||||||
|
|
||||||
|
static const uint8_t img[] PROGMEM = {
|
||||||
|
#include "img.inc"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static void zxing(uint16_t x, uint16_t y)
|
static void zxing(uint16_t x, uint16_t y)
|
||||||
{
|
{
|
||||||
static uint8_t one[LED_BYTES] =
|
static uint8_t one[LED_BYTES] =
|
||||||
@ -109,24 +115,30 @@ static void zxing(uint16_t x, uint16_t y)
|
|||||||
int16_t d;
|
int16_t d;
|
||||||
static bool up = 0;
|
static bool up = 0;
|
||||||
static bool on = 0;
|
static bool on = 0;
|
||||||
|
static const prog_uint8_t *p;
|
||||||
|
static uint16_t cols = 0;
|
||||||
|
|
||||||
e = y+(e-(e >> E_SHIFT));
|
e = y+(e-(e >> E_SHIFT));
|
||||||
m = y+(m-(m >> M_SHIFT));
|
m = y+(m-(m >> M_SHIFT));
|
||||||
d = (e >> E_SHIFT)-(m >> M_SHIFT);
|
d = (e >> E_SHIFT)-(m >> M_SHIFT);
|
||||||
if (on) {
|
|
||||||
on = 0;
|
|
||||||
led_off();
|
|
||||||
}
|
|
||||||
if (up) {
|
if (up) {
|
||||||
if (d < -HYSTERESIS)
|
if (d < -HYSTERESIS)
|
||||||
up = 0;
|
up = 0;
|
||||||
} else {
|
} else {
|
||||||
if (d > HYSTERESIS) {
|
if (d > HYSTERESIS) {
|
||||||
up = 1;
|
up = 1;
|
||||||
led_show(one);
|
p = img;
|
||||||
|
cols = sizeof(img)/LED_BYTES;
|
||||||
on = 1;
|
on = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (cols) {
|
||||||
|
led_show_pgm(p);
|
||||||
|
p += 8;
|
||||||
|
cols--;
|
||||||
|
} else {
|
||||||
|
led_off();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user