mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-05-05 13:28:20 +00:00
Merge remote-tracking branch 'origin/develop' into xap
This commit is contained in:
commit
3724c7420f
@ -857,13 +857,52 @@ void keyboard_post_init_kb(void) {
|
|||||||
|
|
||||||
<!-- tabs:start -->
|
<!-- tabs:start -->
|
||||||
|
|
||||||
#### ** Get Geometry **
|
#### ** Gettters **
|
||||||
|
|
||||||
|
These functions allow external code to retrieve the current width, height, rotation, and drawing offsets.
|
||||||
|
|
||||||
|
<!-- tabs:start -->
|
||||||
|
|
||||||
|
#### ** Width **
|
||||||
|
|
||||||
|
```c
|
||||||
|
uint16_t qp_get_width(painter_device_t device);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### ** Height **
|
||||||
|
|
||||||
|
```c
|
||||||
|
uint16_t qp_get_height(painter_device_t device);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### ** Rotation **
|
||||||
|
|
||||||
|
```c
|
||||||
|
painter_rotation_t qp_get_rotation(painter_device_t device);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### ** Offset X **
|
||||||
|
|
||||||
|
```c
|
||||||
|
uint16_t qp_get_offset_x(painter_device_t device);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### ** Offset Y **
|
||||||
|
|
||||||
|
```c
|
||||||
|
uint16_t qp_get_offset_y(painter_device_t device);
|
||||||
|
```
|
||||||
|
|
||||||
|
##### ** Everything **
|
||||||
|
|
||||||
|
Convenience function to call all the previous ones at once.
|
||||||
|
Note: You can pass `NULL` for the values you are not interested in.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
void qp_get_geometry(painter_device_t device, uint16_t *width, uint16_t *height, painter_rotation_t *rotation, uint16_t *offset_x, uint16_t *offset_y);
|
void qp_get_geometry(painter_device_t device, uint16_t *width, uint16_t *height, painter_rotation_t *rotation, uint16_t *offset_x, uint16_t *offset_y);
|
||||||
```
|
```
|
||||||
|
|
||||||
The `qp_get_geometry` function allows external code to retrieve the current width, height, rotation, and drawing offsets.
|
<!-- tabs:end -->
|
||||||
|
|
||||||
#### ** Set Viewport Offsets **
|
#### ** Set Viewport Offsets **
|
||||||
|
|
||||||
|
66
keyboards/handwired/rabijl/rotary_numpad/info.json
Normal file
66
keyboards/handwired/rabijl/rotary_numpad/info.json
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
"manufacturer": "rabijl",
|
||||||
|
"keyboard_name": "rotary_numpad",
|
||||||
|
"maintainer": "rabijl",
|
||||||
|
"url": "https://github.com/RABijl/",
|
||||||
|
"usb": {
|
||||||
|
"device_version": "1.0.0",
|
||||||
|
"pid": "0x0000",
|
||||||
|
"vid": "0xFEED"
|
||||||
|
},
|
||||||
|
"features": {
|
||||||
|
"bootmagic": true,
|
||||||
|
"command": false,
|
||||||
|
"console": false,
|
||||||
|
"extrakey": true,
|
||||||
|
"mousekey": true,
|
||||||
|
"nkro": true,
|
||||||
|
"encoder": true
|
||||||
|
},
|
||||||
|
"development_board": "promicro",
|
||||||
|
"diode_direction": "COL2ROW",
|
||||||
|
"matrix_pins": {
|
||||||
|
"cols": ["F5", "F4", "B5", "B4"],
|
||||||
|
"rows": ["F6", "F7", "B1", "B3", "B2", "B6"]
|
||||||
|
},
|
||||||
|
"encoder": {
|
||||||
|
"rotary": [
|
||||||
|
{"pin_a": "D1", "pin_b": "D0", "resolution": 3},
|
||||||
|
{"pin_a": "D4", "pin_b": "C6", "resolution": 3},
|
||||||
|
{"pin_a": "D7", "pin_b": "E6", "resolution": 3}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"layouts": {
|
||||||
|
"LAYOUT": {
|
||||||
|
"layout": [
|
||||||
|
{"matrix": [5, 0],"x":0, "y":0.4},
|
||||||
|
{"matrix": [0, 0], "x":2, "y":0},
|
||||||
|
{"matrix": [0, 1], "x":3, "y":0},
|
||||||
|
{"matrix": [0, 2], "x":4, "y":0},
|
||||||
|
{"matrix": [0, 3], "x":5, "y":0},
|
||||||
|
{"matrix": [1, 0], "x":2, "y":1.25},
|
||||||
|
{"matrix": [1, 1], "x":3, "y":1.25},
|
||||||
|
{"matrix": [1, 2], "x":4, "y":1.25},
|
||||||
|
{"matrix": [1, 3], "x":5, "y":1.25},
|
||||||
|
{"matrix": [2, 0], "x":2, "y":2.25},
|
||||||
|
{"matrix": [2, 1], "x":3, "y":2.25},
|
||||||
|
{"matrix": [2, 2], "x":4, "y":2.25},
|
||||||
|
{"matrix": [2, 3], "x":5, "y":2.25, "h":2},
|
||||||
|
|
||||||
|
{"matrix": [3, 3], "x":0, "y":2.75},
|
||||||
|
{"matrix": [3, 0], "x":2, "y":3.25},
|
||||||
|
{"matrix": [3, 1], "x":3, "y":3.25},
|
||||||
|
{"matrix": [3, 2], "x":4, "y":3.25},
|
||||||
|
|
||||||
|
{"matrix": [4, 0], "x":2, "y":4.25},
|
||||||
|
{"matrix": [4, 1], "x":3, "y":4.25},
|
||||||
|
{"matrix": [4, 2], "x":4, "y":4.25},
|
||||||
|
{"matrix": [4, 3], "x":5, "y":4.25, "h":2},
|
||||||
|
|
||||||
|
{"matrix": [5, 3], "x":0, "y":5.05},
|
||||||
|
{"matrix": [5, 1], "x":2, "y":5.25, "w":2},
|
||||||
|
{"matrix": [5, 2], "x":4, "y":5.25}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
// Copyright 2023 QMK
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
//
|
||||||
|
|
||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
/*
|
||||||
|
* ┌───┐┌───┬───┬───┬───┐
|
||||||
|
* │Ply││Esc│Tab│MO1│Bsp│
|
||||||
|
* └───┘├───┼───┼───┼───┤
|
||||||
|
* │Num│ / │ * │ - │
|
||||||
|
* ├───┼───┼───┼───┤
|
||||||
|
* │ 7 │ 8 │ 9 │ │
|
||||||
|
* ┌───┐├───┼───┼───┤ + │
|
||||||
|
* │Esc││ 4 │ 5 │ 6 │ │
|
||||||
|
* └───┘├───┼───┼───┼───┤
|
||||||
|
* │ 1 │ 2 │ 3 │ │
|
||||||
|
* ┌───┐├───┴───┼───┤Ent│
|
||||||
|
* │ENT││ 0 │ . │ │
|
||||||
|
* └───┘└───────┴───┴───┘
|
||||||
|
*/
|
||||||
|
[0] = LAYOUT(
|
||||||
|
KC_MPLY, KC_ESC, KC_TAB, MO(1), KC_BSPC,
|
||||||
|
KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
|
||||||
|
KC_P7, KC_P8, KC_P9, KC_PPLS,
|
||||||
|
KC_ESC, KC_P4, KC_P5, KC_P6,
|
||||||
|
KC_P1, KC_P2, KC_P3, KC_PENT,
|
||||||
|
KC_ENT, KC_P0, KC_PDOT
|
||||||
|
),
|
||||||
|
/*
|
||||||
|
* ┌───┐┌───┬───┬───┬───┐
|
||||||
|
* │Ply││Rst│Tab│MO1│Bsp│
|
||||||
|
* └───┘├───┼───┼───┼───┤
|
||||||
|
* │Num│ / │ * │ - │
|
||||||
|
* ├───┼───┼───┼───┤
|
||||||
|
* │Hom│ ↑ │PgU│ │
|
||||||
|
* ┌───┐├───┼───┼───┤ + │
|
||||||
|
* │Esc││ ← │ │ → │ │
|
||||||
|
* └───┘├───┼───┼───┼───┤
|
||||||
|
* │End│ ↓ │PgD│ │
|
||||||
|
* ┌───┐├───┴───┼───┤Ent│
|
||||||
|
* │ENT││Insert │Del│ │
|
||||||
|
* └───┘└───────┴───┘───┘
|
||||||
|
*/
|
||||||
|
[1] = LAYOUT(
|
||||||
|
_______, QK_BOOT, _______, _______, _______,
|
||||||
|
_______, _______, _______, _______,
|
||||||
|
KC_HOME, KC_UP, KC_PGUP, _______,
|
||||||
|
_______, KC_LEFT, KC_NO, KC_RGHT,
|
||||||
|
KC_END, KC_DOWN, KC_PGDN, _______,
|
||||||
|
_______, KC_INS, KC_DEL
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined(ENCODER_MAP_ENABLE)
|
||||||
|
|
||||||
|
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||||
|
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_DOWN, KC_UP), ENCODER_CCW_CW(KC_LEFT, KC_RIGHT) },
|
||||||
|
[1] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(KC_LEFT, KC_RIGHT), ENCODER_CCW_CW(_______, _______) },
|
||||||
|
};
|
||||||
|
#endif
|
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
ENCODER_MAP_ENABLE = yes
|
67
keyboards/handwired/rabijl/rotary_numpad/readme.md
Normal file
67
keyboards/handwired/rabijl/rotary_numpad/readme.md
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# Rotary Numpad
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
This is a personal project of mine where I wanted a number pad that I can put on the left side of keyboard that doesn't have a numberpad. I fell in love with the feel of rotary encoders on my 3d printer, so added three to be able to play around with.
|
||||||
|
|
||||||
|
* Keyboard Maintainer: [rabijl](https://github.com/rabijl)
|
||||||
|
* Hardware Supported: Sparkfun Pro Micro 5V (atmega32u4)
|
||||||
|
* Hardware Availability: https://www.sparkfun.com/products/12640
|
||||||
|
|
||||||
|
## How to build from scratch
|
||||||
|
|
||||||
|
I handsoldered gateron blue switches to a 3D printed case. The design is modified from the [Ultipad](https://www.thingiverse.com/thing:4248565). \
|
||||||
|
I used a sparkfun Pro Micro as my microcontroller and the pinout can be found in the `info.json`. I found this [site](https://golem.hu/article/pro-micro-pinout/) \
|
||||||
|
to be very useful to identify different pins. You can find useful information on rotary encoders from the qmk docs [here](https://docs.qmk.fm/#/reference_info_json?id=encoders) and [here](https://docs.qmk.fm/#/feature_encoders).
|
||||||
|
|
||||||
|
### matrix
|
||||||
|
|
||||||
|
Due to the three rotary encoders, I had to use most of the available pins. Fortunately, all the buttons still fit in a 6x4 matrix. Looking at the diagram below, the three buttons in the first column correspond to each encoder button.
|
||||||
|
|
||||||
|
```
|
||||||
|
┌──┐┌──┐┌──┐┌──┐
|
||||||
|
│0A││0B││0C││0D│
|
||||||
|
┌──┐ └──┘└──┘└──┘└──┘
|
||||||
|
│5A│
|
||||||
|
└──┘ ┌──┐┌──┐┌──┐┌──┐
|
||||||
|
│1A││1B││1C││1D│
|
||||||
|
└──┘└──┘└──┘└──┘
|
||||||
|
┌──┐┌──┐┌──┐┌──┐
|
||||||
|
│2A││2B││2C││2D│
|
||||||
|
┌──┐ └──┘└──┘└──┘│ │
|
||||||
|
│3D│ ┌──┐┌──┐┌──┐│ │
|
||||||
|
└──┘ │3A││3B││3C││ │
|
||||||
|
└──┘└──┘└──┘└──┘
|
||||||
|
┌──┐┌──┐┌──┐┌──┐
|
||||||
|
│4A││4B││4C││4D│
|
||||||
|
└──┘└──┘└──┘│ │
|
||||||
|
┌──┐ ┌──────┐┌──┐│ │
|
||||||
|
│5D│ │5B ││5C││ │
|
||||||
|
└──┘ └──────┘└──┘└──┘
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Flashing
|
||||||
|
|
||||||
|
Make example for this keyboard (after setting up your build environment):
|
||||||
|
|
||||||
|
qmk compile -kb handwired/rabijl/rotary_numpad -km default
|
||||||
|
|
||||||
|
Flashing example for this keyboard:
|
||||||
|
|
||||||
|
qmk flash -kb handwired/rabijl/rotary_numpad -km default
|
||||||
|
|
||||||
|
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
||||||
|
|
||||||
|
## Bootloader
|
||||||
|
|
||||||
|
Enter the bootloader in 3 ways:
|
||||||
|
|
||||||
|
* **Short reset leads**: tap the reset lead to ground twice quickly after qmk is in flash mode
|
||||||
|
* **Keycode in layout**: double tap the key mapped to `QK_BOOT`. On the default keymap this can be found by holding in key (0,C) and tapping key (0,A), see the matrix section for the positions of these keys.
|
||||||
|
* **Bootmagic reset**: Hold down the key at (0,A) in the matrix (see matrix section) and plug in the keyboard
|
||||||
|
|
||||||
|
**Note:** if the keyboard doesn't show up after putting the keyboard in reset mode, check that
|
||||||
|
your user is added to the `tty` and/or `uucp` groups. \
|
||||||
|
You may need to logout after adding these groups to your user, for the changes to take affect.
|
1
keyboards/handwired/rabijl/rotary_numpad/rules.mk
Normal file
1
keyboards/handwired/rabijl/rotary_numpad/rules.mk
Normal file
@ -0,0 +1 @@
|
|||||||
|
# file intentionally left blank
|
@ -131,49 +131,124 @@ bool qp_flush(painter_device_t device) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Quantum Painter External API: qp_get_geometry
|
// Quantum Painter External API: qp_get_*
|
||||||
|
|
||||||
void qp_get_geometry(painter_device_t device, uint16_t *width, uint16_t *height, painter_rotation_t *rotation, uint16_t *offset_x, uint16_t *offset_y) {
|
uint16_t qp_get_width(painter_device_t device) {
|
||||||
qp_dprintf("qp_get_geometry: entry\n");
|
qp_dprintf("qp_get_width: entry\n");
|
||||||
painter_driver_t *driver = (painter_driver_t *)device;
|
painter_driver_t *driver = (painter_driver_t *)device;
|
||||||
|
|
||||||
if (!driver) {
|
if (!driver || !driver->validate_ok) {
|
||||||
qp_dprintf("qp_get_geometry: fail (pointer to NULL)\n");
|
qp_dprintf("qp_get_width: fail (invalid driver)\n");
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t width;
|
||||||
switch (driver->rotation) {
|
switch (driver->rotation) {
|
||||||
default:
|
default:
|
||||||
case QP_ROTATION_0:
|
case QP_ROTATION_0:
|
||||||
case QP_ROTATION_180:
|
case QP_ROTATION_180:
|
||||||
if (width) {
|
width = driver->panel_width;
|
||||||
*width = driver->panel_width;
|
|
||||||
}
|
|
||||||
if (height) {
|
|
||||||
*height = driver->panel_height;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case QP_ROTATION_90:
|
case QP_ROTATION_90:
|
||||||
case QP_ROTATION_270:
|
case QP_ROTATION_270:
|
||||||
if (width) {
|
width = driver->panel_height;
|
||||||
*width = driver->panel_height;
|
}
|
||||||
}
|
|
||||||
if (height) {
|
qp_dprintf("qp_get_width: ok\n");
|
||||||
*height = driver->panel_width;
|
return width;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
uint16_t qp_get_height(painter_device_t device) {
|
||||||
|
qp_dprintf("qp_get_height: entry\n");
|
||||||
|
painter_driver_t *driver = (painter_driver_t *)device;
|
||||||
|
|
||||||
|
if (!driver || !driver->validate_ok) {
|
||||||
|
qp_dprintf("qp_get_height: fail (invalid driver)\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t height;
|
||||||
|
switch (driver->rotation) {
|
||||||
|
default:
|
||||||
|
case QP_ROTATION_0:
|
||||||
|
case QP_ROTATION_180:
|
||||||
|
height = driver->panel_height;
|
||||||
|
|
||||||
|
case QP_ROTATION_90:
|
||||||
|
case QP_ROTATION_270:
|
||||||
|
height = driver->panel_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
qp_dprintf("qp_get_height: ok\n");
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
painter_rotation_t qp_get_rotation(painter_device_t device) {
|
||||||
|
qp_dprintf("qp_get_rotation: entry\n");
|
||||||
|
painter_driver_t *driver = (painter_driver_t *)device;
|
||||||
|
|
||||||
|
if (!driver || !driver->validate_ok) {
|
||||||
|
qp_dprintf("qp_get_rotation: fail (invalid driver)\n");
|
||||||
|
return QP_ROTATION_0;
|
||||||
|
}
|
||||||
|
|
||||||
|
qp_dprintf("qp_get_rotation: ok\n");
|
||||||
|
return driver->rotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t qp_get_offset_x(painter_device_t device) {
|
||||||
|
qp_dprintf("qp_get_offset_x: entry\n");
|
||||||
|
painter_driver_t *driver = (painter_driver_t *)device;
|
||||||
|
|
||||||
|
if (!driver || !driver->validate_ok) {
|
||||||
|
qp_dprintf("qp_get_offset_x: fail (invalid driver)\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
qp_dprintf("qp_get_offset_x: ok\n");
|
||||||
|
return driver->offset_x;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t qp_get_offset_y(painter_device_t device) {
|
||||||
|
qp_dprintf("qp_get_offset_y: entry\n");
|
||||||
|
painter_driver_t *driver = (painter_driver_t *)device;
|
||||||
|
|
||||||
|
if (!driver || !driver->validate_ok) {
|
||||||
|
qp_dprintf("qp_get_offset_y: fail (invalid driver)\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
qp_dprintf("qp_get_offset_y: ok\n");
|
||||||
|
return driver->offset_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void qp_get_geometry(painter_device_t device, uint16_t *width, uint16_t *height, painter_rotation_t *rotation, uint16_t *offset_x, uint16_t *offset_y) {
|
||||||
|
qp_dprintf("qp_geometry: entry\n");
|
||||||
|
painter_driver_t *driver = (painter_driver_t *)device;
|
||||||
|
|
||||||
|
if (!driver || !driver->validate_ok) {
|
||||||
|
qp_dprintf("qp_geometry: fail (invalid driver)\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (width) {
|
||||||
|
*width = qp_get_width(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (height) {
|
||||||
|
*height = qp_get_height(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rotation) {
|
if (rotation) {
|
||||||
*rotation = driver->rotation;
|
*rotation = qp_get_rotation(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset_x) {
|
if (offset_x) {
|
||||||
*offset_x = driver->offset_x;
|
*offset_x = qp_get_offset_x(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset_y) {
|
if (offset_y) {
|
||||||
*offset_y = driver->offset_y;
|
*offset_y = qp_get_offset_y(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
qp_dprintf("qp_get_geometry: ok\n");
|
qp_dprintf("qp_get_geometry: ok\n");
|
||||||
|
@ -175,6 +175,41 @@ bool qp_clear(painter_device_t device);
|
|||||||
*/
|
*/
|
||||||
bool qp_flush(painter_device_t device);
|
bool qp_flush(painter_device_t device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the width of the display.
|
||||||
|
*
|
||||||
|
* @param device[in] the handle of the device to control
|
||||||
|
*/
|
||||||
|
uint16_t qp_get_width(painter_device_t device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the height of the display.
|
||||||
|
*
|
||||||
|
* @param device[in] the handle of the device to control
|
||||||
|
*/
|
||||||
|
uint16_t qp_get_height(painter_device_t device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the rotation of the display.
|
||||||
|
*
|
||||||
|
* @param device[in] the handle of the device to control
|
||||||
|
*/
|
||||||
|
painter_rotation_t qp_get_rotation(painter_device_t device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the x-offset of the display.
|
||||||
|
*
|
||||||
|
* @param device[in] the handle of the device to control
|
||||||
|
*/
|
||||||
|
uint16_t qp_get_offset_x(painter_device_t device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the y-offset of the display.
|
||||||
|
*
|
||||||
|
* @param device[in] the handle of the device to control
|
||||||
|
*/
|
||||||
|
uint16_t qp_get_offset_y(painter_device_t device);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the size, rotation, and offsets for the display.
|
* Retrieves the size, rotation, and offsets for the display.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user