diff options
Diffstat (limited to 'keyboards/40percentclub/ut47')
22 files changed, 1684 insertions, 0 deletions
diff --git a/keyboards/40percentclub/ut47/LED_controls.ino b/keyboards/40percentclub/ut47/LED_controls.ino new file mode 100644 index 000000000..dd50300eb --- /dev/null +++ b/keyboards/40percentclub/ut47/LED_controls.ino @@ -0,0 +1,420 @@ +#include <FastGPIO.h> +#include <TimerOne.h> + +int iByte; +byte col = 0; +byte leds[12][4]; +byte pass = 1; +int fadecount = 1; +const int fadelimit = 3000; +const int fadelimitshort = 1000; +byte mode = 4; +byte brightness = 2; +boolean changemode = 0; +int rain = 0; +const int rainlimit = 5000; +const int rainfade = 5000; +byte rx = 0; +byte ry = 0; + +// pin[xx] on led matrix connected to nn on Arduino (-1 is dummy to make array start at pos 1) +int pins[17] = { + -1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 16, 14, 15, 18, 19, 20, 21 +}; + +// col[xx] of leds = pin yy on led matrix +int cols[12] = { + pins[8], pins[7], pins[6], pins[5], pins[9], pins[10], pins[11], pins[12], pins[13], pins[14], pins[15], pins[16] +}; + +// row[xx] of leds = pin yy on led matrix +int rows[4] = { + pins[1], pins[2], pins[3], pins[4] +}; + + +#define DELAY 0 +extern byte leds[12][4]; + +void setup() { + Serial1.begin(9600); + setupLeds(); + for (int s = 0; s < 5; s++) { + for ( int r = 1; r < 9; r++) { + delayMicroseconds(65000); + delayMicroseconds(65000); + for (int j = 0; j < 4; j++) { + for (int i = 0; i < 12; i++) { + leds[i][j] = 1; + for (int p = 0; p < 25; p++) { + } + leds[i][j] = r; + } + } + } + for ( int r = 9; r > 0; r--) { + delayMicroseconds(65000); + delayMicroseconds(65000); + delayMicroseconds(65000); + for (int j = 0; j < 4; j++) { + for (int i = 0; i < 12; i++) { + leds[i][j] = 1; + for (int p = 0; p < 25; p++) { + } + leds[i][j] = r; + } + } + } + } +} + +void loop() { + + switch (mode) { + case 0: + //Blacklight + for (int i = 0; i < 12; i++) { + for (int j = 0; j < 4; j++) { + leds[i][j] = brightness; + } + } + checkserial(); + break; + case 1: + //Breathing + for ( int r = 1; r < 9; r++) { + checkserial(); + if (changemode == 0) { + delayMicroseconds(65000); + delayMicroseconds(65000); + delayMicroseconds(65000); + for (int j = 0; j < 4; j++) { + for (int i = 0; i < 12; i++) { + leds[i][j] = 1; + for (int p = 0; p < 25; p++) { + } + leds[i][j] = r; + } + } + } + else { + break; + } + } + for ( int r = 9; r > 0; r--) { + checkserial(); + if (changemode == 0) { + delayMicroseconds(65000); + delayMicroseconds(65000); + delayMicroseconds(65000); + delayMicroseconds(65000); + for (int j = 0; j < 4; j++) { + for (int i = 0; i < 12; i++) { + leds[i][j] = 1; + for (int p = 0; p < 25; p++) { + } + leds[i][j] = r; + } + } + } + else { + break; + } + } + for ( int r = 1; r < 30; r++) { + checkserial(); + if (changemode == 0) { + delayMicroseconds(65000); + delayMicroseconds(65000); + } + else { + break; + } + } + break; + case 2: + //Random + leds[random(12)][random(4)] = random(8); + delayMicroseconds(10000); + checkserial(); + break; + case 3: + //Rain + rain++; + if (rain > rainlimit) { + rain = 0; + rx = random(12); + ry = random(4); + if (leds[rx][ry] == 0) { + leds[rx][ry] = 18; + } + } + fadecount++; + if (fadecount > rainfade) { + fadecount = 1; + for (int i = 0; i < 12; i++) { + for (int j = 0; j < 4; j++) { + if (leds[i][j] > 0) { + leds[i][j] = leds[i][j] - 1; + } + } + } + } + checkserial(); + break; + case 4: + //Reactive + fadecount++; + if (fadecount > fadelimit) { + fadecount = 1; + for (int i = 0; i < 12; i++) { + for (int j = 0; j < 4; j++) { + if (leds[i][j] > 0) { + leds[i][j] = leds[i][j] - 1; + } + } + } + } + checkserial(); + break; + case 5: + //Reactive Target + fadecount++; + if (fadecount > fadelimitshort) { + fadecount = 1; + for (int i = 0; i < 12; i++) { + for (int j = 0; j < 4; j++) { + if (leds[i][j] > 0) { + leds[i][j] = leds[i][j] - 1; + } + } + } + } + checkserial(); + break; + default: + mode = 0; + break; + } + changemode = 0; +} + +void checkserial() { + if (Serial1.available() > 0) { + iByte = Serial1.read(); + if (iByte == 100) { + brightness++; + if (brightness > 9) { + brightness = 1; + } + } + if (iByte == 101) { + mode++; + } + if (iByte < 100) { + if (mode == 4) { + byte row = iByte / 16; + byte col = iByte % 16; + leds[col][row] = 18; + } + if (mode == 5) { + byte row = iByte / 16; + byte col = iByte % 16; + for (byte i = 0; i < 12; i++) { + leds[i][row] = 18; + } + for (byte p = 0; p < 4; p++) { + leds[col][p] = 18; + } + } + } + } +} + +void setupLeds() { + // sets the pins as output + FastGPIO::Pin<2>::setOutputLow(); + FastGPIO::Pin<3>::setOutputLow(); + FastGPIO::Pin<4>::setOutputLow(); + FastGPIO::Pin<5>::setOutputLow(); + FastGPIO::Pin<6>::setOutputLow(); + FastGPIO::Pin<7>::setOutputLow(); + FastGPIO::Pin<8>::setOutputLow(); + FastGPIO::Pin<9>::setOutputLow(); + FastGPIO::Pin<10>::setOutputLow(); + FastGPIO::Pin<16>::setOutputLow(); + FastGPIO::Pin<14>::setOutputLow(); + FastGPIO::Pin<15>::setOutputLow(); + FastGPIO::Pin<18>::setOutputLow(); + FastGPIO::Pin<19>::setOutputLow(); + FastGPIO::Pin<20>::setOutputLow(); + FastGPIO::Pin<21>::setOutputLow(); + + // set up Cols + FastGPIO::Pin<6>::setOutputValueLow(); + FastGPIO::Pin<7>::setOutputValueLow(); + FastGPIO::Pin<8>::setOutputValueLow(); + FastGPIO::Pin<9>::setOutputValueLow(); + FastGPIO::Pin<10>::setOutputValueLow(); + FastGPIO::Pin<16>::setOutputValueLow(); + FastGPIO::Pin<14>::setOutputValueLow(); + FastGPIO::Pin<15>::setOutputValueLow(); + FastGPIO::Pin<18>::setOutputValueLow(); + FastGPIO::Pin<19>::setOutputValueLow(); + FastGPIO::Pin<20>::setOutputValueLow(); + FastGPIO::Pin<21>::setOutputValueLow(); + + // set up Rows + FastGPIO::Pin<2>::setOutputValueLow(); + FastGPIO::Pin<3>::setOutputValueLow(); + FastGPIO::Pin<4>::setOutputValueLow(); + FastGPIO::Pin<5>::setOutputValueLow(); + + clearLeds(); + Timer1.initialize(25); + Timer1.attachInterrupt(display); + +} + +void clearLeds() { + // Clear display array + for (int i = 0; i < 12; i++) { + for (int j = 0; j < 4; j++) { + leds[i][j] = 0; + } + } +} + +void onLeds() { + // Clear display array + for (int i = 0; i < 12; i++) { + for (int j = 0; j < 4; j++) { + leds[i][j] = 7; + } + } +} + +// Interrupt routine +void display() { + + switch (col) { // Turn whole previous column off + case 0: + FastGPIO::Pin<6>::setOutputValueLow(); + break; + case 1: + FastGPIO::Pin<7>::setOutputValueLow(); + break; + case 2: + FastGPIO::Pin<8>::setOutputValueLow(); + break; + case 3: + FastGPIO::Pin<9>::setOutputValueLow(); + break; + case 4: + FastGPIO::Pin<10>::setOutputValueLow(); + break; + case 5: + FastGPIO::Pin<16>::setOutputValueLow(); + break; + case 6: + FastGPIO::Pin<14>::setOutputValueLow(); + break; + case 7: + FastGPIO::Pin<15>::setOutputValueLow(); + break; + case 8: + FastGPIO::Pin<18>::setOutputValueLow(); + break; + case 9: + FastGPIO::Pin<19>::setOutputValueLow(); + break; + case 10: + FastGPIO::Pin<20>::setOutputValueLow(); + break; + case 11: + FastGPIO::Pin<21>::setOutputValueLow(); + break; + } + + col++; + if (col == 12) { + col = 0; + pass++; + if (pass > 8) { + pass = 1; + } + } + for (int row = 0; row < 4; row++) { + if (leds[col][row] > pass) { + switch (row) { // Turn on this led + case 0: + FastGPIO::Pin<2>::setOutputValueLow(); + break; + case 1: + FastGPIO::Pin<3>::setOutputValueLow(); + break; + case 2: + FastGPIO::Pin<4>::setOutputValueLow(); + break; + case 3: + FastGPIO::Pin<5>::setOutputValueLow(); + break; + } + } + else { + switch (row) { // Turn off this led + case 0: + FastGPIO::Pin<2>::setOutputValueHigh(); + break; + case 1: + FastGPIO::Pin<3>::setOutputValueHigh(); + break; + case 2: + FastGPIO::Pin<4>::setOutputValueHigh(); + break; + case 3: + FastGPIO::Pin<5>::setOutputValueHigh(); + break; + } + } + } + switch (col) { // Turn column on + case 0: + FastGPIO::Pin<6>::setOutputValueHigh(); + break; + case 1: + FastGPIO::Pin<7>::setOutputValueHigh(); + break; + case 2: + FastGPIO::Pin<8>::setOutputValueHigh(); + break; + case 3: + FastGPIO::Pin<9>::setOutputValueHigh(); + break; + case 4: + FastGPIO::Pin<10>::setOutputValueHigh(); + break; + case 5: + FastGPIO::Pin<16>::setOutputValueHigh(); + break; + case 6: + FastGPIO::Pin<14>::setOutputValueHigh(); + break; + case 7: + FastGPIO::Pin<15>::setOutputValueHigh(); + break; + case 8: + FastGPIO::Pin<18>::setOutputValueHigh(); + break; + case 9: + FastGPIO::Pin<19>::setOutputValueHigh(); + break; + case 10: + FastGPIO::Pin<20>::setOutputValueHigh(); + break; + case 11: + FastGPIO::Pin<21>::setOutputValueHigh(); + break; + } + +} diff --git a/keyboards/40percentclub/ut47/config.h b/keyboards/40percentclub/ut47/config.h new file mode 100644 index 000000000..4335e3edd --- /dev/null +++ b/keyboards/40percentclub/ut47/config.h @@ -0,0 +1,87 @@ +/* +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 <http://www.gnu.org/licenses/>. +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x0000 +#define DEVICE_VER 0x0001 +#define MANUFACTURER 40percent.club +#define PRODUCT ut47 +#define DESCRIPTION An awesome 40% keyboard + +/* 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 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ +#define DIODE_DIRECTION COL2ROW + +// #define BACKLIGHT_PIN B7 +// #define BACKLIGHT_BREATHING +// #define BACKLIGHT_LEVELS 3 + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* 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 + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* Enable GNAP matrix serial output */ +#define GNAP_ENABLE + +/* USART configuration */ +#ifdef __AVR_ATmega32U4__ +# define SERIAL_UART_BAUD 9600 +# define SERIAL_UART_DATA UDR1 +# define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1) +# define SERIAL_UART_RXD_VECT USART1_RX_vect +# define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1)) +# define SERIAL_UART_INIT() do { \ + /* baud rate */ \ + UBRR1L = SERIAL_UART_UBRR; \ + /* baud rate */ \ + UBRR1H = SERIAL_UART_UBRR >> 8; \ + /* enable TX */ \ + UCSR1B = _BV(TXEN1); \ + /* 8-bit data */ \ + UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \ + sei(); \ + } while(0) +# else +# error "USART configuration is needed." +#endif + +#endif diff --git a/keyboards/40percentclub/ut47/info.json b/keyboards/40percentclub/ut47/info.json new file mode 100644 index 000000000..59bffe99a --- /dev/null +++ b/keyboards/40percentclub/ut47/info.json @@ -0,0 +1,13 @@ +{ + "keyboard_name": "UT47", + "url": "", + "maintainer": "qmk", + "width": 12.5, + "height": 4, + "layouts": { + "LAYOUT": { + "key_count": 47, + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"Q", "x":1, "y":0}, {"label":"W", "x":2, "y":0}, {"label":"E", "x":3, "y":0}, {"label":"R", "x":4, "y":0}, {"label":"T", "x":5, "y":0}, {"label":"Y", "x":6, "y":0}, {"label":"U", "x":7, "y":0}, {"label":"I", "x":8, "y":0}, {"label":"O", "x":9, "y":0}, {"label":"P", "x":10, "y":0}, {"label":"Backspace", "x":11, "y":0, "w":1.5}, {"label":"LT(3) / Tab", "x":0, "y":1, "w":1.25}, {"label":"A", "x":1.25, "y":1}, {"label":"S", "x":2.25, "y":1}, {"label":"D", "x":3.25, "y":1}, {"label":"F", "x":4.25, "y":1}, {"label":"G", "x":5.25, "y":1}, {"label":"H", "x":6.25, "y":1}, {"label":"J", "x":7.25, "y":1}, {"label":"K", "x":8.25, "y":1}, {"label":"L", "x":9.25, "y":1}, {"label":":", "x":10.25, "y":1}, {"label":"\"", "x":11.25, "y":1, "w":1.25}, {"label":"Shift", "x":0, "y":2, "w":1.5}, {"label":"Z", "x":1.5, "y":2}, {"label":"X", "x":2.5, "y":2}, {"label":"C", "x":3.5, "y":2}, {"label":"V", "x":4.5, "y":2}, {"label":"B", "x":5.5, "y":2}, {"label":"N", "x":6.5, "y":2}, {"label":"M", "x":7.5, "y":2}, {"label":"<", "x":8.5, "y":2}, {"label":">", "x":9.5, "y":2}, {"label":"?", "x":10.5, "y":2}, {"label":"Shift / Enter", "x":11.5, "y":2}, {"label":"Ctrl", "x":0, "y":3}, {"label":"Alt", "x":1, "y":3}, {"label":"GUI", "x":2, "y":3}, {"label":"Menu", "x":3, "y":3}, {"label":"MO(2)", "x":4, "y":3, "w":1.25}, {"x":5.25, "y":3, "w":2}, {"label":"MO(1)", "x":7.25, "y":3, "w":1.25}, {"label":"\u2190", "x":8.5, "y":3}, {"label":"\u2193", "x":9.5, "y":3}, {"label":"\u2191", "x":10.5, "y":3}, {"label":"\u2192", "x":11.5, "y":3}] + } + } +} diff --git a/keyboards/40percentclub/ut47/keymaps/default/config.h b/keyboards/40percentclub/ut47/keymaps/default/config.h new file mode 100644 index 000000000..46098a22f --- /dev/null +++ b/keyboards/40percentclub/ut47/keymaps/default/config.h @@ -0,0 +1,24 @@ +/* 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 <http://www.gnu.org/licenses/>. + */ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +// place overrides here + +#endif diff --git a/keyboards/40percentclub/ut47/keymaps/default/keymap.c b/keyboards/40percentclub/ut47/keymaps/default/keymap.c new file mode 100644 index 000000000..6b6bb025b --- /dev/null +++ b/keyboards/40percentclub/ut47/keymaps/default/keymap.c @@ -0,0 +1,136 @@ +/* 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 <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H +#ifdef LED_ENABLE + #include "protocol/serial.h" +#endif + +#define _______ KC_TRNS +#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 + * ,-------------------------------------------------------------------------. + * | Esc | Q | W | E | R | T | Y | U | I | O | P |Bspace | + * |-------------------------------------------------------------------------+ + * |Tab/L3| A | S | D | F | G | H | J | K | L | ; | ' | + * |-------------------------------------------------------------------------+ + * | Shift | Z | X | C | V | B | N | M | , | . | / |Sh/En| + * |-------------------------------------------------------------------------+ + * | Ctrl| Alt | Gui | App | L2 | Space | L1 | Left| Down| Up |Right| + * `-------------------------------------------------------------------------' + */ + +LAYOUT( + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + LT3_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, MT_RSFT_ENT, + KC_LCTL, KC_LALT, KC_LGUI, KC_APP, MO(2), KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + + /* FN Layer 1 + * ,-------------------------------------------------------------------------. + * | ` ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Delete| + * |-------------------------------------------------------------------------+ + * | | | | | | | | - | = | [ | ] | \ | + * |-------------------------------------------------------------------------+ + * | | F11 | F12 | F13 | F14 | F15 | F16 | F17 | F18 | F19 | F20 | | + * |-------------------------------------------------------------------------+ + * | | | |Capsl| | | | Home| PgDn| PgUp| End | + * `-------------------------------------------------------------------------' + */ + +LAYOUT( /* Right */ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DELETE, + _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, + _______, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, _______, + _______, _______, _______, KC_CAPS, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END +), + + /* FN Layer 2 + * ,-------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) |Delete| + * |-------------------------------------------------------------------------+ + * | | | | | | | | _ | + | { | } | | | + * |-------------------------------------------------------------------------+ + * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | | + * |-------------------------------------------------------------------------+ + * | | | |Capsl| | | | Home| PgDn| PgUp| End | + * `-------------------------------------------------------------------------' + */ + +LAYOUT( /* Left */ + KC_TILDE, KC_EXCLAIM, KC_AT, KC_HASH, KC_DOLLAR, KC_PERCENT, KC_CIRCUMFLEX, KC_AMPERSAND, KC_ASTERISK, KC_LEFT_PAREN, KC_RIGHT_PAREN, KC_DELETE, + _______, _______, _______, _______, _______, _______, _______, KC_UNDERSCORE, KC_PLUS, KC_LEFT_CURLY_BRACE, KC_RIGHT_CURLY_BRACE, KC_PIPE, + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, + _______, _______, _______, KC_CAPS, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END +), + + /* FN Layer 2 + * ,-------------------------------------------------------------------------. + * | Esc | Calc|Webhm| Mail| Comp| | | | | |PrtSc| | + * |-------------------------------------------------------------------------+ + * | | | | | | | | | | | | | + * |-------------------------------------------------------------------------+ + * | |LEDtg|LEDch| | | | | | | | | | + * |-------------------------------------------------------------------------+ + * | | | | | | | |MousL|MousD|MousU|MousR| + * `-------------------------------------------------------------------------' + */ + +LAYOUT( /* Tab */ + KC_ESC, KC_CALC, KC_WHOM, KC_MAIL, KC_MYCM, _______, _______, _______, _______, _______, KC_PSCR, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, LED_TOG, LED_CHG, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R +), +}; + +//LED keymap functions + #ifdef LED_ENABLE +void led_chmode(void) { + serial_send(101); +} + +void led_toggle(void) { + serial_send(100); +} + +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/default/readme.md b/keyboards/40percentclub/ut47/keymaps/default/readme.md new file mode 100644 index 000000000..e09dc73fa --- /dev/null +++ b/keyboards/40percentclub/ut47/keymaps/default/readme.md @@ -0,0 +1,19 @@ +# UT47 default keymap + +![UT47 layout image](https://i.imgur.com/Tsz5qsF.png) + +[KLE](http://www.keyboard-layout-editor.com/##@@_y:0%3B&=Esc&=Q&=W&=E&=R&=T&=Y&=U&=I&=O&=P&_w:1.5%3B&=Back%20Space&_x:0.25&a:4&f:4&w:4&h:4&d:true%3B&=%3Cb%3EGNAP!%3C%2F%2Fb%3E%3Cp%3E%3Cp%3EMinimum%20stagger%3Cp%3E47%20key%20layout%3B&@_a:7&f:3&w:1.25%3B&=Tab&=A&=S&=D&=F&=G&=H&=J&=K&=L&=%2F%3B&_w:1.25%3B&=%27%3B&@_w:1.5%3B&=Shift&=Z&=X&=C&=V&=B&=N&=M&=,&=.&=%2F%2F&=Return%3B&@=Ctrl&=Alt&=Super&=Menu&_w:1.25%3B&=%2F&dArr%2F%3B&_w:2%3B&=&_w:1.25%3B&=%2F&uArr%2F%3B&=%2F&larr%2F%3B&=%2F&darr%2F%3B&=%2F&uarr%2F%3B&=%2F&rarr%2F%3B%3B&=undefined) + +### LED Controls + +Use <kbd>TAB</kbd>+<kbd>Z</kbd> to cycle through brightness (8 steps) + +Use <kbd>TAB</kbd>+<kbd>X</kbd> to cycle through the following LED modes: + +- solid +- breathing +- random +- rain +- reactive +- poptang +- off diff --git a/keyboards/40percentclub/ut47/keymaps/non-us/config.h b/keyboards/40percentclub/ut47/keymaps/non-us/config.h new file mode 100644 index 000000000..46098a22f --- /dev/null +++ b/keyboards/40percentclub/ut47/keymaps/non-us/config.h @@ -0,0 +1,24 @@ +/* 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 <http://www.gnu.org/licenses/>. + */ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +// place overrides here + +#endif diff --git a/keyboards/40percentclub/ut47/keymaps/non-us/keymap.c b/keyboards/40percentclub/ut47/keymaps/non-us/keymap.c new file mode 100644 index 000000000..1cb537b7d --- /dev/null +++ b/keyboards/40percentclub/ut47/keymaps/non-us/keymap.c @@ -0,0 +1,136 @@ +/* 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 <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H +#ifdef LED_ENABLE + #include "protocol/serial.h" +#endif + +#define _______ KC_TRNS +#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 + * ,-------------------------------------------------------------------------. + * | Esc | Q | W | E | R | T | Y | U | I | O | P |Bspace | + * |-------------------------------------------------------------------------+ + * |Tab/L3| A | S | D | F | G | H | J | K | L | ; | ' | + * |-------------------------------------------------------------------------+ + * | Shift | Z | X | C | V | B | N | M | , | . | / |Sh/En| + * |-------------------------------------------------------------------------+ + * | Ctrl| Alt | Gui | App | L2 | Space | L1 | Left| Down| Up |Right| + * `-------------------------------------------------------------------------' + */ + +LAYOUT( + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + LT3_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, MT_RSFT_ENT, + KC_LCTL, KC_LALT, KC_LGUI, KC_APP, MO(2), KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + + /* FN Layer 1 + * ,-------------------------------------------------------------------------. + * | ` ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Delete| + * |-------------------------------------------------------------------------+ + * | | | | | | | # | - | = | [ | ] | \ | + * |-------------------------------------------------------------------------+ + * | | F11 | F12 | F13 | F14 | F15 | F16 | F17 | F18 | F19 | F20 | | + * |-------------------------------------------------------------------------+ + * | | | |Capsl| | | | Home| PgDn| PgUp| End | + * `-------------------------------------------------------------------------' + */ + +LAYOUT( /* Right */ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DELETE, + _______, _______, _______, _______, _______, _______, KC_NUHS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_NUBS, + _______, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, _______, + _______, _______, _______, KC_CAPS, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END +), + + /* FN Layer 2 + * ,-------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) |Delete| + * |-------------------------------------------------------------------------+ + * | | | | | | | | _ | + | { | } | | | + * |-------------------------------------------------------------------------+ + * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | | + * |-------------------------------------------------------------------------+ + * | | | |Capsl| | | | Home| PgDn| PgUp| End | + * `-------------------------------------------------------------------------' + */ + +LAYOUT( /* Left */ + KC_TILDE, KC_EXCLAIM, KC_AT, KC_HASH, KC_DOLLAR, KC_PERCENT, KC_CIRCUMFLEX, KC_AMPERSAND, KC_ASTERISK, KC_LEFT_PAREN, KC_RIGHT_PAREN, KC_DELETE, + _______, _______, _______, _______, _______, _______, _______, KC_UNDERSCORE, KC_PLUS, KC_LEFT_CURLY_BRACE, KC_RIGHT_CURLY_BRACE, KC_PIPE, + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, + _______, _______, _______, KC_CAPS, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END +), + + /* FN Layer 2 + * ,-------------------------------------------------------------------------. + * | Esc | Calc|Webhm| Mail| Comp| | | | | |PrtSc| | + * |-------------------------------------------------------------------------+ + * | | | | | | | | | | | | | + * |-------------------------------------------------------------------------+ + * | |LEDtg|LEDch| | | | | | | | | | + * |-------------------------------------------------------------------------+ + * | | | | | | | |MousL|MousD|MousU|MousR| + * `-------------------------------------------------------------------------' + */ + +LAYOUT( /* Tab */ + KC_ESC, KC_CALC, KC_WHOM, KC_MAIL, KC_MYCM, _______, _______, _______, _______, _______, KC_PSCR, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, LED_TOG, LED_CHG, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R +), +}; + +//LED keymap functions + #ifdef LED_ENABLE +void led_chmode(void) { + serial_send(101); +} + +void led_toggle(void) { + serial_send(100); +} + +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/non-us/readme.md b/keyboards/40percentclub/ut47/keymaps/non-us/readme.md new file mode 100644 index 000000000..e09dc73fa --- /dev/null +++ b/keyboards/40percentclub/ut47/keymaps/non-us/readme.md @@ -0,0 +1,19 @@ +# UT47 default keymap + +![UT47 layout image](https://i.imgur.com/Tsz5qsF.png) + +[KLE](http://www.keyboard-layout-editor.com/##@@_y:0%3B&=Esc&=Q&=W&=E&=R&=T&=Y&=U&=I&=O&=P&_w:1.5%3B&=Back%20Space&_x:0.25&a:4&f:4&w:4&h:4&d:true%3B&=%3Cb%3EGNAP!%3C%2F%2Fb%3E%3Cp%3E%3Cp%3EMinimum%20stagger%3Cp%3E47%20key%20layout%3B&@_a:7&f:3&w:1.25%3B&=Tab&=A&=S&=D&=F&=G&=H&=J&=K&=L&=%2F%3B&_w:1.25%3B&=%27%3B&@_w:1.5%3B&=Shift&=Z&=X&=C&=V&=B&=N&=M&=,&=.&=%2F%2F&=Return%3B&@=Ctrl&=Alt&=Super&=Menu&_w:1.25%3B&=%2F&dArr%2F%3B&_w:2%3B&=&_w:1.25%3B&=%2F&uArr%2F%3B&=%2F&larr%2F%3B&=%2F&darr%2F%3B&=%2F&uarr%2F%3B&=%2F&rarr%2F%3B%3B&=undefined) + +### LED Controls + +Use <kbd>TAB</kbd>+<kbd>Z</kbd> to cycle through brightness (8 steps) + +Use <kbd>TAB</kbd>+<kbd>X</kbd> to cycle through the following LED modes: + +- solid +- breathing +- random +- rain +- reactive +- poptang +- off diff --git a/keyboards/40percentclub/ut47/keymaps/nordic/config.h b/keyboards/40percentclub/ut47/keymaps/nordic/config.h new file mode 100644 index 000000000..fcdd2c232 --- /dev/null +++ b/keyboards/40percentclub/ut47/keymaps/nordic/config.h @@ -0,0 +1,17 @@ +/* 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 <http://www.gnu.org/licenses/>. + */ + +#pragma once diff --git a/keyboards/40percentclub/ut47/keymaps/nordic/keymap.c b/keyboards/40percentclub/ut47/keymaps/nordic/keymap.c new file mode 100644 index 000000000..cc3f43650 --- /dev/null +++ b/keyboards/40percentclub/ut47/keymaps/nordic/keymap.c @@ -0,0 +1,179 @@ +/* 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 <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H +#ifdef LED_ENABLE + #include "protocol/serial.h" + +#endif + +#include "keymap_norwegian.h" + +#define _______ KC_TRNS +#define LT3_TAB LT(3, KC_TAB) +#define MT_RSFT_ENT MT(MOD_RSFT, KC_ENT) +#define CTRADEL LALT(LCTL(KC_DEL)) +#define ALTTAB LALT(KC_TAB) + +enum custom_keycodes { + LED_TOG = SAFE_RANGE, + LED_CHG +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Base Layer - L0 + * ,-------------------------------------------------------------------------. + * | Esc | Q | W | E | R | T | Y | U | I | O | P |Bspace | + * |-------------------------------------------------------------------------+ + * |Tab/L3| A | S | D | F | G | H | J | K | L | ' |Ent/RS| + * |-------------------------------------------------------------------------+ + * | Shift | Z | X | C | V | B | N | M | , | . | Up | L4 | + * |-------------------------------------------------------------------------+ + * | Ctrl| Gui | L4 | Alt | L2 | Space | L1 | Ctrl| Left| Down|Right| + * `-------------------------------------------------------------------------' + */ + +LAYOUT( /* Base - L0 */ + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + LT3_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, NO_APOS, MT_RSFT_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, MO(4), + KC_LCTL, KC_LGUI, MO(4), KC_LALT, MO(2), KC_SPC, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT +), + + /* FN Layer 1 + * ,-------------------------------------------------------------------------. + * | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Delete| + * |-------------------------------------------------------------------------+ + * | | | | | | | | | + | = | * | / | + * |-------------------------------------------------------------------------+ + * | | | | | | | | | - | _ | PgUp| | + * |-------------------------------------------------------------------------+ + * | | | |Capsl| | | | | Home| PgDn| End | + * `-------------------------------------------------------------------------' + */ + +LAYOUT( /* Right modifier - L1 */ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DELETE, + _______, _______, _______, _______, _______, _______, _______, _______, NO_PLUS, NO_EQL, NO_ASTR, NO_SLSH, + _______, _______, _______, _______, _______, _______, _______, _______, NO_MINS, NO_UNDS, KC_PGUP, _______, + _______, _______, _______, KC_CAPS, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END +), + + /* FN Layer 2 + * ,-------------------------------------------------------------------------. + * | § | ! | " | # | ¤ | % | & | / | = | + | \ | Delete| + * |-------------------------------------------------------------------------+ + * | | | ? | { | [ | ( | ) | ] | } | F10 | F11 | F12 | + * |-------------------------------------------------------------------------+ + * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | PgUp| | + * |-------------------------------------------------------------------------+ + * | | | |Capsl| | | | | Home| PgDn| End | + * `-------------------------------------------------------------------------' + */ + +LAYOUT( /* Left modifier - L2 */ + NO_SECT, KC_EXCLAIM, NO_QUO2, KC_HASH, NO_BULT, KC_PERCENT, NO_AMPR, NO_SLSH, NO_EQL, NO_PLUS, NO_BSLS, KC_DELETE, + _______, _______, NO_QUES, NO_LCBR, NO_LBRC, NO_LPRN, NO_RPRN, NO_RBRC, NO_RCBR, KC_F10, KC_F11, KC_F12, + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_PGUP, _______, + _______, _______, _______, KC_CAPS, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END +), + + /* FN Layer 3 + * ,-------------------------------------------------------------------------. + * | Esc | Calc|Webhm| Comp|Webrf| | | | | |PrtSc|CtrAlDl| + * |-------------------------------------------------------------------------+ + * | | | | | | | |VolDn|VolUp| | | | + * |-------------------------------------------------------------------------+ + * | |LEDtg|LEDch| | |RESET| | Mute| |MouB1|MousU|MouB2| + * |-------------------------------------------------------------------------+ + * | | | | | | | | |MousL|MousD|MousR| + * `-------------------------------------------------------------------------' + */ + +LAYOUT( /* Hold Tab down - L3 */ + KC_ESC, KC_CALC, KC_WHOM, KC_MYCM, KC_WREF, _______, _______, _______, _______, _______, KC_PSCR, CTRADEL, + _______, _______, _______, _______, _______, _______, _______, KC_VOLD, KC_VOLU, _______, _______, _______, + _______, LED_TOG, LED_CHG, _______, _______, RESET, _______, KC_MUTE, _______, KC_MS_BTN1, KC_MS_U, KC_MS_BTN2, + _______, _______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R +), + + /* FN Layer 4 + * ,-------------------------------------------------------------------------. + * | | | @ | £ | $ | ~ | | ¨ | ´ | ` | Å | | + * |-------------------------------------------------------------------------+ + * | | | | € | | | | | ^ | Ø | Æ | | + * |-------------------------------------------------------------------------+ + * | | < | | | | | | µ | | | | | + * |-------------------------------------------------------------------------+ + * | | | | | | | | L5 | | | | + * `-------------------------------------------------------------------------' + */ + +LAYOUT( /* Norsk - L4 */ + _______, _______, NO_AT, NO_PND, NO_DLR, NO_TILD, _______, NO_QUOT, NO_ACUT, NO_GRV, NO_AA, _______, + _______, _______, _______, NO_EURO, _______, _______, _______, _______, NO_CIRC, NO_OSLH, NO_AE, _______, + _______, NO_LESS, _______, _______, _______, _______, _______, NO_MU, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, TO(5), _______, _______, _______ +), + + /* GAMING Layer (toggle on and off) + * ,-------------------------------------------------------------------------. + * | Esc | Q | W | E | R | T | Y | F1 | F2 | F3 | F4 |Alt+Tab| + * |-------------------------------------------------------------------------+ + * | Tab | A | S | D | F | G | H | F5 | F6 | F7 | F8 | Enter| + * |-------------------------------------------------------------------------+ + * | Shift | 1 | 2 | 3 | 4 | 5 | 6 | F9 | F10 | F11 | Up |TOGGL| + * |-------------------------------------------------------------------------+ + * | Ctrl| Z | X | C | B | Space | M | V |Left |Down |Right| + * `-------------------------------------------------------------------------' + */ + +LAYOUT( /* GAMING, toggled on and off - L5 */ + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_F1, KC_F2, KC_F3, KC_F4, ALTTAB, + KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_F5, KC_F6, KC_F7, KC_F8, KC_ENT, + KC_LSFT, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_F9, KC_F10, KC_F11, KC_UP, TO(0), + KC_LCTL, KC_Z, KC_X, KC_C, KC_B, KC_SPC, KC_M, KC_V, KC_LEFT, KC_DOWN, KC_RGHT +), +}; + +//LED keymap functions + #ifdef LED_ENABLE +void led_chmode(void) { + serial_send(101); +} + +void led_toggle(void) { + serial_send(100); +} + +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/nordic/readme.md b/keyboards/40percentclub/ut47/keymaps/nordic/readme.md new file mode 100644 index 000000000..4b0d0eb12 --- /dev/null +++ b/keyboards/40percentclub/ut47/keymaps/nordic/readme.md @@ -0,0 +1,33 @@ +# UT47 Nordic keymap + + +![UT47 Nordic layout image](https://i.imgur.com/ZNtF4wA.png) + +[KLE - Nordic layout](http://www.keyboard-layout-editor.com/##@_name=UT47%20-%20Nordic%20layout&author=neonSpork%3B&@_a:7%3B&=Esc&=Q&=W&=E&=R&=T&=Y&=U&=I&=O&=P&_w:1.5%3B&=Backspace%3B&@_c=%23c75656&a:4&w:1.25%3B&=%0A%0A%0AL3%0A%0A%0A%0A%0A%0ATab&_c=%23cccccc&a:7%3B&=A&=S&=D&=F&=G&=H&=J&=K&=L&='&_a:4&w:1.25%3B&=Enter%0A%0A%0ARShift%3B&@_a:7&w:1.5%3B&=LShift&=Z&=X&=C&=V&=B&=N&=M&=,&=.&=%2F&uarr%2F%3B&_c=%23bb45c4%3B&=L4%3B&@_c=%23cccccc%3B&=LCtrl&=LGUI&_c=%23bb45c4%3B&=L4&_c=%23cccccc%3B&=LAlt&_c=%2333aaff&w:1.25%3B&=L2&_c=%23cccccc&w:2%3B&=Space&_c=%23f5b047&w:1.25%3B&=L1&_c=%23cccccc%3B&=RCtrl&=%2F&larr%2F%3B&=%2F&darr%2F%3B&=%2F&rarr%2F%3B%3B&@_y:0.25&c=%23f5b047%3B&=%7C&=1&=2&=3&=4&=5&=6&=7&=8&=9&=0&_w:1.5%3B&=Delete%3B&@_w:1.25%3B&=&=&=&=&=&=&=&=&=+&=%2F=&=*&_w:1.25%3B&=%2F%2F%3B&@_w:1.5%3B&=&=&=&=&=&=&=&=&=-&=%2F_&=PgUp&=%3B&@=&=&=&=Caps&_w:1.25%3B&=&_w:2%3B&=&_w:1.25%3B&=&=&=Home&=PgDn&=End%3B&@_y:0.25&c=%2333aaff%3B&=%C2%A7&=!&=%22&=%23&=%C2%A4&=%25&=%2F&&=%2F%2F&=%2F=&=+&=%5C&_w:1.5%3B&=Delete%3B&@_w:1.25%3B&=&=&=%3F&=%7B&=%5B&=(&=)&=%5D&=%7D&=F10&=F11&_w:1.25%3B&=F12%3B&@_w:1.5%3B&=&=F1&=F2&=F3&=F4&=F5&=F6&=F7&=F8&=F9&=PgUp&=%3B&@=&=&=&=Caps&_w:1.25%3B&=&_w:2%3B&=&_w:1.25%3B&=&=&=Home&=PgDn&=End%3B&@_y:0.25&c=%23c75656%3B&=Esc&=Calc&_a:5%3B&=www%0A%0A%0A%0A%0A%0Ahome&=My%0A%0A%0A%0A%0A%0AComp&=www%0A%0A%0A%0A%0A%0ARefresh&_a:7%3B&=&=&=&=&=&=PrtScr&_w:1.5%3B&=Ctr%20Alt%20Del%3B&@_w:1.25%3B&=&=&=&=&=&=&=&=VolDn&=VolUp&=&=&_w:1.25%3B&=%3B&@_w:1.5%3B&=&=LEDtg&=LEDch&=&=&=RESET&=&=Mute&=&_a:5%3B&=Mouse%0AClick%0A%0A%0A%0A%0ALeft&=Mouse%0A%0A%0A%0A%0A%0AUp&=Mouse%0AClick%0A%0A%0A%0A%0ARight%3B&@_a:7%3B&=&=&=&=&_w:1.25%3B&=&_w:2%3B&=&_w:1.25%3B&=&=&_a:5%3B&=Mouse%0A%0A%0A%0A%0A%0ALeft&=Mouse%0A%0A%0A%0A%0A%0ADown&=Mouse%0A%0A%0A%0A%0A%0ARight%3B&@_y:0.25&c=%23bb45c4&a:7%3B&=&=&=%2F@&=%C2%A3&=$&=~&=&=%C2%A8&=%C2%B4&=%60&=%C3%85&_w:1.5%3B&=%3B&@_w:1.25%3B&=&=&=&=%E2%82%AC&=&=&=&=&=%5E&=%C3%98&=%C3%86&_w:1.25%3B&=%3B&@_w:1.5%3B&=&=%3C&=&=&=&=&=&=%C2%B5&=&=&=&=%3B&@=&=&=&=&_w:1.25%3B&=&_w:2%3B&=&_w:1.25%3B&=&_c=%2345b564&a:5%3B&=L5%0A%0A%0A%0A%0A%0AON&_c=%23bb45c4&a:7%3B&=&=&=%3B&@_y:0.25&c=%2345b564%3B&=Esc&=Q&=W&=E&=R&=T&=Y&=F1&=F2&=F3&=F4&_w:1.5%3B&=Alt%20Tab%3B&@_w:1.25%3B&=Tab&=A&=S&=D&=F&=G&=H&=F5&=F6&=F7&=F8&_w:1.25%3B&=Enter%3B&@_w:1.5%3B&=Shift&=1&=2&=3&=4&=5&=6&=F9&=F10&=F11&=%2F&uarr%2F%3B&_c=%23cccccc&a:5%3B&=L5%0A%0A%0A%0A%0A%0AOFF%3B&@_c=%2345b564&a:7%3B&=LCtrl&=Z&=X&=C&_w:1.25%3B&=B&_w:2%3B&=Space&_w:1.25%3B&=M&=V&=%2F&larr%2F%3B&=%2F&darr%2F%3B&=%2F&rarr%2F) + + +Chose to modify the layout to include dedicated arrows on the bottom right. Layers 1-4 are modifiers, layer 5 is a toggle on gaming mode. Tab is dual function: Tap for Tab and hold for L3. So is enter: tap for Enter and hold for Right shift. + +### Nordic characters +On its own modifier layer, accessed from left (between left GUI and ALT) or right (above Right arrow) + +### Gaming layer +Toggled on/off, accessed via the Nordic layer. + +Toggle on: <kbd>L4</kbd>+<kbd>RCtrl</kbd> + +Toggle off: <kbd>L4</kbd> (above <kbd>→</kbd>) + +### LED Controls + +Use <kbd>TAB</kbd>+<kbd>Z</kbd> to cycle through brightness (8 steps) + +Use <kbd>TAB</kbd>+<kbd>X</kbd> to cycle through the following LED modes: + +- solid +- breathing +- random +- rain +- reactive +- poptang +- off diff --git a/keyboards/40percentclub/ut47/keymaps/rgb/config.h b/keyboards/40percentclub/ut47/keymaps/rgb/config.h new file mode 100644 index 000000000..0eb010a3a --- /dev/null +++ b/keyboards/40percentclub/ut47/keymaps/rgb/config.h @@ -0,0 +1,27 @@ +/* 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 <http://www.gnu.org/licenses/>. + */ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +// place overrides here +#define RGBLIGHT_ANIMATIONS +#define RGB_DI_PIN D3 // The pin the LED strip is connected to +#define RGBLED_NUM 7 // Number of LEDs in your strip + +#endif diff --git a/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c b/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c new file mode 100644 index 000000000..58d11031a --- /dev/null +++ b/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c @@ -0,0 +1,88 @@ +/* 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 <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H +#ifdef LED_ENABLE + #include "protocol/serial.h" +#endif + +#define _______ KC_TRNS +#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( + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + LT3_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, MT_RSFT_ENT, + KC_LCTL, KC_LALT, KC_LGUI, KC_APP, MO(2), KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +LAYOUT( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DELETE, + _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, + _______, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, _______, + _______, _______, _______, KC_CAPS, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END +), + +LAYOUT( + KC_FN6, KC_FN7, KC_FN8, KC_FN9, KC_FN10, KC_FN11, KC_FN12, KC_FN13, KC_FN14, KC_FN15, KC_FN16, KC_DELETE, + _______, _______, _______, _______, _______, _______, _______, KC_FN17, KC_FN18, KC_FN19, KC_FN20, KC_FN21, + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, + _______, _______, _______, KC_CAPS, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END +), + +LAYOUT( /* Tab */ + KC_ESC, KC_CALC, KC_WHOM, KC_MAIL, KC_MYCM, _______, _______, _______, _______, _______, KC_PSCR, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R +), +}; + +//LED keymap functions + #ifdef LED_ENABLE +void led_chmode(void) { + serial_send(101); +} + +void led_toggle(void) { + serial_send(100); +} + +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/readme.md b/keyboards/40percentclub/ut47/keymaps/rgb/readme.md new file mode 100644 index 000000000..00076bfc4 --- /dev/null +++ b/keyboards/40percentclub/ut47/keymaps/rgb/readme.md @@ -0,0 +1 @@ +WS2812B LED added and connected to pin D3 as described here: https://www.40percent.club/2018/04/gnap-underglow.html diff --git a/keyboards/40percentclub/ut47/keymaps/rgb/rules.mk b/keyboards/40percentclub/ut47/keymaps/rgb/rules.mk new file mode 100644 index 000000000..1e3cebb14 --- /dev/null +++ b/keyboards/40percentclub/ut47/keymaps/rgb/rules.mk @@ -0,0 +1 @@ +RGBLIGHT_ENABLE = yes diff --git a/keyboards/40percentclub/ut47/led.c b/keyboards/40percentclub/ut47/led.c new file mode 100644 index 000000000..9458c038f --- /dev/null +++ b/keyboards/40percentclub/ut47/led.c @@ -0,0 +1,38 @@ +/* +Copyright 2012 Jun Wako <wakojun@gmail.com> + +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 <http://www.gnu.org/licenses/>. +*/ + +#include <avr/io.h> +#include "stdint.h" +#include "led.h" + + +void led_set(uint8_t usb_led) +{ + if (usb_led & (1<<USB_LED_CAPS_LOCK)) { + // output low + DDRB |= (1<<0); + PORTB &= ~(1<<0); + DDRD |= (1<<5); + PORTD &= ~(1<<5); + } else { + // Hi-Z + DDRB &= ~(1<<0); + PORTB &= ~(1<<0); + DDRD &= ~(1<<5); + PORTD &= ~(1<<5); + } +} diff --git a/keyboards/40percentclub/ut47/matrix.c b/keyboards/40percentclub/ut47/matrix.c new file mode 100644 index 000000000..921bc9ed5 --- /dev/null +++ b/keyboards/40percentclub/ut47/matrix.c @@ -0,0 +1,213 @@ +/* +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 <http://www.gnu.org/licenses/>. +*/ + +/* + * scan matrix + */ +#include <stdint.h> +#include <stdbool.h> +#include <avr/io.h> +#include <util/delay.h> +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#ifdef LED_ENABLE + #include "protocol/serial.h" +#endif + + +#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; + } + +#ifdef LED_ENABLE + serial_init(); +#endif +} + +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) { + debug("bounce!: "); debug_hex(debouncing); debug("\n"); + } + 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; +} + +bool matrix_is_modified(void) +{ + if (debouncing) return false; + return true; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1<<col)); +} + +inline +matrix_row_t matrix_get_row(uint8_t row) +{ + return matrix[row]; +} + +void matrix_print(void) +{ + print("\nr/c 0123456789ABCDEF\n"); + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + phex(row); print(": "); + pbin_reverse16(matrix_get_row(row)); + print("\n"); + } +} + +uint8_t matrix_key_count(void) +{ + uint8_t count = 0; + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + count += bitpop16(matrix[i]); + } + return count; +} + +/* Column pin configuration + * col: 0 1 2 3 4 5 6 7 8 9 10 11 + * pin: D7 E6 B4 B5 B6 B2 B3 B1 F7 F6 F5 F4 + */ + +static void init_cols(void) +{ + // Input with pull-up(DDR:0, PORT:1) + DDRF &= ~(1<<4 | 1<<5 | 1<<6 | 1<<7); + PORTF |= (1<<4 | 1<<5 | 1<<6 | 1<<7); + DDRE &= ~(1<<6); + PORTE |= (1<<6); + DDRD &= ~(1<<7); + PORTD |= (1<<7); + DDRB &= ~(1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6); + PORTB |= (1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6); +} + +static matrix_row_t read_cols(void) +{ + return (PIND&(1<<7) ? 0 : (1<<0)) | + (PINE&(1<<6) ? 0 : (1<<1)) | + (PINB&(1<<4) ? 0 : (1<<2)) | + (PINB&(1<<5) ? 0 : (1<<3)) | + (PINB&(1<<6) ? 0 : (1<<4)) | + (PINB&(1<<2) ? 0 : (1<<5)) | + (PINB&(1<<3) ? 0 : (1<<6)) | + (PINB&(1<<1) ? 0 : (1<<7)) | + (PINF&(1<<7) ? 0 : (1<<8)) | + (PINF&(1<<6) ? 0 : (1<<9)) | + (PINF&(1<<5) ? 0 : (1<<10)) | + (PINF&(1<<4) ? 0 : (1<<11)); +} + +/* Row pin configuration + * row: 0 1 2 3 + * pin: D1 D0 D4 C6 + */ + +static void unselect_rows(void) +{ + // Hi-Z(DDR:0, PORT:0) to unselect + DDRD &= ~0b00010011; + PORTD &= ~0b00010011; + DDRC &= ~0b01000000; + PORTC &= ~0b01000000; +} + +static void select_row(uint8_t row) +{ + // Output low(DDR:1, PORT:0) to select + switch (row) { + case 0: + DDRD |= (1<<1); + PORTD &= ~(1<<1); + break; + case 1: + DDRD |= (1<<0); + PORTD &= ~(1<<0); + break; + case 2: + DDRD |= (1<<4); + PORTD &= ~(1<<4); + break; + case 3: + DDRC |= (1<<6); + PORTC &= ~(1<<6); + break; + } +} diff --git a/keyboards/40percentclub/ut47/readme.md b/keyboards/40percentclub/ut47/readme.md new file mode 100644 index 000000000..bbae1384a --- /dev/null +++ b/keyboards/40percentclub/ut47/readme.md @@ -0,0 +1,40 @@ +# ut47 + +![ut47](https://i.imgur.com/ZDKZQaj.jpg) +=== + +Somewhere between ortholinear and standard offset. Created to have all the same functions on a Planck in a keyboard but with a more conventional keyboard row stagger. + +Keyboard Maintainer: [filoxo](https://github.com/filoxo), [network_operations] +Hardware Supported: [PCB design](http://www.40percent.club/2016/10/gnap-20-plateless.html), Arduino Pro Micro +Hardware Availability: [How to order](http://www.40percent.club/2017/03/ordering-pcb.html) + +### Instructions + +To flash the UT47 without LEDs (single controller), run: + + make 40percentclub/ut47:default + +To enable the UT47 LEDs (dual controller), run this for the main controller: + + make 40percentclub/ut47:default LED_ENABLE=yes + +Or you can add `LED_ENABLE = yes` to *rules.mk* + +And then flash [LED_controls.ino](LED_controls.ino) to the second controller using [Arduino IDE](https://www.arduino.cc/en/Main/Software) or similar. NOTE: Arduino IDE will require importing additional libraries to compile. + +<small>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).</small> + +### Layout + +Go to the [default layout README](keymaps/default/readme.md) for more information. + +### Additional info + +Credit: Forked from [di0ib TMK version](https://github.com/di0ib/tmk_keyboard/tree/master/keyboard/gnap) + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. + +### Build Guide + +[u/network_operations' build guide thread](https://www.reddit.com/r/MechanicalKeyboards/comments/7wqktu/gnap_the_cheap_40/) diff --git a/keyboards/40percentclub/ut47/rules.mk b/keyboards/40percentclub/ut47/rules.mk new file mode 100644 index 000000000..b04659866 --- /dev/null +++ b/keyboards/40percentclub/ut47/rules.mk @@ -0,0 +1,70 @@ +# MCU name +#MCU = at90usb1286 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + +# Bootloader +BOOTLOADER = caterina + +# custom matrix setup +CUSTOM_MATRIX = yes +SRC += matrix.c protocol/serial_uart.c + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches + +ifeq ($(strip $(LED_ENABLE)), yes) + OPT_DEFS += -DLED_ENABLE + SRC += led.c +endif diff --git a/keyboards/40percentclub/ut47/ut47.c b/keyboards/40percentclub/ut47/ut47.c new file mode 100644 index 000000000..f467fd130 --- /dev/null +++ b/keyboards/40percentclub/ut47/ut47.c @@ -0,0 +1,50 @@ +/* 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 <http://www.gnu.org/licenses/>. + */ +#include "ut47.h" +#ifdef LED_ENABLE + #include "protocol/serial.h" +#endif + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + + matrix_scan_user(); +} + +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 + serial_send((record->event.key.row*16)+record->event.key.col); + #endif + } + return process_record_user(keycode, record); +} + +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + + led_set_user(usb_led); +} diff --git a/keyboards/40percentclub/ut47/ut47.h b/keyboards/40percentclub/ut47/ut47.h new file mode 100644 index 000000000..a4507dd34 --- /dev/null +++ b/keyboards/40percentclub/ut47/ut47.h @@ -0,0 +1,49 @@ +/* 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 <http://www.gnu.org/licenses/>. + */ +#ifndef UT47_H +#define UT47_H + +#include "quantum.h" + +#define LAYOUT( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0a, K0b, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1a, K1b, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2a, K2b, \ + K30, K31, K32, K33, K34, K35, K37, K38, K39, K3a, K3b \ +) \ + { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0a, K0b }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1a, K1b }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2a, K2b }, \ + { K30, K31, K32, K33, K34, K35, K35, K37, K38, K39, K3a, K3b } \ + } + +#define LAYOUT_kc( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0a, K0b, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1a, K1b, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2a, K2b, \ + K30, K31, K32, K33, K34, K35, K37, K38, K39, K3a, K3b \ +) \ + LAYOUT( \ + KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0a, KC_##K0b, \ + KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1a, KC_##K1b, \ + KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2a, KC_##K2b, \ + KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K37, KC_##K38, KC_##K39, KC_##K3a, KC_##K3b \ + ) + +#define LAYOUT_kc_ut47 LAYOUT_kc + +#endif |