From b16bfac1077f1f88b4d0c0e062e085f0e380885b Mon Sep 17 00:00:00 2001 From: Conor Burns Date: Fri, 5 Mar 2021 23:22:42 +0100 Subject: added 0xCB/1337 keyboard (#12089) Co-authored-by: Drashna Jaelre Co-authored-by: Joel Challis --- keyboards/0xcb/1337/1337.c | 34 +++++ keyboards/0xcb/1337/1337.h | 38 ++++++ keyboards/0xcb/1337/config.h | 70 ++++++++++ keyboards/0xcb/1337/info.json | 22 ++++ keyboards/0xcb/1337/keymaps/default/keymap.c | 189 +++++++++++++++++++++++++++ keyboards/0xcb/1337/keymaps/via/keymap.c | 189 +++++++++++++++++++++++++++ keyboards/0xcb/1337/keymaps/via/rules.mk | 1 + keyboards/0xcb/1337/readme.md | 25 ++++ keyboards/0xcb/1337/rules.mk | 27 ++++ 9 files changed, 595 insertions(+) create mode 100644 keyboards/0xcb/1337/1337.c create mode 100644 keyboards/0xcb/1337/1337.h create mode 100644 keyboards/0xcb/1337/config.h create mode 100644 keyboards/0xcb/1337/info.json create mode 100644 keyboards/0xcb/1337/keymaps/default/keymap.c create mode 100644 keyboards/0xcb/1337/keymaps/via/keymap.c create mode 100644 keyboards/0xcb/1337/keymaps/via/rules.mk create mode 100644 keyboards/0xcb/1337/readme.md create mode 100644 keyboards/0xcb/1337/rules.mk (limited to 'keyboards/0xcb/1337') diff --git a/keyboards/0xcb/1337/1337.c b/keyboards/0xcb/1337/1337.c new file mode 100644 index 0000000000..142c24639a --- /dev/null +++ b/keyboards/0xcb/1337/1337.c @@ -0,0 +1,34 @@ +/* +Copyright 2021 0xCB - Conor Burns + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include "1337.h" + +void eeconfig_init_kb(void) { +#ifdef BACKLIGHT_ENABLE + backlight_enable(); + backlight_level(5); +#endif +#ifdef RGBLIGHT_ENABLE + rgblight_enable(); + rgblight_sethsv(0, 255, 255); +#ifdef RGBLIGHT_ANIMATIONS + rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL + 2); +#endif +#endif + + eeconfig_update_kb(0); + eeconfig_init_user(); +} diff --git a/keyboards/0xcb/1337/1337.h b/keyboards/0xcb/1337/1337.h new file mode 100644 index 0000000000..7de5365d8b --- /dev/null +++ b/keyboards/0xcb/1337/1337.h @@ -0,0 +1,38 @@ +/* +Copyright 2021 0xCB - Conor Burns + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#pragma once + +#include "quantum.h" + +/* This a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ + #define LAYOUT( \ + KA1, KA2, KA3, \ + KB1, KB2, KB3, \ + KC1, KC2, KC3 \ + ) \ + { \ + { KA1, KA2, KA3 }, \ + { KB1, KB2, KB3 }, \ + { KC1, KC2, KC3 } \ + } diff --git a/keyboards/0xcb/1337/config.h b/keyboards/0xcb/1337/config.h new file mode 100644 index 0000000000..25b1eadd91 --- /dev/null +++ b/keyboards/0xcb/1337/config.h @@ -0,0 +1,70 @@ +/* +Copyright 2021 0xCB - Conor Burns + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xCB00 +#define PRODUCT_ID 0x1337 +#define DEVICE_VER 0x0001 +#define MANUFACTURER 0xCB +#define PRODUCT 1337 + +/* key matrix size */ +#define MATRIX_ROWS 3 +#define MATRIX_COLS 3 + +/* Keyboard Matrix Assignments */ +#define DIRECT_PINS { \ + { D2, D4, F4 }, \ + { D7, B1, B3 }, \ + { E6, B4, B2 } \ +} +#define TAP_CODE_DELAY 10 +#define ENCODER_RESOLUTION 4 +#define ENCODERS_PAD_A { F5 } +#define ENCODERS_PAD_B { F6 } + +#define BACKLIGHT_PIN B5 +// #define BACKLIGHT_BREATHING +#define BACKLIGHT_LEVELS 7 + +#define RGB_DI_PIN D3 +#ifdef RGB_DI_PIN + #define RGBLED_NUM 5 + #define RGBLIGHT_HUE_STEP 8 + #define RGBLIGHT_SAT_STEP 8 + #define RGBLIGHT_VAL_STEP 8 + #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ + #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ + /*== all animations enable ==*/ + #define RGBLIGHT_ANIMATIONS +#endif + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 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 +/* Oled Size */ +#define OLED_DISPLAY_128X64 + +/* QMK DFU */ +#define QMK_LED B0 diff --git a/keyboards/0xcb/1337/info.json b/keyboards/0xcb/1337/info.json new file mode 100644 index 0000000000..67cb9d0d63 --- /dev/null +++ b/keyboards/0xcb/1337/info.json @@ -0,0 +1,22 @@ +{ + "keyboard_name": "0xCB 1337", + "url": "https://0xCB.dev", + "maintainer": "Conor-Burns", + "width": 3, + "height": 3, + "layouts": { + "LAYOUT": { + "layout": [ + {"x":0, "y":0}, + {"x":1, "y":0}, + {"x":2, "y":0}, + {"x":0, "y":1}, + {"x":1, "y":1}, + {"x":2, "y":1}, + {"x":0, "y":2}, + {"x":1, "y":2}, + {"x":2, "y":2} + ] + } + } +} diff --git a/keyboards/0xcb/1337/keymaps/default/keymap.c b/keyboards/0xcb/1337/keymaps/default/keymap.c new file mode 100644 index 0000000000..c711bdae90 --- /dev/null +++ b/keyboards/0xcb/1337/keymaps/default/keymap.c @@ -0,0 +1,189 @@ +/* +Copyright 2021 0xCB - Conor Burns + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include QMK_KEYBOARD_H + +enum layer_names { + _HOME, + _MISC, + _RGB, + _BLED +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[_HOME] = LAYOUT( + KC_MPRV, KC_MNXT, KC_MPLY, + KC_PGUP, KC_PGDN, TO(3), + KC_HOME, KC_END, TO(1) +), +[_MISC] = LAYOUT( + _______, _______, _______, + _______, _______, TO(0), + _______, _______, TO(2) +), +[_RGB] = LAYOUT( + RGB_HUI, RGB_HUD, RGB_MOD, + RGB_SAI, RGB_SAD, TO(1), + RGB_SPI, RGB_SPD, TO(3) +), +[_BLED] = LAYOUT( + BL_STEP, BL_BRTG, BL_TOGG, + BL_ON, BL_OFF, TO(2), + BL_INC, BL_DEC, TO(0) +) +}; + + +/* rotary encoder (SW3) - add more else if blocks for more granular layer control */ +#ifdef ENCODER_ENABLE +void encoder_update_user(uint8_t index, bool clockwise) { + if (IS_LAYER_ON(_RGB)) { + if (clockwise) { + rgblight_increase_val(); + } else { + rgblight_decrease_val(); + } + } else if (IS_LAYER_ON(_BLED)) { + if (clockwise) { + backlight_increase(); + } else { + backlight_decrease(); + } + } else { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } +} +#endif + +/* oled stuff :) */ +#ifdef OLED_DRIVER_ENABLE +uint16_t startup_timer; + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + startup_timer = timer_read(); + return rotation; +} + +static void render_logo(void) { + static const char PROGMEM logo[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x02, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, + 0xf8, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0x70, 0x78, + 0x38, 0x3f, 0x1c, 0x0e, 0x0e, 0x0e, 0xfe, 0x0e, 0x0e, 0x1e, 0x1c, 0x3f, 0x38, 0x78, 0x70, 0xe0, + 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0xf8, 0x05, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xa0, + 0x13, 0xa2, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xfc, + 0xfe, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x3c, 0x3c, 0x00, 0x00, + 0x01, 0xff, 0xff, 0xff, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0xa2, 0x13, 0xa0, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0xc0, 0x40, 0x40, 0xc0, 0x80, 0x00, 0x00, 0xc0, 0x40, 0x40, 0xc0, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0xc0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x40, 0x40, 0xc0, 0x80, 0x00, 0x00, 0x80, 0xc0, 0x40, + 0x40, 0xc0, 0x80, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xf9, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x7f, 0xff, 0xff, 0xc0, 0x80, 0x80, 0x0f, + 0x1f, 0x1f, 0x01, 0x01, 0x01, 0x01, 0xff, 0x00, 0x00, 0x00, 0x1e, 0x1e, 0x0e, 0x0e, 0x80, 0xc0, + 0xc0, 0xff, 0xff, 0x7f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xf9, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1f, 0x31, 0x40, 0x4e, 0x40, 0x31, 0x1f, 0x00, 0x00, 0x61, 0x16, 0x08, 0x16, 0x61, + 0x00, 0x00, 0x1f, 0x31, 0x60, 0x40, 0x40, 0x60, 0x20, 0x00, 0x00, 0x7f, 0x44, 0x44, 0x64, 0x3b, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x7f, + 0x40, 0x40, 0x00, 0x00, 0x00, 0x20, 0x64, 0x44, 0x44, 0x6e, 0x3b, 0x00, 0x00, 0x20, 0x64, 0x44, + 0x44, 0x6e, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x03, 0x01, 0x00, 0x00, 0x00, 0x08, 0x14, + 0x23, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x07, 0x07, + 0x0f, 0xfe, 0x1e, 0x1c, 0x1c, 0x1c, 0xff, 0x1c, 0x1c, 0x1c, 0x1e, 0xfe, 0x0f, 0x07, 0x03, 0x03, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0a, 0x11, 0x0a, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x1f, 0x00, 0x00, 0x10, 0x28, 0x47, 0x28, 0x10, 0x00, 0x00, 0x1f, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x28, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + oled_write_raw_P(logo, sizeof(logo)); +} +/* Shows the name of the current layer and locks for the host (CAPS etc.) */ +static void render_info(void) { + oled_write_P(PSTR("Layer: "), false); + + switch (get_highest_layer(layer_state)) { + case _HOME: + oled_write_ln_P(PSTR("HOME"), false); + break; + case _MISC: + oled_write_ln_P(PSTR("MISC"), false); + break; + case _RGB: + oled_write_ln_P(PSTR("RGB"), false); + break; + case _BLED: + oled_write_ln_P(PSTR("Backlight"), false); + break; + default: + oled_write_ln_P(PSTR("Undefined"), false); + } + led_t led_state = host_keyboard_led_state(); + oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); + oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); + oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); +} + +void oled_task_user(void) { + static bool finished_timer = false; + if ((timer_elapsed(startup_timer) < 3000) && !finished_timer) { + render_logo(); + } else { + finished_timer = true; + render_info(); + } +} +#endif diff --git a/keyboards/0xcb/1337/keymaps/via/keymap.c b/keyboards/0xcb/1337/keymaps/via/keymap.c new file mode 100644 index 0000000000..c711bdae90 --- /dev/null +++ b/keyboards/0xcb/1337/keymaps/via/keymap.c @@ -0,0 +1,189 @@ +/* +Copyright 2021 0xCB - Conor Burns + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include QMK_KEYBOARD_H + +enum layer_names { + _HOME, + _MISC, + _RGB, + _BLED +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[_HOME] = LAYOUT( + KC_MPRV, KC_MNXT, KC_MPLY, + KC_PGUP, KC_PGDN, TO(3), + KC_HOME, KC_END, TO(1) +), +[_MISC] = LAYOUT( + _______, _______, _______, + _______, _______, TO(0), + _______, _______, TO(2) +), +[_RGB] = LAYOUT( + RGB_HUI, RGB_HUD, RGB_MOD, + RGB_SAI, RGB_SAD, TO(1), + RGB_SPI, RGB_SPD, TO(3) +), +[_BLED] = LAYOUT( + BL_STEP, BL_BRTG, BL_TOGG, + BL_ON, BL_OFF, TO(2), + BL_INC, BL_DEC, TO(0) +) +}; + + +/* rotary encoder (SW3) - add more else if blocks for more granular layer control */ +#ifdef ENCODER_ENABLE +void encoder_update_user(uint8_t index, bool clockwise) { + if (IS_LAYER_ON(_RGB)) { + if (clockwise) { + rgblight_increase_val(); + } else { + rgblight_decrease_val(); + } + } else if (IS_LAYER_ON(_BLED)) { + if (clockwise) { + backlight_increase(); + } else { + backlight_decrease(); + } + } else { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } +} +#endif + +/* oled stuff :) */ +#ifdef OLED_DRIVER_ENABLE +uint16_t startup_timer; + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + startup_timer = timer_read(); + return rotation; +} + +static void render_logo(void) { + static const char PROGMEM logo[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x02, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, + 0xf8, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0x70, 0x78, + 0x38, 0x3f, 0x1c, 0x0e, 0x0e, 0x0e, 0xfe, 0x0e, 0x0e, 0x1e, 0x1c, 0x3f, 0x38, 0x78, 0x70, 0xe0, + 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0xf8, 0x05, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xa0, + 0x13, 0xa2, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xfc, + 0xfe, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x3c, 0x3c, 0x00, 0x00, + 0x01, 0xff, 0xff, 0xff, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0xa2, 0x13, 0xa0, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0xc0, 0x40, 0x40, 0xc0, 0x80, 0x00, 0x00, 0xc0, 0x40, 0x40, 0xc0, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0xc0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x40, 0x40, 0xc0, 0x80, 0x00, 0x00, 0x80, 0xc0, 0x40, + 0x40, 0xc0, 0x80, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xf9, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x7f, 0xff, 0xff, 0xc0, 0x80, 0x80, 0x0f, + 0x1f, 0x1f, 0x01, 0x01, 0x01, 0x01, 0xff, 0x00, 0x00, 0x00, 0x1e, 0x1e, 0x0e, 0x0e, 0x80, 0xc0, + 0xc0, 0xff, 0xff, 0x7f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xf9, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1f, 0x31, 0x40, 0x4e, 0x40, 0x31, 0x1f, 0x00, 0x00, 0x61, 0x16, 0x08, 0x16, 0x61, + 0x00, 0x00, 0x1f, 0x31, 0x60, 0x40, 0x40, 0x60, 0x20, 0x00, 0x00, 0x7f, 0x44, 0x44, 0x64, 0x3b, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x7f, + 0x40, 0x40, 0x00, 0x00, 0x00, 0x20, 0x64, 0x44, 0x44, 0x6e, 0x3b, 0x00, 0x00, 0x20, 0x64, 0x44, + 0x44, 0x6e, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x03, 0x01, 0x00, 0x00, 0x00, 0x08, 0x14, + 0x23, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x07, 0x07, + 0x0f, 0xfe, 0x1e, 0x1c, 0x1c, 0x1c, 0xff, 0x1c, 0x1c, 0x1c, 0x1e, 0xfe, 0x0f, 0x07, 0x03, 0x03, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0a, 0x11, 0x0a, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x1f, 0x00, 0x00, 0x10, 0x28, 0x47, 0x28, 0x10, 0x00, 0x00, 0x1f, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x28, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + oled_write_raw_P(logo, sizeof(logo)); +} +/* Shows the name of the current layer and locks for the host (CAPS etc.) */ +static void render_info(void) { + oled_write_P(PSTR("Layer: "), false); + + switch (get_highest_layer(layer_state)) { + case _HOME: + oled_write_ln_P(PSTR("HOME"), false); + break; + case _MISC: + oled_write_ln_P(PSTR("MISC"), false); + break; + case _RGB: + oled_write_ln_P(PSTR("RGB"), false); + break; + case _BLED: + oled_write_ln_P(PSTR("Backlight"), false); + break; + default: + oled_write_ln_P(PSTR("Undefined"), false); + } + led_t led_state = host_keyboard_led_state(); + oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); + oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); + oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); +} + +void oled_task_user(void) { + static bool finished_timer = false; + if ((timer_elapsed(startup_timer) < 3000) && !finished_timer) { + render_logo(); + } else { + finished_timer = true; + render_info(); + } +} +#endif diff --git a/keyboards/0xcb/1337/keymaps/via/rules.mk b/keyboards/0xcb/1337/keymaps/via/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/0xcb/1337/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/0xcb/1337/readme.md b/keyboards/0xcb/1337/readme.md new file mode 100644 index 0000000000..da54eb78fc --- /dev/null +++ b/keyboards/0xcb/1337/readme.md @@ -0,0 +1,25 @@ +# 0xCB 1337 + +Macro keypad + +* Keyboard Maintainer: [Conor Burns](https://github.com/conor-burns) +* Hardware Supported: https://github.com/conor-burns/0xcb-1337 +* Hardware Availability: Soon on tindie or order your own parts - the hardware in the repo is Open Source :D +* PCB renders :) + +![](https://github.com/Conor-Burns/0xcb-1337/blob/main/PCB/top.png) + +![](https://github.com/Conor-Burns/0xcb-1337/blob/main/PCB/bottom.png) + + +To go to bootloader press row 0 col 0 key (top left) while plugging in the board. + +Make example for this keyboard (after setting up your build environment): + + make 0xcb/1337:default + +Flashing example for this keyboard: + + make 0xcb/1337:default:flash + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/0xcb/1337/rules.mk b/keyboards/0xcb/1337/rules.mk new file mode 100644 index 0000000000..5469b415c2 --- /dev/null +++ b/keyboards/0xcb/1337/rules.mk @@ -0,0 +1,27 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = qmk-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # 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 = no # USB Nkey Rollover +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output + +ENCODER_ENABLE = yes +LTO_ENABLE = yes +OLED_DRIVER_ENABLE = yes -- cgit v1.2.3