Teensy 4.1 core updated for 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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef USBserial_h_
  2. #define USBserial_h_
  3. #include <inttypes.h>
  4. #include "Print.h"
  5. #include "Stream.h"
  6. class usb_rawhid_class
  7. {
  8. public:
  9. int available(void);
  10. int recv(void *buffer, uint16_t timeout);
  11. int send(const void *buffer, uint16_t timeout);
  12. };
  13. extern usb_rawhid_class RawHID;
  14. class usb_serial_class : public Stream
  15. {
  16. public:
  17. // standard Arduino functions
  18. void begin(long);
  19. void end();
  20. virtual int available();
  21. virtual int read();
  22. virtual int peek();
  23. virtual void flush();
  24. #if ARDUINO >= 100
  25. virtual size_t write(uint8_t);
  26. #else
  27. virtual void write(uint8_t);
  28. #endif
  29. using Print::write;
  30. operator bool();
  31. // Teensy extensions
  32. void send_now(void);
  33. uint32_t baud(void);
  34. uint8_t stopbits(void);
  35. uint8_t paritytype(void);
  36. uint8_t numbits(void);
  37. uint8_t dtr(void);
  38. uint8_t rts(void);
  39. private:
  40. uint8_t readnext(void);
  41. };
  42. extern usb_serial_class Serial;
  43. #endif