Skip to content

Commit 3d15f37

Browse files
committed
eliminated Keyboard.type() - unnecessary duplication of Keyboard.write() (David Mellis). Also edit KeyboardReprogram example which was the only example using type()
1 parent 57b3395 commit 3d15f37

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

build/shared/examples/09. USB (Leonardo only)/Keyboard/KeyboardReprogram/KeyboardReprogram.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* wire to connect D2 to ground.
1616
1717
created 5 Mar 2012
18-
modified 27 Mar 2012
18+
modified 28 Mar 2012
1919
by Tom Igoe
2020
2121
This example is in the public domain
@@ -63,7 +63,7 @@ void loop() {
6363
// 3000 ms is too long. Delete it:
6464
for (int keystrokes=0; keystrokes < 6; keystrokes++) {
6565
delay(500);
66-
Keyboard.type(KEY_BACKSPACE);
66+
Keyboard.write(KEY_BACKSPACE);
6767
}
6868
// make it 1000 instead:
6969
Keyboard.println("1000);");

hardware/arduino/cores/arduino/HID.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,7 @@ void Keyboard_::releaseAll(void)
591591
sendReport(&_keyReport);
592592
}
593593

594-
// type() does a press and release of the specified key.
595-
size_t Keyboard_::type(uint8_t c)
594+
size_t Keyboard_::write(uint8_t c)
596595
{
597596
uint8_t p = press(c); // Keydown
598597
uint8_t r = release(c); // Keyup

hardware/arduino/cores/arduino/USBAPI.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ class Keyboard_ : public Print
126126
Keyboard_(void);
127127
void begin(void);
128128
void end(void);
129-
virtual size_t write(uint8_t k) {return type(k);};
130-
virtual size_t type(uint8_t k);
129+
virtual size_t write(uint8_t k);
131130
virtual size_t press(uint8_t k);
132131
virtual size_t release(uint8_t k);
133132

0 commit comments

Comments
 (0)