diff --git a/src/kaleidoscope/Hardware.h b/src/kaleidoscope/Hardware.h index 805730aa..35a303a4 100644 --- a/src/kaleidoscope/Hardware.h +++ b/src/kaleidoscope/Hardware.h @@ -198,14 +198,17 @@ class Hardware { * Must detach the device, without rebooting or cutting power. Only the end * points should get detached, the device must remain powered on. */ - void detachFromHost() {} + void detachFromHost() { + UDCON |= _BV(DETACH); + } /** * Attack the device to the host. * * Must restore the link detachFromHost severed. */ - void attachToHost() {} - + void attachToHost() { + UDCON &= ~_BV(DETACH); + } /** @} */ /** diff --git a/src/kaleidoscope/hardware/ATMegaKeyboard.cpp b/src/kaleidoscope/hardware/ATMegaKeyboard.cpp index 230eb3de..59f17401 100644 --- a/src/kaleidoscope/hardware/ATMegaKeyboard.cpp +++ b/src/kaleidoscope/hardware/ATMegaKeyboard.cpp @@ -51,14 +51,6 @@ void ATMegaKeyboard::setup(void) { TIMSK1 = _BV(TOIE1); } -void ATMegaKeyboard::detachFromHost() { - UDCON |= _BV(DETACH); -} - -void ATMegaKeyboard::attachToHost() { - UDCON &= ~_BV(DETACH); -} - void __attribute__((optimize(3))) ATMegaKeyboard::readMatrix(void) { for (uint8_t current_row = 0; current_row < KeyboardHardware.matrix_rows; current_row++) { uint16_t mask, cols; diff --git a/src/kaleidoscope/hardware/ATMegaKeyboard.h b/src/kaleidoscope/hardware/ATMegaKeyboard.h index f44fafe7..13d56483 100644 --- a/src/kaleidoscope/hardware/ATMegaKeyboard.h +++ b/src/kaleidoscope/hardware/ATMegaKeyboard.h @@ -80,17 +80,6 @@ class ATMegaKeyboard : public kaleidoscope::Hardware { void setup(void); - /** Detaching from / attaching to the host. - * - * These two functions should detach the device from (or attach it to) the - * host, preferably without rebooting the device. Their purpose is to allow - * one to do some configuration inbetween, so the re-attach happens with - * different properties. The device remains powered between these operations, - * only the connection to the host gets severed. - */ - void detachFromHost(); - void attachToHost(); - void readMatrix(void); /** diff --git a/src/kaleidoscope/hardware/ez/ErgoDox.cpp b/src/kaleidoscope/hardware/ez/ErgoDox.cpp index 46f1fdd6..b5228780 100644 --- a/src/kaleidoscope/hardware/ez/ErgoDox.cpp +++ b/src/kaleidoscope/hardware/ez/ErgoDox.cpp @@ -223,14 +223,6 @@ void ErgoDox::debounceRow(uint8_t change, uint8_t row) { } } -void ErgoDox::detachFromHost() { - UDCON |= (1 << DETACH); -} - -void ErgoDox::attachToHost() { - UDCON &= ~(1 << DETACH); -} - bool ErgoDox::isKeyswitchPressed(byte row, byte col) { return (bitRead(keyState_[row], col) != 0); } diff --git a/src/kaleidoscope/hardware/ez/ErgoDox.h b/src/kaleidoscope/hardware/ez/ErgoDox.h index 000d537d..ff765d37 100644 --- a/src/kaleidoscope/hardware/ez/ErgoDox.h +++ b/src/kaleidoscope/hardware/ez/ErgoDox.h @@ -61,17 +61,6 @@ class ErgoDox : public kaleidoscope::Hardware { void actOnMatrixScan(void); void setup(); - /** Detaching from / attaching to the host. - * - * These two functions should detach the device from (or attach it to) the - * host, preferably without rebooting the device. Their purpose is to allow - * one to do some configuration inbetween, so the re-attach happens with - * different properties. The device remains powered between these operations, - * only the connection to the host gets severed. - */ - void detachFromHost(); - void attachToHost(); - /* Key masking * ----------- * diff --git a/src/kaleidoscope/hardware/keyboardio/Model01.cpp b/src/kaleidoscope/hardware/keyboardio/Model01.cpp index f0f67980..0db65458 100644 --- a/src/kaleidoscope/hardware/keyboardio/Model01.cpp +++ b/src/kaleidoscope/hardware/keyboardio/Model01.cpp @@ -292,14 +292,6 @@ void Model01::setKeyscanInterval(uint8_t interval) { rightHand.setKeyscanInterval(interval); } -void Model01::detachFromHost() { - UDCON |= (1 << DETACH); -} - -void Model01::attachToHost() { - UDCON &= ~(1 << DETACH); -} - bool Model01::isKeyswitchPressed(byte row, byte col) { if (col <= 7) { return (bitRead(leftHandState.rows[row], 7 - col) != 0); diff --git a/src/kaleidoscope/hardware/keyboardio/Model01.h b/src/kaleidoscope/hardware/keyboardio/Model01.h index 33dde527..0360e8cc 100644 --- a/src/kaleidoscope/hardware/keyboardio/Model01.h +++ b/src/kaleidoscope/hardware/keyboardio/Model01.h @@ -55,17 +55,6 @@ class Model01 : public kaleidoscope::Hardware { void setup(); void rebootBootloader(); - /** Detaching from / attaching to the host. - * - * These two functions should detach the device from (or attach it to) the - * host, preferably without rebooting the device. Their purpose is to allow - * one to do some configuration inbetween, so the re-attach happens with - * different properties. The device remains powered between these operations, - * only the connection to the host gets severed. - */ - void detachFromHost(); - void attachToHost(); - /* These public functions are things supported by the Model 01, but * aren't necessarily part of the Kaleidoscope API */