diff options
Diffstat (limited to 'tmk_core/common/keyboard.c')
| -rw-r--r-- | tmk_core/common/keyboard.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index fe626efb3..1bfd4c9cc 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c | |||
| @@ -73,6 +73,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 73 | #ifdef HD44780_ENABLE | 73 | #ifdef HD44780_ENABLE |
| 74 | # include "hd44780.h" | 74 | # include "hd44780.h" |
| 75 | #endif | 75 | #endif |
| 76 | #ifdef QWIIC_ENABLE | ||
| 77 | # include "qwiic.h" | ||
| 78 | #endif | ||
| 76 | 79 | ||
| 77 | #ifdef MATRIX_HAS_GHOST | 80 | #ifdef MATRIX_HAS_GHOST |
| 78 | extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | 81 | extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; |
| @@ -121,6 +124,14 @@ static inline bool has_ghost_in_row(uint8_t row, matrix_row_t rowdata) | |||
| 121 | 124 | ||
| 122 | #endif | 125 | #endif |
| 123 | 126 | ||
| 127 | void disable_jtag(void) { | ||
| 128 | // To use PORTF disable JTAG with writing JTD bit twice within four cycles. | ||
| 129 | #if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega32U4__)) | ||
| 130 | MCUCR |= _BV(JTD); | ||
| 131 | MCUCR |= _BV(JTD); | ||
| 132 | #endif | ||
| 133 | } | ||
| 134 | |||
| 124 | /** \brief matrix_setup | 135 | /** \brief matrix_setup |
| 125 | * | 136 | * |
| 126 | * FIXME: needs doc | 137 | * FIXME: needs doc |
| @@ -134,6 +145,7 @@ void matrix_setup(void) { | |||
| 134 | * FIXME: needs doc | 145 | * FIXME: needs doc |
| 135 | */ | 146 | */ |
| 136 | void keyboard_setup(void) { | 147 | void keyboard_setup(void) { |
| 148 | disable_jtag(); | ||
| 137 | matrix_setup(); | 149 | matrix_setup(); |
| 138 | } | 150 | } |
| 139 | 151 | ||
| @@ -152,13 +164,11 @@ bool is_keyboard_master(void) { | |||
| 152 | */ | 164 | */ |
| 153 | void keyboard_init(void) { | 165 | void keyboard_init(void) { |
| 154 | timer_init(); | 166 | timer_init(); |
| 155 | // To use PORTF disable JTAG with writing JTD bit twice within four cycles. | ||
| 156 | #if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega32U4__)) | ||
| 157 | MCUCR |= _BV(JTD); | ||
| 158 | MCUCR |= _BV(JTD); | ||
| 159 | #endif | ||
| 160 | matrix_init(); | 167 | matrix_init(); |
| 161 | matrix_debounce_init(); | 168 | matrix_debounce_init(); |
| 169 | #ifdef QWIIC_ENABLE | ||
| 170 | qwiic_init(); | ||
| 171 | #endif | ||
| 162 | #ifdef PS2_MOUSE_ENABLE | 172 | #ifdef PS2_MOUSE_ENABLE |
| 163 | ps2_mouse_init(); | 173 | ps2_mouse_init(); |
| 164 | #endif | 174 | #endif |
| @@ -256,6 +266,10 @@ void keyboard_task(void) | |||
| 256 | 266 | ||
| 257 | MATRIX_LOOP_END: | 267 | MATRIX_LOOP_END: |
| 258 | 268 | ||
| 269 | #ifdef QWIIC_ENABLE | ||
| 270 | qwiic_task(); | ||
| 271 | #endif | ||
| 272 | |||
| 259 | #ifdef MOUSEKEY_ENABLE | 273 | #ifdef MOUSEKEY_ENABLE |
| 260 | // mousekey repeat & acceleration | 274 | // mousekey repeat & acceleration |
| 261 | mousekey_task(); | 275 | mousekey_task(); |
