39 lines
737 B
C++
39 lines
737 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;
|
|
|
|
sei();
|
|
Serial serial;
|
|
|
|
|
|
Plotter plotter(&PORTB, PB4);
|
|
HpglParser parser(&plotter);
|
|
|
|
//serial.putString("UVOS plotter interface\n");
|
|
while(true)
|
|
{
|
|
if(serial.dataIsWaiting())
|
|
{
|
|
char ch = serial.getChar();
|
|
int parseRetrun = parser.add(ch);
|
|
if(parseRetrun == 1)
|
|
{
|
|
serial.putString("ok\n");
|
|
}
|
|
else if(parseRetrun == 2)
|
|
{
|
|
serial.putString("overrun!, ok\n");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|