Root/
| Source at commit d278ebb4ad2cb58e226f49eb96e7525f36e7e1c2 created 10 years 11 months ago. By Werner Almesberger, tornado/led/: update schematics for new power distribution | |
|---|---|
| 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 | |
| 25 | struct 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 | |
| 34 | extern volatile bool sweeping; |
| 35 | |
| 36 | |
| 37 | static 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 | |
| 45 | uint32_t uptime_irq(void); |
| 46 | uint32_t uptime(void); |
| 47 | |
| 48 | void sweep_image(const struct sweep *sweep); |
| 49 | void sweep_init(void); |
| 50 | |
| 51 | #endif /* !SWEEP_H */ |
| 52 | |
Branches:
master
tornado-v1
