From 3d15f3781aeeca0a2e6aa9403af55ebeac6d5959 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Wed, 28 Mar 2012 18:35:26 -0400 Subject: [PATCH] eliminated Keyboard.type() - unnecessary duplication of Keyboard.write() (David Mellis). Also edit KeyboardReprogram example which was the only example using type() --- .../Keyboard/KeyboardReprogram/KeyboardReprogram.ino | 4 ++-- hardware/arduino/cores/arduino/HID.cpp | 3 +-- hardware/arduino/cores/arduino/USBAPI.h | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/build/shared/examples/09. USB (Leonardo only)/Keyboard/KeyboardReprogram/KeyboardReprogram.ino b/build/shared/examples/09. USB (Leonardo only)/Keyboard/KeyboardReprogram/KeyboardReprogram.ino index 1178b19b5..5ee021266 100644 --- a/build/shared/examples/09. USB (Leonardo only)/Keyboard/KeyboardReprogram/KeyboardReprogram.ino +++ b/build/shared/examples/09. USB (Leonardo only)/Keyboard/KeyboardReprogram/KeyboardReprogram.ino @@ -15,7 +15,7 @@ * wire to connect D2 to ground. created 5 Mar 2012 - modified 27 Mar 2012 + modified 28 Mar 2012 by Tom Igoe This example is in the public domain @@ -63,7 +63,7 @@ void loop() { // 3000 ms is too long. Delete it: for (int keystrokes=0; keystrokes < 6; keystrokes++) { delay(500); - Keyboard.type(KEY_BACKSPACE); + Keyboard.write(KEY_BACKSPACE); } // make it 1000 instead: Keyboard.println("1000);"); diff --git a/hardware/arduino/cores/arduino/HID.cpp b/hardware/arduino/cores/arduino/HID.cpp index b556223a5..dfcbd9d25 100644 --- a/hardware/arduino/cores/arduino/HID.cpp +++ b/hardware/arduino/cores/arduino/HID.cpp @@ -591,8 +591,7 @@ void Keyboard_::releaseAll(void) sendReport(&_keyReport); } -// type() does a press and release of the specified key. -size_t Keyboard_::type(uint8_t c) +size_t Keyboard_::write(uint8_t c) { uint8_t p = press(c); // Keydown uint8_t r = release(c); // Keyup diff --git a/hardware/arduino/cores/arduino/USBAPI.h b/hardware/arduino/cores/arduino/USBAPI.h index e83089aea..ee35af92d 100644 --- a/hardware/arduino/cores/arduino/USBAPI.h +++ b/hardware/arduino/cores/arduino/USBAPI.h @@ -126,8 +126,7 @@ public: Keyboard_(void); void begin(void); void end(void); - virtual size_t write(uint8_t k) {return type(k);}; - virtual size_t type(uint8_t k); + virtual size_t write(uint8_t k); virtual size_t press(uint8_t k); virtual size_t release(uint8_t k);