gnea\grbl-Mega  1.0f
Source Code Documentation ( Internal Workings )
serial.h
Go to the documentation of this file.
1 /*
2  serial.c - Low level functions for sending and recieving bytes via the serial port
3  Part of Grbl
4 
5  Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
6  Copyright (c) 2009-2011 Simen Svale Skogsrud
7 
8  Grbl is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  Grbl is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with Grbl. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef serial_h
23 #define serial_h
24 
25 
26 #ifndef RX_BUFFER_SIZE
27  #define RX_BUFFER_SIZE 255
28 #endif
29 #ifndef TX_BUFFER_SIZE
30  #define TX_BUFFER_SIZE 255
31 #endif
32 
33 #define SERIAL_NO_DATA 0xff
34 
35 
36 void serial_init();
38 void serial_write(uint8_t data);
40 uint8_t serial_read();
46 //
50 //
53 
54 #endif
uint8_t serial_get_tx_buffer_count()
Returns the number of bytes used in the TX serial buffer.
Definition: serial.c:56
uint8_t serial_read()
Fetches the first byte in the serial read buffer. Called by main program.
Definition: serial.c:122
void serial_write(uint8_t data)
Writes one byte to the TX serial buffer. Called by main program.
Definition: serial.c:84
void serial_init()
Definition: serial.c:64
void serial_reset_read_buffer()
Reset and empty data in read buffer. Used by e-stop and reset.
Definition: serial.c:195
uint8_t serial_get_rx_buffer_available()
Returns the number of bytes available in the RX serial buffer.
Definition: serial.c:36
uint8_t serial_get_rx_buffer_count()
Returns the number of bytes used in the RX serial buffer.
Definition: serial.c:46