mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
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>
This commit is contained in:
@@ -10,7 +10,7 @@ func main() {
|
||||
button := machine.BUTTON
|
||||
button.Configure(machine.PinConfig{Mode: machine.PinInputPullup})
|
||||
|
||||
kb := keyboard.New()
|
||||
kb := keyboard.Port()
|
||||
|
||||
for {
|
||||
if !button.Get() {
|
||||
|
||||
@@ -10,7 +10,7 @@ func main() {
|
||||
button := machine.BUTTON
|
||||
button.Configure(machine.PinConfig{Mode: machine.PinInputPullup})
|
||||
|
||||
mouse := mouse.New()
|
||||
mouse := mouse.Port()
|
||||
|
||||
for {
|
||||
if !button.Get() {
|
||||
|
||||
@@ -17,7 +17,7 @@ func main() {
|
||||
button := machine.BUTTON
|
||||
button.Configure(machine.PinConfig{Mode: machine.PinInputPullup})
|
||||
|
||||
m := midi.New()
|
||||
m := midi.Port()
|
||||
m.SetHandler(func(b []byte) {
|
||||
led.Set(!led.Get())
|
||||
fmt.Printf("% X\r\n", b)
|
||||
|
||||
@@ -63,8 +63,8 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
// New returns hid-keybord.
|
||||
func New() *keyboard {
|
||||
// Port returns the USB hid-keyboard port.
|
||||
func Port() *keyboard {
|
||||
return Keyboard
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
// New returns hid-mouse.
|
||||
func New() *mouse {
|
||||
// Port returns the USB hid-mouse port.
|
||||
func Port() *mouse {
|
||||
return Mouse
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
// New returns hid-mouse.
|
||||
func New() *midi {
|
||||
// Port returns the USB midi port.
|
||||
func Port() *midi {
|
||||
return Midi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user