2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
3 Smoothie 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.
4 Smoothie 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.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
8 #ifndef SERIALCONSOLE_H
9 #define SERIALCONSOLE_H
11 #include "libs/Module.h"
12 #include "Serial.h" // mbed.h lib
13 #include "libs/Kernel.h"
17 #include "libs/RingBuffer.h"
18 #include "libs/StreamOutput.h"
21 #define baud_rate_setting_checksum CHECKSUM("baud_rate")
23 class SerialConsole
: public Module
, public StreamOutput
{
25 SerialConsole( PinName rx_pin
, PinName tx_pin
, int baud_rate
);
27 void on_module_loaded();
28 void on_serial_char_received();
29 void on_main_loop(void * argument
);
30 bool has_char(char letter
);
34 int puts(const char*);
36 //string receive_buffer; // Received chars are stored here until a newline character is received
37 //vector<std::string> received_lines; // Received lines are stored here until they are requested
38 RingBuffer
<char,256> buffer
; // Receive buffer