machine/usb: rename 'New()' to 'Port()' to have the API better match the singleton that is actually being returned
Signed-off-by: deadprogram <ron@hybridgroup.com>
Этот коммит содержится в:
родитель
c32490935b
коммит
3d7f24e26c
6 изменённых файлов: 9 добавлений и 9 удалений
|
@ -10,7 +10,7 @@ func main() {
|
||||||
button := machine.BUTTON
|
button := machine.BUTTON
|
||||||
button.Configure(machine.PinConfig{Mode: machine.PinInputPullup})
|
button.Configure(machine.PinConfig{Mode: machine.PinInputPullup})
|
||||||
|
|
||||||
kb := keyboard.New()
|
kb := keyboard.Port()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
if !button.Get() {
|
if !button.Get() {
|
||||||
|
|
|
@ -10,7 +10,7 @@ func main() {
|
||||||
button := machine.BUTTON
|
button := machine.BUTTON
|
||||||
button.Configure(machine.PinConfig{Mode: machine.PinInputPullup})
|
button.Configure(machine.PinConfig{Mode: machine.PinInputPullup})
|
||||||
|
|
||||||
mouse := mouse.New()
|
mouse := mouse.Port()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
if !button.Get() {
|
if !button.Get() {
|
||||||
|
|
|
@ -17,7 +17,7 @@ func main() {
|
||||||
button := machine.BUTTON
|
button := machine.BUTTON
|
||||||
button.Configure(machine.PinConfig{Mode: machine.PinInputPullup})
|
button.Configure(machine.PinConfig{Mode: machine.PinInputPullup})
|
||||||
|
|
||||||
m := midi.New()
|
m := midi.Port()
|
||||||
m.SetHandler(func(b []byte) {
|
m.SetHandler(func(b []byte) {
|
||||||
led.Set(!led.Get())
|
led.Set(!led.Get())
|
||||||
fmt.Printf("% X\r\n", b)
|
fmt.Printf("% X\r\n", b)
|
||||||
|
|
|
@ -63,8 +63,8 @@ func init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// New returns hid-keybord.
|
// Port returns the USB hid-keyboard port.
|
||||||
func New() *keyboard {
|
func Port() *keyboard {
|
||||||
return Keyboard
|
return Keyboard
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ func init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// New returns hid-mouse.
|
// Port returns the USB hid-mouse port.
|
||||||
func New() *mouse {
|
func Port() *mouse {
|
||||||
return Mouse
|
return Mouse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ func init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// New returns hid-mouse.
|
// Port returns the USB midi port.
|
||||||
func New() *midi {
|
func Port() *midi {
|
||||||
return Midi
|
return Midi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче