summaryrefslogtreecommitdiff
path: root/keyboards/whitefox
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/whitefox')
-rw-r--r--keyboards/whitefox/config.h14
-rw-r--r--keyboards/whitefox/keymaps/kim-kim/keymap.c15
-rw-r--r--keyboards/whitefox/keymaps/matt3o/keymap.c60
-rw-r--r--keyboards/whitefox/rules.mk8
-rw-r--r--keyboards/whitefox/whitefox.c76
5 files changed, 135 insertions, 38 deletions
diff --git a/keyboards/whitefox/config.h b/keyboards/whitefox/config.h
index 4d7a460d26..1cdac01d07 100644
--- a/keyboards/whitefox/config.h
+++ b/keyboards/whitefox/config.h
@@ -62,6 +62,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define LED_BRIGHTNESS_LO 100
#define LED_BRIGHTNESS_HI 255
+/* LED matrix driver */
+#define LED_DRIVER_ADDR_1 0x74
+#define LED_DRIVER_COUNT 1
+#define DRIVER_LED_TOTAL 71
+#define LED_DISABLE_WHEN_USB_SUSPENDED
+
+/* i2c (for LED matrix) */
+#define I2C1_CLOCK_SPEED 400000
+#define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2
+#define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2
+#define I2C1_BANK GPIOB
+#define I2C1_SCL 0
+#define I2C1_SDA 1
+
/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
* This is useful for the Windows task manager shortcut (ctrl+shift+esc).
*/
diff --git a/keyboards/whitefox/keymaps/kim-kim/keymap.c b/keyboards/whitefox/keymaps/kim-kim/keymap.c
index a254067582..baaa136873 100644
--- a/keyboards/whitefox/keymaps/kim-kim/keymap.c
+++ b/keyboards/whitefox/keymaps/kim-kim/keymap.c
@@ -51,18 +51,3 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______,_______,_______, _______, _______,_______,_______, KC_HOME,_______,KC_END \
),
};
-
-/* Give numbers some descriptive names */
-#define ACTION_LEDS_ALL 1
-#define ACTION_LEDS_GAME 2
-
-const uint16_t fn_actions[] = {
- [2] = ACTION_FUNCTION(ACTION_LEDS_ALL),
- [3] = ACTION_FUNCTION(ACTION_LEDS_GAME),
-
- [4] = ACTION_USAGE_CONSUMER(0x1B4),
- [5] = ACTION_USAGE_CONSUMER(0x196),
- [6] = ACTION_USAGE_CONSUMER(0x1A6),
- [7] = ACTION_USAGE_CONSUMER(0x1A0),
-
-};
diff --git a/keyboards/whitefox/keymaps/matt3o/keymap.c b/keyboards/whitefox/keymaps/matt3o/keymap.c
index f6987fe1aa..bb84196684 100644
--- a/keyboards/whitefox/keymaps/matt3o/keymap.c
+++ b/keyboards/whitefox/keymaps/matt3o/keymap.c
@@ -16,6 +16,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
+enum custom_keycodes {
+ AL_FILE = SAFE_RANGE,
+ AL_WWW,
+ AL_HELP,
+ AL_CMD
+};
+
const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Layer 0: Default Layer
* ,---------------------------------------------------------------.
@@ -45,25 +52,44 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_HOME,KC_PGDN,KC_END \
),
[2] = LAYOUT( \
- KC_SLEP,KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, KC_P0, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_FN2, \
- KC_TRNS,KC_TRNS,KC_FN5 ,KC_FN6 ,KC_TRNS,KC_FN7 ,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_TRNS,KC_TRNS,KC_TRNS, KC_FN3, \
- KC_CAPS,KC_TRNS,KC_TRNS,KC_TRNS,KC_FN4 ,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,\
+ KC_SLEP,KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, KC_P0, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_NO, \
+ KC_TRNS,KC_TRNS,AL_WWW ,AL_HELP ,KC_TRNS,AL_CMD ,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_TRNS,KC_TRNS,KC_TRNS, KC_NO, \
+ KC_CAPS,KC_TRNS,KC_TRNS,KC_TRNS,AL_FILE ,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_CALC,KC_TRNS,KC_TRNS,KC_TRNS,KC_MAIL,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 \
),
};
-/* Give numbers some descriptive names */
-#define ACTION_LEDS_ALL 1
-#define ACTION_LEDS_GAME 2
-
-const uint16_t fn_actions[] = {
- [2] = ACTION_FUNCTION(ACTION_LEDS_ALL),
- [3] = ACTION_FUNCTION(ACTION_LEDS_GAME),
-
- [4] = ACTION_USAGE_CONSUMER(0x1B4),
- [5] = ACTION_USAGE_CONSUMER(0x196),
- [6] = ACTION_USAGE_CONSUMER(0x1A6),
- [7] = ACTION_USAGE_CONSUMER(0x1A0),
-
-};
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case AL_FILE:
+ if (record->event.pressed) {
+ host_consumer_send(0x1B4); // AL File Browser
+ } else {
+ host_consumer_send(0);
+ }
+ return false;
+ case AL_WWW:
+ if (record->event.pressed) {
+ host_consumer_send(0x196); // AL Internet Browser
+ } else {
+ host_consumer_send(0);
+ }
+ return false;
+ case AL_HELP:
+ if (record->event.pressed) {
+ host_consumer_send(0x1A6); // AL Integrated Help Center
+ } else {
+ host_consumer_send(0);
+ }
+ return false;
+ case AL_CMD:
+ if (record->event.pressed) {
+ host_consumer_send(0x1A0); // AL Command Line Processor/Run
+ } else {
+ host_consumer_send(0);
+ }
+ return false;
+ }
+ return true;
+}
diff --git a/keyboards/whitefox/rules.mk b/keyboards/whitefox/rules.mk
index 771804369c..7c1d0c3def 100644
--- a/keyboards/whitefox/rules.mk
+++ b/keyboards/whitefox/rules.mk
@@ -25,16 +25,12 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = yes # USB Nkey Rollover
-BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = no # Audio output
-BACKLIGHT_DRIVER = custom
-VISUALIZER_ENABLE = yes
-LED_DRIVER = is31fl3731c
-LED_WIDTH = 16
-LED_HEIGHT = 5
+LED_MATRIX_ENABLE = yes
+LED_MATRIX_DRIVER = IS31FL3731
LAYOUTS = 65_ansi 65_ansi_blocker 65_ansi_blocker_split_bs 65_iso 65_iso_blocker 65_iso_blocker_split_bs
diff --git a/keyboards/whitefox/whitefox.c b/keyboards/whitefox/whitefox.c
index ea083c6e09..b17af15127 100644
--- a/keyboards/whitefox/whitefox.c
+++ b/keyboards/whitefox/whitefox.c
@@ -16,3 +16,79 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "whitefox.h"
+
+#ifdef LED_MATRIX_ENABLE
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
+// The numbers in the comments are the led numbers DXX on the PCB
+/* Refer to IS31 manual for these locations
+ * driver
+ * | LED address
+ * | | */
+// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
+ { 0, C1_1 }, { 0, C1_2 }, { 0, C1_3 }, { 0, C1_4 }, { 0, C1_5 }, { 0, C1_6 }, { 0, C1_7 }, { 0, C1_8 }, { 0, C2_1 }, { 0, C2_2 }, { 0, C2_3 }, { 0, C2_4 }, { 0, C2_5 }, { 0, C2_6 }, { 0, C2_7 }, { 0, C2_8 },
+// 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
+ { 0, C3_1 }, { 0, C3_2 }, { 0, C3_3 }, { 0, C3_4 }, { 0, C3_5 }, { 0, C3_6 }, { 0, C3_7 }, { 0, C3_8 }, { 0, C4_1 }, { 0, C4_2 }, { 0, C4_3 }, { 0, C4_4 }, { 0, C4_5 }, { 0, C4_6 }, { 0, C4_7 },
+// 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
+ { 0, C4_8 }, { 0, C5_1 }, { 0, C5_2 }, { 0, C5_3 }, { 0, C5_4 }, { 0, C5_5 }, { 0, C5_6 }, { 0, C5_7 }, { 0, C5_8 }, { 0, C6_1 }, { 0, C6_2 }, { 0, C6_3 }, { 0, C6_4 }, { 0, C6_5 }, { 0, C6_6 },
+// 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
+ { 0, C6_7 }, { 0, C6_8 }, { 0, C7_1 }, { 0, C7_2 }, { 0, C7_3 }, { 0, C7_4 }, { 0, C7_5 }, { 0, C7_6 }, { 0, C7_7 }, { 0, C7_8 }, { 0, C8_1 }, { 0, C8_2 }, { 0, C8_3 }, { 0, C8_4 }, { 0, C8_5 },
+// 62 63 64 65 66 67 68 69 70 71
+ { 0, C8_6 }, { 0, C8_7 }, { 0, C8_8 }, { 0, C9_1 }, { 0, C9_2 }, { 0, C9_3 }, { 0, C9_4 }, { 0, C9_5 }, { 0, C9_6 }, { 0, C9_7 },
+};
+
+led_config_t g_led_config = {
+ {
+ // Key Matrix to LED Index
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8 },
+ { 9, 10, 11, 12, 13, 14, 15, 16, 17 },
+ { 18, 19, 20, 21, 22, 23, 24, 25, 26 },
+ { 27, 28, 29, 30, 31, 32, 33, 34, 35 },
+ { 36, 37, 38, 39, 40, 41, 42, 43, 44 },
+ { 45, 46, 47, 48, 49, 50, 51, 52, 53 },
+ { 54, 55, 56, 57, 58, 59, 60, 61, 62 },
+ { 63, 64, 65, 66, 67, 68, 69, 70, NO_LED },
+ }, {
+ // LED Index to Physical Position
+ { 0, 0 }, { 15, 0 }, { 30, 0 }, { 45, 0 }, { 60, 0 }, { 75, 0 }, { 90, 0 }, { 105, 0 }, { 119, 0 }, { 134, 0 }, { 149, 0 }, { 164, 0 }, { 179, 0 }, { 194, 0 }, { 209, 0 }, { 224, 0 },
+ { 4, 16 }, { 22, 16 }, { 37, 16 }, { 52, 16 }, { 67, 16 }, { 82, 16 }, { 97, 16 }, { 112, 16 }, { 127, 16 }, { 142, 16 }, { 157, 16 }, { 172, 16 }, { 187, 16 }, { 205, 16 }, { 224, 16 },
+ { 6, 32 }, { 26, 32 }, { 41, 32 }, { 56, 32 }, { 71, 32 }, { 86, 32 }, { 101, 32 }, { 116, 32 }, { 131, 32 }, { 146, 32 }, { 161, 32 }, { 175, 32 }, { 190, 32 }, { 207, 32 }, { 224, 32 },
+ { 2, 48 }, { 19, 48 }, { 34, 48 }, { 49, 48 }, { 63, 48 }, { 78, 48 }, { 93, 48 }, { 108, 48 }, { 123, 48 }, { 138, 48 }, { 153, 48 }, { 168, 48 }, { 189, 48 }, { 209, 48 }, { 224, 48 },
+ { 2, 64 }, { 21, 64 }, { 39, 64 }, { 95, 64 }, { 149, 64 }, { 164, 64 }, { 179, 64 }, { 194, 64 }, { 209, 64 }, { 224, 64 }
+ }, {
+ // LED Index to Flag
+ 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
+ 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1,
+ 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1,
+ 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ }
+};
+#endif
+
+void keyboard_pre_init_kb(void) {
+#ifdef LED_MATRIX_ENABLE
+ // Turn on LED controller
+ setPinOutput(B16);
+ writePinHigh(B16);
+#endif
+ keyboard_pre_init_user();
+}
+
+void matrix_init_kb(void) {
+ // put your keyboard start-up code here
+ // runs once when the firmware starts up
+
+#ifdef LED_MATRIX_ENABLE
+ /*
+ * Since K20x is stuck with a 32 byte EEPROM (see tmk_core/common/chibios/eeprom_teensy.c),
+ * and neither led_matrix_eeconfig.speed or .flags fit in this boundary, just force their values to default on boot.
+ */
+# if !defined(LED_MATRIX_STARTUP_SPD)
+# define LED_MATRIX_STARTUP_SPD UINT8_MAX / 2
+# endif
+ led_matrix_set_speed(LED_MATRIX_STARTUP_SPD),
+ led_matrix_set_flags(LED_FLAG_ALL);
+#endif
+
+ matrix_init_user();
+}