1
0
mirror of git://projects.qi-hardware.com/antorcha.git synced 2024-06-10 12:26:23 +03:00
antorcha/fw/sweep.h

52 lines
1.0 KiB
C

/*
* fw/sweep.h - Image sweep
*
* Written 2012 by Werner Almesberger
* Copyright 2012 Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef SWEEP_H
#define SWEEP_H
#include <stdbool.h>
#include <stdint.h>
#include <avr/io.h>
#include "image.h"
struct sweep {
uint32_t start_ticks; /* absolute start time */
uint16_t pixel_ticks; /* number of ticks per pixel */
uint8_t left; /* leftmost line of image */
uint8_t right; /* rightmost line of image */
bool forward; /* direction of movement */
};
extern volatile bool sweeping;
static inline void set_line(struct line line)
{
PORTB = (PORTB & 0x3f) | (line.cb & 0xc0);
PORTC = line.cb;
PORTD = line.d;
}
uint32_t uptime_irq(void);
uint32_t uptime(void);
void sweep_image(const struct sweep *sweep);
void sweep_init(void);
#endif /* !SWEEP_H */