File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -312,18 +312,26 @@ void Keyboard_::releaseAll(void)
312
312
313
313
size_t Keyboard_::write (uint8_t c)
314
314
{
315
- if (c == ' \r ' ) {
316
- // ignore it
317
- return 0 ;
318
- }
319
- if (c == ' \n ' ) {
320
- c = KEY_RETURN;
321
- }
322
315
uint8_t p = press (c); // Keydown
323
316
release (c); // Keyup
324
317
return p; // just return the result of press() since release() almost always returns 1
325
318
}
326
319
320
+ size_t Keyboard_::write (const uint8_t *buffer, size_t size) {
321
+ size_t n = 0 ;
322
+ while (size--) {
323
+ if (*buffer != ' \r ' ) {
324
+ if (write (*buffer)) {
325
+ n++;
326
+ } else {
327
+ break ;
328
+ }
329
+ }
330
+ buffer++;
331
+ }
332
+ return n;
333
+ }
334
+
327
335
Keyboard_ Keyboard;
328
336
329
337
#endif
Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ class Keyboard_ : public Print
102
102
void begin (void );
103
103
void end (void );
104
104
size_t write (uint8_t k);
105
+ size_t write (const uint8_t *buffer, size_t size);
105
106
size_t press (uint8_t k);
106
107
size_t release (uint8_t k);
107
108
void releaseAll (void );
You can’t perform that action at this time.
0 commit comments