You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

210 lines
5.9 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. /* Copyright 2015-2018 Jack Humbert
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef CONFIG_DEFINITIONS_H
  17. #define CONFIG_DEFINITIONS_H
  18. /* diode directions */
  19. #define COL2ROW 0
  20. #define ROW2COL 1
  21. #define CUSTOM_MATRIX 2 /* Disables built-in matrix scanning code */
  22. #ifdef __AVR__
  23. /* I/O pins */
  24. #ifndef F0
  25. #define B0 0x30
  26. #define B1 0x31
  27. #define B2 0x32
  28. #define B3 0x33
  29. #define B4 0x34
  30. #define B5 0x35
  31. #define B6 0x36
  32. #define B7 0x37
  33. #define C0 0x60
  34. #define C1 0x61
  35. #define C2 0x62
  36. #define C3 0x63
  37. #define C4 0x64
  38. #define C5 0x65
  39. #define C6 0x66
  40. #define C7 0x67
  41. #define D0 0x90
  42. #define D1 0x91
  43. #define D2 0x92
  44. #define D3 0x93
  45. #define D4 0x94
  46. #define D5 0x95
  47. #define D6 0x96
  48. #define D7 0x97
  49. #define E0 0xC0
  50. #define E1 0xC1
  51. #define E2 0xC2
  52. #define E3 0xC3
  53. #define E4 0xC4
  54. #define E5 0xC5
  55. #define E6 0xC6
  56. #define E7 0xC7
  57. #define F0 0xF0
  58. #define F1 0xF1
  59. #define F2 0xF2
  60. #define F3 0xF3
  61. #define F4 0xF4
  62. #define F5 0xF5
  63. #define F6 0xF6
  64. #define F7 0xF7
  65. #define A0 0x00
  66. #define A1 0x01
  67. #define A2 0x02
  68. #define A3 0x03
  69. #define A4 0x04
  70. #define A5 0x05
  71. #define A6 0x06
  72. #define A7 0x07
  73. #endif
  74. #elif defined(__arm__)
  75. #define A0 PAL_LINE(GPIOA, 0)
  76. #define A1 PAL_LINE(GPIOA, 1)
  77. #define A2 PAL_LINE(GPIOA, 2)
  78. #define A3 PAL_LINE(GPIOA, 3)
  79. #define A4 PAL_LINE(GPIOA, 4)
  80. #define A5 PAL_LINE(GPIOA, 5)
  81. #define A6 PAL_LINE(GPIOA, 6)
  82. #define A7 PAL_LINE(GPIOA, 7)
  83. #define A8 PAL_LINE(GPIOA, 8)
  84. #define A9 PAL_LINE(GPIOA, 9)
  85. #define A10 PAL_LINE(GPIOA, 10)
  86. #define A11 PAL_LINE(GPIOA, 11)
  87. #define A12 PAL_LINE(GPIOA, 12)
  88. #define A13 PAL_LINE(GPIOA, 13)
  89. #define A14 PAL_LINE(GPIOA, 14)
  90. #define A15 PAL_LINE(GPIOA, 15)
  91. #define B0 PAL_LINE(GPIOB, 0)
  92. #define B1 PAL_LINE(GPIOB, 1)
  93. #define B2 PAL_LINE(GPIOB, 2)
  94. #define B3 PAL_LINE(GPIOB, 3)
  95. #define B4 PAL_LINE(GPIOB, 4)
  96. #define B5 PAL_LINE(GPIOB, 5)
  97. #define B6 PAL_LINE(GPIOB, 6)
  98. #define B7 PAL_LINE(GPIOB, 7)
  99. #define B8 PAL_LINE(GPIOB, 8)
  100. #define B9 PAL_LINE(GPIOB, 9)
  101. #define B10 PAL_LINE(GPIOB, 10)
  102. #define B11 PAL_LINE(GPIOB, 11)
  103. #define B12 PAL_LINE(GPIOB, 12)
  104. #define B13 PAL_LINE(GPIOB, 13)
  105. #define B14 PAL_LINE(GPIOB, 14)
  106. #define B15 PAL_LINE(GPIOB, 15)
  107. #define C0 PAL_LINE(GPIOC, 0)
  108. #define C1 PAL_LINE(GPIOC, 1)
  109. #define C2 PAL_LINE(GPIOC, 2)
  110. #define C3 PAL_LINE(GPIOC, 3)
  111. #define C4 PAL_LINE(GPIOC, 4)
  112. #define C5 PAL_LINE(GPIOC, 5)
  113. #define C6 PAL_LINE(GPIOC, 6)
  114. #define C7 PAL_LINE(GPIOC, 7)
  115. #define C8 PAL_LINE(GPIOC, 8)
  116. #define C9 PAL_LINE(GPIOC, 9)
  117. #define C10 PAL_LINE(GPIOC, 10)
  118. #define C11 PAL_LINE(GPIOC, 11)
  119. #define C12 PAL_LINE(GPIOC, 12)
  120. #define C13 PAL_LINE(GPIOC, 13)
  121. #define C14 PAL_LINE(GPIOC, 14)
  122. #define C15 PAL_LINE(GPIOC, 15)
  123. #define D0 PAL_LINE(GPIOD, 0)
  124. #define D1 PAL_LINE(GPIOD, 1)
  125. #define D2 PAL_LINE(GPIOD, 2)
  126. #define D3 PAL_LINE(GPIOD, 3)
  127. #define D4 PAL_LINE(GPIOD, 4)
  128. #define D5 PAL_LINE(GPIOD, 5)
  129. #define D6 PAL_LINE(GPIOD, 6)
  130. #define D7 PAL_LINE(GPIOD, 7)
  131. #define D8 PAL_LINE(GPIOD, 8)
  132. #define D9 PAL_LINE(GPIOD, 9)
  133. #define D10 PAL_LINE(GPIOD, 10)
  134. #define D11 PAL_LINE(GPIOD, 11)
  135. #define D12 PAL_LINE(GPIOD, 12)
  136. #define D13 PAL_LINE(GPIOD, 13)
  137. #define D14 PAL_LINE(GPIOD, 14)
  138. #define D15 PAL_LINE(GPIOD, 15)
  139. #define E0 PAL_LINE(GPIOE, 0)
  140. #define E1 PAL_LINE(GPIOE, 1)
  141. #define E2 PAL_LINE(GPIOE, 2)
  142. #define E3 PAL_LINE(GPIOE, 3)
  143. #define E4 PAL_LINE(GPIOE, 4)
  144. #define E5 PAL_LINE(GPIOE, 5)
  145. #define E6 PAL_LINE(GPIOE, 6)
  146. #define E7 PAL_LINE(GPIOE, 7)
  147. #define E8 PAL_LINE(GPIOE, 8)
  148. #define E9 PAL_LINE(GPIOE, 9)
  149. #define E10 PAL_LINE(GPIOE, 10)
  150. #define E11 PAL_LINE(GPIOE, 11)
  151. #define E12 PAL_LINE(GPIOE, 12)
  152. #define E13 PAL_LINE(GPIOE, 13)
  153. #define E14 PAL_LINE(GPIOE, 14)
  154. #define E15 PAL_LINE(GPIOE, 15)
  155. #define F0 PAL_LINE(GPIOF, 0)
  156. #define F1 PAL_LINE(GPIOF, 1)
  157. #define F2 PAL_LINE(GPIOF, 2)
  158. #define F3 PAL_LINE(GPIOF, 3)
  159. #define F4 PAL_LINE(GPIOF, 4)
  160. #define F5 PAL_LINE(GPIOF, 5)
  161. #define F6 PAL_LINE(GPIOF, 6)
  162. #define F7 PAL_LINE(GPIOF, 7)
  163. #define F8 PAL_LINE(GPIOF, 8)
  164. #define F9 PAL_LINE(GPIOF, 9)
  165. #define F10 PAL_LINE(GPIOF, 10)
  166. #define F11 PAL_LINE(GPIOF, 11)
  167. #define F12 PAL_LINE(GPIOF, 12)
  168. #define F13 PAL_LINE(GPIOF, 13)
  169. #define F14 PAL_LINE(GPIOF, 14)
  170. #define F15 PAL_LINE(GPIOF, 15)
  171. #endif
  172. /* USART configuration */
  173. #ifdef BLUETOOTH_ENABLE
  174. # ifdef __AVR_ATmega32U4__
  175. # define SERIAL_UART_BAUD 9600
  176. # define SERIAL_UART_DATA UDR1
  177. # define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
  178. # define SERIAL_UART_RXD_VECT USART1_RX_vect
  179. # define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
  180. # define SERIAL_UART_INIT() do { \
  181. /* baud rate */ \
  182. UBRR1L = SERIAL_UART_UBRR; \
  183. /* baud rate */ \
  184. UBRR1H = SERIAL_UART_UBRR >> 8; \
  185. /* enable TX */ \
  186. UCSR1B = _BV(TXEN1); \
  187. /* 8-bit data */ \
  188. UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
  189. sei(); \
  190. } while(0)
  191. # else
  192. # error "USART configuration is needed."
  193. # endif
  194. #endif
  195. #define API_SYSEX_MAX_SIZE 32
  196. #include "song_list.h"
  197. #endif