You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
553 B

4 years ago
  1. /*
  2. * uart.h
  3. *
  4. * Created on: Aug 5, 2019
  5. * Author: cristian
  6. */
  7. #include <termios.h>
  8. #include <unistd.h>
  9. #ifndef SRC_UART_H_
  10. #define SRC_UART_H_
  11. #define UART_FAILURE -1
  12. #define UART_SUCCESS 0
  13. #define DEBUG
  14. struct UartDevice {
  15. char* name;
  16. int rate;
  17. int fd;
  18. struct termios *tty;
  19. };
  20. int uartStart(struct UartDevice* dev, unsigned char canonic);
  21. int uartSend(struct UartDevice* dev, char *data, int size);
  22. int uartReceive(struct UartDevice* dev, char* data, int size_max);
  23. int uartStop(struct UartDevice* dev);
  24. #endif /* SRC_UART_H_ */