-
Notifications
You must be signed in to change notification settings - Fork 12
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
Pointing device #9
base: main
Are you sure you want to change the base?
Conversation
@wallamide Would you be able to test the IQS5xx driver? I don't have access to a touchpad, so whatever I added in here is just best effort. I didn't aim to replicate the implementation that you provided for now, since I'm not sure whether that would be a sane default behaviour. If you would like to have functionality similar to that, you can always reimplement |
…`setup_i2c` macro
@Univa thanks for the ping! i'm sadly recovering from being sick so i'll need to check this out in a day or so. looking this over, i had a few questions:
thanks again for sharing and i'm looking forward to checking this out! |
|
@Univa thanks again for answering my questions! one last question before i get to this: is there anything preventing me from using the trackpad with a split keyboard on the peripheral/right half? like on zmk for a while you could only add a pointer to the main half not to the peripheral. just to let you know my plan, i'll be testing out the default functionality with a firmware of just the pointer and giving feedback then i was hoping to try flashing a my layout and making sure it's still working the same. then i'd like to get familiar with the default for a bit and try modifying it. |
Usage of the trackpad isn't supported on a peripheral side yet since there is no enum variant in |
i was unable to get my firmware to build. i used
i'm running on windows 11. |
I don't develop on windows, but it looks like you might be missing vcpkg? |
also does some slight api changes: - CentralDevice::Layout is now optional - MATRIX_EVENTS get published events from the matrix polling task and central task, instead of peripheral task and layout collect task - split setup function for iqs5xx into two different types: one for default behavior, and another for custom implementor of IQS5xxEventHandler - mouse tasks are now split into two: polling task and mouse event collection task (similar to matrix polling and layout collect) - PeripheralDevice::get_matrix_events_channel changed to return a channel of MessageToCentral instead
@wallamide I added support for a peripheral-side pointing device, but it may not be entirely stable. The last commit also changes some of the API, so I also updated the instructions in the original comment. Peripheral side should look something like this: #[keyboard(
usb,
split_peripheral(
driver_setup_fn = setup_split_driver
),
pointer(
driver_setup_fn = test_pointer,
)
)]
struct MyKeyboard;
async fn test_pointer() -> impl rumcake::pointer::PointingDriver {
// ...
}
impl rumcake::pointer::PointingDevice for MyKeyboard {
type PeripheralDeviceType = Self; // send mouse events to a central device
}
impl rumcake::split::peripheral::PeripheralDevice for MyKeyboard {}
async fn setup_split_driver() -> impl rumcake::split::peripheral::PeripheralDeviceDriver {
// ...
} Central should look like: #[keyboard(
usb,
split_central(
driver_setup_fn = setup_split_driver
)
)]
struct MyKeyboard;
// collects mouse events from peripherals
impl rumcake::pointer::MouseEventCollector for MyKeyboard {}
impl rumcake::split::central::CentralDevice for MyKeyboard {
type MouseEventCollector = Self;
}
async fn setup_split_driver() -> impl rumcake::split::central::CentralDeviceDriver {
// ...
} |
thanks for the update! i actually am unable to build a basic firmware using the template for the split, though it's looking like this is the result of the refactor. i'll see if i can get it compiling using just the example code in a sec. were you able to check my repo linked above to make sure what i had originally should be working? |
My bad, I totally forgot to update those templates. I pushed some updates which should hopefully work now. If you use those templates, then add my example code from my previous comment, you should be able to get something compiling. |
okay, so i'm unsure what i need to change atm, but i'm getting a few errors from this pointer setup function: async fn test_pointer() -> impl rumcake::pointer::PointingDriver {
rumcake::drivers::iqs5xx::setup_driver(
setup_i2c! {
interrupt: P0_22,
i2c: P0_24,
sda: P0_17,
scl: P0_20,
},
input_pin!(P0_24),
output_pin!(P0_22),
)
} here's the main errors, i can post the full log if you need as well. i definitely recommend adding an i2c docs page when you have time or i could help once we can get this sorted out.
|
So, you can change the setup_i2c! {
interrupt: SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0,
i2c: TWISPI0,
sda: P0_17,
scl: P0_20,
}, I'll add docs to the API reference at some point to hopefully clarify this stuff. |
Applicable Changes
Related Issues
#8
Description of Changes
Added a
pointing
module to support pointing devices like a mouse or touchpad. Note that this only adds support for pointing devices over USB for now. Bluetooth support to come later.Testing Instructions
Try out the IQS5xx pointing driver in your
main.rs
(assuming a non-split keyboard):The touchpad should be capable of basic cursor movements, scrolling (with two fingers sliding), left-clicks (via single finger tap), right-clicks (via two finger tap), and left-click holding (press hold).
More complicated behaviour can be implemented by overriding the implementation of
tick
andhandle_event
in theIQS5xxPointingDriver
traitCheck-list