Skip to content

Commit 6ede98a

Browse files
committed
Add feature to restore key settings to default values
1 parent 733f425 commit 6ede98a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,15 @@ Set the key with the key code of `0x7C03`, and then press it.
159159
Then a reset will restore the default keymap.
160160
See [#8](https://github.com/sago35/tinygo-keyboard/pull/8).
161161

162+
## Restore default keymap (tinygo flash)
163+
164+
Restore default keymap each time it is reset by specifying `--tags reset_to_default`.
165+
Note that in this setting, any changes made from Vial or other sources will immediately revert to the original setting.
166+
167+
```
168+
$ tinygo flash --target wioterminal --size short --tags reset_to_default ./targets/wiokey
169+
```
170+
162171
## Note
163172

164173
The following PR changes are required for all keys to work properly.

reset_to_default.go

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//go:build reset_to_default
2+
3+
package keyboard
4+
5+
import (
6+
"machine"
7+
)
8+
9+
func init() {
10+
machine.Flash.EraseBlocks(0, 1)
11+
}

0 commit comments

Comments
 (0)