This commit is contained in:
cyp0633 2022-08-25 10:19:39 +08:00
parent 0535ddd145
commit 34fc2a582b
Signed by: cyp0633
GPG Key ID: CF90D09FB1FDCE45
2 changed files with 42 additions and 15 deletions

View File

@ -1,19 +1,9 @@
# README
# joycon-terminal
## About
实际上这个项目和 Nintendo Switch 没有任何关系。它只是一个课程大作业……的 PC 端程序。
This is the official Wails Vue template.
Actually this project has nothing to do with Nintendo Switch. It's just the PC part of the course homework.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
## 继续阅读 Continue Reading
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
## Building
To build a redistributable, production mode package, use `wails build`.
[协议文档 / Protocol docs](docs/protocol.md)

37
docs/protocol.md Normal file
View File

@ -0,0 +1,37 @@
# `joycon-terminal` 协议文档 / Protocol Docs
## 按键协议 / Key Protocol
数据包共 8 字节,结构为:
The data packet is 8 bytes long, and the structure is as follows:
```c
struct {
uint8_t head;
uint8_t device_num;
uint8_t key_num;
uint8_t key_action;
uint8_t unused1;
uint8_t unused2;
uint8_t unused3;
uint8_t unused4;
}
```
head数据包头固定为 0x01。
head is the header of the data packet, and it's fixed to 0x01.
device_num: 设备编号,连接 PC 的机器固定为 0x01其余机器<del>未来</del>可以自选。
device_num is the device number. For the board connected to the PC, it's fixed to 0x01; otherwise it's customizable <del>in the future</del>.
key_num 是按键编号Key1-3、上、下、左、右分别为 0x01-0x07。
key_num is the key number. Key1-3, up, down, left, right are 0x01-0x07.
key_action 是按键动作0x01 按下0x02 抬起。
key_action is the key action. 0x01 is pressed, 0x02 is released.