/*
serial.c - replacement for the modul of the same name in grbl
Make sure the simulator reads from stdin and writes to stdout.
Also print info about the last buffered block.
Part of Grbl Simulator
Copyright (c) 2012 Jens Geisler
Grbl 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 3 of the License, or
(at your option) any later version.
Grbl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl. If not, see .
*/
#include "../serial.h"
#include
#include "simulator.h"
#include
#include "kbhit.h"
//prototypes for overridden functions
uint8_t orig_serial_read();
//used to inject a sleep in grbl main loop,
// ensures hardware simulator gets some cycles in "parallel"
uint8_t serial_read() {
platform_sleep(0);
return orig_serial_read();
}
void simulate_write_interrupt(){
while (UCSR0B & (1<