Plotter/main.cpp
2017-09-22 21:40:29 +02:00

43 lines
796 B
C++

#include <stdint.h>
#include <stdio.h>
#include "point.h"
#include "hpglparser.h"
#include "plotter.h"
#include "serial.h"
#include "pwm.h"
int main()
{
DDRB = 0xFF;
Serial serial;
sei();
/*serial.write("UVOS plotter interface\n");
serial.write(1250);
serial.putChar('\n');*/
Plotter plotter(&PORTB, PB4, &serial);
HpglParser parser(&plotter);
while(true)
{
if(serial.dataIsWaiting())
{
char ch = serial.getChar();
int parseRetrun = parser.add(ch);
if(parseRetrun == 1)
{
serial.write("ok\n");
}
else if(parseRetrun == 2)
{
serial.write("overrun!, ok\n");
}
}
}
}