Read fixed number of bytes into buffer.
- Parameters
-
| buffer | Pointer to destination buffer |
| length | Number of bytes to read |
- Returns
- Number of bytes actually read
Reads up to length bytes from serial. May return fewer bytes if timeout occurs.
Definition at line 176 of file serial.cpp.hpp.
176 {
177 if (!buffer ||
length == 0) {
178 return 0;
179 }
180
181 size_t count = 0;
183
187 if (c != -1) {
188 buffer[count++] =
static_cast<u8>(c);
190 }
191 }
192 }
193
194 return count;
195}
int read() FL_NO_EXCEPT
Read next byte from serial input.
int available() FL_NO_EXCEPT
Check how many bytes are available to read.
fl::UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)
fl::u32 millis() FL_NO_EXCEPT
Universal millisecond timer - returns milliseconds since system startup.
References fl::available(), fl::FL_NO_EXCEPT, length(), fl::millis(), mTimeoutMs, and fl::read().