Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joypad HID #54

Open
milkpirate opened this issue Dec 3, 2024 · 5 comments
Open

Joypad HID #54

milkpirate opened this issue Dec 3, 2024 · 5 comments

Comments

@milkpirate
Copy link

Hey,

I am trying to use the nice!nano for my own project, a bluetooth game controller. I was scraping TinyGo for the BLE HID support and the most mature project I found was yours. I have seen you have a branch blehid2 (which seems to be newer than blehid), as well as blekeyboard*. I would like to use it as a starter for my project. Can you recommend a branch / resources you used for you work?

Best regards

@sago35
Copy link
Owner

sago35 commented Dec 3, 2024

Hello,
I think the following branch will help BLE HID move forward a bit.
Currently, the blehid2 branch of tinygo-keyboard works as a BLE HID Keyboard on Android, but it does not work on Windows or other platforms. This requires additional implementations, such as LESC.

tinygo-org/bluetooth#295
tinygo-org/bluetooth#204

@milkpirate
Copy link
Author

milkpirate commented Dec 13, 2024

Ok, I started tinkering and... its not even compiling. It does not seem to find the following functions/constants:

bluetooth.SetSecParamsBonding()
bluetooth.SetSecCapabilities()
bluetooth.NoneGapIOCapability

I tried:

  • tinygo.org/x/bluetooth v0.10.0
  • tinygo.org/x/bluetooth v0.8.0

Both seem to miss them. Do you have an idea about that?

Further there are quite some magic value, can you elaborate a little on these?

@sago35
Copy link
Owner

sago35 commented Dec 18, 2024

First, check out the blehid2 branch and try building it as is. It successfully built on my end.

$ git checkout blehid2

$ tinygo build -o /tmp/out.uf2 --target xiao-ble --stack-size 8kb --size short ./targets/sgkey-ble/
   code    data     bss |   flash     ram
 100184    3644   11168 |  103828   14812

@sago35
Copy link
Owner

sago35 commented Dec 18, 2024

Further there are quite some magic value, can you elaborate a little on these?

There are still many magic numbers left, but there are no plans to fix them at this point. I think this will be revisited when the PR approaches completion. For now, please note that this is still a draft.

@milkpirate
Copy link
Author

milkpirate commented Dec 18, 2024

Seems like something is different in your setup:

$ git pull
Host key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU
+--[ED25519 256]--+
|                 |
|     .           |
|      o          |
|     o o o  .    |
|     .B S oo     |
|     =+^ =...    |
|    oo#[email protected].     |
|    E+.&.=o      |
|    ooo.X=.      |
+----[SHA256]-----+
Already up to date.

$ git st
On branch blehid2
Your branch is up to date with 'origin/blehid2'.

nothing to commit, working tree clean

$ tinygo build -o /tmp/out.uf2 --target xiao-ble --stack-size 8kb --size short ./targets/sgkey-ble/
# github.com/sago35/tinygo-keyboard
kbblesplit.go:155:30: cannot use (func(device bluetooth.Device, connected bool) literal) (value of type func(device bluetooth.Device,
connected bool)) as func(device bluetooth.Address, connected bool) value in argument to d.adapter.SetConnectHandler

Though not the error I expected.

Regarding the magic values, ChatGPT helped me out on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants