Skip to content

USBHID implementation for Digispark #3650

Open
@BrunoTeixeira1996

Description

@BrunoTeixeira1996

Hi guys,
I was playing with the USBHID feature in a Digispark device and I was following the #2889.
In my case looks like there's no machine.BUTTON and if I want to flash the device with the following code Ill get an error for undefined variables.

package main

import (
	"machine"
	"machine/usb/hid/keyboard"
)

func main() {
	button := machine.BUTTON // UNDEFINED machine.BUTTON

	kb := keyboard.New()
	for {
		if button.Get() {
			kb.Write([]byte("tinygo"))
		}
	}
}

Flashing

$ tinygo flash -target=digispark main.go 
# machine/usb/hid
/usr/local/lib/tinygo/src/machine/usb/hid/hid.go:35:11: undefined: machine.EnableHID
/usr/local/lib/tinygo/src/machine/usb/hid/hid.go:56:11: undefined: machine.SendZlp
/usr/local/lib/tinygo/src/machine/usb/hid/hid.go:64:10: undefined: machine.SendUSBInPacket
$ tinygo version
tinygo version 0.27.0 linux/amd64 (using go version go1.20.2 and LLVM version 15.0.0)

Any idea how I can solve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    avrAVR (Arduino Uno, etc.)enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions