Loading...
Searching...
No Matches
SerialUSB.h
Go to the documentation of this file.
1
9#pragma once
10
11#include "api/HardwareSerial.h"
12
19class SerialUSBClass : public arduino::HardwareSerial {
20public:
25 void begin(unsigned long baud) override { (void)baud; }
26
32 void begin(unsigned long baud, uint16_t config) override { (void)baud; (void)config; }
33
37 void end() override {}
38
43 int available() override;
44
49 int peek() override;
50
55 int read() override;
56
60 void flush() override;
61
67 size_t write(uint8_t c) override { return write(&c, 1); }
68
78 size_t write(const uint8_t* buffer, size_t size) override;
79 using arduino::Print::write;
80
87 operator bool() override;
88};
89
92
void serialUsbInitStack()
Starts TinyUSB and its 1 ms background task. Called once from init().
SerialUSBClass Serial
USB serial port, the one the Serial Monitor uses.
Serial port over the board's USB connection; sketches use Serial.
Definition SerialUSB.h:19
void end() override
Does nothing: the port stays up so the IDE can still upload.
Definition SerialUSB.h:37
int read() override
Takes the next received byte from the buffer.
size_t write(uint8_t c) override
Sends one byte.
Definition SerialUSB.h:67
void begin(unsigned long baud) override
Does nothing: the port starts before setup().
Definition SerialUSB.h:25
void begin(unsigned long baud, uint16_t config) override
Does nothing: the port starts before setup().
Definition SerialUSB.h:32
int peek() override
Next received byte, left in the buffer.
void flush() override
Sends any bytes still held in the USB buffer.
size_t write(const uint8_t *buffer, size_t size) override
Sends a block of bytes.
int available() override
Number of received bytes waiting to be read.