Skip to content

Commit 8c10c9d

Browse files
committed
Update ./targets/sg48key/ and ./targets/sgh60/
1 parent 8312259 commit 8c10c9d

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

targets/sg48key/main.go

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,33 @@ func run() error {
7171
// override ctrl-h to BackSpace
7272
d.OverrideCtrlH()
7373

74+
// Combos
75+
combos := []keyboard.Combo{
76+
{
77+
Keys: [4]keyboard.Keycode{jp.KeyQ, jp.KeyZ},
78+
OutputKey: jp.KeyMediaMute,
79+
},
80+
{
81+
Keys: [4]keyboard.Keycode{jp.KeyW, jp.KeyX},
82+
OutputKey: jp.KeyMediaVolumeDec,
83+
},
84+
{
85+
Keys: [4]keyboard.Keycode{jp.KeyE, jp.KeyC},
86+
OutputKey: jp.KeyMediaVolumeInc,
87+
},
88+
{
89+
Keys: [4]keyboard.Keycode{jp.KeyR, jp.KeyV},
90+
OutputKey: jp.KeyMediaBrightnessDown,
91+
},
92+
{
93+
Keys: [4]keyboard.Keycode{jp.KeyT, jp.KeyB},
94+
OutputKey: jp.KeyMediaBrightnessUp,
95+
},
96+
}
97+
for i, c := range combos {
98+
d.SetCombo(i, c)
99+
}
100+
74101
loadKeyboardDef()
75102

76103
err := d.Init()
@@ -81,7 +108,7 @@ func run() error {
81108
cont := true
82109
x := NewADCDevice(ax, 0x3000, 0xD000, true)
83110
y := NewADCDevice(ay, 0x3000, 0xD000, true)
84-
ticker := time.Tick(2 * time.Millisecond)
111+
ticker := time.Tick(500 * time.Microsecond)
85112
cnt := 0
86113
for cont {
87114
<-ticker
@@ -90,7 +117,7 @@ func run() error {
90117
return err
91118
}
92119

93-
if cnt%5 == 0 {
120+
if cnt%(5*3) == 0 {
94121
xx := x.Get2()
95122
yy := y.Get2()
96123
//fmt.Printf("%04X %04X %4d %4d %4d %4d\n", x.RawValue, y.RawValue, xx, yy, x.Get(), y.Get())

targets/sgh60/main.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,33 @@ func run() error {
7373
// override ctrl-h to BackSpace
7474
d.OverrideCtrlH()
7575

76+
// Combos
77+
combos := []keyboard.Combo{
78+
{
79+
Keys: [4]keyboard.Keycode{jp.KeyQ, jp.KeyZ},
80+
OutputKey: jp.KeyMediaMute,
81+
},
82+
{
83+
Keys: [4]keyboard.Keycode{jp.KeyW, jp.KeyX},
84+
OutputKey: jp.KeyMediaVolumeDec,
85+
},
86+
{
87+
Keys: [4]keyboard.Keycode{jp.KeyE, jp.KeyC},
88+
OutputKey: jp.KeyMediaVolumeInc,
89+
},
90+
{
91+
Keys: [4]keyboard.Keycode{jp.KeyR, jp.KeyV},
92+
OutputKey: jp.KeyMediaBrightnessDown,
93+
},
94+
{
95+
Keys: [4]keyboard.Keycode{jp.KeyT, jp.KeyB},
96+
OutputKey: jp.KeyMediaBrightnessUp,
97+
},
98+
}
99+
for i, c := range combos {
100+
d.SetCombo(i, c)
101+
}
102+
76103
loadKeyboardDef()
77104

78105
err := d.Init()

0 commit comments

Comments
 (0)