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.

116 lines
2.5 KiB

8 years ago
  1. #ifndef CONFIG_DEFINITIONS_H
  2. #define CONFIG_DEFINITIONS_H
  3. #define B0 0x20
  4. #define B1 0x21
  5. #define B2 0x22
  6. #define B3 0x23
  7. #define B4 0x24
  8. #define B5 0x25
  9. #define B6 0x26
  10. #define B7 0x27
  11. #define C0 0x30
  12. #define C1 0x31
  13. #define C2 0x32
  14. #define C3 0x33
  15. #define C4 0x34
  16. #define C5 0x35
  17. #define C6 0x36
  18. #define C7 0x37
  19. #define D0 0x40
  20. #define D1 0x41
  21. #define D2 0x42
  22. #define D3 0x43
  23. #define D4 0x44
  24. #define D5 0x45
  25. #define D6 0x46
  26. #define D7 0x47
  27. #define E0 0x50
  28. #define E1 0x51
  29. #define E2 0x52
  30. #define E3 0x53
  31. #define E4 0x54
  32. #define E5 0x55
  33. #define E6 0x56
  34. #define E7 0x57
  35. #define F0 0x60
  36. #define F1 0x61
  37. #define F2 0x62
  38. #define F3 0x63
  39. #define F4 0x64
  40. #define F5 0x65
  41. #define F6 0x66
  42. #define F7 0x67
  43. #define COL2ROW 0x0
  44. #define ROW2COL 0x1
  45. #ifdef BLUETOOTH_ENABLE
  46. #ifdef __AVR_ATmega32U4__
  47. #define SERIAL_UART_BAUD 9600
  48. #define SERIAL_UART_DATA UDR1
  49. #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
  50. #define SERIAL_UART_RXD_VECT USART1_RX_vect
  51. #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
  52. #define SERIAL_UART_INIT() do { \
  53. UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
  54. UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
  55. UCSR1B = (1<<TXEN1); /* TX: enable */ \
  56. UCSR1C = (0<<UPM11) | (0<<UPM10) | /* parity: none(00), even(01), odd(11) */ \
  57. (0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* data-8bit(011) */ \
  58. sei(); \
  59. } while(0)
  60. #else
  61. # error "USART configuration is needed."
  62. #endif
  63. // I'm fairly sure these aren't needed, but oh well - Jack
  64. /*
  65. * PS/2 Interrupt configuration
  66. */
  67. #ifdef PS2_USE_INT
  68. /* uses INT1 for clock line(ATMega32U4) */
  69. #define PS2_CLOCK_PORT PORTD
  70. #define PS2_CLOCK_PIN PIND
  71. #define PS2_CLOCK_DDR DDRD
  72. #define PS2_CLOCK_BIT 1
  73. #define PS2_DATA_PORT PORTD
  74. #define PS2_DATA_PIN PIND
  75. #define PS2_DATA_DDR DDRD
  76. #define PS2_DATA_BIT 0
  77. #define PS2_INT_INIT() do { \
  78. EICRA |= ((1<<ISC11) | \
  79. (0<<ISC10)); \
  80. } while (0)
  81. #define PS2_INT_ON() do { \
  82. EIMSK |= (1<<INT1); \
  83. } while (0)
  84. #define PS2_INT_OFF() do { \
  85. EIMSK &= ~(1<<INT1); \
  86. } while (0)
  87. #define PS2_INT_VECT INT1_vect
  88. #endif
  89. /*
  90. * PS/2 Busywait configuration
  91. */
  92. #ifdef PS2_USE_BUSYWAIT
  93. #define PS2_CLOCK_PORT PORTD
  94. #define PS2_CLOCK_PIN PIND
  95. #define PS2_CLOCK_DDR DDRD
  96. #define PS2_CLOCK_BIT 1
  97. #define PS2_DATA_PORT PORTD
  98. #define PS2_DATA_PIN PIND
  99. #define PS2_DATA_DDR DDRD
  100. #define PS2_DATA_BIT 0
  101. #endif
  102. #endif
  103. #endif