Root/fw/sweep.h

Source at commit a11670bb7bb6e506db72463fea6738100b22c9a7 created 11 years 17 days ago.
By Werner Almesberger, tornado/fw/sim/alg.c: accept data from standard input; fix "process"
1/*
2 * fw/sweep.h - Image sweep
3 *
4 * Written 2012 by Werner Almesberger
5 * Copyright 2012 Werner Almesberger
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13
14#ifndef SWEEP_H
15#define SWEEP_H
16
17#include <stdbool.h>
18#include <stdint.h>
19
20#include <avr/io.h>
21
22#include "image.h"
23
24
25struct sweep {
26    uint32_t start_ticks; /* absolute start time */
27    uint16_t pixel_ticks; /* number of ticks per pixel */
28    uint8_t left; /* leftmost line of image */
29    uint8_t right; /* rightmost line of image */
30    bool forward; /* direction of movement */
31};
32
33
34extern volatile bool sweeping;
35
36
37static inline void set_line(struct line line)
38{
39    PORTB = (PORTB & 0x3f) | (line.cb & 0xc0);
40    PORTC = line.cb;
41    PORTD = line.d;
42}
43
44
45uint32_t uptime_irq(void);
46uint32_t uptime(void);
47
48void sweep_image(const struct sweep *sweep);
49void sweep_init(void);
50
51#endif /* !SWEEP_H */
52

Archive Download this file

Branches:
master
tornado-v1



interactive