Date:2012-12-04 11:28:55 (11 years 3 months ago)
Author:Werner Almesberger
Commit:f3c22bc6abe96c81146aff8070ca1d6c6946af39
Message:tornado/fw/: display test text on positive zero crossing

Files: tornado/fw/Makefile (2 diffs)
tornado/fw/tornado.c (3 diffs)

Change Details

tornado/fw/Makefile
7878        $(BUILD) $(OBJCOPY) -j .text -j .data -O ihex $< $@
7979        $(SIZE) $@
8080
81tornado.o: img.inc
82
83img.inc: txt/t
84        (cd txt; ./t) >$@ || { rm -f $@; exit 1; }
85
8186# ----- Cleanup ---------------------------------------------------------------
8287
8388clean:
...... 
8691        rm -f boot.hex boot.elf
8792        rm -f $(BOOT_OBJS) $(BOOT_OBJS:.o=.d)
8893        rm -f version.c version.d version.o
94        rm -f img.inc
8995
9096# ----- Build version ---------------------------------------------------------
9197
tornado/fw/tornado.c
22#include <stdint.h>
33
44#include <avr/interrupt.h>
5#include <avr/pgmspace.h>
56#define F_CPU 8000000UL
67#include <util/delay.h>
78
...... 
100101#define HYSTERESIS 14
101102
102103
104static const uint8_t img[] PROGMEM = {
105    #include "img.inc"
106};
107
108
103109static void zxing(uint16_t x, uint16_t y)
104110{
105111    static uint8_t one[LED_BYTES] =
...... 
109115    int16_t d;
110116    static bool up = 0;
111117    static bool on = 0;
118    static const prog_uint8_t *p;
119    static uint16_t cols = 0;
112120
113121    e = y+(e-(e >> E_SHIFT));
114122    m = y+(m-(m >> M_SHIFT));
115123    d = (e >> E_SHIFT)-(m >> M_SHIFT);
116    if (on) {
117        on = 0;
118        led_off();
119    }
120124    if (up) {
121125        if (d < -HYSTERESIS)
122126            up = 0;
123127    } else {
124128        if (d > HYSTERESIS) {
125129            up = 1;
126            led_show(one);
130            p = img;
131            cols = sizeof(img)/LED_BYTES;
127132            on = 1;
128133        }
129134    }
135    if (cols) {
136        led_show_pgm(p);
137        p += 8;
138        cols--;
139    } else {
140        led_off();
141    }
130142}
131143
132144

Archive Download the corresponding diff file

Branches:
master
tornado-v1



interactive