config.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright (C) 2021 System76
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. */
  17. #pragma once
  18. /*
  19. * Key matrix pins
  20. * ROWS: AVR pins used for rows, top to bottom
  21. * COLS: AVR pins used for columns, left to right
  22. */
  23. #define MATRIX_ROW_PINS { F0, F1, F4, F5, F6, F7 }
  24. #define MATRIX_COL_PINS { D7, C7, C6, B6, B5, B4, D6, D4, E6, D5, D3, D2, B7, B0 }
  25. /*
  26. * Diode Direction
  27. * COL2ROW = COL => Anode (+), ROW => Cathode (-)
  28. * ROW2COL = ROW => Anode (+), COL => Cathode (-)
  29. */
  30. #define DIODE_DIRECTION COL2ROW
  31. #ifdef RGB_MATRIX_ENABLE
  32. # define RGB_DI_PIN E2
  33. # define RGB_MATRIX_LED_COUNT 84
  34. # define RGB_MATRIX_KEYPRESSES // Reacts to keypresses
  35. // # define RGB_MATRIX_KEYRELEASES // Reacts to keyreleases (instead of keypresses)
  36. // # define RGB_MATRIX_FRAMEBUFFER_EFFECTS // Enables framebuffer effects
  37. # define RGB_DISABLE_WHEN_USB_SUSPENDED // Turns off effects when suspended
  38. // Limit brightness to support USB-A at 0.5 A
  39. // TODO: Do this dynamically based on power source
  40. # define RGB_MATRIX_MAXIMUM_BRIGHTNESS 176 // Limits maximum brightness of LEDs to 176 out of 255. If not defined, maximum brightness is set to 255
  41. # define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Sets the default mode, if none has been set
  42. # define RGB_MATRIX_DEFAULT_HUE 142 // Sets the default hue value, if none has been set
  43. # define RGB_MATRIX_DEFAULT_SAT 255 // Sets the default saturation value, if none has been set
  44. # define RGB_MATRIX_DEFAULT_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set
  45. # define RGB_MATRIX_DEFAULT_SPD 127 // Sets the default animation speed, if none has been set
  46. # define RGB_MATRIX_DISABLE_KEYCODES // Disables control of rgb matrix by keycodes (must use code functions to control the feature)
  47. # define ENABLE_RGB_MATRIX_CYCLE_ALL
  48. # define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
  49. # define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
  50. # define ENABLE_RGB_MATRIX_CYCLE_OUT_IN
  51. # define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
  52. # define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
  53. # define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
  54. # define ENABLE_RGB_MATRIX_CYCLE_SPIRAL
  55. # define ENABLE_RGB_MATRIX_RAINDROPS
  56. # define ENABLE_RGB_MATRIX_SPLASH
  57. # define ENABLE_RGB_MATRIX_MULTISPLASH
  58. #endif // RGB_MATRIX_ENABLE
  59. // Mechanical locking support; use KC_LCAP, KC_LNUM, or KC_LSCR instead in keymap
  60. #define LOCKING_SUPPORT_ENABLE
  61. // Locking resynchronize hack
  62. #define LOCKING_RESYNC_ENABLE
  63. // I2C {
  64. #define F_SCL 100000UL // Run I2C bus at 100 kHz
  65. #define I2C_START_RETRY_COUNT 20
  66. #define I2C_TIMEOUT 100 // milliseconds
  67. // } I2C
  68. // EEPROM {
  69. #define EEPROM_SIZE 1024
  70. // TODO: Refactor with new user EEPROM code (coming soon)
  71. #define EEPROM_MAGIC 0x76EC
  72. #define EEPROM_MAGIC_ADDR 64
  73. // Bump this every time we change what we store
  74. // This will automatically reset the EEPROM with defaults
  75. // and avoid loading invalid data from the EEPROM
  76. #define EEPROM_VERSION 0x02
  77. #define EEPROM_VERSION_ADDR (EEPROM_MAGIC_ADDR + 2)
  78. // } EEPROM
  79. // Dynamic keymap {
  80. #define DYNAMIC_KEYMAP_LAYER_COUNT 4
  81. #define DYNAMIC_KEYMAP_MACRO_COUNT 0
  82. // Dynamic keymap starts after EEPROM version
  83. #define DYNAMIC_KEYMAP_EEPROM_ADDR (EEPROM_VERSION_ADDR + 1)
  84. // Dynamic macro starts after dynamic keymaps, it is disabled
  85. #define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2))
  86. #define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 0
  87. // } Dynamic keymap
  88. // System76 EC {
  89. #define SYSTEM76_EC_EEPROM_ADDR (DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE)
  90. #define SYSTEM76_EC_EEPROM_SIZE (EEPROM_SIZE - SYSTEM76_EC_EEPROM_ADDR)
  91. // } System76 EC