-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
[WIP] initial bluetooth support between split keyboards #18
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
I think many sections are good.
However, I think we need to be careful not to cause overwriting in Get().
I tried a few myself.
I think the following code will almost eliminate the problem.
If it looks OK, I suggest you merge it into funkycode:main.
fcbe49d
d.buf[0] = value[0] | ||
d.buf[1] = value[1] | ||
d.buf[2] = value[2] | ||
d.changed = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part may be overwritten before it is processed by Loop().
Perhaps you need to use RingBuffer or something similar, as in the following source.
This is the same as kbuart.go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regarding ringbuffer as briefly read it, does it mean we can get the bytes out of order and need to handle it?
In general i suggest to add RemoteKeyboard
that will have buffer and method to pass info to it and read from it.
that way we can implement both ble and uart keyboard as same type where the difference would be how we save and read from. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I created RingBuffer is to address the following issues.
- WriteEvent() : Here d.buf is set.
- WriteEvent() : Here, d.buf is set again. At this time, the data received in the first WriteEvent() is overwritten.
RingBuffer can be used to suppress overwriting.
RemoteKeyboard is a good approach.
I think the UpDowner interface is the way to go at the moment, but there may be a better way.
Since the current Loop() is a little too slow, it would be better to run the loop with a 1ms wait as shown below. It will be a little more responsive. tinygo-keyboard/targets/sgkey-ble/right/main.go Lines 55 to 68 in cde6760
|
Co-authored-by: sago35 <[email protected]>
In general that adds basic support for one half to connect to other one via bluetooth using same logic uart keyboard have
Not sure if it is ready to be merged, but it can be used as reference, in general it works, but:
Opening PR for reference and some feedback, if it is okay (if not you can close it till it would be ready)
it can be tested with wireless corne on repo https://github.com/funkycode/tinygo-corne (works with pinout of typeractive.xyz version, as well with niceview)