Implement a "reset" method for the Model 100

pull/1148/head
Jesse Vincent 3 years ago
parent 4ca969092b
commit 50008ddd5a
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -239,6 +239,7 @@ void Model100::enableHardwareTestMode() {
} }
void Model100::rebootBootloader() { void Model100::rebootBootloader() {
USBCore().disconnect();
NVIC_SystemReset(); NVIC_SystemReset();
} }

@ -43,6 +43,8 @@ struct cRGB {
#include "kaleidoscope/driver/keyscanner/Base.h" #include "kaleidoscope/driver/keyscanner/Base.h"
#include "kaleidoscope/driver/led/Base.h" #include "kaleidoscope/driver/led/Base.h"
#include "kaleidoscope/driver/storage/GD32Flash.h" #include "kaleidoscope/driver/storage/GD32Flash.h"
#include "kaleidoscope/driver/mcu/GD32.h"
namespace kaleidoscope { namespace kaleidoscope {
namespace device { namespace device {
@ -145,6 +147,9 @@ struct Model100Props : public kaleidoscope::device::BaseProps {
typedef kaleidoscope::driver::bootloader::gd32::Base BootLoader; typedef kaleidoscope::driver::bootloader::gd32::Base BootLoader;
static constexpr const char *short_name = "kbio100"; static constexpr const char *short_name = "kbio100";
typedef kaleidoscope::driver::mcu::GD32Props MCUProps;
typedef kaleidoscope::driver::mcu::GD32<MCUProps> MCU;
}; };
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD #ifndef KALEIDOSCOPE_VIRTUAL_BUILD

@ -17,6 +17,8 @@
#pragma once #pragma once
#include <Arduino.h> // NVIC_Reset
#include <USBCore.h> // For connect, disconnect, USBCore
#include "kaleidoscope/driver/mcu/Base.h" // for Base, BaseProps #include "kaleidoscope/driver/mcu/Base.h" // for Base, BaseProps
namespace kaleidoscope { namespace kaleidoscope {
@ -31,10 +33,10 @@ template<typename _Props>
class GD32 : public kaleidoscope::driver::mcu::Base<_Props> { class GD32 : public kaleidoscope::driver::mcu::Base<_Props> {
public: public:
void detachFromHost() { void detachFromHost() {
USBCore::disconnect(); USBCore().disconnect();
} }
void attachToHost() { void attachToHost() {
USBCore::connect(); USBCore().connect();
} }

Loading…
Cancel
Save