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.

45 lines
943B

  1. #ifndef USBserial_h_
  2. #define USBserial_h_
  3. #include <inttypes.h>
  4. #include "Stream.h"
  5. class usb_serial_class : public Stream
  6. {
  7. public:
  8. void begin(long);
  9. void end();
  10. virtual int available();
  11. virtual int read();
  12. virtual int peek();
  13. virtual void flush();
  14. #if ARDUINO >= 100
  15. virtual size_t write(uint8_t c) { return write(&c, 1); }
  16. virtual size_t write(const uint8_t *buffer, uint16_t size);
  17. using Print::write;
  18. #else
  19. virtual void write(uint8_t c) { write(&c, 1); }
  20. virtual void write(const uint8_t *buffer, uint16_t size);
  21. virtual void write(const char *s) { write((const uint8_t *)s, strlen(s)); }
  22. #endif
  23. void send_now(void);
  24. uint32_t baud(void);
  25. uint8_t stopbits(void);
  26. uint8_t paritytype(void);
  27. uint8_t numbits(void);
  28. uint8_t dtr(void);
  29. uint8_t rts(void);
  30. operator bool();
  31. #if ARDUINO >= 100
  32. size_t readBytes(char *buffer, size_t length);
  33. #endif
  34. private:
  35. int16_t peek_buf;
  36. };
  37. extern usb_serial_class Serial;
  38. #endif