diff options
Diffstat (limited to 'keyboards/touchpad')
-rw-r--r-- | keyboards/touchpad/config.h | 22 | ||||
-rw-r--r-- | keyboards/touchpad/keyboard.json (renamed from keyboards/touchpad/info.json) | 13 | ||||
-rw-r--r-- | keyboards/touchpad/matrix.c | 81 | ||||
-rw-r--r-- | keyboards/touchpad/rules.mk | 12 |
4 files changed, 54 insertions, 74 deletions
diff --git a/keyboards/touchpad/config.h b/keyboards/touchpad/config.h index d499fb795c..f6f58cc5a1 100644 --- a/keyboards/touchpad/config.h +++ b/keyboards/touchpad/config.h @@ -17,28 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once - /* key matrix size */ #define MATRIX_ROWS 6 #define MATRIX_COLS 6 - -/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ -#define LOCKING_SUPPORT_ENABLE -/* Locking resynchronize hack */ -#define LOCKING_RESYNC_ENABLE - -/* - * Feature disable options - * These options are also useful to firmware size reduction. - */ - -/* disable debug print */ -//#define NO_DEBUG - -/* disable print */ -//#define NO_PRINT - -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT diff --git a/keyboards/touchpad/info.json b/keyboards/touchpad/keyboard.json index 7b3cc0950d..5429b5844d 100644 --- a/keyboards/touchpad/info.json +++ b/keyboards/touchpad/keyboard.json @@ -8,6 +8,19 @@ "pid": "0x0DB8", "device_version": "0.0.1" }, + "features": { + "bootmagic": false, + "console": true, + "extrakey": true, + "mousekey": false, + "nkro": true + }, + "qmk": { + "locking": { + "enabled": true, + "resync": true + } + }, "processor": "atmega32u4", "bootloader": "caterina", "layouts": { diff --git a/keyboards/touchpad/matrix.c b/keyboards/touchpad/matrix.c index 87944cb7cc..afe14cf542 100644 --- a/keyboards/touchpad/matrix.c +++ b/keyboards/touchpad/matrix.c @@ -23,7 +23,8 @@ SOFTWARE. #include "matrix.h" #include "i2c_master.h" -#include "quantum.h" +#include "print.h" +#include <string.h> #define VIBRATE_LENGTH 50 //Defines number of interrupts motor will vibrate for, must be bigger than 8 for correct operation volatile uint8_t vibrate = 0; //Trigger vibration in interrupt @@ -126,32 +127,32 @@ void matrix_init(void) { i2c_init(); //Motor enable - setPinOutput(E6); + gpio_set_pin_output(E6); //Motor PWM - setPinOutput(D7); + gpio_set_pin_output(D7); //Power LED - setPinOutput(B7); - writePinHigh(B7); + gpio_set_pin_output(B7); + gpio_write_pin_high(B7); //LEDs Columns - setPinOutput(F7); - setPinOutput(F6); - setPinOutput(F5); - setPinOutput(F4); - setPinOutput(F1); - setPinOutput(F0); + gpio_set_pin_output(F7); + gpio_set_pin_output(F6); + gpio_set_pin_output(F5); + gpio_set_pin_output(F4); + gpio_set_pin_output(F1); + gpio_set_pin_output(F0); //LEDs Rows - setPinOutput(D6); - setPinOutput(B4); - setPinOutput(B5); - setPinOutput(B6); - setPinOutput(C6); - setPinOutput(C7); + gpio_set_pin_output(D6); + gpio_set_pin_output(B4); + gpio_set_pin_output(B5); + gpio_set_pin_output(B6); + gpio_set_pin_output(C6); + gpio_set_pin_output(C7); //Capacitive Interrupt - setPinInput(D2); + gpio_set_pin_input(D2); capSetup(); writeDataToTS(0x06, 0x12); //Calibrate capacitive touch IC @@ -207,7 +208,7 @@ void touchClearCurrentDetections(void) { //Check interrupt pin uint8_t isTouchChangeDetected(void) { - return !readPin(D2); + return !gpio_read_pin(D2); } uint8_t matrix_scan(void) { @@ -231,34 +232,34 @@ uint8_t matrix_scan(void) { for (uint8_t c = 0; c < 6; c++) { for (uint8_t r = 0; r < 6; r++) { switch (r) { - case 0: writePin(D6, matrix_is_on(r, c)); break; - case 1: writePin(B4, matrix_is_on(r, c)); break; - case 2: writePin(B5, matrix_is_on(r, c)); break; - case 3: writePin(B6, matrix_is_on(r, c)); break; - case 4: writePin(C6, matrix_is_on(r, c)); break; - case 5: writePin(C7, matrix_is_on(r, c)); break; + case 0: gpio_write_pin(D6, matrix_is_on(r, c)); break; + case 1: gpio_write_pin(B4, matrix_is_on(r, c)); break; + case 2: gpio_write_pin(B5, matrix_is_on(r, c)); break; + case 3: gpio_write_pin(B6, matrix_is_on(r, c)); break; + case 4: gpio_write_pin(C6, matrix_is_on(r, c)); break; + case 5: gpio_write_pin(C7, matrix_is_on(r, c)); break; } switch (c) { - case 0: writePin(F5, !matrix_is_on(r, c)); break; - case 1: writePin(F4, !matrix_is_on(r, c)); break; - case 2: writePin(F1, !matrix_is_on(r, c)); break; - case 3: writePin(F0, !matrix_is_on(r, c)); break; - case 4: writePin(F6, !matrix_is_on(r, c)); break; - case 5: writePin(F7, !matrix_is_on(r, c)); break; + case 0: gpio_write_pin(F5, !matrix_is_on(r, c)); break; + case 1: gpio_write_pin(F4, !matrix_is_on(r, c)); break; + case 2: gpio_write_pin(F1, !matrix_is_on(r, c)); break; + case 3: gpio_write_pin(F0, !matrix_is_on(r, c)); break; + case 4: gpio_write_pin(F6, !matrix_is_on(r, c)); break; + case 5: gpio_write_pin(F7, !matrix_is_on(r, c)); break; } } } if (vibrate == VIBRATE_LENGTH) { - writePinHigh(E6); - writePinHigh(D7); + gpio_write_pin_high(E6); + gpio_write_pin_high(D7); vibrate--; } else if (vibrate > 0) { vibrate--; } else if (vibrate == 0) { - writePinLow(D7); - writePinLow(E6); + gpio_write_pin_low(D7); + gpio_write_pin_low(E6); } matrix_scan_kb(); @@ -276,16 +277,16 @@ matrix_row_t matrix_get_row(uint8_t row) { } void matrix_print(void) { - printf("\nr/c 01234567\n"); + xprintf("\nr/c 01234567\n"); for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - printf("%X0: ", row); + xprintf("%X0: ", row); matrix_row_t data = matrix_get_row(row); for (int col = 0; col < MATRIX_COLS; col++) { if (data & (1<<col)) - printf("1"); + xprintf("1"); else - printf("0"); + xprintf("0"); } - printf("\n"); + xprintf("\n"); } } diff --git a/keyboards/touchpad/rules.mk b/keyboards/touchpad/rules.mk index b9fb83c48c..42be966784 100644 --- a/keyboards/touchpad/rules.mk +++ b/keyboards/touchpad/rules.mk @@ -1,15 +1,3 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite -MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = yes # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -AUDIO_ENABLE = no # Audio output -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. CUSTOM_MATRIX = yes SRC += matrix.c |