[WIP] initial bluetooth support between split keyboards#18
[WIP] initial bluetooth support between split keyboards#18funkycode wants to merge 2 commits intosago35:mainfrom
Conversation
sago35
left a comment
There was a problem hiding this comment.
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.
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.
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.
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 <sago35@gmail.com>
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)