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.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * serial.h
  3. *
  4. * Copyright 2011 Thomas Buck <xythobuz@me.com>
  5. *
  6. * This file is part of xyRobot.
  7. *
  8. * xyRobot is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * xyRobot is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with xyRobot. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #ifndef serial_h_
  22. #define serial_h_
  23. // RX & TX buffer size in bytes
  24. #define RX_BUFFER_SIZE 32
  25. #define TX_BUFFER_SIZE 32
  26. // Select Baudrate with this macro
  27. #define UART_BAUD_SELECT(baudRate,xtalCpu) ((xtalCpu)/((baudRate)*16l)-1)
  28. #define ODD 2
  29. #define EVEN 1
  30. #define NONE 0
  31. uint8_t serialInit(uint16_t baud, uint8_t databits, uint8_t parity, uint8_t stopbits);
  32. uint8_t serialHasChar(void);
  33. uint8_t serialGet(void);
  34. // 1 if space remaining, 0 if full
  35. uint8_t serialBufferSpaceRemaining(void);
  36. void serialWrite(uint8_t data);
  37. void serialWriteString(char *data);
  38. void serialClose(void);
  39. #endif /* SERIAL_H_ */