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 179 of file serial.cpp.hpp.
179 {
180 if (!buffer ||
length == 0) {
181 return 0;
182 }
183
184 size_t count = 0;
186
190 if (c != -1) {
191 buffer[count++] =
static_cast<u8>(c);
193 }
194 }
195 }
196
197 return count;
198}
int available()
Check how many bytes are available to read.
int read()
Read next byte from serial input.
fl::UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
References available(), length(), fl::millis(), mTimeoutMs, and read().