diff options
| author | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-12-29 11:16:24 -0800 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-12-29 11:16:24 -0800 |
| commit | 64263bbb0255df756dc30467ee6643054d325597 (patch) | |
| tree | 21da8898b5451ecf2d0d0281d423da0f7347ef64 /keyboards/duck | |
| parent | 8af1501328711ba806785861b183786cb5cbb80a (diff) | |
| download | qmk_firmware-64263bbb0255df756dc30467ee6643054d325597.tar.gz qmk_firmware-64263bbb0255df756dc30467ee6643054d325597.zip | |
[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>
Diffstat (limited to 'keyboards/duck')
| -rw-r--r-- | keyboards/duck/orion/v3/config.h | 10 | ||||
| -rw-r--r-- | keyboards/duck/orion/v3/keymaps/default/keymap.c | 22 | ||||
| -rw-r--r-- | keyboards/duck/orion/v3/matrix.c | 31 | ||||
| -rw-r--r-- | keyboards/duck/orion/v3/readme.md | 14 | ||||
| -rw-r--r-- | keyboards/duck/orion/v3/v3.c | 58 | ||||
| -rw-r--r-- | keyboards/duck/readme.md | 1 |
6 files changed, 64 insertions, 72 deletions
diff --git a/keyboards/duck/orion/v3/config.h b/keyboards/duck/orion/v3/config.h index 3a17d5941..b04729712 100644 --- a/keyboards/duck/orion/v3/config.h +++ b/keyboards/duck/orion/v3/config.h | |||
| @@ -37,11 +37,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 37 | #define DEBOUNCE 5 | 37 | #define DEBOUNCE 5 |
| 38 | 38 | ||
| 39 | /* number of backlight levels */ | 39 | /* number of backlight levels */ |
| 40 | #define BACKLIGHT_LEVELS 3 | 40 | // #define BACKLIGHT_LEVELS 3 |
| 41 | |||
| 42 | #undef BACKLIGHT_PIN | ||
| 43 | #define BACKLIGHT_PINS { B1, B2, B3, E6 } | ||
| 44 | #define BACKLIGHT_LED_COUNT 4 | ||
| 45 | #define BACKLIGHT_LEVELS 10 | ||
| 46 | #define BACKLIGHT_ON_STATE 1 | ||
| 41 | 47 | ||
| 42 | #define RGBLIGHT_ANIMATIONS | 48 | #define RGBLIGHT_ANIMATIONS |
| 43 | #define RGB_DI_PIN D6 | 49 | #define RGB_DI_PIN D6 |
| 44 | #define RGBLED_NUM 17 | 50 | #define RGBLED_NUM 18 |
| 45 | 51 | ||
| 46 | /* Set to top left most key */ | 52 | /* Set to top left most key */ |
| 47 | #define BOOTMAGIC_LITE_ROW 4 | 53 | #define BOOTMAGIC_LITE_ROW 4 |
diff --git a/keyboards/duck/orion/v3/keymaps/default/keymap.c b/keyboards/duck/orion/v3/keymaps/default/keymap.c index 83fa4f9a8..0da0cdaeb 100644 --- a/keyboards/duck/orion/v3/keymaps/default/keymap.c +++ b/keyboards/duck/orion/v3/keymaps/default/keymap.c | |||
| @@ -16,11 +16,19 @@ | |||
| 16 | #include QMK_KEYBOARD_H | 16 | #include QMK_KEYBOARD_H |
| 17 | 17 | ||
| 18 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 18 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 19 | [0] = LAYOUT_tkl_ansi(\ | 19 | [0] = LAYOUT_tkl_ansi( |
| 20 | 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, \ | 20 | 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, |
| 21 | 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, \ | 21 | 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, |
| 22 | 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, \ | 22 | 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, |
| 23 | 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, \ | 23 | 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, |
| 24 | 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, \ | 24 | 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, |
| 25 | KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, KC_APP,KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT) \ | 25 | KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, MO(1),KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT), |
| 26 | |||
| 27 | [1] = LAYOUT_tkl_ansi( | ||
| 28 | 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, | ||
| 29 | 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, | ||
| 30 | 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, | ||
| 31 | 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, | ||
| 32 | 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, | ||
| 33 | KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) | ||
| 26 | }; | 34 | }; |
diff --git a/keyboards/duck/orion/v3/matrix.c b/keyboards/duck/orion/v3/matrix.c index 3c3240b9f..f93c7a9cd 100644 --- a/keyboards/duck/orion/v3/matrix.c +++ b/keyboards/duck/orion/v3/matrix.c | |||
| @@ -14,13 +14,7 @@ You should have received a copy of the GNU General Public License | |||
| 14 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include <util/delay.h> | 17 | #include "quantum.h" |
| 18 | #include <avr/io.h> | ||
| 19 | #include <stdio.h> | ||
| 20 | #include "matrix.h" | ||
| 21 | #include "util.h" | ||
| 22 | #include "print.h" | ||
| 23 | #include "debug.h" | ||
| 24 | 18 | ||
| 25 | static uint8_t debouncing = DEBOUNCE; | 19 | static uint8_t debouncing = DEBOUNCE; |
| 26 | 20 | ||
| @@ -54,18 +48,23 @@ void matrix_scan_user(void) { | |||
| 54 | 48 | ||
| 55 | void backlight_init_ports(void) | 49 | void backlight_init_ports(void) |
| 56 | { | 50 | { |
| 57 | DDRD |= 0b11010000; | 51 | |
| 58 | PORTD &= ~0b01010000; | 52 | } |
| 59 | PORTD |= 0b10000000; | 53 | |
| 60 | DDRB |= 0b00011111; | 54 | void indicator_init_ports(void) { |
| 61 | PORTB &= ~0b00001110; | 55 | |
| 62 | PORTB |= 0b00010001; | 56 | // Num LED |
| 63 | DDRE |= 0b01000000; | 57 | setPinOutput(B4); |
| 64 | PORTE &= ~0b01000000; | 58 | |
| 59 | // Caps Lock | ||
| 60 | setPinOutput(B0); | ||
| 61 | |||
| 62 | // Scroll Lock | ||
| 63 | setPinOutput(D7); | ||
| 65 | } | 64 | } |
| 66 | 65 | ||
| 67 | void matrix_init(void) { | 66 | void matrix_init(void) { |
| 68 | backlight_init_ports(); | 67 | indicator_init_ports(); |
| 69 | unselect_cols(); | 68 | unselect_cols(); |
| 70 | init_rows(); | 69 | init_rows(); |
| 71 | 70 | ||
diff --git a/keyboards/duck/orion/v3/readme.md b/keyboards/duck/orion/v3/readme.md index 50032e93e..8d1b83401 100644 --- a/keyboards/duck/orion/v3/readme.md +++ b/keyboards/duck/orion/v3/readme.md | |||
| @@ -3,9 +3,9 @@ | |||
| 3 | Non official firmware for custom TKL Korean keyboard made by Duck. | 3 | Non official firmware for custom TKL Korean keyboard made by Duck. |
| 4 | Group buy was run December 2018 via [geekhack](https://geekhack.org/index.php?topic=98581.0) with 100 keyboards total. | 4 | Group buy was run December 2018 via [geekhack](https://geekhack.org/index.php?topic=98581.0) with 100 keyboards total. |
| 5 | 5 | ||
| 6 | Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin) | 6 | * Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin) |
| 7 | Hardware Supported: Duck Eagle/Viper PCB Ver 2.0, Atmega32u4 | 7 | * Hardware Supported: Duck Orion V3 PCB Ver 2.1 |
| 8 | Hardware Availability: Wait until GB of the next revision | 8 | * Hardware Availability: Wait until GB of the next revision |
| 9 | 9 | ||
| 10 | Make example for this keyboard (after setting up your build environment): | 10 | Make example for this keyboard (after setting up your build environment): |
| 11 | 11 | ||
| @@ -13,7 +13,7 @@ Make example for this keyboard (after setting up your build environment): | |||
| 13 | 13 | ||
| 14 | **Reset Key:** To put the Orion V3 into reset, hold Backspace key (`K4N`) while plugging in. | 14 | **Reset Key:** To put the Orion V3 into reset, hold Backspace key (`K4N`) while plugging in. |
| 15 | 15 | ||
| 16 | **CAUTION:** At this time 10/03/19 lighting has not been tested fully and may not properly work. | 16 | **CAUTION:** At this time 12/19/19 layer indicator lighting has not been implemented by default. |
| 17 | 17 | ||
| 18 | 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). | 18 | 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). |
| 19 | 19 | ||
| @@ -22,9 +22,9 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to | |||
| 22 | The Orion V3 PCB consists of: | 22 | The Orion V3 PCB consists of: |
| 23 | 23 | ||
| 24 | ### Microchips | 24 | ### Microchips |
| 25 | 2 74HC237D 3-to-8 line decoders | 25 | 2 74HC237D 3-to-8 line decoders U1, U2 |
| 26 | 1 Atmega32u4 microcontroller | 26 | 1 Atmega32u4 microcontroller |
| 27 | 2 WS2811 LED controller | 27 | 2 WS2811 LED controller U5, U6 |
| 28 | 28 | ||
| 29 | ## Notes | 29 | ## Notes |
| 30 | Special thanks to Marcus aka Keebology for doing this remotely and mapping the matrix. \ No newline at end of file | 30 | Special thanks to Marcus aka Keebology for doing this remotely and mapping the matrix, indicator LEDs, and backlight LEDs. |
diff --git a/keyboards/duck/orion/v3/v3.c b/keyboards/duck/orion/v3/v3.c index 95da4b45b..ca5c512ce 100644 --- a/keyboards/duck/orion/v3/v3.c +++ b/keyboards/duck/orion/v3/v3.c | |||
| @@ -16,48 +16,26 @@ | |||
| 16 | #include "v3.h" | 16 | #include "v3.h" |
| 17 | #include "indicator_leds.h" | 17 | #include "indicator_leds.h" |
| 18 | 18 | ||
| 19 | enum BACKLIGHT_AREAS { | 19 | // Alphas PB1 |
| 20 | BACKLIGHT_ALPHAS = 0b00000010, | 20 | // Navigation Cluster: PB2 |
| 21 | BACKLIGHT_MODNUM = 0b00001000 | 21 | // Number Row, Mods: PB3 |
| 22 | }; | 22 | // Function Row: PE6 |
| 23 | 23 | ||
| 24 | void backlight_set(uint8_t level) { | 24 | // Other than using RGB or LED matrix, QMK cannot turn on specific zones |
| 25 | switch(level) { | 25 | // of backlight LEDs. Unfortunately, Duck PCBs do not follow this design |
| 26 | case 0: | 26 | // and instead use multiple pins connected to each of these zones. QMK is |
| 27 | PORTB |= BACKLIGHT_ALPHAS; | 27 | // only able to control them ALL with the current default mechanisms. |
| 28 | PORTB |= BACKLIGHT_MODNUM; | ||
| 29 | break; | ||
| 30 | case 1: | ||
| 31 | PORTB &= ~BACKLIGHT_ALPHAS; | ||
| 32 | PORTB |= BACKLIGHT_MODNUM; | ||
| 33 | break; | ||
| 34 | case 2: | ||
| 35 | PORTB |= BACKLIGHT_ALPHAS; | ||
| 36 | PORTB &= ~BACKLIGHT_MODNUM; | ||
| 37 | break; | ||
| 38 | case 3: | ||
| 39 | PORTB &= ~BACKLIGHT_ALPHAS; | ||
| 40 | PORTB &= ~BACKLIGHT_MODNUM; | ||
| 41 | break; | ||
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 45 | // Port from backlight_update_state | ||
| 46 | void led_set_kb(uint8_t usb_led) { | ||
| 47 | bool status[8] = { | ||
| 48 | IS_HOST_LED_ON(USB_LED_SCROLL_LOCK), /* LED 3 */ | ||
| 49 | IS_HOST_LED_ON(USB_LED_CAPS_LOCK), /* LED 2 */ | ||
| 50 | IS_HOST_LED_ON(USB_LED_NUM_LOCK), /* LED 1 */ | ||
| 51 | |||
| 52 | layer_state & (1<<2), /* LED 6 */ | ||
| 53 | layer_state & (1<<1), /* LED 5 */ | ||
| 54 | layer_state & (1<<0) ? 0: 1, /* LED 4 */ | ||
| 55 | |||
| 56 | layer_state & (1<<5), /* LED 8 */ | ||
| 57 | layer_state & (1<<4) /* LED 7 */ | ||
| 58 | }; | ||
| 59 | 28 | ||
| 60 | indicator_leds_set(status); | 29 | // Locking indicator LEDs |
| 30 | // The Duck Orion V3 has 3 locking indicator LEDs and are located to the right | ||
| 31 | // of the Escape key. | ||
| 32 | bool led_update_kb(led_t led_state) { | ||
| 33 | if(led_update_user(led_state)) { | ||
| 34 | writePin(B0, !led_state.caps_lock); | ||
| 35 | writePin(B4, !led_state.num_lock); | ||
| 36 | writePin(D7, !led_state.scroll_lock); | ||
| 37 | } | ||
| 38 | return true; | ||
| 61 | } | 39 | } |
| 62 | 40 | ||
| 63 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | 41 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { |
diff --git a/keyboards/duck/readme.md b/keyboards/duck/readme.md index caf7e156d..32076da7d 100644 --- a/keyboards/duck/readme.md +++ b/keyboards/duck/readme.md | |||
| @@ -13,4 +13,5 @@ Jetfire V1 | |||
| 13 | Lightsaver V3 | 13 | Lightsaver V3 |
| 14 | Octagon V1 | 14 | Octagon V1 |
| 15 | Octagon V2 | 15 | Octagon V2 |
| 16 | Orion V3 | ||
| 16 | Viper V2 \ No newline at end of file | 17 | Viper V2 \ No newline at end of file |
