You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.6 KiB
C
53 lines
1.6 KiB
C
/*
|
|
* Copyright (C) 2019 Akshay Patwardhan
|
|
* akshay.patwardhan@outlook.com
|
|
*
|
|
* Please go through readme.md for usage and other instructions, if any.
|
|
*
|
|
* 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/>.
|
|
*/
|
|
|
|
// Guarding macro start
|
|
#ifndef UART_H
|
|
#define UART_H
|
|
|
|
// Includes begin
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stddef.h>
|
|
#include <time.h>
|
|
#include <termios.h>
|
|
#include <fcntl.h>
|
|
#include <unistd.h>
|
|
#include <sys/types.h>
|
|
#include <string.h>
|
|
|
|
// Error codes and return values
|
|
#define UART_FUNCTION_SUCCESSFUL 0
|
|
#define UART_NUMBER_INCORRECT 1
|
|
#define UART_BAUDRATE_INCORRECT 2
|
|
#define UART_FIFO_ERROR 3
|
|
#define UART_INCORRECT_PATH 4
|
|
|
|
// Function declarations
|
|
/*
|
|
* uartNumber as unsigned char (8 bits) to reduce RAM usage
|
|
*/
|
|
int uartConf(unsigned char uartNumber, int baudRate);
|
|
int uartClose(unsigned char uartNumber);
|
|
int uartTransmit(unsigned char uartNumber, unsigned char message[]);
|
|
int uartReceive(unsigned char uartNumber);
|
|
|
|
// Guarding macro end
|
|
#endif // UART_H
|