Simple single-color 8x8x8 LED Cube with AVRs
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

serial.h 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * POSIX compatible serial port library
  3. * Uses 8 databits, no parity, 1 stop bit, no handshaking
  4. * By: Thomas Buck <taucher.bodensee@gmail.com>
  5. * Visit: www.xythobuz.org
  6. *
  7. * serial.h
  8. *
  9. * Copyright 2012 Thomas Buck <xythobuz@me.com>
  10. *
  11. * This file is part of LED-Cube.
  12. *
  13. * LED-Cube is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation, either version 3 of the License, or
  16. * (at your option) any later version.
  17. *
  18. * LED-Cube is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with LED-Cube. If not, see <http://www.gnu.org/licenses/>.
  25. */
  26. // Use POSIX Baud constants (B2400, B9600...)
  27. #define BAUD B38400
  28. // Searchterm for ports in unix
  29. #define SEARCH "tty."
  30. // Open the serial port. Return 0 on success, -1 on error
  31. int serialOpen(char *port);
  32. // Write to port. Returns number of characters sent, -1 on error
  33. ssize_t serialWrite(char *data, size_t length);
  34. // Read from port. Return number of characters read, 0 if none available, -1 on error
  35. ssize_t serialRead(char *data, size_t length);
  36. // Close the serial Port
  37. void serialClose(void);
  38. // String array with serial port names
  39. char** getSerialPorts(void);