forked from JW2586/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Keyboard] Add Big Knob board (qmk#22292)
Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com>
- Loading branch information
Showing
13 changed files
with
1,878 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// Copyright 2023 jpe230 (@jpe230) | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#include "qp.h" | ||
#include "qp_comms.h" | ||
#include "qp_st77xx_opcodes.h" | ||
#include "gfx/logo.qgf.h" | ||
|
||
painter_device_t lcd; | ||
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
// Init board: | ||
// - Draw logo | ||
|
||
void keyboard_post_init_kb(void) { | ||
backlight_set(BACKLIGHT_DEFAULT_LEVEL); | ||
|
||
wait_ms(LCD_WAIT_TIME); | ||
|
||
// Initialise the LCD | ||
lcd = qp_st7735_make_spi_device(LCD_HEIGHT, LCD_WIDTH, LCD_CS_PIN, LCD_DC_PIN, LCD_RST_PIN, LCD_SPI_DIVISOR, 0); | ||
qp_init(lcd, LCD_ROTATION); | ||
|
||
// Invert Colour | ||
#ifdef LCD_INVERT_COLOUR | ||
qp_comms_start(lcd); | ||
qp_comms_command(lcd, ST77XX_CMD_INVERT_ON); | ||
qp_comms_stop(lcd); | ||
#endif | ||
|
||
// Apply Offset | ||
qp_set_viewport_offsets(lcd, LCD_OFFSET_X, LCD_OFFSET_Y); | ||
|
||
// Turn on the LCD and clear the display | ||
qp_power(lcd, true); | ||
qp_rect(lcd, 0, 0, LCD_WIDTH, LCD_HEIGHT, HSV_BLACK, true); | ||
|
||
// Show logo | ||
painter_image_handle_t logo_image = qp_load_image_mem(gfx_logo); | ||
qp_drawimage(lcd, 0, 0, logo_image); | ||
|
||
keyboard_post_init_user(); | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
// Lights handling: | ||
// - Turn off backlight (screen) after timeout or suspend | ||
// - Turn off rgblight after timeout or suspend | ||
|
||
bool lights_off = false; | ||
|
||
__attribute__((weak)) void lights_wakeup_user(void) {}; | ||
__attribute__((weak)) void lights_suspend_user(void) {}; | ||
|
||
void backlight_wakeup(void) { | ||
backlight_set(BACKLIGHT_DEFAULT_LEVEL); | ||
} | ||
|
||
void backlight_suspend(void) { | ||
backlight_set(0); | ||
} | ||
|
||
void lights_wakeup(void) { | ||
lights_off = false; | ||
rgblight_wakeup(); | ||
backlight_wakeup(); | ||
lights_wakeup_user(); | ||
} | ||
|
||
void lights_suspend(void) { | ||
lights_off = true; | ||
lights_suspend_user(); | ||
rgblight_suspend(); | ||
backlight_suspend(); | ||
} | ||
|
||
void housekeeping_task_kb(void) { | ||
if ( lights_off && last_input_activity_elapsed() <= LIGHTS_TIMEOUT) | ||
{ | ||
lights_wakeup(); | ||
} | ||
if (!lights_off && last_input_activity_elapsed() > LIGHTS_TIMEOUT) { | ||
lights_suspend(); | ||
} | ||
} | ||
|
||
void suspend_power_down_kb(void) { | ||
lights_suspend(); | ||
qp_power(lcd, false); | ||
suspend_power_down_user(); | ||
} | ||
|
||
void suspend_wakeup_init_kb(void) { | ||
qp_power(lcd, true); | ||
lights_wakeup(); | ||
suspend_wakeup_init_user(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2023 jpe230 (@jpe230) | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#pragma once | ||
|
||
// SPI pins | ||
#define SPI_DRIVER SPID0 | ||
#define SPI_SCK_PIN GP22 | ||
#define SPI_MOSI_PIN GP23 | ||
#define SPI_MISO_PIN GP20 // Unused | ||
|
||
// LCD Configuration | ||
#define LCD_RST_PIN GP21 | ||
#define LCD_CS_PIN GP8 | ||
#define LCD_DC_PIN GP9 | ||
#define LCD_BLK_PIN GP7 | ||
#define LCD_SPI_DIVISOR 4 | ||
#define LCD_WAIT_TIME 150 | ||
#define LCD_WIDTH 160 | ||
#define LCD_HEIGHT 80 | ||
#define LCD_ROTATION QP_ROTATION_270 | ||
#define LCD_OFFSET_X 1 | ||
#define LCD_OFFSET_Y 26 | ||
#define LCD_INVERT_COLOUR | ||
|
||
// QP Configuration | ||
#define QUANTUM_PAINTER_SUPPORTS_NATIVE_COLORS TRUE | ||
#define ST7735_NO_AUTOMATIC_VIEWPORT_OFFSETS | ||
|
||
// Backlight configuration | ||
#define BACKLIGHT_PWM_DRIVER PWMD3 | ||
#define BACKLIGHT_PWM_CHANNEL 2 | ||
#define BACKLIGHT_DEFAULT_LEVEL 6 | ||
|
||
// Timeout configuration | ||
#define QUANTUM_PAINTER_DISPLAY_TIMEOUT 10000 | ||
#define LIGHTS_TIMEOUT QUANTUM_PAINTER_DISPLAY_TIMEOUT |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2023 jpe230 (@jpe230) | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
// This file was auto-generated by `qmk painter-convert-graphics -i logo.png -f rgb565` | ||
|
||
#pragma once | ||
|
||
#include <qp.h> | ||
|
||
extern const uint32_t gfx_logo_length; | ||
extern const uint8_t gfx_logo[24769]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright 2023 jpe230 (@jpe230) | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#pragma once | ||
|
||
#include_next <halconf.h> | ||
|
||
#undef HAL_USE_SPI | ||
#define HAL_USE_SPI TRUE | ||
|
||
#undef HAL_USE_PWM | ||
#define HAL_USE_PWM TRUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"manufacturer": "jpe230", | ||
"keyboard_name": "big_knob", | ||
"maintainer": "jpe230", | ||
"bootloader": "rp2040", | ||
"processor": "RP2040", | ||
"url": "https://github.com/Jpe230/big_knob", | ||
"usb": { | ||
"device_version": "1.0.0", | ||
"vid": "0xE230", | ||
"pid": "0x1337" | ||
}, | ||
"features": { | ||
"rgblight": true, | ||
"bootmagic": true, | ||
"extrakey": true, | ||
"mousekey": true, | ||
"encoder": true, | ||
"backlight": true | ||
}, | ||
"matrix_pins": { | ||
"direct": [ | ||
["GP1"] | ||
] | ||
}, | ||
"encoder": { | ||
"rotary": [ | ||
{"pin_a": "GP2", "pin_b": "GP3"} | ||
] | ||
}, | ||
"backlight": { | ||
"pin": "GP7", | ||
"levels": 7, | ||
"breathing": false | ||
}, | ||
"rgblight": { | ||
"driver": "ws2812", | ||
"led_count": 10, | ||
"max_brightness": 200, | ||
"sleep": true, | ||
"animations": { | ||
"breathing": true, | ||
"rainbow_mood": true, | ||
"rainbow_swirl": true, | ||
"snake": true, | ||
"knight": true, | ||
"christmas": true, | ||
"static_gradient": true, | ||
"rgb_test": true, | ||
"alternating": true, | ||
"twinkle": true | ||
} | ||
}, | ||
"ws2812": { | ||
"pin": "GP0", | ||
"driver": "vendor" | ||
}, | ||
"community_layouts": ["ortho_1x1"], | ||
"layouts": { | ||
"LAYOUT_ortho_1x1": { | ||
"layout": [ | ||
{"matrix": [0, 0], "x": 0, "y": 0} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2023 jpe230 (@jpe230) | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#include QMK_KEYBOARD_H | ||
|
||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
[0] = LAYOUT_ortho_1x1( | ||
KC_MUTE | ||
) | ||
}; | ||
|
||
#ifdef ENCODER_MAP_ENABLE | ||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { | ||
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ENCODER_MAP_ENABLE = yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2023 jpe230 (@jpe230) | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#include QMK_KEYBOARD_H | ||
|
||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
[0] = LAYOUT_ortho_1x1( | ||
KC_MUTE | ||
) | ||
}; | ||
|
||
#ifdef ENCODER_MAP_ENABLE | ||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { | ||
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ENCODER_MAP_ENABLE = yes | ||
VIA_ENABLE = yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright 2023 jpe230 (@jpe230) | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#pragma once | ||
|
||
#include_next <mcuconf.h> | ||
|
||
#undef RP_SPI_USE_SPI0 | ||
#define RP_SPI_USE_SPI0 TRUE | ||
|
||
#undef RP_PWM_USE_PWM3 | ||
#define RP_PWM_USE_PWM3 TRUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Big Knob | ||
|
||
![big_knob](https://i.imgur.com/KLS0O7Zh.png) | ||
|
||
A 3D printed single encoder volume knob with a SPI Screen. | ||
|
||
* Keyboard Maintainer: [jpe230](https://github.com/jpe230) | ||
* Hardware Supported: Big Knob PCB, Sparkfun ProMicro RP2040 (*See notes*) | ||
* Hardware Availability: <https://github.com/Jpe230/big_knob> | ||
## Features | ||
|
||
The Big Knob was designed to be easy to assemble: | ||
* Designed to be used with a RP2040 board (*See notes*) | ||
* ST7735 0.96 inch color display | ||
* RGBLight | ||
* Easy to 3D print | ||
|
||
### Notes | ||
You can use any compatible RP2040 board (I.E.: KB2040, Elite Pi, etc), but you will need to modify the pin definition to match you board | ||
|
||
## Flashing | ||
|
||
Make example for this keyboard (after setting up your build environment): | ||
|
||
qmk compile -kb jpe230/big_knob -km default | ||
|
||
Flashing example for this keyboard: | ||
|
||
qmk flash -kb jpe230/big_knob -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). | ||
|
||
## Building Instructions | ||
|
||
You can find the required materials and the instructions to build your own Big Knob in the [project repo](https://github.com/Jpe230/big_knob) | ||
|
||
## Bootloader | ||
|
||
Enter the bootloader in 3 ways: | ||
|
||
* **Bootmagic reset**: Hold down the encoder buitton and plug in the keyboard | ||
* **Physical reset button**: Briefly press the reset button on the front of the RP2040 board | ||
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
QUANTUM_PAINTER_ENABLE = yes | ||
QUANTUM_PAINTER_DRIVERS += st7735_spi | ||
SRC += gfx/logo.qgf.c |