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)
312312
313313size_t Keyboard_::write (uint8_t c)
314314{
315- if (c == ' \r ' ) {
316- // ignore it
317- return 0 ;
318- }
319- if (c == ' \n ' ) {
320- c = KEY_RETURN;
321- }
322315 uint8_t p = press (c); // Keydown
323316 release (c); // Keyup
324317 return p; // just return the result of press() since release() almost always returns 1
325318}
326319
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+
327335Keyboard_ Keyboard;
328336
329337#endif
Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ class Keyboard_ : public Print
102102 void begin (void );
103103 void end (void );
104104 size_t write (uint8_t k);
105+ size_t write (const uint8_t *buffer, size_t size);
105106 size_t press (uint8_t k);
106107 size_t release (uint8_t k);
107108 void releaseAll (void );
You can’t perform that action at this time.
0 commit comments