config_common.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef CONFIG_DEFINITIONS_H
  2. #define CONFIG_DEFINITIONS_H
  3. /* diode directions */
  4. #define COL2ROW 0
  5. #define ROW2COL 1
  6. #define CUSTOM_MATRIX 2 /* Disables built-in matrix scanning code */
  7. /* I/O pins */
  8. #ifndef F0
  9. #define B0 0x30
  10. #define B1 0x31
  11. #define B2 0x32
  12. #define B3 0x33
  13. #define B4 0x34
  14. #define B5 0x35
  15. #define B6 0x36
  16. #define B7 0x37
  17. #define C0 0x60
  18. #define C1 0x61
  19. #define C2 0x62
  20. #define C3 0x63
  21. #define C4 0x64
  22. #define C5 0x65
  23. #define C6 0x66
  24. #define C7 0x67
  25. #define D0 0x90
  26. #define D1 0x91
  27. #define D2 0x92
  28. #define D3 0x93
  29. #define D4 0x94
  30. #define D5 0x95
  31. #define D6 0x96
  32. #define D7 0x97
  33. #define E0 0xC0
  34. #define E1 0xC1
  35. #define E2 0xC2
  36. #define E3 0xC3
  37. #define E4 0xC4
  38. #define E5 0xC5
  39. #define E6 0xC6
  40. #define E7 0xC7
  41. #define F0 0xF0
  42. #define F1 0xF1
  43. #define F2 0xF2
  44. #define F3 0xF3
  45. #define F4 0xF4
  46. #define F5 0xF5
  47. #define F6 0xF6
  48. #define F7 0xF7
  49. #define A0 0x00
  50. #define A1 0x01
  51. #define A2 0x02
  52. #define A3 0x03
  53. #define A4 0x04
  54. #define A5 0x05
  55. #define A6 0x06
  56. #define A7 0x07
  57. #endif
  58. /* USART configuration */
  59. #ifdef BLUETOOTH_ENABLE
  60. # ifdef __AVR_ATmega32U4__
  61. # define SERIAL_UART_BAUD 9600
  62. # define SERIAL_UART_DATA UDR1
  63. # define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
  64. # define SERIAL_UART_RXD_VECT USART1_RX_vect
  65. # define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
  66. # define SERIAL_UART_INIT() do { \
  67. /* baud rate */ \
  68. UBRR1L = SERIAL_UART_UBRR; \
  69. /* baud rate */ \
  70. UBRR1H = SERIAL_UART_UBRR >> 8; \
  71. /* enable TX */ \
  72. UCSR1B = _BV(TXEN1); \
  73. /* 8-bit data */ \
  74. UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
  75. sei(); \
  76. } while(0)
  77. # else
  78. # error "USART configuration is needed."
  79. # endif
  80. #endif
  81. #define API_SYSEX_MAX_SIZE 32
  82. #endif