update md

This commit is contained in:
AnalogDragon 2023-07-06 17:27:45 +08:00
parent fa3a8c68de
commit e5fb8aac07
13 changed files with 372 additions and 87 deletions

View File

@ -2,13 +2,12 @@
Taiko Input 硬件
分为双鼓与单鼓硬件,双鼓设计用于街机,单鼓的硬件则是双鼓硬件简单地切去一半输入前端设计的,在硬件上两者并无很大的差异。
分为双鼓与单鼓硬件,双鼓设计用于街机或两个鼓的场景,单鼓的硬件则是双鼓硬件简单地切去一半输入前端设计的,在硬件上两者并无很大的差异。
[ENG](./README_EN.md)
[English Version](./README_EN.md)
[主页](../)
<br/>
## 硬件结构
@ -16,10 +15,8 @@ Taiko Input 硬件
除此之外还,有电源、滤波电路等未在结构图中体现。
![硬件结构图](./img/hardware.png "硬件结构图")
硬件结构
<center>硬件结构</center>
<br/>
## 前端电路
@ -27,87 +24,78 @@ Taiko Input 硬件
![前端电路](./img/frontend.png "前端电路")
<center>其中一路前端电路</center>
其中一路前端电路
<br/>
![前端电路测试信号](./img/soc.png "前端电路测试信号")
信号的波形
<br/>
由于来自压电传感器的信号带宽高且信号幅值小,不宜直接进行采样。前端电路将输入信号处理成便于采样的信号。
在示波器截图中C1(黄色)为传感器输出C3红色为经过前端电路处理后的信号C2蓝色为程序识别后的输出。
<br/>
## 硬件
# 硬件
硬件分为双鼓硬件和单鼓硬件,双鼓硬件为完整版的硬件,
硬件分为双鼓硬件和单鼓硬件,双鼓硬件为完整版的硬件,可以用于街机环境。
单鼓硬件为双鼓硬件删去一半输入电路的硬件,软件上兼容了更多的单人应用场景。
### 双鼓硬件
## 双鼓硬件
[硬件工程](./taiko-io/)
[原理图](./taiko-io/new_io.pdf)
![双鼓的硬件3d图](./img/new_io_3d.png "双鼓的硬件3d图")
<center>双鼓的硬件3d图</center>
双鼓的硬件3d图
<br/>
#### 接口
### 接口
- ① 两个单鼓输入的接口接口定义借鉴了大力鼓Taiko Force
- ② 一个双鼓的输入接口可以焊接IDC-16P牛角连接器或者焊接XAD连接器B16B-XADSS-N以兼容不同接口的双太鼓。
- ③ 配置USB接口用于配置采样单片机。
- ④ 太鼓usb接口插入电脑会枚举成一个USB-HID键盘设备用于接收太鼓的数据。
- ⑤ service按键输入焊接XAD连接器或IDC连接器以连接不同的按键面板。其中16P接口用于自定义的连接36P用于12亚的IO板接口40P用于更新框体的IO板接口。
- ⑤ service按键输入焊接XAD连接器或IDC连接器以连接不同的按键面板。其中16P接口用于自定义的连接36P用于12亚的IO板接口40P用于更新框体的IO板接口。可以连接最多8个接地始能的按键。
- ⑥ stm32烧录接口和配置串口。
- ⑦ CH552/CH554的boot控制位
- ⑦ CH552/CH554的boot选择开关
<br/>
### 单鼓硬件
## 单鼓硬件
[硬件工程](./taiko-io-mini/)
[原理图](./taiko-io-mini/Taiko_input_x4.pdf)
![单鼓的硬件3d图](./img/taiko_input_x4_3d.png "单鼓的硬件3d图")
<center>单鼓的硬件3d图</center>
单鼓的硬件3d图
<br/>
#### 接口
### 接口
- 只能连接一个鼓的4路传感器接口定义借鉴了大力鼓Taiko Force的接口。
- 四个按键用于启动的模式选择和其他按键。
<br/> <br/>
## 装配
# 装配
### 双鼓硬件
## 双鼓硬件
双鼓硬件不设计外盒,借鉴街机的装配方式为使用螺柱直接装配。
![装配尺寸图](./img/instructions.png "装配尺寸图")
<center>装配尺寸图</center>
装配尺寸图
<br/>
### 单鼓硬件
## 单鼓硬件
单鼓的硬件使用了一款较通用的胶盒,可以较为方便的携带和连接。
![装配示意图1](./img/img1.png "装配示意图1")
<center>装配示意图1</center>
装配示意图1
<br/>
![装配示意图2](./img/img2.png "装配示意图2")
<center>装配示意图2</center>
装配示意图2

90
HW/README_EN.md Normal file
View File

@ -0,0 +1,90 @@
# Taiko Input Hardware
Taiko Input Hardware
There are dual drum and single drum hardware options. The dual drum design is intended for arcade or two-drum setups, while the single drum hardware is a simplified version of the dual drum hardware with half of the input frontend removed. There are no significant differences between the two in terms of hardware.
[Chinese Version](./README.md)
[Home](../)
## Hardware Structure
The entire system is composed of sensors (drums), frontend, sampling, USB, and PC. The frontend, sampling, and USB are located on the input hardware. In addition, there are other components such as power supply and filtering circuitry not shown in the structural diagram.
![Hardware Structure Diagram](./img/hardware_en.png "Hardware Structure Diagram")
Hardware Structure
## Frontend Circuitry
The frontend circuitry adopts a design similar to the SIF Board, amplifying and integrating the signal before limiting the output.
![Frontend Circuitry](./img/frontend.png "Frontend Circuitry")
One of the frontend circuitry paths
![Frontend Circuitry Test Signal](./img/soc.png "Frontend Circuitry Test Signal")
Signal waveform
Due to the high bandwidth and small signal amplitude from the piezoelectric sensors, direct sampling is not suitable. The frontend circuitry processes the input signal into a form that is suitable for sampling. In the oscilloscope screenshot, C1 (yellow) represents the sensor output, C3 (red) represents the signal after frontend processing, and C2 (blue) represents the output after program recognition.
# Hardware
The hardware consists of dual drum hardware and single drum hardware. The dual drum hardware is the complete version, suitable for arcade environments. The single drum hardware is a modified version of the dual drum hardware with half of the input circuit removed, and it is compatible with more single-player scenarios in software.
## Dual Drum Hardware
[Hardware Engineering](./taiko-io/)
[Schematic](./taiko-io/new_io.pdf)
![3D View of Dual Drum Hardware](./img/new_io_3d.png "3D View of Dual Drum Hardware")
3D view of dual drum hardware
### Interfaces
- ¢Ù Two single drum input interfaces, with interface definitions inspired by Taiko Force.
- ¢Ú One dual drum input interface that can be soldered with an IDC-16P ribbon connector or an XAD connector (B16B-XADSS-N) to accommodate different interfaces of dual drums.
- ¢Û Configuration USB interface for configuring the sampling microcontroller.
- ¢Ü Taiko USB interface, when plugged into a computer, it enumerates as a USB-HID keyboard device for receiving drum data.
- ¢Ý Service button input, soldered with an XAD or IDC connector to connect different button panels. The 16P interface is for custom connections, 36P is for the 12-pin IO board interface, and 40P is for updating the frame's IO board interface. It can connect up to 8 buttons with common ground.
- ¢Þ STM32 burning interface and configuration serial port.
- ¢ß CH552/CH554 boot selection switch.
## Single Drum Hardware
[Hardware Engineering](./taiko-io-mini/)
[Schematic](./taiko-io-mini/Taiko_input_x4.pdf)
![3D View of Single Drum Hardware](./img/taiko_input_x4_3d.png "3D View of Single Drum Hardware")
3D view of single drum hardware
### Interfaces
- Can only connect 4-channel sensors for a single drum, with interface definitions inspired by Taiko Force.
- Four buttons for mode selection and other functions.
# Assembly
## Dual Drum Hardware
The dual drum hardware does not have an external enclosure. It is assembled directly using screws, following the assembly approach commonly used in arcades.
![Assembly Dimension Diagram](./img/instructions.png "Assembly Dimension Diagram")
Assembly Dimension Diagram
## Single Drum Hardware
The single drum hardware uses a more common and portable casing, making it easier to carry and connect.
![Assembly Illustration 1](./img/img1.png "Assembly Illustration 1")
Assembly Illustration 1
![Assembly Illustration 2](./img/img2.png "Assembly Illustration 2")
Assembly Illustration 2

BIN
HW/img/hardware_en.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

View File

@ -2,16 +2,15 @@
QTWIN64
上位机软件用于配置采样单片机的参数。
[EN](./README_EN.md)
[English Version](./README_EN.md)
[主页](../)
<br/>
## 使用说明
![软件截图](./img/img.png "软件截图")
<center>软件截图</center>
软件截图
### 软件界面
@ -21,8 +20,8 @@
- D-输出时间配置H为按下保持时间L为松开保持时间保持时间内不响应其他输入
- E-屏蔽配置(用于计算鼓的物理结构带来的串音影响)
- F-屏蔽配置-单次响应(选择后每次只会触发一个传感器)
- G-屏蔽配置-计算回合数
- H-一些默认参数
- G-屏蔽配置-计算回合数设置为0时不计算直接按照速度最快触发
- H-一些默认参数(大力鼓和街机鼓)
- I-串口选择
- J-选择上载板上的参数组
- K-上载参数键
@ -32,14 +31,13 @@
### 配置流程
- 1 选择串口点击上载后显示状态为Success用于判断是否连接成功
- 1 选择串口,点击上载后,显示状态为`Success`(用于判断是否连接成功)
- 2 根据需求重置预设参数,或上载旧的参数
- 需要在旧参数的基础上修改的选择Load Saved再按上载参数键
- 需要在旧参数的基础上修改的,选择`Load Saved`,再按上载参数键
- 需要在默认配置基础上修改的,直接点按需要的默认配置按钮(两种默认配置只有鼓的映射不同)
- 修改后,点击下载参数键后,在鼓上确认参数是否合理
- 点击保存参数键
<br/>
## 其他说明
- 使用单鼓硬件时,第二套鼓的参数无意义

45
QT-APP/README_EN.md Normal file
View File

@ -0,0 +1,45 @@
# Host Computer
QT, WIN64
The host computer software is used to configure the parameters of the sampling microcontroller.
[Chinese Version](./README.md)
[Home](../)
## Instructions
![Screenshot](./img/img.png "Screenshot")
Screenshot
### Software Interface
- A-Drum sensor channel sequence configuration
- B-Input configuration-Trigger threshold (triggering is done in hardware, no obvious effect in software configuration)
- C-Input configuration-Multiplication factor (configure this when a certain sensor is exceptionally sensitive or insensitive, C for reset)
- D-Output time configuration, H for hold time when pressing, L for hold time when releasing, no response to other inputs during hold time
- E-Shielding configuration (used to calculate crosstalk caused by the physical structure of the drum)
- F-Shielding configuration-Single response (selecting this will trigger only one sensor each time)
- G-Shielding configuration-Calculate rounds (set to 0 to disable calculation, directly trigger according to the fastest speed)
- H-Some default parameters (for big drum and arcade drum)
- I-Serial port selection
- J-Select the parameter group on the upload board
- K-Upload parameter button
- L-Download parameter button (this step does not store data, data will be lost when the microcontroller is reset)
- M-Save parameter button
- N-Software status
### Configuration Process
- 1 Select the serial port, click upload, and the status will be displayed as `Success` (used to determine if the connection is successful)
- 2 Reset the preset parameters according to your needs or upload old parameters
- For modifications based on the old parameters, select `Load Saved`, and then press the upload parameter button
- For modifications based on the default configuration, click the desired default configuration button (the two default configurations only differ in drum mapping)
- After making modifications, click the download parameter button and confirm if the parameters are reasonable on the drum
- Click the save parameter button
## Other Instructions
- When using single drum hardware, the parameters for the second drum are meaningless
- Default configurations may have issues; you can make fine adjustments based on the default parameters to suit your drum
- The sensor wire sequence of the drum can be remapped through this host computer.

View File

@ -1,10 +1,10 @@
# Taiko Input
太鼓输入硬件usb为HID设备可以连接2个鼓和8通道的数字量输入。
文中所提到的太鼓-虹相关的软件,皆下载自互联网。
- [English Version](./README_EN.md)
<br/>
## [硬件工程](./HW/)
## [USB 单片机](./USB-MCU/)
@ -12,7 +12,7 @@
## [上位机](./QT-APP/)
## [文档](./TEXT/)
<br/><br/>
## 工程结构:
```
@ -29,32 +29,29 @@
|—— TEXT
```
<br/><br/>
## HW 硬件工程
硬件工程位于此目录下。
taiko-io/内放置的是双鼓的工程可用于两个鼓的使用环境工程使用KICAD设计。
`taiko-io/`目录内的是双鼓的工程,可用于两个鼓的使用环境(街机)工程使用KICAD设计。
此项目硬件包含8路模拟输入和8路数字量输入板载配置接口单usb供电。
taiko-io-mini/内放置的是单鼓的工程一般用于一个鼓的使用环境工程使用LCEDA设计。
`taiko-io-mini/`目录内的是单鼓的工程一般用于一个鼓的使用环境工程使用LCEDA设计。
此项目硬件包含4路模拟输入和4个按键需要测试点配置单usb供电。
<br/><br/>
## USB-MCU USB单片机
USB单片机的软件工程位于此目录下。包含两个软件根据硬件不同适配的软件工程也不同。
使用的单片机为 CH552/CH554是一款USB 8位单片机。
TK_usb_CH552/软件适配双鼓硬件,能枚举成为一个USB-HID键盘。
`TK_usb_CH552/`目录内的软件适配双鼓硬件(街机)能枚举成为一个USB-HID键盘。
TK_usb_CH552_mini/软件适配单鼓硬件可以枚举成USB-HID键盘或n******o switch适用的手柄设备。
`TK_usb_CH552_mini/`目录内的软件适配单鼓硬件,可以枚举成不同的USB设备。比如说USB-HID键盘或n******o switch适用的手柄设备。
软件使用keil 4编译编译前根据宏可以关闭/打开相关的软件功能。
<br/><br/>
## Sampling-MCU 采样单片机
@ -63,7 +60,6 @@ TK_usb_CH552_mini/软件适配单鼓硬件可以枚举成USB-HID键盘或n***
软件使用keil 5编译编译前根据宏可以关闭/打开相关的软件功能,切换硬件版本。
<br/><br/>
## QT-APP 上位机
@ -71,32 +67,31 @@ TK_usb_CH552_mini/软件适配单鼓硬件可以枚举成USB-HID键盘或n***
使用的UI框架为QT 5
<br/><br/>
## TEXT 文档
一些中间文档和输出文档位于此目录下。
<br/><br/>
# 系统框图
详见[硬件工程](./HW/)
![系统框图](./HW/img/hardware.png "系统框图")
<center>系统框图</center>
系统框图
# 做的一些裂开设计
主要是通过观察游戏运行的特征,去做体验上的优化。可能合理也可能不合理。
## 游戏软件运行的观察
- 输入频率限制ns平台的作品与虹均有输入频率限制经过测试这个频率每个player单个通道限制最高30次每秒四个通道一起限制60次每秒。超过这个频率的输入大概率就会被扔掉。
- 输入频率限制ns平台的游戏与虹均有输入频率限制。经过测试每个player独立的。同一个玩家单个通道限制最高30次每秒四个通道一起限制60次每秒。超过这个频率的输入会被扔掉。
也就是说如果只敲左咚或者右咚则最多30打每秒而如果左右咚交替输入能提高到60打每秒。
- ns平台本身的硬件限制按键输入会有一个很长的滤波且按下与松开均需要一段时间才能生效。
在ns运行的游戏内这个一段时间大于20ms时不再出现丢输入。但是主页上20ms仍会无响应可能是ns可以允许输入滤波时间动态变化。
- ns平台本身的硬件限制按键输入会有一个很长的滤波且按下与松开均需要保持一段时间才能生效。
在ns游戏内这个一段时间需要大于20ms。但是主页上则要远大于20ms甚至要到100ms可能是ns支持可变滤波时间。
- 虹的数据注入:
<br/>
## 输出交叉分配
@ -106,7 +101,33 @@ TK_usb_CH552_mini/软件适配单鼓硬件可以枚举成USB-HID键盘或n***
表现就是在触发频率高的时候,同一个通道的输入会分配到另一个通道,不同的设备采取的方案不相同。
- ns按键消抖做的比较激进直接在有高频输入的时候优先分配给同侧的两个按键。
- 虹:游戏软件限制了全局输入的最高频率和单个通道输入的最高频率,可能是为了方便计算图像,这边限制了单一个通道的输入频率,且将同为“咚”的输入分配给空闲的通道。
- PC的其他应用比如说Open Taiko等软件没有做输入频率限制所以不需要做分配。
![交叉分配](./USB-MCU/img/cross.png "交叉分配")
适配虹的交叉分配示意图
## 信号触发与串音检测
多路信号同时输入的时候,会选择触发幅值更高的通道。
鼓的传感器被固定在几块相对独立的木板上。通常情况下,直接敲击木板得到的信号,强度是远大于受震动干扰或串扰带来的信号。
这里的做法是,在首次触发后做微小的延时等待其他通道触发。如果在这期间有多个通道被触发,则输出这里面最强信号的通道。
![触发](./Sampling-MCU/img/trigger.png "触发")
触发示意图
如果怎么调都会串音,需要考虑是鼓的结构导致的。检查鼓是不是传感器脱落,木板是不是调节的高度不合适等。
# 外观
详见[硬件工程](./HW/)
## 双鼓硬件(街机/两个鼓场景)
![双鼓的硬件3d图](./HW/img/new_io_3d.png "双鼓的硬件3d图")
双鼓的硬件3d图
## 单鼓硬件(自己玩)
![单鼓的硬件3d图](./HW/img/taiko_input_x4_3d.png "单鼓的硬件3d图")
单鼓的硬件3d图

View File

@ -2,11 +2,10 @@
采样单片机软件
MCUstm32g030IDEKEIL 5
[EN](./README_EN.md)
[English Version](./README_EN.md)
[主页](../)
<br/>
## 双鼓版本与单鼓版本
@ -20,40 +19,49 @@
```
双鼓版本:
双鼓版本(注释这一行代码)
```
//#define IS_4CH_MODE
```
<br/>
## 数字信号处理
数字信号处理主要需要处理触发、消抖和判断是否信号串扰。
由于鼓是包含物理结构的,震动的串扰可以导致信号被误触发。所以需要对同一时间收到的信号进行判断再输出。
### 软件处理框图
### 处理框图
![数据流向](./img/block1.png "数据流向")
<center>数据流向图</center>
数据流向图
信号被采样后,记录成一个波形数组,通过触发函数来判断是否有符合预期强度的信号。
通过延时输出来确保信号到来时,不会漏掉其他传感器的触发。当有其他通道在延时期间被触发,则也会记录被触发的值。
仲裁函数用来判断延时这段时间内,被触发的几个通道中强度最大的值。同时用于复位其他函数的状态。
输出的信号由输出器输出给USB单片机。
<br/>
### 信号触发与串音检测
多路信号同时输入的时候,会选择触发幅值更高的通道。
鼓的传感器被固定在几块相对独立的木板上。通常情况下,直接敲击木板得到的信号,强度是远大于受震动干扰或串扰带来的信号。
这里的做法是,在首次触发后做微小的延时等待其他通道触发。如果在这期间有多个通道被触发,则输出这里面最强信号的通道。
![触发](./img/trigger.png "触发")
触发示意图
## 软件流程图
![数据流向](./img/block2.png "数据流向")
<center>数据流向图</center>
数据流向图
软件可以配置为速度优先触发或峰值最大触发。
软件可以配置为速度优先触发周期设置为0或峰值最大触发。
回合数越大则计算的周期越长当回合数设置为0时则以速度优先的方式进行触发。
<br/>
## 配置采样参数
@ -61,7 +69,6 @@
[上位机软件](../QT-APP/)
<br/>
## 数据输出

77
Sampling-MCU/README_EN.md Normal file
View File

@ -0,0 +1,77 @@
# Sampling MCU Project
Sampling Microcontroller Software
MCU: stm32g030, IDE: KEIL 5
[Chinese Version](./README.md)
[Home](../)
## Dual Drum Version and Single Drum Version
Differentiate the software between dual drum and single drum hardware using macros in /main.h/.
It is important to note that the software compiled for single drum hardware cannot be used on dual drum hardware due to differences in initialization.
Single Drum Version:
```
¡­
#define IS_4CH_MODE
¡­
```
Dual Drum Version (comment out this line of code):
```
¡­
//#define IS_4CH_MODE
¡­
```
## Digital Signal Processing
Digital signal processing mainly involves trigger handling, debouncing, and determining if there is signal crosstalk.
Since the drum contains a physical structure, vibrations can cause signal misfires. Therefore, it is necessary to determine and output the signals received at the same time.
### Processing Flowchart
![Data Flow](./img/block1_en.png "Data Flow")
Data flow diagram
After the signal is sampled, it is recorded as a waveform array, and a trigger function is used to determine if there is a signal with the expected strength.
The delayed output ensures that when a signal arrives, it does not miss the trigger of other sensors. If other channels are triggered during the delay, the triggered values will also be recorded.
The arbitration function determines the maximum strength among the triggered channels during the delay and is used to reset the states of other functions.
The output signal is sent to the USB microcontroller by the output device.
### Signal Triggering and Crosstalk Detection
When multiple signals are input simultaneously, the channel with the higher amplitude will be triggered.
The drum sensors are fixed on several relatively independent boards. Typically, the signal obtained by directly striking the board has a much higher strength than the signals caused by vibration interference or crosstalk.
The approach here is to wait for a small delay after the initial trigger to allow other channels to trigger. If multiple channels are triggered during this period, then the channel with the strongest signal among them is output.
![Triggering](./img/trigger.png "Triggering")
Triggering illustration
## Software Flowchart
![Data Flow](./img/block2_en.png "Data Flow")
Data flow diagram
The software can be configured for speed-priority triggering (setting the period to 0) or maximum peak triggering.
The longer the number of cycles, the longer the calculated period. When the number of cycles is set to 0, triggering is performed in a speed-priority manner.
## Configuring Sampling Parameters
Sampling parameters are configured through the upper computer software
[Upper Computer Software](../QT-APP/)
## Data Output
Data is sent to the computer using a USB microcontroller
[USB MCU Software](../USB-MCU/)

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -1,22 +1,20 @@
# USB-MCU工程
[EN](./README_EN.md)
[English Version](./README_EN.md)
[主页](../)
MCUCH552IDEKEIL 4
单片机官网:[沁恒CH552](https://www.wch.cn/products/CH552.html)
</br>
## 软件流程
软件按照如下流程运行
```
采样输入 -> 输出频率限制 -> 分配输出 -> 键值映射 -> USB
输入 -> 输出频率限制 -> 分配输出 -> 键值映射 -> USB
```
</br>
### 输出频率限制
对输出进行频率限制主要是因为接收数据的硬件或程序,收到了超过其处理能力的数据时,会产生丢包的现象。
@ -24,7 +22,6 @@ MCUCH552IDEKEIL 4
n******o switch限制输入信号的时间为20ms按下与抬起都为20ms左右小于这个值可能会导致输入与上一个输入粘连
其他电脑上运行的自治软件通常无这方便的限制但是在选择页面会有10ms左右的滤波。
</br>
### 分配输出
由于机能或软件运行方式,不同的软件支持的输入最大频率不同,分配输出主要用于使输入频率能达到这台设备的上限。
@ -35,21 +32,17 @@ n******o switch限制输入信号的时间为20ms按下与抬起都为20ms左
![交叉分配](./img/cross.png "交叉分配")
适配虹的交叉分配示意图
</br>
### 键值映射
- 双鼓硬件鼓的输入映射为键盘输入的DFJK ZXCV服务按键映射为键盘输入的12345678。
- 单鼓硬件分为ns和键盘输入其中ns输入键位见下图键盘输入可以通过按键设置为DFJK或ZXCV默认为DFJK。
![标签](./img/tag.png "标签")
单鼓硬件的标签
</br>
## 程序的修改
</br>
### 双鼓软件
@ -57,7 +50,6 @@ n******o switch限制输入信号的时间为20ms按下与抬起都为20ms左
- 修改输出频率限制相关的参数,修改位于`CompatibilityHID.C`内的宏`EXCHANGE_DATA`。
- 修改键值,则修改位于`CompatibilityHID.C`内的`Enp2BlukIn`函数的数组。
</br>
### 单鼓软件
单鼓软件内集成了三种模式分别是ns模式借用了HORI的PID/VIDns只校验了PID/VID没做其他加密适配虹的键盘模式输出锁60Hz输入适配其他太鼓软件的键盘模式解锁限制并关闭分配输出三种。

67
USB-MCU/README_EN.md Normal file
View File

@ -0,0 +1,67 @@
# USB-MCU Project
[Chinese Version](./README.md)
[Homepage](../)
MCU: CH552, IDE: KEIL 4
Microcontroller's official website: [WCH CH552](https://www.wch.cn/products/CH552.html)
## Software Flow
The software runs according to the following flow:
```
Input -> Output Frequency Limitation -> Output Assignment -> Key Mapping -> USB
```
### Output Frequency Limitation
The output frequency limitation is mainly due to the hardware or program that receives the data. When it receives data that exceeds its processing capability, packet loss may occur.
After multiple tests, the software input limitation for Rainbow is a maximum input frequency of 60Hz for all channels and 30Hz for signals of the same color.
The Neo Switch limits the input signal time to 20ms (both press and release are around 20ms; values smaller than this may result in sticky inputs).
Other software running on different computers usually doesn't have this convenient limitation, but there is usually a filtering of around 10ms on the selection page.
### Output Assignment
Due to different functionalities or software operation modes, different software supports different maximum input frequencies. Output assignment is mainly used to make the input frequency reach the upper limit of the device.
The behavior is that when the triggering frequency is high, the input of the same channel will be assigned to another channel. Different devices adopt different approaches.
- For Rainbow: The key debouncing is relatively aggressive. When there is a high-frequency input, it will be assigned to the two adjacent keys on the same side.
- For Neo: The gaming software limits the maximum global input frequency and the maximum input frequency per channel. This may be for easier image calculations. Here, the input frequency for each channel is also limited, and inputs that have the same sound are assigned to idle channels.
![Cross Assignment](./img/cross.png "Cross Assignment")
Cross assignment diagram for compatibility with Rainbow software
### Key Mapping
- For dual-drum hardware, drum inputs are mapped to keyboard inputs DFJK ZXCV, and service key inputs are mapped to keyboard inputs 12345678.
- For single-drum hardware, there are two modes: ns mode and keyboard mode. For ns mode, the input keys are shown in the image below. For keyboard mode, you can set the inputs as DFJK or ZXCV through the buttons, with DFJK being the default.
![Tags](./img/tag.png "Tags")
Tags for single-drum hardware
## Modifying the Program
### Dual-drum Software
- To disable the output assignment feature, modify the `WITHOUT_OUTPUT_ASSIGN` macro inside `CompatibilityHID.C` by uncommenting it.
- To modify the parameters related to output frequency limitation, modify the `EXCHANGE_DATA` macro inside `CompatibilityHID.C`.
- To change the key values, modify the array inside the `Enp2BlukIn` function in `CompatibilityHID.C`.
### Single-drum Software
The single-drum software integrates three modes: ns mode (using HORI's PID/VID, where ns only verifies the PID/VID without any further encryption), keyboard mode compatible with Rainbow software (60Hz input lock), and keyboard mode compatible with other taiko drum software (unlock the limitations and disable the output assignment).
- To change the default startup mode, modify the `MODE_STARTUP` macro inside `CompatibilityHID.C`.
- To switch modes during startup within 1 second, use the following button combinations:
```
...
if(!KEY1)start_up_mode = MODE_NS_GP;
if(!KEY2)start_up_mode = MODE_KEYBOARD;
if(!KEY3)start_up_mode = MODE_KB_LMT;
if(!KEY4)start_up_mode = MODE_STARTUP;
...
```
- During runtime, holding down buttons 1 to 4 will trigger a reset, allowing you to switch modes again.