mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
add SW reset (#107)
This commit is contained in:
@@ -73,4 +73,11 @@ namespace DRIVERS {
|
||||
}
|
||||
}
|
||||
|
||||
Board* Factory::makeBoard(type _type) {
|
||||
switch (_type) {
|
||||
default:
|
||||
return new Board(DRIVERS::DUMMY);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
38
hid/lib/drivers-stm32/board-stm32.h
Normal file
38
hid/lib/drivers-stm32/board-stm32.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*****************************************************************************
|
||||
# #
|
||||
# KVMD - The main PiKVM daemon. #
|
||||
# #
|
||||
# Copyright (C) 2018-2022 Maxim Devaev <mdevaev@gmail.com> #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "board.h"
|
||||
|
||||
|
||||
namespace DRIVERS {
|
||||
class BoardStm32 : public Board {
|
||||
public:
|
||||
BoardStm32() : Board(BOARD){
|
||||
}
|
||||
|
||||
void reset() override {
|
||||
nvic_sys_reset();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "usb/mouse-absolute-stm32.h"
|
||||
#include "usb/mouse-relative-stm32.h"
|
||||
#include "backup-register.h"
|
||||
#include "board-stm32.h"
|
||||
|
||||
#ifndef __STM32F1__
|
||||
# error "Only STM32F1 is supported"
|
||||
@@ -72,4 +73,14 @@ namespace DRIVERS {
|
||||
return new Storage(DRIVERS::DUMMY);
|
||||
}
|
||||
}
|
||||
|
||||
Board* Factory::makeBoard(type _type) {
|
||||
switch (_type) {
|
||||
case BOARD:
|
||||
return new BoardStm32();
|
||||
default:
|
||||
return new Board(DRIVERS::DUMMY);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
32
hid/lib/drivers/board.h
Normal file
32
hid/lib/drivers/board.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*****************************************************************************
|
||||
# #
|
||||
# KVMD - The main PiKVM daemon. #
|
||||
# #
|
||||
# Copyright (C) 2018-2022 Maxim Devaev <mdevaev@gmail.com> #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
namespace DRIVERS {
|
||||
struct Board : public Driver {
|
||||
using Driver::Driver;
|
||||
virtual void reset() {}
|
||||
};
|
||||
}
|
||||
@@ -34,6 +34,7 @@ namespace DRIVERS {
|
||||
USB_KEYBOARD,
|
||||
PS2_KEYBOARD,
|
||||
NON_VOLATILE_STORAGE,
|
||||
BOARD,
|
||||
};
|
||||
|
||||
class Driver {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "keyboard.h"
|
||||
#include "mouse.h"
|
||||
#include "storage.h"
|
||||
#include "board.h"
|
||||
|
||||
|
||||
namespace DRIVERS {
|
||||
@@ -31,5 +32,6 @@ namespace DRIVERS {
|
||||
static Keyboard *makeKeyboard(type _type);
|
||||
static Mouse *makeMouse(type _type);
|
||||
static Storage* makeStorage(type _type);
|
||||
static Board* makeBoard(type _type);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user