1
0
Fork 0

[Keyboard] Orion Locking Indicator LED Support (#7683)

* add indicator lighting support thanks to Keebology tracing

* set the correct number of underglow LEDs

* add comments and skeletal structure for layer indicator LEDs

* add backlight areas pins

* update readme

* we can't turn leds on based on zones, so we use multiple backlight pin support instead to turn them ALL on and control them.

* add comments to backlight setting

* make a more useful default keymap that can also be used for testing

* add duck orion to list

* add indicator led support

* update readme

* Update keyboards/duck/orion/v3/matrix.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/duck/orion/v3/matrix.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/duck/orion/v3/matrix.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/duck/orion/v3/matrix.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/duck/orion/v3/matrix.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/duck/orion/v3/matrix.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* add the appropriate header files

* fix indent so Drashna will not die

* Update keyboards/duck/orion/v3/v3.c

Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/duck/orion/v3/keymaps/default/keymap.c

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/duck/orion/v3/keymaps/default/keymap.c

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/duck/orion/v3/readme.md

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/duck/orion/v3/readme.md

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/duck/orion/v3/readme.md

Co-Authored-By: fauxpark <fauxpark@gmail.com>

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
Co-authored-by: fauxpark <fauxpark@gmail.com>
This commit is contained in:
MechMerlin 2019-12-29 11:16:24 -08:00 committed by Drashna Jaelre
parent 8af1501328
commit 64263bbb02
6 changed files with 64 additions and 72 deletions

View file

@ -37,11 +37,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DEBOUNCE 5 #define DEBOUNCE 5
/* number of backlight levels */ /* number of backlight levels */
#define BACKLIGHT_LEVELS 3 // #define BACKLIGHT_LEVELS 3
#undef BACKLIGHT_PIN
#define BACKLIGHT_PINS { B1, B2, B3, E6 }
#define BACKLIGHT_LED_COUNT 4
#define BACKLIGHT_LEVELS 10
#define BACKLIGHT_ON_STATE 1
#define RGBLIGHT_ANIMATIONS #define RGBLIGHT_ANIMATIONS
#define RGB_DI_PIN D6 #define RGB_DI_PIN D6
#define RGBLED_NUM 17 #define RGBLED_NUM 18
/* Set to top left most key */ /* Set to top left most key */
#define BOOTMAGIC_LITE_ROW 4 #define BOOTMAGIC_LITE_ROW 4

View file

@ -16,11 +16,19 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_tkl_ansi(\ [0] = LAYOUT_tkl_ansi(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SLCK,KC_PAUS, \ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SLCK,KC_PAUS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,KC_MINS, KC_EQL,KC_BSPC, KC_INS ,KC_HOME,KC_PGUP, \ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,KC_MINS, KC_EQL,KC_BSPC, KC_INS ,KC_HOME,KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,KC_LBRC,KC_RBRC,KC_BSLS, KC_DEL ,KC_END ,KC_PGDN, \ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,KC_LBRC,KC_RBRC,KC_BSLS, KC_DEL ,KC_END ,KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_SCLN,KC_QUOT, KC_ENT, \ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_SCLN,KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, \ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, KC_APP,KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT) \ KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, MO(1),KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT),
[1] = LAYOUT_tkl_ansi(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
BL_TOGG, BL_STEP, BL_INC, BL_DEC, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
}; };

View file

@ -14,13 +14,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <util/delay.h> #include "quantum.h"
#include <avr/io.h>
#include <stdio.h>
#include "matrix.h"
#include "util.h"
#include "print.h"
#include "debug.h"
static uint8_t debouncing = DEBOUNCE; static uint8_t debouncing = DEBOUNCE;
@ -54,18 +48,23 @@ void matrix_scan_user(void) {
void backlight_init_ports(void) void backlight_init_ports(void)
{ {
DDRD |= 0b11010000;
PORTD &= ~0b01010000; }
PORTD |= 0b10000000;
DDRB |= 0b00011111; void indicator_init_ports(void) {
PORTB &= ~0b00001110;
PORTB |= 0b00010001; // Num LED
DDRE |= 0b01000000; setPinOutput(B4);
PORTE &= ~0b01000000;
// Caps Lock
setPinOutput(B0);
// Scroll Lock
setPinOutput(D7);
} }
void matrix_init(void) { void matrix_init(void) {
backlight_init_ports(); indicator_init_ports();
unselect_cols(); unselect_cols();
init_rows(); init_rows();

View file

@ -3,9 +3,9 @@
Non official firmware for custom TKL Korean keyboard made by Duck. Non official firmware for custom TKL Korean keyboard made by Duck.
Group buy was run December 2018 via [geekhack](https://geekhack.org/index.php?topic=98581.0) with 100 keyboards total. Group buy was run December 2018 via [geekhack](https://geekhack.org/index.php?topic=98581.0) with 100 keyboards total.
Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin) * Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin)
Hardware Supported: Duck Eagle/Viper PCB Ver 2.0, Atmega32u4 * Hardware Supported: Duck Orion V3 PCB Ver 2.1
Hardware Availability: Wait until GB of the next revision * Hardware Availability: Wait until GB of the next revision
Make example for this keyboard (after setting up your build environment): Make example for this keyboard (after setting up your build environment):
@ -13,7 +13,7 @@ Make example for this keyboard (after setting up your build environment):
**Reset Key:** To put the Orion V3 into reset, hold Backspace key (`K4N`) while plugging in. **Reset Key:** To put the Orion V3 into reset, hold Backspace key (`K4N`) while plugging in.
**CAUTION:** At this time 10/03/19 lighting has not been tested fully and may not properly work. **CAUTION:** At this time 12/19/19 layer indicator lighting has not been implemented by 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). 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).
@ -22,9 +22,9 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to
The Orion V3 PCB consists of: The Orion V3 PCB consists of:
### Microchips ### Microchips
2 74HC237D 3-to-8 line decoders 2 74HC237D 3-to-8 line decoders U1, U2
1 Atmega32u4 microcontroller 1 Atmega32u4 microcontroller
2 WS2811 LED controller 2 WS2811 LED controller U5, U6
## Notes ## Notes
Special thanks to Marcus aka Keebology for doing this remotely and mapping the matrix. Special thanks to Marcus aka Keebology for doing this remotely and mapping the matrix, indicator LEDs, and backlight LEDs.

View file

@ -16,48 +16,26 @@
#include "v3.h" #include "v3.h"
#include "indicator_leds.h" #include "indicator_leds.h"
enum BACKLIGHT_AREAS { // Alphas PB1
BACKLIGHT_ALPHAS = 0b00000010, // Navigation Cluster: PB2
BACKLIGHT_MODNUM = 0b00001000 // Number Row, Mods: PB3
}; // Function Row: PE6
void backlight_set(uint8_t level) { // Other than using RGB or LED matrix, QMK cannot turn on specific zones
switch(level) { // of backlight LEDs. Unfortunately, Duck PCBs do not follow this design
case 0: // and instead use multiple pins connected to each of these zones. QMK is
PORTB |= BACKLIGHT_ALPHAS; // only able to control them ALL with the current default mechanisms.
PORTB |= BACKLIGHT_MODNUM;
break; // Locking indicator LEDs
case 1: // The Duck Orion V3 has 3 locking indicator LEDs and are located to the right
PORTB &= ~BACKLIGHT_ALPHAS; // of the Escape key.
PORTB |= BACKLIGHT_MODNUM; bool led_update_kb(led_t led_state) {
break; if(led_update_user(led_state)) {
case 2: writePin(B0, !led_state.caps_lock);
PORTB |= BACKLIGHT_ALPHAS; writePin(B4, !led_state.num_lock);
PORTB &= ~BACKLIGHT_MODNUM; writePin(D7, !led_state.scroll_lock);
break;
case 3:
PORTB &= ~BACKLIGHT_ALPHAS;
PORTB &= ~BACKLIGHT_MODNUM;
break;
} }
} return true;
// Port from backlight_update_state
void led_set_kb(uint8_t usb_led) {
bool status[8] = {
IS_HOST_LED_ON(USB_LED_SCROLL_LOCK), /* LED 3 */
IS_HOST_LED_ON(USB_LED_CAPS_LOCK), /* LED 2 */
IS_HOST_LED_ON(USB_LED_NUM_LOCK), /* LED 1 */
layer_state & (1<<2), /* LED 6 */
layer_state & (1<<1), /* LED 5 */
layer_state & (1<<0) ? 0: 1, /* LED 4 */
layer_state & (1<<5), /* LED 8 */
layer_state & (1<<4) /* LED 7 */
};
indicator_leds_set(status);
} }
bool process_record_kb(uint16_t keycode, keyrecord_t *record) { bool process_record_kb(uint16_t keycode, keyrecord_t *record) {

View file

@ -13,4 +13,5 @@ Jetfire V1
Lightsaver V3 Lightsaver V3
Octagon V1 Octagon V1
Octagon V2 Octagon V2
Orion V3
Viper V2 Viper V2