serial.h 502 B

1234567891011121314151617181920212223
  1. #ifndef __SERIAL_H
  2. #define __SERIAL_H
  3. #include <stdint.h>
  4. #include <termios.h>
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. int serial_init(const char *device,
  9. int baud, char parity, int data_bit,
  10. int stop_bit, struct termios *old_tios);
  11. void serial_close(int s, struct termios *old_tios);
  12. int serial_send(int s, const uint8_t *buf, int length);
  13. int serial_receive(int s, uint8_t *buf, int bufsz, int timeout);
  14. int serial_flush(int s);
  15. #ifdef __cplusplus
  16. }
  17. #endif
  18. #endif