calculator/include/serial.h

49 lines
1.3 KiB
C
Raw Normal View History

/**
* @file serial.h
* Provides basic serial IO (through STM debug stuff)
2018-03-25 21:16:33 -04:00
*
* Copyright (C) 2018 Clyne Sullivan
*
* This program 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.
*
* This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
*/
2018-01-06 19:47:40 -05:00
#ifndef SERIAL_H_
#define SERIAL_H_
/**
* Initializes the serial device.
*/
2018-01-06 19:47:40 -05:00
void serial_init(void);
/**
* Puts the given character through serial.
* @param c the character to send
*/
2018-01-06 19:47:40 -05:00
void serial_put(int c);
2018-01-23 08:23:46 -05:00
/**
* Gets a character from serial.
* @return the character
*/
2018-01-06 19:47:40 -05:00
char serial_get(void);
/**
* Gets a string from serial, cut off by a newline.
* @param buf the initialized buffer to fill
* @param max the max amount of bytes to write to the buffer
*/
2018-01-25 11:00:18 -05:00
void serial_gets(char *buf, int max);
2018-01-06 19:47:40 -05:00
#endif // SERIAL_H_