usb: rename callback to handler to keep consistent

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2022-07-12 19:59:03 +02:00
committed by Ron Evans
parent 8fed063820
commit 5fdb894760
5 changed files with 23 additions and 23 deletions
+7 -7
View File
@@ -20,35 +20,35 @@ const (
)
type hidDevicer interface {
Callback() bool
Handler() bool
}
var devices [5]hidDevicer
var size int
// SetCallbackHandler sets the callback. Only the first time it is called, it
// SetHandler sets the handler. Only the first time it is called, it
// calls machine.EnableHID for USB configuration
func SetCallbackHandler(d hidDevicer) {
func SetHandler(d hidDevicer) {
if size == 0 {
machine.EnableHID(callback, nil, callbackSetup)
machine.EnableHID(handler, nil, setupHandler)
}
devices[size] = d
size++
}
func callback() {
func handler() {
for _, d := range devices {
if d == nil {
continue
}
if done := d.Callback(); done {
if done := d.Handler(); done {
return
}
}
}
func callbackSetup(setup machine.USBSetup) bool {
func setupHandler(setup machine.USBSetup) bool {
ok := false
if setup.BmRequestType == usb_SET_REPORT_TYPE && setup.BRequest == usb_SET_IDLE {
machine.SendZlp()