PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
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.

преди 3 години
12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. int availableForWrite(void);
  24. void clear(void);
  25. void send_now(void);
  26. uint32_t baud(void);
  27. uint8_t stopbits(void);
  28. uint8_t paritytype(void);
  29. uint8_t numbits(void);
  30. uint8_t dtr(void);
  31. uint8_t rts(void);
  32. operator bool();
  33. #if ARDUINO >= 100
  34. size_t readBytes(char *buffer, size_t length);
  35. #endif
  36. private:
  37. int16_t peek_buf;
  38. };
  39. extern usb_serial_class Serial;
  40. #endif