From b1e01e9d1ffcc6ca0803f30c09d3eebe6a90186b Mon Sep 17 00:00:00 2001 From: Geoff Lane Date: Sat, 10 Jun 2017 21:04:16 -0400 Subject: [PATCH] Support Sentraq S65-X Add initial support for ANSI layout of S65-X. Includes support for controlling RGB underlighting. --- keyboards/s65_x/Makefile | 3 + keyboards/s65_x/config.h | 55 ++++++ keyboards/s65_x/keymaps/default/keymap.c | 222 ++++++++++++++++++++++ keyboards/s65_x/keymaps/default/readme.md | 27 +++ keyboards/s65_x/readme.md | 82 ++++++++ keyboards/s65_x/rules.mk | 67 +++++++ keyboards/s65_x/s65_x.c | 30 +++ keyboards/s65_x/s65_x.h | 25 +++ 8 files changed, 511 insertions(+) create mode 100644 keyboards/s65_x/Makefile create mode 100644 keyboards/s65_x/config.h create mode 100644 keyboards/s65_x/keymaps/default/keymap.c create mode 100644 keyboards/s65_x/keymaps/default/readme.md create mode 100644 keyboards/s65_x/readme.md create mode 100644 keyboards/s65_x/rules.mk create mode 100644 keyboards/s65_x/s65_x.c create mode 100644 keyboards/s65_x/s65_x.h diff --git a/keyboards/s65_x/Makefile b/keyboards/s65_x/Makefile new file mode 100644 index 000000000..57b2ef62e --- /dev/null +++ b/keyboards/s65_x/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../Makefile +endif diff --git a/keyboards/s65_x/config.h b/keyboards/s65_x/config.h new file mode 100644 index 000000000..0af9f6dd1 --- /dev/null +++ b/keyboards/s65_x/config.h @@ -0,0 +1,55 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define PRODUCT S65-X-RGB +#define DESCRIPTION q.m.k. keyboard firmware for S60-X RGB +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6060 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Sentraq + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 18 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { C7, C6, B6, B5, B4 } +#define MATRIX_COL_PINS { F6, F5, F4, F1, F0, E6, B0, B1, D5, B2, B3, D0, D1, D2, D4, D6, D7, F7 } +#define UNUSED_PINS + +/* number of backlight levels */ +#define BACKLIGHT_PIN B7 +#define BACKLIGHT_LEVELS 3 + +#define RGB_DI_PIN D3 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 20 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* 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 command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + + +/* prevent stuck modifiers */ +#define PREVENT_STUCK_MODIFIERS + +#endif diff --git a/keyboards/s65_x/keymaps/default/keymap.c b/keyboards/s65_x/keymaps/default/keymap.c new file mode 100644 index 000000000..c0737c11b --- /dev/null +++ b/keyboards/s65_x/keymaps/default/keymap.c @@ -0,0 +1,222 @@ +#include "s65_x.h" +#include "action_layer.h" + +#define _BL 0 +#define _AL 1 +#define _FL 2 +#define _UL 3 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* 0: Main layer, swapped alt and GUI for Mac + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ ESC │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │▒▒▒▒▒│BKSPC│DEL │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ TAB │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │█████│END │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │CAPSL│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │▒▒▒▒▒│ENTER│█████│PG_UP│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │LSHFT│▒▒▒▒▒│ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │▒▒▒▒▒│RSHFT│ UP │PG_DN│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │LCTRL│L_ALT│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ FN0 │ APP │LEFT │DOWN │RIGHT│ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + /* 0: ANSI qwerty */ + [_BL] = ANSI_KEYMAP( + F(3), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_END, \ + F(2), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, \ + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, MO(_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT), + + + /* 1: Locking arrow keys to WASD for when you need dedicated arrow keys + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│▒▒▒▒▒│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ Up │ │ │ │ │ │ │ │ │ │ │ │█████│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │Left │Down │Right│ │ │ │ │ │ │ │ │▒▒▒▒▒│ │█████│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │▒▒▒▒▒│ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │█████│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │ │ │ │ │ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + [_AL] = ANSI_KEYMAP( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + /* 2: Fn layer + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │GRAVE│ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │▒▒▒▒▒│▒▒▒▒▒│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ _AL │ Up │ │ │ │ │ │PGUP │PGDWN│PRTSC│SCLCK│PAUSE│ │█████│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │Left │Down │Right│ │ │Left │Down │ Up │Right│ │ │▒▒▒▒▒│ │█████│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │▒▒▒▒▒│_UL │ │ │ │ │ │ │Home │ End │ │▒▒▒▒▒│Vol+ │█████│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │Mute │Vol- │Play │ │ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + [_FL] = ANSI_KEYMAP( + KC_GRAVE, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS, \ + KC_TRNS, F(1), KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, F(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_END, KC_TRNS, KC_TRNS, KC_VOLU, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_MPLY, KC_TRNS), + + /* 3: Locking layer for controlling the underglow + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│▒▒▒▒▒│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │█████│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ On │Mode │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │█████│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │▒▒▒▒▒│ │Hue+ │Hue- │Sat+ │Sat- │Val+ │Val- │ │ │ │▒▒▒▒▒│ │█████│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │ │ │ │ │ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + [_UL] = ANSI_KEYMAP( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, F(4), F(5), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, F(6), F(7), F(8), F(9), F(10), F(11), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), +}; + +enum function_id { + RGBLED_TOGGLE, + RGBLED_STEP_MODE, + RGBLED_INCREASE_HUE, + RGBLED_DECREASE_HUE, + RGBLED_INCREASE_SAT, + RGBLED_DECREASE_SAT, + RGBLED_INCREASE_VAL, + RGBLED_DECREASE_VAL, + SHIFT_ESC, +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_MOMENTARY(_FL), // Momentary Fn overlay + [1] = ACTION_LAYER_TOGGLE(_AL), // Toggle Arrow Layer overlay + [2] = ACTION_LAYER_TAP_KEY(_FL, KC_CAPS),// Tap to toggle caps lock and hold to activate function layer + [3] = ACTION_LAYER_TOGGLE(_UL), // Toggle Underglow Layer overlay + [4] = ACTION_FUNCTION(RGBLED_TOGGLE), // Turn on/off underglow + [5] = ACTION_FUNCTION(RGBLED_STEP_MODE), // Change underglow mode + [6] = ACTION_FUNCTION(RGBLED_INCREASE_HUE), + [7] = ACTION_FUNCTION(RGBLED_DECREASE_HUE), + [8] = ACTION_FUNCTION(RGBLED_INCREASE_SAT), + [9] = ACTION_FUNCTION(RGBLED_DECREASE_SAT), + [10] = ACTION_FUNCTION(RGBLED_INCREASE_VAL), + [11] = ACTION_FUNCTION(RGBLED_DECREASE_VAL), + [12] = ACTION_FUNCTION(SHIFT_ESC), +}; + +void matrix_scan_user(void) { + + /* uint32_t layer = layer_state; */ + /* if (layer & (1<<1)) { */ + /* gh60_wasd_leds_on(); */ + /* } else { */ + /* gh60_wasd_leds_off(); */ + /* } */ + /* */ + /* if (layer & (1<<2)) { */ + /* gh60_esc_led_on(); */ + /* } else { */ + /* gh60_esc_led_off(); */ + /* } */ +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + +#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + switch (id) { + case RGBLED_TOGGLE: + //led operations + if (record->event.pressed) { + rgblight_toggle(); + } + break; + case RGBLED_INCREASE_HUE: + if (record->event.pressed) { + rgblight_increase_hue(); + } + break; + case RGBLED_DECREASE_HUE: + if (record->event.pressed) { + rgblight_decrease_hue(); + } + break; + case RGBLED_INCREASE_SAT: + if (record->event.pressed) { + rgblight_increase_sat(); + } + break; + case RGBLED_DECREASE_SAT: + if (record->event.pressed) { + rgblight_decrease_sat(); + } + break; + case RGBLED_INCREASE_VAL: + if (record->event.pressed) { + rgblight_increase_val(); + } + break; + case RGBLED_DECREASE_VAL: + if (record->event.pressed) { + rgblight_decrease_val(); + } + break; + case RGBLED_STEP_MODE: + if (record->event.pressed) { + rgblight_step(); + } + break; + static uint8_t shift_esc_shift_mask; + // Shift + ESC = ~ + case SHIFT_ESC: + shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; + if (record->event.pressed) { + if (shift_esc_shift_mask) { + add_key(KC_GRV); + send_keyboard_report(); + } else { + add_key(KC_ESC); + send_keyboard_report(); + } + } else { + if (shift_esc_shift_mask) { + del_key(KC_GRV); + send_keyboard_report(); + } else { + del_key(KC_ESC); + send_keyboard_report(); + } + } + break; + } +}; diff --git a/keyboards/s65_x/keymaps/default/readme.md b/keyboards/s65_x/keymaps/default/readme.md new file mode 100644 index 000000000..c180ffdf9 --- /dev/null +++ b/keyboards/s65_x/keymaps/default/readme.md @@ -0,0 +1,27 @@ +### 1 ANSI +A Mac ANSI layout that assumes standard sized shifts, enter, and backspace keys. + +#### 1.0 Default layer + ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + │ ESC │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │▒▒▒▒▒│BKSPC│DEL │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ TAB │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │█████│END │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │CAPSL│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │▒▒▒▒▒│ENTER│█████│PG_UP│ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │LSHFT│▒▒▒▒▒│ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │▒▒▒▒▒│RSHFT│ UP │PG_DN│ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │LCTRL│L_ALT│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ FN0 │ APP │LEFT │DOWN │RIGHT│ + └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ +#### 1.1 Fn layer + ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + │GRAVE│ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │▒▒▒▒▒│▒▒▒▒▒│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │ _AL │ Up │ │ │ │ │ │PGUP │PGDWN│PRTSC│SCLCK│PAUSE│ │█████│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │Left │Down │Right│ │ │Left │Down │ Up │Right│ │ │▒▒▒▒▒│ │█████│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │▒▒▒▒▒│_UL │ │ │ │ │ │ │Home │ End │ │▒▒▒▒▒│Vol+ │█████│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │Mute │Vol- │Play │ │ + └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ diff --git a/keyboards/s65_x/readme.md b/keyboards/s65_x/readme.md new file mode 100644 index 000000000..e086a2056 --- /dev/null +++ b/keyboards/s65_x/readme.md @@ -0,0 +1,82 @@ +S65-x keyboard firmware +====================== +DIY 65% keyboard from Sentraq. + +## S65X Resources +- [Sentraq page](https://sentraq.com/collections/group-buys/products/gb-s65-x-rgb-diy-kit?variant=39246723914) + +## Flashing your keyboard +The recommended programs for flashing your keyboard are [Atmel FLIP](http://www.atmel.com/tools/FLIP.aspx) (Windows) and [dfu-programmer](http://dfu-programmer.sourceforge.net/) (Linux/Windows). + +[QMK Firmware Flasher](https://github.com/qmk/qmk_firmware_flasher/releases) may work, as the S65-X keyboard uses the ATMega32U4 microcontroller, but it is untested. Use at your own risk. + +**Programming the firmware (Windows)** + +1. download and install FLIP (http://www.atmel.com/tools/FLIP.aspx) +2. connect the keyboard, press the program button on the underside of the board (S1) and wait until it enumerates (you'll hear the "disconnect" and "connect" sound) +3. go to device manager, find the atmega32u4 chip and click "update driver" +4. choose location manually: folder named "usb" inside the installation directory of FLIP +5. once the driver is installed, run flip +6. Device -> Select: choose ATMega32U4 +7. Settings -> Communication -> USB, FLIP should show the signature at this point (58 1E 95 87) +8. File -> Load HEX file: choose the hex firmware: .hex +9. click "Run" +10. after programming is done, disconnect the device from USB and connect again. + + +**Programming the firmware (Linux/Mac)** + +1. Download and install/compile/unpack dfu-programmer from http://dfu-programmer.sourceforge.net/. +2. Issue the following commands in the command prompt after connecting the device and pressing the programming button (S1). You may need root permissions or udev rules to do that. + 1. `sudo dfu-programmer atmega32u4 erase` + 2. `sudo dfu-programmer atmega32u4 flash .hex` + 3. `sudo dfu-programmer atmega32u4 start` +3. The keyboard should start working. If it doesn't, reconnect the cable. + +## Building the firmware + +To build the firmware binary hex file with a keymap just do `make` with a keymap like this: + + $ make default + +For a more detailed explanation of the build process and the environment setup, see the ["Getting Started" section](/readme.md#getting-started). + +## Keymaps + +Currently only an ANSI keymap is provided, hopefully others will contribute theirs. + +### 0 Initial explanations +The █████ blocks on the layouts hides the switch positions that do not exist physically on the PCB. If you feel like hacking the keyboard and adding new keys, those are the positions that can be used. You'll have to modify the [keymap_common.h](keymap_common.h) file for that. + +The ▒▒▒▒▒ blocks hides switch positions not used on this particular layout, but they do exist on the PCB. + +There is no LED support on the PCB at the moment, but I'll let the code for that untouched. + + +### 1 [Standard - ANSI (default layout)](keymaps/default/keymap.c) + +#### 1.0 Default layer + ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + │ ESC │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │▒▒▒▒▒│BKSPC│DEL │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ TAB │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │█████│END │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │CAPSL│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │▒▒▒▒▒│ENTER│█████│PG_UP│ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │LSHFT│▒▒▒▒▒│ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │▒▒▒▒▒│RSHFT│ UP │PG_DN│ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │LCTRL│L_ALT│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ FN0 │ APP │LEFT │DOWN │RIGHT│ + └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ +#### 1.1 Fn layer + ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + │GRAVE│ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │▒▒▒▒▒│▒▒▒▒▒│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │ _AL │ Up │ │ │ │ │ │PGUP │PGDWN│PRTSC│SCLCK│PAUSE│ │█████│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │Left │Down │Right│ │ │Left │Down │ Up │Right│ │ │▒▒▒▒▒│ │█████│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │▒▒▒▒▒│_UL │ │ │ │ │ │ │Home │ End │ │▒▒▒▒▒│Vol+ │█████│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │Mute │Vol- │Play │ │ + └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + diff --git a/keyboards/s65_x/rules.mk b/keyboards/s65_x/rules.mk new file mode 100644 index 000000000..9d8b559af --- /dev/null +++ b/keyboards/s65_x/rules.mk @@ -0,0 +1,67 @@ + + +# MCU name +#MCU = at90usb1287 +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 + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend +MIDI_ENABLE ?= no # MIDI controls +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE ?= no # Audio output on port C6 +NKRO_ENABLE ?= yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE ?= yes # Enable keyboard backlight functionality +RGBLIGHT_ENABLE ?= yes # Enable RGB light diff --git a/keyboards/s65_x/s65_x.c b/keyboards/s65_x/s65_x.c new file mode 100644 index 000000000..f3f8ffbc8 --- /dev/null +++ b/keyboards/s65_x/s65_x.c @@ -0,0 +1,30 @@ +#include "s65_x.h" +#include "led.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + matrix_init_user(); + led_init_ports(); +}; + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + matrix_scan_user(); +}; + +void led_init_ports(void) { + // * Set our LED pins as output + DDRB |= (1<<7); +} + +void led_set_kb(uint8_t usb_led) { + if (usb_led & (1<