logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

keymap.c (2250B)


  1. // Copyright 2023 QMK
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include QMK_KEYBOARD_H
  4. /* Keymap for 3x4 Macropad
  5. *
  6. * Layer 0 (Base Layer) - Numpad layout with mute button and layer toggle:
  7. * ,----------------------,
  8. * | 7 | 8 | 9 | MUTE |
  9. * |-------+-------+-------+--------|
  10. * | 4 | 5 | 6 | Layer1 |
  11. * |-------+-------+-------+--------|
  12. * | 1 | 2 | 3 | 0 |
  13. * `-----------------------^--------'
  14. *
  15. * Layer 1 (Function Layer) - Accessed by holding MO(1):
  16. * ,----------------------,
  17. * | BKSP | / | - | ---- |
  18. * |-------+-------+-------+--------|
  19. * | = | * | + | ---- |
  20. * |-------+-------+-------+--------|
  21. * | ENTER | ---- | ---- | . |
  22. * `-----------------------^--------'
  23. *
  24. * The base layer (0) provides standard numpad functionality with:
  25. * - Numbers 0-9 in traditional numpad layout
  26. * - Mute button in top right
  27. * - Layer 1 momentary toggle (MO1) in middle right
  28. *
  29. * The function layer (1) adds:
  30. * - Basic mathematical operators (+, -, *, /)
  31. * - Backspace, Enter, and decimal point
  32. * - Equal sign for calculations
  33. * - Empty slots marked as ---- (KC_NO)
  34. */
  35. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  36. [0] = LAYOUT_ortho_3x4(
  37. KC_KP_7, KC_KP_8, KC_KP_9, KC_MUTE,
  38. KC_KP_4, KC_KP_5, KC_KP_6, MO(1),
  39. KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_0
  40. ),
  41. [1] = LAYOUT_ortho_3x4(
  42. KC_BACKSPACE, KC_KP_SLASH, KC_KP_MINUS, _______,
  43. KC_EQUAL, KC_KP_ASTERISK, KC_KP_PLUS, _______,
  44. KC_ENTER, _______, _______, KC_KP_DOT
  45. )
  46. };
  47. /*
  48. * Handle layer state changes by updating RGB matrix colors
  49. *
  50. * Sets RGB matrix colors based on active layer:
  51. * - Layer 0: Light green (#88FB7A)
  52. * - Layer 1: Red
  53. * - Other layers: Red (fallback)
  54. */
  55. layer_state_t layer_state_set_user(layer_state_t state) {
  56. switch (get_highest_layer(state)) {
  57. case 0:
  58. rgb_matrix_sethsv(85, 255, 251); // #88FB7A for layer 0
  59. break;
  60. case 1:
  61. rgb_matrix_sethsv(0, 255, 255); // Red for layer 1
  62. break;
  63. default:
  64. rgb_matrix_sethsv(0, 255, 255); // Red for any other layer
  65. break;
  66. }
  67. return state;
  68. }