diff --git a/src/kaleidoscope/hardware/ErgoDox.cpp b/src/kaleidoscope/hardware/ErgoDox.cpp index 43965cde..7fc5728e 100644 --- a/src/kaleidoscope/hardware/ErgoDox.cpp +++ b/src/kaleidoscope/hardware/ErgoDox.cpp @@ -217,6 +217,14 @@ void ErgoDox::debounceRow(uint8_t change, uint8_t row) { } } +void ErgoDox::detachFromHost() { + UDCON |= (1 << DETACH); +} + +void ErgoDox::attachToHost() { + UDCON &= ~(1 << DETACH); +} + } } diff --git a/src/kaleidoscope/hardware/ErgoDox.h b/src/kaleidoscope/hardware/ErgoDox.h index f9d7ae7c..9a11e0cd 100644 --- a/src/kaleidoscope/hardware/ErgoDox.h +++ b/src/kaleidoscope/hardware/ErgoDox.h @@ -63,6 +63,17 @@ class ErgoDox { 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 * ----------- *