]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - tmk_core/common/keyboard.c
Fix pinout of split hand and LED, remove flip half option
[qmk_firmware.git] / tmk_core / common / keyboard.c
index 4eff764e2d85f3351235a36ca43701ea134c9287..6f659b2440a9f9e29c8f325c440f31145bbf2668 100644 (file)
@@ -69,6 +69,12 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #ifdef MIDI_ENABLE
 #   include "process_midi.h"
 #endif
+#ifdef HD44780_ENABLE
+#   include "hd44780.h"
+#endif
+#ifdef QWIIC_ENABLE
+#   include "qwiic.h"
+#endif
 
 #ifdef MATRIX_HAS_GHOST
 extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
@@ -117,6 +123,14 @@ static inline bool has_ghost_in_row(uint8_t row, matrix_row_t rowdata)
 
 #endif
 
+void disable_jtag(void) {
+// To use PORTF disable JTAG with writing JTD bit twice within four cycles.
+#if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega32U4__))
+    MCUCR |= _BV(JTD);
+    MCUCR |= _BV(JTD);
+#endif
+}
+
 /** \brief matrix_setup
  *
  * FIXME: needs doc
@@ -130,6 +144,7 @@ void matrix_setup(void) {
  * FIXME: needs doc
  */
 void keyboard_setup(void) {
+    disable_jtag();
     matrix_setup();
 }
 
@@ -149,6 +164,9 @@ bool is_keyboard_master(void) {
 void keyboard_init(void) {
     timer_init();
     matrix_init();
+#ifdef QWIIC_ENABLE
+    qwiic_init();
+#endif
 #ifdef PS2_MOUSE_ENABLE
     ps2_mouse_init();
 #endif
@@ -185,7 +203,7 @@ void keyboard_init(void) {
 
 /** \brief Keyboard task: Do keyboard routine jobs
  *
- * Do routine keyboard jobs: 
+ * Do routine keyboard jobs:
  *
  * * scan matrix
  * * handle mouse movements
@@ -258,6 +276,10 @@ void keyboard_task(void)
 
 MATRIX_LOOP_END:
 
+#ifdef QWIIC_ENABLE
+    qwiic_task();
+#endif
+
 #ifdef MOUSEKEY_ENABLE
     // mousekey repeat & acceleration
     mousekey_task();