Skip to content

Commit

Permalink
feat(docs): Add documentation about PIM447 trackball driver.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdc-mkb committed Nov 21, 2021
1 parent d081ac7 commit eb88898
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 0 deletions.
33 changes: 33 additions & 0 deletions docs/docs/behaviors/trackball-pim447.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: Trackball PIM447 Behaviors
sidebar_label: Trackball PIM447
---

The mode of the trackball PIM447 driver can be changed using the
following key behaviors.

- `&pim447_move`: set trackball mode to "move" .
- `&pim447_scroll`: set trackball mode to "scroll" .
- `&pim447_toggle`: toggle trackball mode (from "scroll" to "move", or vice versa).
- `&pim447_move_scroll`: set trackball mode to "move" when pressed, then to "scroll" when released.
- `&pim447_scroll_move`: set trackball mode to "scroll" when pressed, then to "move" when released.
- `&pim447_toggle_toggle`: toggle trackball mode when pressed, then toggle again when released.

Example:

```
#include <dt-bindings/zmk/trackball_pim447.h>
/ {
keymap {
compatible = "zmk,keymap";
a_layer {
bindings = <&kp a
&kp b
&kp c
&pim447_toggle>;
};
};
};
```
71 changes: 71 additions & 0 deletions docs/docs/features/trackballs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: Trackballs
sidebar_label: Trackballs
---

Only the [Pimoroni PIM447](https://shop.pimoroni.com/products/trackball-breakout)
trackball is supported in ZMK so far.

## Enable Trackball Support

To enable support for PIM447 trackball — and to make it acts like a
mouse — add the two following lines to the shield `.config` file:

```ini
CONFIG_ZMK_MOUSE=y
CONFIG_ZMK_TRACKBALL_PIM447=y
```

Assuming the PIM447 trackball is connected to the `pro_micro_i2c` pins
and its bus address hasn't been changed, then the following lines must
be added to the shield `.overlay` file:

```devicetree
&pro_micro_i2c {
status = "okay";
trackball_pim447@a {
compatible = "pimoroni,trackball_pim447";
reg = <0xa>;
label = "TRACKBALL_PIM447";
};
};
```

## Customize Trackball Driver Properties

The PIM447 trackball driver can be configured according to a lot of
different properties that are listed in the shield `.overlay` sample
below:

```devicetree
#include <dt-bindings/zmk/trackball_pim447.h> // for PIM447_MOVE and PIM447_SCROLL constants.
&pro_micro_i2c {
status = "okay";
trackball_pim447@a {
compatible = "pimoroni,trackball_pim447";
reg = <0xa>;
label = "TRACKBALL_PIM447";
move-factor = <2>; // Increase pointer velocity (default: 1)
invert-move-x; // Invert pointer X axis (left is right, and vice versa)
invert-move-y; // Invert pointer Y axis (up is down, and vice versa)
button = <1>; // Send right-click when pressing the ball (default: 0, ie. left-click)
swap-axes; // Swap X and Y axes (horizontal is vertical, and vice versa)
scroll-divisor = <1>; // Increase wheel velocity (default: 2)
invert-scroll-x; // Invert wheel X axis (left is right, and vice versa)
invert-scroll-y; // Invert wheel Y axis (up is down, and vice versa)
mode = <PIM447_SCROLL>; // Act as mouse wheels at startup (default: PIM447_MOVE for a pointer)
};
};
```

## Change Trackball Driver Mode

As seen at the end of the previous section, the PIM447 trackball
driver can act as a mouse pointer or as mouse wheels according to the
`mode` specified in the shield `.overlay` file. It can also be
changed dynamically using [dedicated key
behaviors](/docs/behaviors/trackball-pim447).
1 change: 1 addition & 0 deletions docs/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ZMK is currently missing some features found in other popular firmware. This tab
| Realtime Keymap Updating | 💡 | ||
| AVR/8 Bit | | ||
| [Wide Range of ARM Chips Supported](https://docs.zephyrproject.org/latest/boards/index.html) || | |
| [Trackballs](features/trackballs) || ||

[^2]: Encoders are not currently supported on peripheral side splits.
[^1]: OLEDs are currently proof of concept in ZMK.
Expand Down
2 changes: 2 additions & 0 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
"features/displays",
"features/encoders",
"features/underglow",
"features/trackballs",
"features/beta-testing",
],
Behaviors: [
Expand All @@ -32,6 +33,7 @@ module.exports = {
"behaviors/outputs",
"behaviors/lighting",
"behaviors/power",
"behaviors/trackball-pim447",
],
Codes: [
"codes/index",
Expand Down

0 comments on commit eb88898

Please sign in to comment.