From 50008ddd5a4f64ee85e3a27881294831b41748a0 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 28 Mar 2022 12:36:38 -0700 Subject: [PATCH] Implement a "reset" method for the Model 100 --- .../src/kaleidoscope/device/keyboardio/Model100.cpp | 1 + .../src/kaleidoscope/device/keyboardio/Model100.h | 5 +++++ src/kaleidoscope/driver/mcu/GD32.h | 6 ++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp index 8b13028f..a1353d39 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp @@ -239,6 +239,7 @@ void Model100::enableHardwareTestMode() { } void Model100::rebootBootloader() { + USBCore().disconnect(); NVIC_SystemReset(); } diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.h index 99b08f6a..5e666c45 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.h @@ -43,6 +43,8 @@ struct cRGB { #include "kaleidoscope/driver/keyscanner/Base.h" #include "kaleidoscope/driver/led/Base.h" #include "kaleidoscope/driver/storage/GD32Flash.h" +#include "kaleidoscope/driver/mcu/GD32.h" + namespace kaleidoscope { namespace device { @@ -145,6 +147,9 @@ struct Model100Props : public kaleidoscope::device::BaseProps { typedef kaleidoscope::driver::bootloader::gd32::Base BootLoader; static constexpr const char *short_name = "kbio100"; + + typedef kaleidoscope::driver::mcu::GD32Props MCUProps; + typedef kaleidoscope::driver::mcu::GD32 MCU; }; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/src/kaleidoscope/driver/mcu/GD32.h b/src/kaleidoscope/driver/mcu/GD32.h index b9adafe6..b6ac7b8d 100644 --- a/src/kaleidoscope/driver/mcu/GD32.h +++ b/src/kaleidoscope/driver/mcu/GD32.h @@ -17,6 +17,8 @@ #pragma once +#include // NVIC_Reset +#include // For connect, disconnect, USBCore #include "kaleidoscope/driver/mcu/Base.h" // for Base, BaseProps namespace kaleidoscope { @@ -31,10 +33,10 @@ template class GD32 : public kaleidoscope::driver::mcu::Base<_Props> { public: void detachFromHost() { - USBCore::disconnect(); + USBCore().disconnect(); } void attachToHost() { - USBCore::connect(); + USBCore().connect(); }