forked from mfulz_github/qmk_firmware
		
	[Keyboard] Add work louder micro (#17586)
* [Keyboard] Add work louder micro * Update keyboards/work_louder/micro/readme.md * Update readme * Update kb config files * Update to use encoder map Co-authored-by: Tom Barnes <barnestom@me.com>
This commit is contained in:
		
							parent
							
								
									9dbc0473ef
								
							
						
					
					
						commit
						5f36285fc5
					
				
							
								
								
									
										89
									
								
								keyboards/work_louder/micro/config.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								keyboards/work_louder/micro/config.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,89 @@ | |||||||
|  | // Copyright 2022 Christopher Courtney, aka Drashna Jael're  (@drashna) <drashna@live.com>
 | ||||||
|  | // SPDX-License-Identifier: GPL-2.0-or-later
 | ||||||
|  | 
 | ||||||
|  | #pragma once | ||||||
|  | 
 | ||||||
|  | #include "config_common.h" | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  * Feature disable options | ||||||
|  |  *  These options are also useful to firmware size reduction. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #define RGB_DI_PIN D1 | ||||||
|  | #define DRIVER_LED_TOTAL 12 | ||||||
|  | #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255 | ||||||
|  | #define RGB_MATRIX_DISABLE_KEYCODES | ||||||
|  | #define RGB_DISABLE_WHEN_USB_SUSPENDED | ||||||
|  | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | ||||||
|  | 
 | ||||||
|  | #define RGBLIGHT_DI_PIN D2 | ||||||
|  | #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ | ||||||
|  | #define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT + 9 | ||||||
|  | #define RGBLIGHT_DEFAULT_HUE 213 | ||||||
|  | 
 | ||||||
|  | #define ENABLE_RGB_MATRIX_ALPHAS_MODS | ||||||
|  | #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN | ||||||
|  | #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT | ||||||
|  | #define ENABLE_RGB_MATRIX_BREATHING | ||||||
|  | #define ENABLE_RGB_MATRIX_BAND_SAT | ||||||
|  | #define ENABLE_RGB_MATRIX_BAND_VAL | ||||||
|  | #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT | ||||||
|  | #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL | ||||||
|  | #define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT | ||||||
|  | #define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL | ||||||
|  | #define ENABLE_RGB_MATRIX_CYCLE_ALL | ||||||
|  | #define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT | ||||||
|  | #define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN | ||||||
|  | #define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON | ||||||
|  | #define ENABLE_RGB_MATRIX_CYCLE_OUT_IN | ||||||
|  | #define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL | ||||||
|  | #define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL | ||||||
|  | #define ENABLE_RGB_MATRIX_CYCLE_SPIRAL | ||||||
|  | #define ENABLE_RGB_MATRIX_DUAL_BEACON | ||||||
|  | #define ENABLE_RGB_MATRIX_RAINBOW_BEACON | ||||||
|  | #define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS | ||||||
|  | #define ENABLE_RGB_MATRIX_RAINDROPS | ||||||
|  | #define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS | ||||||
|  | #define ENABLE_RGB_MATRIX_HUE_BREATHING | ||||||
|  | #define ENABLE_RGB_MATRIX_HUE_PENDULUM | ||||||
|  | #define ENABLE_RGB_MATRIX_HUE_WAVE | ||||||
|  | #define ENABLE_RGB_MATRIX_PIXEL_RAIN | ||||||
|  | #define ENABLE_RGB_MATRIX_PIXEL_FLOW | ||||||
|  | #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL | ||||||
|  | // enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined
 | ||||||
|  | #define ENABLE_RGB_MATRIX_TYPING_HEATMAP | ||||||
|  | #define ENABLE_RGB_MATRIX_DIGITAL_RAIN | ||||||
|  | // enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined
 | ||||||
|  | #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE | ||||||
|  | #define ENABLE_RGB_MATRIX_SOLID_REACTIVE | ||||||
|  | #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE | ||||||
|  | #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE | ||||||
|  | #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS | ||||||
|  | #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS | ||||||
|  | #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS | ||||||
|  | #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS | ||||||
|  | #define ENABLE_RGB_MATRIX_SPLASH | ||||||
|  | #define ENABLE_RGB_MATRIX_MULTISPLASH | ||||||
|  | #define ENABLE_RGB_MATRIX_SOLID_SPLASH | ||||||
|  | #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH | ||||||
|  | 
 | ||||||
|  | /* disable debug print */ | ||||||
|  | //#define NO_DEBUG
 | ||||||
|  | 
 | ||||||
|  | /* disable print */ | ||||||
|  | //#define NO_PRINT
 | ||||||
|  | 
 | ||||||
|  | /* disable action features */ | ||||||
|  | //#define NO_ACTION_LAYER
 | ||||||
|  | //#define NO_ACTION_TAPPING
 | ||||||
|  | //#define NO_ACTION_ONESHOT
 | ||||||
|  | 
 | ||||||
|  | #define ENCODERS_PAD_A \ | ||||||
|  |     { D4, B0 } | ||||||
|  | #define ENCODERS_PAD_B \ | ||||||
|  |     { D6, B1 } | ||||||
|  | 
 | ||||||
|  | #define WORK_LOUDER_LED_PIN_1 B7 | ||||||
|  | #define WORK_LOUDER_LED_PIN_2 B6 | ||||||
|  | #define WORK_LOUDER_LED_PIN_3 B5 | ||||||
							
								
								
									
										64
									
								
								keyboards/work_louder/micro/info.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								keyboards/work_louder/micro/info.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,64 @@ | |||||||
|  | { | ||||||
|  |     "manufacturer": "Work Louder", | ||||||
|  |     "keyboard_name": "micro", | ||||||
|  |     "bootloader": "atmel-dfu", | ||||||
|  |     "diode_direction": "COL2ROW", | ||||||
|  |     "features": { | ||||||
|  |         "bootmagic": false, | ||||||
|  |         "command": false, | ||||||
|  |         "console": false, | ||||||
|  |         "extrakey": true, | ||||||
|  |         "mousekey": true, | ||||||
|  |         "nkro": true, | ||||||
|  |         "encoder": true, | ||||||
|  |         "rgblight": true, | ||||||
|  |         "rgb_matrix": true | ||||||
|  |     }, | ||||||
|  |     "matrix_pins": { | ||||||
|  |         "custom_lite": true, | ||||||
|  |         "cols": ["B4", "C6", "C7", "E6"], | ||||||
|  |         "rows": ["F1", "F4", "F5", "F6"] | ||||||
|  |     }, | ||||||
|  |     "processor": "atmega32u4", | ||||||
|  |     "rgblight": { | ||||||
|  |         "animations": { | ||||||
|  |           "all": true | ||||||
|  |         }, | ||||||
|  |         "brightness_steps": 8, | ||||||
|  |         "hue_steps": 8, | ||||||
|  |         "led_count": 8, | ||||||
|  |         "max_brightness": 255, | ||||||
|  |         "saturation_steps": 8 | ||||||
|  |     }, | ||||||
|  |     "url": "", | ||||||
|  |     "usb": { | ||||||
|  |         "device_version": "1.0.0", | ||||||
|  |         "pid": "0xE6E3", | ||||||
|  |         "vid": "0x574C" | ||||||
|  |     }, | ||||||
|  |     "build": { | ||||||
|  |         "lto": true | ||||||
|  |     }, | ||||||
|  |     "layouts": { | ||||||
|  |         "LAYOUT": { | ||||||
|  |             "layout": [ | ||||||
|  |                 { "matrix": [0, 0], "x": 0, "y": 0 }, | ||||||
|  |                 { "matrix": [0, 1], "x": 1.25, "y": 0.25 }, | ||||||
|  |                 { "matrix": [0, 2], "x": 2.25, "y": 0.25 }, | ||||||
|  |                 { "matrix": [0, 3], "x": 3.5, "y": 0 }, | ||||||
|  |                 { "matrix": [1, 0], "x": 0.25, "y": 1.25 }, | ||||||
|  |                 { "matrix": [1, 1], "x": 1.25, "y": 1.25 }, | ||||||
|  |                 { "matrix": [1, 2], "x": 2.25, "y": 1.25 }, | ||||||
|  |                 { "matrix": [1, 3], "x": 3.25, "y": 1.25 }, | ||||||
|  |                 { "matrix": [2, 0], "x": 0.25, "y": 2.25 }, | ||||||
|  |                 { "matrix": [2, 1], "x": 1.25, "y": 2.25 }, | ||||||
|  |                 { "matrix": [2, 2], "x": 2.25, "y": 2.25 }, | ||||||
|  |                 { "matrix": [2, 3], "x": 3.25, "y": 2.25 }, | ||||||
|  |                 { "matrix": [3, 0], "x": 0, "y": 3.5 }, | ||||||
|  |                 { "matrix": [3, 1], "x": 1.25, "y": 3.25 }, | ||||||
|  |                 { "matrix": [3, 2], "x": 2.25, "y": 3.25 }, | ||||||
|  |                 { "matrix": [3, 3], "x": 3.5, "y": 3.5 } | ||||||
|  |             ] | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										91
									
								
								keyboards/work_louder/micro/keymaps/default/keymap.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								keyboards/work_louder/micro/keymaps/default/keymap.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,91 @@ | |||||||
|  | // Copyright 2022 Christopher Courtney, aka Drashna Jael're  (@drashna) <drashna@live.com>
 | ||||||
|  | // SPDX-License-Identifier: GPL-2.0-or-later
 | ||||||
|  | 
 | ||||||
|  | #include QMK_KEYBOARD_H | ||||||
|  | 
 | ||||||
|  | enum custom_keycodes { | ||||||
|  |     LED_LEVEL = SAFE_RANGE, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||||||
|  |     LAYOUT( | ||||||
|  |         KC_MPLY, KC_9,    KC_0,    KC_NO, | ||||||
|  |         KC_5,    KC_6,    KC_7,    KC_8, | ||||||
|  |         KC_1,    KC_2,    KC_3,    KC_4, | ||||||
|  |         TO(1),   KC_DOT,  KC_COMM, LED_LEVEL | ||||||
|  |     ), | ||||||
|  |     LAYOUT( | ||||||
|  |         KC_1,    KC_2,    KC_3,    KC_4, | ||||||
|  |         KC_5,    KC_6,    KC_7,    KC_8, | ||||||
|  |         KC_9,    KC_0,    KC_A,    KC_B, | ||||||
|  |         TO(2),   KC_C,    KC_D,    KC_E | ||||||
|  |     ), | ||||||
|  |     LAYOUT( | ||||||
|  |         KC_1,    KC_2,    KC_3,    KC_4, | ||||||
|  |         KC_5,    KC_6,    KC_7,    KC_8, | ||||||
|  |         KC_9,    KC_0,    KC_A,    KC_B, | ||||||
|  |         TO(3),   KC_C,    KC_D,    KC_E | ||||||
|  |     ), | ||||||
|  |     LAYOUT( | ||||||
|  |         KC_1,    KC_2,    KC_3,    KC_4, | ||||||
|  |         KC_5,    KC_6,    KC_7,    KC_8, | ||||||
|  |         KC_9,    KC_0,    KC_A,    KC_B, | ||||||
|  |         TO(0),   KC_C,    LED_LEVEL,KC_E | ||||||
|  |     ), | ||||||
|  | 
 | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | typedef union { | ||||||
|  |     uint32_t raw; | ||||||
|  |     struct { | ||||||
|  |         uint8_t led_level : 3; | ||||||
|  |     }; | ||||||
|  | } work_louder_config_t; | ||||||
|  | 
 | ||||||
|  | work_louder_config_t work_louder_config; | ||||||
|  | 
 | ||||||
|  | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||||||
|  |     switch (keycode) { | ||||||
|  |         case LED_LEVEL: | ||||||
|  |             if (record->event.pressed) { | ||||||
|  |                 work_louder_config.led_level++; | ||||||
|  |                 if (work_louder_config.led_level > 4) { | ||||||
|  |                     work_louder_config.led_level = 0; | ||||||
|  |                 } | ||||||
|  |                 work_louder_micro_led_all_set((uint8_t)(work_louder_config.led_level * 255 / 4)); | ||||||
|  |                 eeconfig_update_user(work_louder_config.raw); | ||||||
|  |                 layer_state_set_kb(layer_state); | ||||||
|  |             } | ||||||
|  |             break; | ||||||
|  |     } | ||||||
|  |     return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #if defined(ENCODER_MAP_ENABLE) | ||||||
|  | const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { | ||||||
|  |     { ENCODER_CCW_CW(KC_VOLD, KC_VOLU),           ENCODER_CCW_CW(C(KC_Z), C(KC_Y))  }, | ||||||
|  |     { ENCODER_CCW_CW(_______, _______),           ENCODER_CCW_CW(_______, _______)  }, | ||||||
|  |     { ENCODER_CCW_CW(_______, _______),           ENCODER_CCW_CW(_______, _______)  }, | ||||||
|  |     { ENCODER_CCW_CW(_______, _______),           ENCODER_CCW_CW(_______, _______)  }, | ||||||
|  | }; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | layer_state_t layer_state_set_user(layer_state_t state) { | ||||||
|  |     layer_state_cmp(state, 1) ? work_louder_micro_led_1_on(): work_louder_micro_led_1_off(); | ||||||
|  |     layer_state_cmp(state, 2) ? work_louder_micro_led_2_on(): work_louder_micro_led_2_off(); | ||||||
|  |     layer_state_cmp(state, 3) ? work_louder_micro_led_3_on(): work_louder_micro_led_3_off(); | ||||||
|  | 
 | ||||||
|  |     return state; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void eeconfig_init_user(void) { | ||||||
|  |     work_louder_config.raw = 0; | ||||||
|  |     work_louder_config.led_level = 1; | ||||||
|  |     eeconfig_update_user(work_louder_config.raw); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void matrix_init_user(void) { | ||||||
|  |     work_louder_config.raw = eeconfig_read_user(); | ||||||
|  |     work_louder_micro_led_all_set((uint8_t)(work_louder_config.led_level * 255 / 4)); | ||||||
|  | } | ||||||
							
								
								
									
										1
									
								
								keyboards/work_louder/micro/keymaps/default/rules.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								keyboards/work_louder/micro/keymaps/default/rules.mk
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | ENCODER_MAP_ENABLE = yes | ||||||
							
								
								
									
										92
									
								
								keyboards/work_louder/micro/keymaps/via/keymap.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								keyboards/work_louder/micro/keymaps/via/keymap.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,92 @@ | |||||||
|  | // Copyright 2022 Christopher Courtney, aka Drashna Jael're  (@drashna) <drashna@live.com>
 | ||||||
|  | // SPDX-License-Identifier: GPL-2.0-or-later
 | ||||||
|  | 
 | ||||||
|  | #include QMK_KEYBOARD_H | ||||||
|  | 
 | ||||||
|  | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||||||
|  |     LAYOUT( | ||||||
|  |         KC_MPLY, KC_9,    KC_0,    KC_NO, | ||||||
|  |         KC_5,    KC_6,    KC_7,    KC_8, | ||||||
|  |         KC_1,    KC_2,    KC_3,    KC_4, | ||||||
|  |         TO(1),   KC_DOT,  KC_COMM, USER09 | ||||||
|  |     ), | ||||||
|  |     LAYOUT( | ||||||
|  |         _______, _______, _______, _______, | ||||||
|  |         _______, _______, _______, _______, | ||||||
|  |         _______, _______, _______, _______, | ||||||
|  |         TO(2),   _______, _______, _______ | ||||||
|  | 
 | ||||||
|  |     ), | ||||||
|  |     LAYOUT( | ||||||
|  |         _______, _______, _______, _______, | ||||||
|  |         _______, _______, _______, _______, | ||||||
|  |         _______, _______, _______, _______, | ||||||
|  |         TO(3),   _______, _______, _______ | ||||||
|  |     ), | ||||||
|  |     LAYOUT( | ||||||
|  |         _______, _______, _______, _______, | ||||||
|  |         _______, _______, _______, _______, | ||||||
|  |         _______, _______, _______, _______, | ||||||
|  |         TO(0),   _______, _______, _______ | ||||||
|  |     ) | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | #if defined(ENCODER_MAP_ENABLE) | ||||||
|  | const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { | ||||||
|  |     { ENCODER_CCW_CW(KC_VOLD, KC_VOLU),           ENCODER_CCW_CW(C(KC_Z), C(KC_Y))  }, | ||||||
|  |     { ENCODER_CCW_CW(_______, _______),           ENCODER_CCW_CW(_______, _______)  }, | ||||||
|  |     { ENCODER_CCW_CW(_______, _______),           ENCODER_CCW_CW(_______, _______)  }, | ||||||
|  |     { ENCODER_CCW_CW(_______, _______),           ENCODER_CCW_CW(_______, _______)  } | ||||||
|  | }; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | typedef union { | ||||||
|  |     uint32_t raw; | ||||||
|  |     struct { | ||||||
|  |         uint8_t led_level : 3; | ||||||
|  |     }; | ||||||
|  | } work_louder_config_t; | ||||||
|  | 
 | ||||||
|  | work_louder_config_t work_louder_config; | ||||||
|  | 
 | ||||||
|  | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||||||
|  | #ifdef CONSOLE_ENABLE | ||||||
|  |     uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %b, time: %5u, int: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count); | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  |     switch (keycode) { | ||||||
|  |         case USER09: | ||||||
|  |             if (record->event.pressed) { | ||||||
|  |                 work_louder_config.led_level++; | ||||||
|  |                 if (work_louder_config.led_level > 4) { | ||||||
|  |                     work_louder_config.led_level = 0; | ||||||
|  |                 } | ||||||
|  |                 work_louder_micro_led_all_set((uint8_t)(work_louder_config.led_level * 255 / 4)); | ||||||
|  |                 eeconfig_update_user(work_louder_config.raw); | ||||||
|  |                 layer_state_set_kb(layer_state); | ||||||
|  |             } | ||||||
|  |             break; | ||||||
|  |     } | ||||||
|  |     return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | layer_state_t layer_state_set_user(layer_state_t state) { | ||||||
|  |     layer_state_cmp(state, 1) ? work_louder_micro_led_1_on(): work_louder_micro_led_1_off(); | ||||||
|  |     layer_state_cmp(state, 2) ? work_louder_micro_led_2_on(): work_louder_micro_led_2_off(); | ||||||
|  |     layer_state_cmp(state, 3) ? work_louder_micro_led_3_on(): work_louder_micro_led_3_off(); | ||||||
|  | 
 | ||||||
|  |     return state; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void eeconfig_init_user(void) { | ||||||
|  |     work_louder_config.raw = 0; | ||||||
|  |     work_louder_config.led_level = 1; | ||||||
|  |     eeconfig_update_user(work_louder_config.raw); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void matrix_init_user(void) { | ||||||
|  |     work_louder_config.raw = eeconfig_read_user(); | ||||||
|  |     work_louder_micro_led_all_set((uint8_t)(work_louder_config.led_level * 255 / 4)); | ||||||
|  | } | ||||||
							
								
								
									
										3
									
								
								keyboards/work_louder/micro/keymaps/via/rules.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								keyboards/work_louder/micro/keymaps/via/rules.mk
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | VIA_ENABLE = yes | ||||||
|  | ENCODER_MAP_ENABLE = yes | ||||||
|  | LTO_ENABLE = yes | ||||||
							
								
								
									
										131
									
								
								keyboards/work_louder/micro/matrix.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										131
									
								
								keyboards/work_louder/micro/matrix.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,131 @@ | |||||||
|  | // Copyright 2022 Christopher Courtney, aka Drashna Jael're  (@drashna) <drashna@live.com>
 | ||||||
|  | // SPDX-License-Identifier: GPL-2.0-or-later
 | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  * scan matrix | ||||||
|  |  */ | ||||||
|  | #include <stdint.h> | ||||||
|  | #include <stdbool.h> | ||||||
|  | #include <avr/io.h> | ||||||
|  | #include "wait.h" | ||||||
|  | #include "print.h" | ||||||
|  | #include "debug.h" | ||||||
|  | #include "util.h" | ||||||
|  | #include "matrix.h" | ||||||
|  | #include "debounce.h" | ||||||
|  | #include QMK_KEYBOARD_H | ||||||
|  | 
 | ||||||
|  | /* matrix state(1:on, 0:off) */ | ||||||
|  | extern matrix_row_t matrix[MATRIX_ROWS];     // debounced values
 | ||||||
|  | extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values
 | ||||||
|  | 
 | ||||||
|  | static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; | ||||||
|  | static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | ||||||
|  | #define MATRIX_ROW_SHIFTER ((matrix_row_t)1) | ||||||
|  | 
 | ||||||
|  | static inline void setPinOutput_writeLow(pin_t pin) { | ||||||
|  |     ATOMIC_BLOCK_FORCEON { | ||||||
|  |         setPinOutput(pin); | ||||||
|  |         writePinLow(pin); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static inline void setPinOutput_writeHigh(pin_t pin) { | ||||||
|  |     ATOMIC_BLOCK_FORCEON { | ||||||
|  |         setPinOutput(pin); | ||||||
|  |         writePinHigh(pin); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static inline void setPinInputHigh_atomic(pin_t pin) { | ||||||
|  |     ATOMIC_BLOCK_FORCEON { | ||||||
|  |         setPinInputHigh(pin); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static inline uint8_t readMatrixPin(pin_t pin) { | ||||||
|  |     if (pin != NO_PIN) { | ||||||
|  |         return readPin(pin); | ||||||
|  |     } else { | ||||||
|  |         return 1; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static bool select_row(uint8_t row) { | ||||||
|  |     pin_t pin = row_pins[row]; | ||||||
|  |     if (pin != NO_PIN) { | ||||||
|  |         setPinOutput_writeLow(pin); | ||||||
|  |         return true; | ||||||
|  |     } | ||||||
|  |     return false; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static void unselect_row(uint8_t row) { | ||||||
|  |     pin_t pin = row_pins[row]; | ||||||
|  |     if (pin != NO_PIN) { | ||||||
|  |         setPinInputHigh_atomic(pin); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static void unselect_rows(void) { | ||||||
|  |     for (uint8_t x = 0; x < MATRIX_ROWS; x++) { | ||||||
|  |         unselect_row(x); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | __attribute__((weak)) void matrix_init_custom(void) { | ||||||
|  |     unselect_rows(); | ||||||
|  |     for (uint8_t x = 0; x < MATRIX_COLS; x++) { | ||||||
|  |         if (col_pins[x] != NO_PIN) { | ||||||
|  |             setPinInputHigh_atomic(col_pins[x]); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     setPinInputHigh_atomic(F7); | ||||||
|  |     setPinInputHigh_atomic(F0); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { | ||||||
|  |     // Start with a clear matrix row
 | ||||||
|  |     matrix_row_t current_row_value = 0; | ||||||
|  | 
 | ||||||
|  |     if (!select_row(current_row)) { // Select row
 | ||||||
|  |         return;                     // skip NO_PIN row
 | ||||||
|  |     } | ||||||
|  |     matrix_output_select_delay(); | ||||||
|  | 
 | ||||||
|  |     // For each col...
 | ||||||
|  |     matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; | ||||||
|  |     for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++, row_shifter <<= 1) { | ||||||
|  |         uint8_t pin_state = 0; | ||||||
|  |         if (current_row == 3 && col_index == 0) { | ||||||
|  |             pin_state = !readMatrixPin(F7); | ||||||
|  |         } else if (current_row == 3 && col_index == 3) { | ||||||
|  |             pin_state = !readMatrixPin(F0); | ||||||
|  |         } else { | ||||||
|  |             pin_state = readMatrixPin(col_pins[col_index]); | ||||||
|  |         } | ||||||
|  |         // Populate the matrix row with the state of the col pin
 | ||||||
|  |         current_row_value |= pin_state ? 0 : row_shifter; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     // Unselect row
 | ||||||
|  |     unselect_row(current_row); | ||||||
|  |     matrix_output_unselect_delay(current_row, current_row_value != 0); // wait for all Col signals to go HIGH
 | ||||||
|  | 
 | ||||||
|  |     // Update the matrix
 | ||||||
|  |     current_matrix[current_row] = current_row_value; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool matrix_scan_custom(matrix_row_t current_matrix[]) { | ||||||
|  |     static matrix_row_t temp_matrix[MATRIX_ROWS] = {0}; | ||||||
|  | 
 | ||||||
|  |     for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { | ||||||
|  |         matrix_read_cols_on_row(temp_matrix, current_row); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     bool changed = memcmp(current_matrix, temp_matrix, sizeof(temp_matrix)) != 0; | ||||||
|  |     if (changed) { | ||||||
|  |         memcpy(current_matrix, temp_matrix, sizeof(temp_matrix)); | ||||||
|  |     } | ||||||
|  |     return changed; | ||||||
|  | } | ||||||
							
								
								
									
										170
									
								
								keyboards/work_louder/micro/micro.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										170
									
								
								keyboards/work_louder/micro/micro.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,170 @@ | |||||||
|  | // Copyright 2022 Christopher Courtney, aka Drashna Jael're  (@drashna) <drashna@live.com>
 | ||||||
|  | // SPDX-License-Identifier: GPL-2.0-or-later
 | ||||||
|  | 
 | ||||||
|  | #include QMK_KEYBOARD_H | ||||||
|  | 
 | ||||||
|  | #if defined(RGB_MATRIX_ENABLE) | ||||||
|  | // clang-format off
 | ||||||
|  | led_config_t g_led_config = { { | ||||||
|  |     { NO_LED, 10, 11, NO_LED }, | ||||||
|  |     {      9 , 8,  7, 6 }, | ||||||
|  |     {      2,  3,  4, 5 }, | ||||||
|  |     { NO_LED,  1,  0, NO_LED } | ||||||
|  |   }, { | ||||||
|  |                   { 122,  64 }, { 103,  64 }, | ||||||
|  |     {  84,  45 }, { 103,  45 }, { 133,  45 }, { 152,  45 }, | ||||||
|  |     { 152,  26 }, { 122,  26 }, { 103,  26 }, { 84,  26 }, | ||||||
|  |                   { 103,   7 }, { 122,   7 } | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |        4, 4, | ||||||
|  |     4, 4, 4, 4, | ||||||
|  |     4, 4, 4, 4, | ||||||
|  |        4, 4 | ||||||
|  |   } | ||||||
|  | }; | ||||||
|  | // clang-format on
 | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #if defined(ENCODER_ENABLE) && !defined(ENCODERS) && !defined(ENCODER_MAP_ENABLE) | ||||||
|  | bool encoder_update_kb(uint8_t index, bool clockwise) { | ||||||
|  |     if (!encoder_update_user(index, clockwise)) { | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |     if (index == 0) { | ||||||
|  |         if (clockwise) { | ||||||
|  |             tap_code_delay(KC_VOLU, 10); | ||||||
|  |         } else { | ||||||
|  |             tap_code_delay(KC_VOLD, 10); | ||||||
|  |         } | ||||||
|  |     } else if (index == 1) { | ||||||
|  |         if (clockwise) { | ||||||
|  |             tap_code_delay(KC_WH_U, 10); | ||||||
|  |         } else { | ||||||
|  |             tap_code_delay(KC_WH_D, 10); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     return true; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | void work_louder_micro_led_1_on(void) { | ||||||
|  |     writePin(WORK_LOUDER_LED_PIN_1, true); | ||||||
|  | } | ||||||
|  | void work_louder_micro_led_2_on(void) { | ||||||
|  |     writePin(WORK_LOUDER_LED_PIN_2, true); | ||||||
|  | } | ||||||
|  | void work_louder_micro_led_3_on(void) { | ||||||
|  |     writePin(WORK_LOUDER_LED_PIN_3, true); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void work_louder_micro_led_1_off(void) { | ||||||
|  |     writePin(WORK_LOUDER_LED_PIN_1, false); | ||||||
|  | } | ||||||
|  | void work_louder_micro_led_2_off(void) { | ||||||
|  |     writePin(WORK_LOUDER_LED_PIN_2, false); | ||||||
|  | } | ||||||
|  | void work_louder_micro_led_3_off(void) { | ||||||
|  |     writePin(WORK_LOUDER_LED_PIN_3, false); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void work_louder_micro_led_all_on(void) { | ||||||
|  |     work_louder_micro_led_1_on(); | ||||||
|  |     work_louder_micro_led_2_on(); | ||||||
|  |     work_louder_micro_led_3_on(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void work_louder_micro_led_all_off(void) { | ||||||
|  |     work_louder_micro_led_1_off(); | ||||||
|  |     work_louder_micro_led_2_off(); | ||||||
|  |     work_louder_micro_led_3_off(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void work_louder_micro_led_1_set(uint8_t n) { | ||||||
|  | #if WORK_LOUDER_LED_PIN_1 == B7 | ||||||
|  |     OCR1C = n; | ||||||
|  | #else | ||||||
|  |     n ? work_louder_micro_led_1_on() : work_louder_micro_led_1_off(); | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | void work_louder_micro_led_2_set(uint8_t n) { | ||||||
|  | #if WORK_LOUDER_LED_PIN_2 == B6 | ||||||
|  |     OCR1B = n; | ||||||
|  | #else | ||||||
|  |     n ? work_louder_micro_led_2_on() : work_louder_micro_led_2_off(); | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | void work_louder_micro_led_3_set(uint8_t n) { | ||||||
|  | #if WORK_LOUDER_LED_PIN_3 == B5 | ||||||
|  |     OCR1A = n; | ||||||
|  | #else | ||||||
|  |     n ? work_louder_micro_led_3_on() : work_louder_micro_led_3_off(); | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void work_louder_micro_led_all_set(uint8_t n) { | ||||||
|  |     work_louder_micro_led_1_set(n); | ||||||
|  |     work_louder_micro_led_2_set(n); | ||||||
|  |     work_louder_micro_led_3_set(n); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #ifdef DEFER_EXEC_ENABLE | ||||||
|  | uint32_t startup_animation(uint32_t trigger_time, void *cb_arg) { | ||||||
|  |     static uint8_t index = 0; | ||||||
|  | 
 | ||||||
|  |     switch (index) { | ||||||
|  |         case 0: | ||||||
|  |             work_louder_micro_led_1_on(); | ||||||
|  |             break; | ||||||
|  |         case 1: | ||||||
|  |             work_louder_micro_led_2_on(); | ||||||
|  |             break; | ||||||
|  |         case 2: | ||||||
|  |             work_louder_micro_led_3_on(); | ||||||
|  |             break; | ||||||
|  |         case 3: | ||||||
|  |             work_louder_micro_led_1_off(); | ||||||
|  |             break; | ||||||
|  |         case 4: | ||||||
|  |             work_louder_micro_led_2_off(); | ||||||
|  |             break; | ||||||
|  |         case 5: | ||||||
|  |             work_louder_micro_led_3_off(); | ||||||
|  |             break; | ||||||
|  |         default: | ||||||
|  |             return 0; | ||||||
|  |     } | ||||||
|  |     index++; | ||||||
|  |     return 100; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | void matrix_init_kb(void) { | ||||||
|  | 
 | ||||||
|  |     setPinOutput(WORK_LOUDER_LED_PIN_1); // left led
 | ||||||
|  |     writePin(WORK_LOUDER_LED_PIN_1, false); | ||||||
|  |     setPinOutput(WORK_LOUDER_LED_PIN_2); // middle led
 | ||||||
|  |     writePin(WORK_LOUDER_LED_PIN_2, false); | ||||||
|  |     setPinOutput(WORK_LOUDER_LED_PIN_3); // right led
 | ||||||
|  |     writePin(WORK_LOUDER_LED_PIN_3, false); | ||||||
|  | 
 | ||||||
|  | #ifdef DEFER_EXEC_ENABLE | ||||||
|  |     defer_exec(500, startup_animation, NULL); | ||||||
|  | #else | ||||||
|  |     wait_ms(500); | ||||||
|  |     work_louder_micro_led_1_on(); | ||||||
|  |     wait_ms(100); | ||||||
|  |     work_louder_micro_led_2_on(); | ||||||
|  |     wait_ms(100); | ||||||
|  |     work_louder_micro_led_3_on(); | ||||||
|  |     wait_ms(100); | ||||||
|  |     work_louder_micro_led_1_off(); | ||||||
|  |     wait_ms(100); | ||||||
|  |     work_louder_micro_led_2_off(); | ||||||
|  |     wait_ms(100); | ||||||
|  |     work_louder_micro_led_3_off(); | ||||||
|  |     wait_ms(200); | ||||||
|  | #endif | ||||||
|  |     matrix_init_user(); | ||||||
|  | 
 | ||||||
|  | } | ||||||
							
								
								
									
										22
									
								
								keyboards/work_louder/micro/micro.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								keyboards/work_louder/micro/micro.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | |||||||
|  | // Copyright 2022 Christopher Courtney, aka Drashna Jael're  (@drashna) <drashna@live.com>
 | ||||||
|  | // SPDX-License-Identifier: GPL-2.0-or-later
 | ||||||
|  | 
 | ||||||
|  | #include "quantum.h" | ||||||
|  | 
 | ||||||
|  | extern void work_louder_micro_led_1_on(void); | ||||||
|  | extern void work_louder_micro_led_2_on(void); | ||||||
|  | extern void work_louder_micro_led_3_on(void); | ||||||
|  | 
 | ||||||
|  | extern void work_louder_micro_led_1_off(void); | ||||||
|  | extern void work_louder_micro_led_2_off(void); | ||||||
|  | extern void work_louder_micro_led_3_off(void); | ||||||
|  | 
 | ||||||
|  | extern void work_louder_micro_led_all_on(void); | ||||||
|  | 
 | ||||||
|  | extern void work_louder_micro_led_all_off(void); | ||||||
|  | 
 | ||||||
|  | extern void work_louder_micro_led_1_set(uint8_t n); | ||||||
|  | extern void work_louder_micro_led_2_set(uint8_t n); | ||||||
|  | extern void work_louder_micro_led_3_set(uint8_t n); | ||||||
|  | 
 | ||||||
|  | extern void work_louder_micro_led_all_set(uint8_t n); | ||||||
							
								
								
									
										26
									
								
								keyboards/work_louder/micro/readme.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								keyboards/work_louder/micro/readme.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | |||||||
|  | # work_louder/micro | ||||||
|  | 
 | ||||||
|  |  | ||||||
|  | 
 | ||||||
|  | A 16 "key" macro pad, with dual encoders, per key RGB, RGB underglow and more | ||||||
|  | 
 | ||||||
|  | * Keyboard Maintainer: [Drashna Jael're](https://github.com/Drashna Jael're) | ||||||
|  | * Hardware Supported:  atmega32u4 based PCB | ||||||
|  | * Hardware Availability: [Work Louder shop](https://worklouder.cc/creator-micro/) | ||||||
|  | 
 | ||||||
|  | Make example for this keyboard (after setting up your build environment): | ||||||
|  | 
 | ||||||
|  |     make work_louder/micro:default | ||||||
|  | 
 | ||||||
|  | Flashing example for this keyboard: | ||||||
|  | 
 | ||||||
|  |     make work_louder/micro:default:flash | ||||||
|  | 
 | ||||||
|  | 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 2 ways: | ||||||
|  | 
 | ||||||
|  | * **Bootmagic reset**: Hold down the horizontal encoder (top left) and plug in the keyboard | ||||||
|  | * **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead | ||||||
							
								
								
									
										6
									
								
								keyboards/work_louder/micro/rules.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								keyboards/work_louder/micro/rules.mk
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | |||||||
|  | RGB_MATRIX_DRIVER = WS2812 | ||||||
|  | 
 | ||||||
|  | SRC += rgb_functions.c \
 | ||||||
|  |         matrix.c | ||||||
|  | 
 | ||||||
|  | DEFERRED_EXEC_ENABLE = yes | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Drashna Jaelre
						Drashna Jaelre