diff --git a/keyboards/40percentclub/ut47/config.h b/keyboards/40percentclub/ut47/config.h
deleted file mode 100644
index f0182a59f8..0000000000
--- a/keyboards/40percentclub/ut47/config.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-Copyright 2018 Carlos Filoteo
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-*/
-
-#pragma once
-
-
-/* key matrix size */
-#define MATRIX_ROWS 4
-#define MATRIX_COLS 12
-
-#define MATRIX_ROW_PINS { D1, D0, D4, C6 }
-#define MATRIX_COL_PINS { D7, E6, B4, B5, B6, B2, B3, B1, F7, F6, F5, F4 }
-
-/* COL2ROW, ROW2COL*/
-#define DIODE_DIRECTION COL2ROW
-
-/* Enable GNAP matrix serial output */
-#define GNAP_ENABLE
diff --git a/keyboards/40percentclub/ut47/keyboard.json b/keyboards/40percentclub/ut47/keyboard.json
index 00c8edef69..176d2a6b2d 100644
--- a/keyboards/40percentclub/ut47/keyboard.json
+++ b/keyboards/40percentclub/ut47/keyboard.json
@@ -22,6 +22,15 @@
"resync": true
}
},
+ "diode_direction": "COL2ROW",
+ "matrix_pins": {
+ "cols": ["D7", "E6", "B4", "B5", "B6", "B2", "B3", "B1", "F7", "F6", "F5", "F4"],
+ "rows": ["D1", "D0", "D4", "C6"]
+ },
+ "keycodes": [
+ {"key": "LED_TOG"},
+ {"key": "LED_CHG"}
+ ],
"layouts": {
"LAYOUT": {
"layout": [
diff --git a/keyboards/40percentclub/ut47/keymaps/default/keymap.c b/keyboards/40percentclub/ut47/keymaps/default/keymap.c
index 4a9de82492..050cb6d4b3 100644
--- a/keyboards/40percentclub/ut47/keymaps/default/keymap.c
+++ b/keyboards/40percentclub/ut47/keymaps/default/keymap.c
@@ -1,31 +1,10 @@
-/* Copyright 2018 Carlos Filoteo
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
+// Copyright 2018 Carlos Filoteo
+// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
-#ifdef LED_ENABLE
- #include "uart.h"
-#endif
#define LT3_TAB LT(3, KC_TAB)
#define MT_RSFT_ENT MT(MOD_RSFT, KC_ENT)
-enum custom_keycodes {
- LED_TOG = SAFE_RANGE,
- LED_CHG
-};
-
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Base Layer
@@ -104,32 +83,3 @@ LAYOUT( /* Tab */
_______, _______, _______, _______, _______, _______, _______, MS_LEFT, MS_DOWN, MS_UP, MS_RGHT
),
};
-
-//LED keymap functions
- #ifdef LED_ENABLE
-void led_chmode(void) {
- uart_write(0x65);
-}
-
-void led_toggle(void) {
- uart_write(0x64);
-}
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- if (record->event.pressed) {
- switch(keycode) {
- case LED_TOG:
- #ifdef LED_ENABLE
- led_toggle();
- #endif
- return false;
- case LED_CHG:
- #ifdef LED_ENABLE
- led_chmode();
- #endif
- return false;
- }
- }
- return true;
-};
-#endif
diff --git a/keyboards/40percentclub/ut47/keymaps/rgb/config.h b/keyboards/40percentclub/ut47/keymaps/rgb/config.h
index d48ee2bf3f..7a66d80f0e 100644
--- a/keyboards/40percentclub/ut47/keymaps/rgb/config.h
+++ b/keyboards/40percentclub/ut47/keymaps/rgb/config.h
@@ -1,23 +1,7 @@
-/* Copyright 2018 Carlos Filoteo
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
+// Copyright 2018 Carlos Filoteo
+// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
-
-// place overrides here
#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
diff --git a/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c b/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c
index 17c0be7772..1250c72f2a 100644
--- a/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c
+++ b/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c
@@ -1,31 +1,10 @@
-/* Copyright 2018 Carlos Filoteo
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
+// Copyright 2018 Carlos Filoteo
+// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
-#ifdef LED_ENABLE
- #include "uart.h"
-#endif
#define LT3_TAB LT(3, KC_TAB)
#define MT_RSFT_ENT MT(MOD_RSFT, KC_ENT)
-enum custom_keycodes {
- LED_TOG = SAFE_RANGE,
- LED_CHG
-};
-
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LAYOUT(
@@ -56,32 +35,3 @@ LAYOUT( /* Tab */
_______, _______, _______, _______, _______, _______, _______, MS_LEFT, MS_DOWN, MS_UP, MS_RGHT
),
};
-
-//LED keymap functions
- #ifdef LED_ENABLE
-void led_chmode(void) {
- uart_write(0x65);
-}
-
-void led_toggle(void) {
- uart_write(0x64);
-}
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- if (record->event.pressed) {
- switch(keycode) {
- case LED_TOG:
- #ifdef LED_ENABLE
- led_toggle();
- #endif
- return false;
- case LED_CHG:
- #ifdef LED_ENABLE
- led_chmode();
- #endif
- return false;
- }
- }
- return true;
-};
-#endif
diff --git a/keyboards/40percentclub/ut47/led.c b/keyboards/40percentclub/ut47/led.c
deleted file mode 100644
index fa431de760..0000000000
--- a/keyboards/40percentclub/ut47/led.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-Copyright 2012 Jun Wako
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-*/
-
-#include
-#include
-#include "led.h"
-
-bool led_update_kb(led_t led_state)
-{
- bool res = led_update_user(led_state);
- if (res) {
- if (led_state.caps_lock) {
- // output low
- gpio_set_pin_output(B0);
- gpio_write_pin_low(B0);
- gpio_set_pin_output(D5);
- gpio_write_pin_low(D5);
- } else {
- // Hi-Z
- gpio_set_pin_input(B0);
- gpio_set_pin_input(D5);
- }
- }
- return false;
-}
diff --git a/keyboards/40percentclub/ut47/led_controls.c b/keyboards/40percentclub/ut47/led_controls.c
new file mode 100644
index 0000000000..34a0ceb5b7
--- /dev/null
+++ b/keyboards/40percentclub/ut47/led_controls.c
@@ -0,0 +1,44 @@
+// Copyright 2018 Carlos Filoteo
+// SPDX-License-Identifier: GPL-2.0-or-later
+#include QMK_KEYBOARD_H
+#include "uart.h"
+
+bool led_update_kb(led_t led_state) {
+ bool res = led_update_user(led_state);
+ if (res) {
+ if (led_state.caps_lock) {
+ // output low
+ gpio_set_pin_output(B0);
+ gpio_write_pin_low(B0);
+ gpio_set_pin_output(D5);
+ gpio_write_pin_low(D5);
+ } else {
+ // Hi-Z
+ gpio_set_pin_input(B0);
+ gpio_set_pin_input(D5);
+ }
+ }
+ return false;
+}
+
+void keyboard_post_init_kb(void) {
+ uart_init(9600);
+
+ keyboard_post_init_user();
+}
+
+bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
+ if (record->event.pressed) {
+ uart_write((record->event.key.row * 16) + record->event.key.col);
+
+ switch (keycode) {
+ case LED_TOG:
+ uart_write(0x64);
+ return false;
+ case LED_CHG:
+ uart_write(0x65);
+ return false;
+ }
+ }
+ return process_record_user(keycode, record);
+}
diff --git a/keyboards/40percentclub/ut47/LED_controls.ino b/keyboards/40percentclub/ut47/led_controls.ino
similarity index 100%
rename from keyboards/40percentclub/ut47/LED_controls.ino
rename to keyboards/40percentclub/ut47/led_controls.ino
diff --git a/keyboards/40percentclub/ut47/matrix.c b/keyboards/40percentclub/ut47/matrix.c
deleted file mode 100644
index d803f11c5e..0000000000
--- a/keyboards/40percentclub/ut47/matrix.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
-Copyright 2018 Carlos Filoteo
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-*/
-
-/*
- * scan matrix
- */
-#include
-#include
-#include
-#include
-#include "print.h"
-#include "debug.h"
-#include "util.h"
-#include "matrix.h"
-
-#ifndef DEBOUNCE
-# define DEBOUNCE 5
-#endif
-static uint8_t debouncing = DEBOUNCE;
-
-/* matrix state(1:on, 0:off) */
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-static matrix_row_t read_cols(void);
-static void init_cols(void);
-static void unselect_rows(void);
-static void select_row(uint8_t row);
-
-
-inline
-uint8_t matrix_rows(void)
-{
- return MATRIX_ROWS;
-}
-
-inline
-uint8_t matrix_cols(void)
-{
- return MATRIX_COLS;
-}
-
-void matrix_init(void)
-{
- // initialize row and col
- unselect_rows();
- init_cols();
-
- // initialize matrix state: all keys off
- for (uint8_t i=0; i < MATRIX_ROWS; i++) {
- matrix[i] = 0;
- matrix_debouncing[i] = 0;
- }
-}
-
-uint8_t matrix_scan(void)
-{
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- select_row(i);
- _delay_us(30); // without this wait read unstable value.
- matrix_row_t cols = read_cols();
- if (matrix_debouncing[i] != cols) {
- matrix_debouncing[i] = cols;
- if (debouncing) {
- dprintf("bounce!: %02X\n", debouncing);
- }
- debouncing = DEBOUNCE;
- }
- unselect_rows();
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
-
- return 1;
-}
-
-inline
-bool matrix_is_on(uint8_t row, uint8_t col)
-{
- return (matrix[row] & ((matrix_row_t)1<The reason this is an "opt-in" feature is to prevent sending serial communication over the pin, in case it ends up being used for something else (like RGB underglow).
diff --git a/keyboards/40percentclub/ut47/rules.mk b/keyboards/40percentclub/ut47/rules.mk
deleted file mode 100644
index 5480f61b9b..0000000000
--- a/keyboards/40percentclub/ut47/rules.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-CUSTOM_MATRIX = yes
-SRC += matrix.c
-UART_DRIVER_REQUIRED = yes
diff --git a/keyboards/40percentclub/ut47/ut47.c b/keyboards/40percentclub/ut47/ut47.c
deleted file mode 100644
index 867d8c0202..0000000000
--- a/keyboards/40percentclub/ut47/ut47.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright 2018 Carlos Filoteo
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-#include "quantum.h"
-#ifdef LED_ENABLE
- #include "uart.h"
-
-void matrix_init_kb(void) {
- uart_init(9600);
-
- matrix_init_user();
-}
-#endif
-
-bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
- // put your per-action keyboard code here
- // runs for every action, just before processing by the firmware
- if (record->event.pressed) {
- #ifdef LED_ENABLE
- uart_write((record->event.key.row*16)+record->event.key.col);
- #endif
- }
- return process_record_user(keycode, record);
-}