Browse Source

Added userspace code for user bbaserdem

pull/14484/head^2
Batuhan Başerdem 2 years ago
parent
commit
bb9f95e72b
20 changed files with 2515 additions and 0 deletions
  1. +2
    -0
      users/bbaserdem/.gitignore
  2. +220
    -0
      users/bbaserdem/README.md
  3. +77
    -0
      users/bbaserdem/bb-audio.c
  4. +24
    -0
      users/bbaserdem/bb-audio.h
  5. +26
    -0
      users/bbaserdem/bb-backlight.c
  6. +19
    -0
      users/bbaserdem/bb-backlight.h
  7. +467
    -0
      users/bbaserdem/bb-encoder.c
  8. +35
    -0
      users/bbaserdem/bb-encoder.h
  9. +78
    -0
      users/bbaserdem/bb-keylight.c
  10. +27
    -0
      users/bbaserdem/bb-keylight.h
  11. +183
    -0
      users/bbaserdem/bb-macro.c
  12. +110
    -0
      users/bbaserdem/bb-macro.h
  13. +162
    -0
      users/bbaserdem/bb-oled.c
  14. +18
    -0
      users/bbaserdem/bb-oled.h
  15. +113
    -0
      users/bbaserdem/bb-underglow.c
  16. +24
    -0
      users/bbaserdem/bb-underglow.h
  17. +224
    -0
      users/bbaserdem/bbaserdem.c
  18. +484
    -0
      users/bbaserdem/bbaserdem.h
  19. +139
    -0
      users/bbaserdem/config.h
  20. +83
    -0
      users/bbaserdem/rules.mk

+ 2
- 0
users/bbaserdem/.gitignore View File

@ -0,0 +1,2 @@
/secrets.h
/secrets.c

+ 220
- 0
users/bbaserdem/README.md View File

@ -0,0 +1,220 @@
# BBASERDEM userspace code for qmk
My userspace code for my various keyboards; available here.
# Todo
- [X] Add OLED support
- [ ] Centralize color definitions for RGB
- [ ] Document all features more extensibly
- [ ] Generate json files to be used with Keyboard-Layout-Editor to produce images.
# Keyboards
A list of my code accross the QMK repo accessible here.
(I will sell my built-but-not-using ones.)
## Builds
These are my keyboard builds and info, it allows me to plan out my builds.
### Planck WORK
* Board: planck/rev6
* Switches: Zilent
* Case: Planck Hi-Pro Bottom Case: Glossy White
* Plate: Stainless steel with shiny finish (LaserBoost)
* Keycaps: Pudding PBT Doubleshot Keycap Set
* Artisan: B.O.B StoneuCarved Lotus Artisan Keycap
* Artisan: Teamwolf 304 Stainless Steel Transparent Metal Keycaps
I use this at the workplace to not bother coworkers; focus on silence.
### Planck HOME
* Board: planck/rev6
* Switches: Crystal BOX Navy
* Case: Planck Hi-Pro Bottom Case (MOD version): Matte Black
* Plate: Copper with shiny finish (LaserBoost)
* Keycaps: Buger TH01 XDA Dye-Subbed PBT
* Artisan: Sparkle Loft Reactor Artisan Keycap
I use this at home.
Has all the extra pinouts exposed to play arounh with.
### Planck SERVER
* Board: jj40
* Switches: BOX Navy
* Case: Clear Acrylic Top and Bottow, with Frosted Acrylic Diffuser (Smashing Acrylics)
* Keycaps: Datamancer Tall Deco Typewriter Keycaps
I'm using this while I'm in between boards; but very usable.
Long term plan is to use this for the server.
The case was initially designed for planck rev4;
I'm replaced the PCB since my rev4 one was derelict
due to repeated desolderings.
### Planck CARRY
* Board: planck/light
* Switches: Choc Low Jade
* Case: Stock Planck light case
* Keycaps: Blanck MKB
I carry this around; and is one of my favourite boards.
Found a better keycap profile for these as well.
### XD75RE
* Board: xd75
* Switches: Zealios 67g + Silencios
* Case: Npkc 60% Wooden Case (Rosewood)
* Keycaps: Massdrop x MITO XDA Godspeed
* Artisan: Hammer Fidget Spinner Artisan Keycap
* Artisan: Waffle Key Studio Rosette (Sunset)
My first work board; that is not seing any use due to being big.
### Gherkin PAD
* Board: 40percentclub/gherkin
* Case: Acrylic Case (Smashing Acrylics)
* Controller: Proton C
* Switches: Novelkeys Creams
* Keycaps: Random
The point of this is to act like a game/macro pad.
Other than that; i just use this for bragging points.
I have been planning on using my Proton C to turn into a MIDI controller.
### Let's Split Eh?
* Board: lets_split_eh/eh
* Case: Acrylic Case (Smashing Acrylics)
* Switches: Novelkeys BOX Royals
* Keycaps: G20 Semiotics
I built this; but then I realized that I really don't enjoy ortholinear split.
### Infinity Ergodox
* Board: ergodox_infinity
* Case: Datamancer Wooden case
* Switches: Kailh Speed Gold
* Keycaps: None
I don't like Infinity Ergodox.
Should sell this soon cause really not seeing myself ever using this.
Lucky me got the case for free due to (then) Massdrop shipping errors.
### Corne
* Board: [Proton-C Compatible crkbd PCB](https://github.com/ItsWaffIe/waffle_corne)
* Case: IMK Corne Case v2 Polycarbonate
* Switches: Healios V2
* Keycaps: POM Jelly
I'm planning on adding a trackpad for this, as detailed
[here](https://github.com/manna-harbour/crkbd/blob/master/trackpoint/readme.org).
### Corne Lite
* Board: crkbd/rev1
* Case: Custom
* Switches: Choc Low Burnt Orange
* Keycaps: [Scooped Choc Keycaps](https://mkultra.click/collections/keycaps/products/scooped-choc-keycaps?variant=31223543365730)
### Kyria
* Board: kyria/rev1
* Case: Matte Black Acrylic High-Profile case
* Switches: Gateron Ink Silent Black
* Keycaps: Oblotzky SA Oblivion
Want to add a joystick to this board for mouse control.
### Big Switch
* Board: bigseries/1key
* Case: WoodKeys (KNOWN SCAMMER: DO NOT RECOMMEND)
* Switches: Big Series Pale Blue
* Keycaps: Idea23
Got this before being scammed out of 200$ by Cole Markham: owner of WoodKeys;
The usb port got torn off; and could not fix it.
Expensive paperweight?
# Firmware building
## Archlinux
On archlinux, the package *arm-none-eabi-gcc* is too new.
To fix; add to the environment `CFLAGS="-Wno-error=deprecated"` to compilation commands.
Also; try to run `avr-gcc` version `8.4.0` for smaller firmware.
## Bootloader
If I want to flash a new bootloader for a machine; here are steps;
1. Flash the util/pro_micro_ISP_B6_10.hex to a spare promicro using;
`avrdude -p atmega32u4 -P "$(ls /dev/ttyACM*)" -c avr109 -D -U flash:w:pro_micro_ISP_B6_10.hex`
2. Wire the pins; (first is the ISP pro micro; second is the target)
```
Pro Micro 10 (B6) <-> Keyboard RESET
Pro Micro 15 (B1) <-> Keyboard B1 (SCLK)
Pro Micro 16 (B2) <-> Keyboard B2 (MOSI)
Pro Micro 14 (B3) <-> Keyboard B3 (MISO)
Pro Micro VCC <-> Keyboard VCC
Pro Micro GND <-> Keyboard GND
```
I do have this on hand I believe; from massdrop's planck light firmware updater.
3. Connect the flashed pro micro to my computer and run
`avrdude -c avrisp -P "$(ls /dev/ttyACM*)" -p atmega32u4 -U flash:w:bootloader_atmega32u4_1.0.0.hex:i -U lfuse:w:0x5E:m -U hfuse:w:0xD9:m -U efuse:w:0xC3:m`
The avrisp here refers to the firmware on the ISP flasher pro micro.
The `atmega32u4` refers to the CPU used in the respective breakout boards.
The `avrdude` command interacts with catalina bootloader.
The shell call after the `-P` flag auto finds the port that the pro micro connects to.
The last few arguments are some jumpers apparently.
# Features
My userspace has a lot of shared code between different keyboards.
These files are prefixed with `sbp-` to remove any naming clash.
* [bb-audio](bb-audio.c): Code dealing with audio playback using onboard sound.
Also contains stuff regarding using the devices as MIDI controllers. (WIP)
* [bb-backlight](bb-backlight.c): Controls global key single-channel LED stuff.
* [bb-keylight](bb-keylight.c): Controls per-key RGB LED matrix stuff.
* [bb-underglow](bb-underglow.c): Controls RGB underglow effects.
* [bb-process](bb-macro.c): My custom keycodes; macros, tap dances, etc.
* [bb-rotary](bb-rotary.c): Rotary encoder sutff
# Layout
![Corne layout](https://i.imgur.com/6VvQZ2I.png)
My personal layout is mostly inspired by the
[Miryoku layout](../manna-harbour_miryoku/miryoku.org).
There are some changes to make it friendlier to international keyboards.
My board is compatible with software implementation of Dvorak and Turkish F.
## Base
Base layer uses tap-hold functionality to have access to modifiers.
The modifiers are mirrored on each half of the layout;
as to make those modifiers accessible to the keys that overlap them.
Besides the Alt key; each side has the proper L/R version of the modifier.
Since Right Alt key functions as AltGr key;
both the L and R versions are available on each side.
# Shoutout
* To [drashna](../drashna/readme.md), for documenting how to use userspace features;
all my code is pretty much inspired from them.
* To [Manna Harbour](../manna-harbour_miryoku/README.org) for their
amazing keymap that inspired me to recreate mine and allowed me to move to
smaller split keyboards.
* To people who taught me C and have me enjoy working with it;
Dr. Mehmet Enis Oğuz and Dr. Veysi Erkcan Özcan.

+ 77
- 0
users/bbaserdem/bb-audio.c View File

@ -0,0 +1,77 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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 "bb-audio.h"
/* AUDIO
* This contains some audio related stuff.
* There is no need to wrap this up with preprocessor commands;
* This is only called if audio is enabled
*/
float tone_game_intro[][2] = GAME_ON_SONG;
float tone_game_outro[][2] = GAME_OFF_SONG;
// Audio playing when layer changes
uint32_t layer_state_set_audio(uint32_t state) {
// Get this layer
static bool prev_game = false;
// If entering the game layer; play the intro sound
if (layer_state_cmp(state, _GAME) && (!prev_game)) {
stop_all_notes();
PLAY_SONG(tone_game_intro);
prev_game = true;
}
// If exiting the game layer; play the outro sound
if ((!layer_state_cmp(state, _GAME)) && prev_game) {
stop_all_notes();
PLAY_SONG(tone_game_outro);
prev_game = false;
}
return state;
}
// Audio layer switch; add the music layer on top of this
bool process_record_audio(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case MU_TOG:
if (!record->event.pressed) {
// On release, exit music mode if enabled
if (layer_state_is(_MUSI)) {
layer_off(_MUSI);
// If not enabled; turn off all layers and load music layer
} else {
layer_clear();
layer_on(_MUSI);
}
}
return true;
break;
case MU_ON:
if (!record->event.pressed) {
// On release, enter music mode
layer_clear();
layer_on(_MUSI);
}
return true;
break;
case MU_OFF:
if (!record->event.pressed) {
// On release, exit music mode
layer_off(_MUSI);
}
return true;
break;
}
return true;
}

+ 24
- 0
users/bbaserdem/bb-audio.h View File

@ -0,0 +1,24 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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
#include "bbaserdem.h"
/* AUDIO
* Some functions to hook to some modes
*/
// Hook to layer change effects
layer_state_t layer_state_set_audio(layer_state_t state);
// Hook to audio keycodes
bool process_record_audio(uint16_t keycode, keyrecord_t *record);

+ 26
- 0
users/bbaserdem/bb-backlight.c View File

@ -0,0 +1,26 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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 "bb-backlight.h"
/* Replaced functions with noeeprom varieties; I don't need retention across
* booting.
*/
// Backlight LEDs
void keyboard_post_init_backlight(void) {
backlight_enable();
backlight_level(2);
#ifdef BACKLIGHT_BREATHING
breathing_enable();
#endif
}

+ 19
- 0
users/bbaserdem/bb-backlight.h View File

@ -0,0 +1,19 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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
#include "bbaserdem.h"
/* Hooks for backlight definitions
*/
void keyboard_post_init_backlight(void);

+ 467
- 0
users/bbaserdem/bb-encoder.c View File

@ -0,0 +1,467 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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 "bb-encoder.h"
/* ROTARY ENCODER
* This contains my general rotary encoder code
* Encoders each have a list of different modes they can be in.
* Each mode also have an on click action as well.
* Modes can be cycled using either shift-click or ctrl-click
* Modes can be reset using OS click
* Some modes are only accessible through some keymap layers
*/
//encoder_state_t encoder_state[NUMBER_OF_ENCODERS];
encoder_state_t encoder_state[2];
// Default state for the encoders
void reset_encoder_state(void) {
// for (int i = 0; i < NUMBER_OF_ENCODERS; i++) {
for (int i = 0; i < 2; i++) {
encoder_state[i].base = i;
encoder_state[i].rgb = i;
encoder_state[i].point = i;
}
}
// Initialize the encoder state beginning
void keyboard_post_init_encoder(void) {
reset_encoder_state();
}
// Oled string printing for given layer and index; ONLY for OLED
#ifdef OLED_DRIVER_ENABLE
void oled_encoder_state_5char(uint8_t index, uint8_t layer) {
// Get the layer straight from the main function
switch (layer) {
// If RGB control mode is enabled
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
case _MEDI:
switch (encoder_state[index].rgb) {
case 0:
oled_write_P(PSTR(" mode"), false);
break;
case 1:
oled_write_P(PSTR(" hue "), false);
break;
case 2:
oled_write_P(PSTR("satur"), false);
break;
case 3:
oled_write_P(PSTR("value"), false);
break;
case 4:
oled_write_P(PSTR("speed"), false);
break;
default:
oled_write_P(PSTR("!oob!"), false);
break;
}
break;
#endif
// If pointer control is enabled
#ifdef MOUSEKEY_ENABLE
case _MOUS:
switch (encoder_state[index].point) {
case 0:
oled_write_P(PSTR("m.lat"), false);
break;
case 1:
oled_write_P(PSTR("m.ver"), false);
break;
case 2:
oled_write_P(PSTR("s.ver"), false);
break;
case 3:
oled_write_P(PSTR("s.lat"), false);
break;
default:
oled_write_P(PSTR("!oob!"), false);
break;
}
break;
#endif
default:
switch (encoder_state[index].base) {
case 0:
oled_write_P(PSTR(" volm"), false);
break;
case 1:
oled_write_P(PSTR(" song"), false);
break;
case 2:
oled_write_P(PSTR(" sink"), false);
break;
case 3:
oled_write_P(PSTR("s.vol"), false);
break;
case 4:
oled_write_P(PSTR(" src "), false);
break;
case 5:
oled_write_P(PSTR(" L/R "), false);
break;
case 6:
oled_write_P(PSTR(" U/D "), false);
break;
case 7:
oled_write_P(PSTR("pgU/D"), false);
break;
case 8:
oled_write_P(PSTR(" del "), false);
break;
default:
oled_write_P(PSTR("!oob!"), false);
break;
}
break;
}
}
#endif
// Encoder scroll functionality
void encoder_update_user(uint8_t index, bool clockwise) {
// Differentiate layer roles
switch (get_highest_layer(layer_state)) {
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
case _MEDI:
switch(encoder_state[index].rgb) {
case 0: // Effect the RGB mode
if (clockwise) {
#ifdef RGBLIGHT_ENABLE
rgblight_step_noeeprom();
#endif
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_step_noeeprom();
#endif
} else {
#ifdef RGBLIGHT_ENABLE
rgblight_step_reverse_noeeprom();
#endif
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_step_reverse_noeeprom();
#endif
}
break;
case 1: // Effect the RGB hue
if (clockwise) {
#ifdef RGBLIGHT_ENABLE
rgblight_increase_hue_noeeprom();
#endif
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_increase_hue_noeeprom();
#endif
} else {
#ifdef RGBLIGHT_ENABLE
rgblight_decrease_hue_noeeprom();
#endif
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_decrease_hue_noeeprom();
#endif
}
break;
case 2: // Effect the RGB saturation
if (clockwise) {
#ifdef RGBLIGHT_ENABLE
rgblight_increase_sat_noeeprom();
#endif
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_increase_sat_noeeprom();
#endif
} else {
#ifdef RGBLIGHT_ENABLE
rgblight_decrease_sat_noeeprom();
#endif
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_decrease_sat_noeeprom();
#endif
}
break;
case 3: // Effect the RGB brightness
if (clockwise) {
#ifdef RGBLIGHT_ENABLE
rgblight_increase_val_noeeprom();
#endif
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_increase_val_noeeprom();
#endif
} else {
#ifdef RGBLIGHT_ENABLE
rgblight_decrease_val_noeeprom();
#endif
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_decrease_val_noeeprom();
#endif
}
break;
case 4: // Effect the RGB effect speed
if (clockwise) {
#ifdef RGBLIGHT_ENABLE
#endif
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_increase_speed_noeeprom();
#endif
} else {
#ifdef RGBLIGHT_ENABLE
#endif
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_decrease_speed_noeeprom();
#endif
}
break;
}
break;
#endif
#ifdef MOUSEKEY_ENABLE
case _MOUS:
switch(encoder_state[index].point) {
case 0: // Move mouse on horizontal axis
if (clockwise) {
tap_code(KC_MS_R);
} else {
tap_code(KC_MS_L);
}
break;
case 1: // Move mouse on vertical axis
if (clockwise) {
tap_code(KC_MS_D);
} else {
tap_code(KC_MS_U);
}
break;
case 2: // Move mouse wheel on vertical axis
if (clockwise) {
tap_code(KC_WH_D);
} else {
tap_code(KC_WH_U);
}
break;
case 3: // Move mouse on horizontal axis
if (clockwise) {
tap_code(KC_WH_R);
} else {
tap_code(KC_WH_L);
}
break;
}
break;
#endif
default:
switch(encoder_state[index].base) {
case 0: // Volume
if (clockwise) {
tap_code16(KC_VOLU);
} else {
tap_code16(KC_VOLD);
}
break;
case 1: // Song change
if (clockwise) {
tap_code16(KC_MNXT);
} else {
tap_code16(KC_MPRV);
}
break;
case 2: // Move to audio sink
if (clockwise) {
tap_code16(KC_F13);
} else {
tap_code16(S(KC_F13));
}
break;
case 3: // Volume of source
if (clockwise) {
tap_code16(S(KC_VOLU));
} else {
tap_code16(C(KC_VOLD));
}
break;
case 4: // Move to audio source
if (clockwise) {
tap_code16(C(KC_F13));
} else {
tap_code16(C(S(KC_F13)));
}
break;
case 5: // Left-right
if (clockwise) {
tap_code16(KC_RGHT);
} else {
tap_code16(KC_LEFT);
}
break;
case 6: // Up-down
if (clockwise) {
tap_code16(KC_DOWN);
} else {
tap_code16(KC_UP);
}
break;
case 7: // Page Up-down
if (clockwise) {
tap_code16(KC_PGDN);
} else {
tap_code16(KC_PGUP);
}
break;
case 8: // Delete
if (clockwise) {
tap_code16(KC_DEL);
} else {
tap_code16(KC_BSPC);
}
break;
}
break;
}
}
void encoder_click_action(uint8_t index) {
// Differentiate layer roles
switch (get_highest_layer(layer_state)) {
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
case _MEDI:
switch(encoder_state[index].rgb) {
case 0: // Return to no animation
#ifdef RGBLIGHT_ENABLE
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
#endif
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_COLOR);
#endif
break;
case 1:
case 2:
case 3: // Toggle
#ifdef RGBLIGHT_ENABLE
rgblight_increase_val_noeeprom();
#endif
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_increase_val_noeeprom();
#endif
break;
case 4: // Toggle velocikey
#ifdef VELOCIKEY_ENABLE
velocikey_toggle();
#endif
break;
}
break;
#endif
#ifdef MOUSEKEY_ENABLE
case _MOUS:
switch(encoder_state[index].point) {
case 0: // Left click
tap_code16(KC_BTN1);
break;
case 1: // Right click
tap_code16(KC_BTN2);
break;
case 2:
case 3: // Middle click
tap_code16(KC_BTN2);
break;
}
break;
#endif
default:
switch(encoder_state[index].base) {
case 0: // Toggle mute
case 2:
tap_code16(KC_MUTE);
break;
case 1: // Pause
tap_code16(KC_MPLY);
break;
case 3: // Mute source
case 4:
tap_code16(A(KC_MUTE));
break;
case 5: // Insert
tap_code16(KC_INS);
break;
case 6: // Capslock
tap_code16(KC_CAPS);
break;
case 7: // Redo
tap_code16(BB_REDO);
break;
case 8: // Undo
tap_code16(BB_UNDO);
break;
}
break;
}
}
bool process_record_encoder(uint16_t keycode, keyrecord_t *record) {
// Check if and which encoder
int encoder_index = -1;
switch (keycode) {
case BB_ENC0:
encoder_index = 0;
break;
case BB_ENC1:
encoder_index = 1;
break;
}
// Activate encoder function of button
if ((encoder_index >= 0) & (!record->event.pressed)) {
// If shifted, move mode one point forward
if (get_mods() & MOD_MASK_SHIFT) {
switch (get_highest_layer(layer_state)) {
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
case _MEDI:
encoder_state[encoder_index].rgb =
(encoder_state[encoder_index].rgb + 1) % 5;
break;
#endif
#ifdef MOUSEKEY_ENABLE
case _MOUS:
encoder_state[encoder_index].point =
(encoder_state[encoder_index].point + 1) % 4;
break;
#endif
default:
encoder_state[encoder_index].base =
(encoder_state[encoder_index].base + 1) % 9;
break;
}
// If ctrl is active, move mode one point backwards
} else if (get_mods() & MOD_MASK_CTRL) {
switch (get_highest_layer(layer_state)) {
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
case _MEDI:
encoder_state[encoder_index].rgb =
(encoder_state[encoder_index].rgb + 5 - 1) % 5;
break;
#endif
#ifdef MOUSEKEY_ENABLE
case _MOUS:
encoder_state[encoder_index].point =
(encoder_state[encoder_index].point + 4 - 1) % 4;
break;
#endif
default:
encoder_state[encoder_index].base =
(encoder_state[encoder_index].base + 9 - 1) % 9;
break;
}
// If meta is active, reset the encoder states
} else if (get_mods() & MOD_MASK_GUI) {
reset_encoder_state();
// If nothing else; just perform the click action
} else {
encoder_click_action(encoder_index);
}
}
return true;
}

+ 35
- 0
users/bbaserdem/bb-encoder.h View File

@ -0,0 +1,35 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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
#include "bbaserdem.h"
// Code to print to OLED
#ifdef ENCODER_ENABLE
void oled_encoder_state_5char(uint8_t index, uint8_t layer);
#endif
// Hook to encoder stuff
void encoder_update_user(uint8_t index, bool clockwise);
// Complicated code for what the encoder keys do when pressed
bool process_record_encoder(uint16_t keycode, keyrecord_t *record);
// Initializing the encoder array
void keyboard_post_init_encoder(void);
// Clear the encoder settings
void reset_encoder_state(void);
// Structure to keep runtime info on encoder state
typedef struct {
uint8_t base; // The encoder state on most layers; regular function
uint8_t rgb; // The encoder state on media layer; controls light settings
uint8_t point; // The encoder state on mouse layer; moves pointer
} encoder_state_t;

+ 78
- 0
users/bbaserdem/bb-keylight.c View File

@ -0,0 +1,78 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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 "bb-keylight.h"
/* Code relating to per-key RGB LED stuff
*/
// These are matrix specific so they need to be defined in the keymap code.
// BUT these are made to take RGB arguments so the color choice is central
__attribute__ ((weak))
void keylight_set_left(uint8_t red, uint8_t green, uint8_t blue) { }
__attribute__ ((weak))
void keylight_set_right(uint8_t red, uint8_t green, uint8_t blue) { }
// Allow hooking into the RGB matrix indications using keymap code
__attribute__ ((weak)) void rgb_matrix_indicators_keymap(void) { }
// Set RGB state depending on layer
void rgb_matrix_indicators_user(void) {
// Do each layer seperately
switch (get_highest_layer(layer_state)) {
case _GAME:
keylight_set_left(RGB_TURQUOISE);
break;
case _CHAR:
rgb_matrix_set_color_all(RGB_CHARTREUSE);
break;
case _MEDI:
keylight_set_right(RGB_CORAL);
break;
case _NAVI:
keylight_set_right(RGB_GREEN);
break;
case _SYMB:
keylight_set_right(RGB_PURPLE);
break;
case _NUMB:
keylight_set_left(RGB_CYAN);
break;
case _FUNC:
keylight_set_left(RGB_RED);
break;
case _MOUS:
keylight_set_left(RGB_YELLOW);
break;
case _MUSI:
rgb_matrix_set_color_all(RGB_MAGENTA);
break;
}
// Load keymap hooks
rgb_matrix_indicators_keymap();
}
// Hook into shutdown code to make all perkey LED's red on hitting reset
void shutdown_keylight(void) {
// Flash all the key LED's red on shutdown
uint16_t timer_start = timer_read();
rgb_matrix_set_color_all(RGB_CORAL);
// Delay until this registers
while(timer_elapsed(timer_start) < 250) {wait_ms(1);}
}
// Hook into suspend code
void suspend_power_down_keylight(void) {
rgb_matrix_set_suspend_state(true);
}
void suspend_wakeup_init_keylight(void) {
rgb_matrix_set_suspend_state(false);
}

+ 27
- 0
users/bbaserdem/bb-keylight.h View File

@ -0,0 +1,27 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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
#include "bbaserdem.h"
/* Hooks involving perkey RGB LEDs
*/
// For custom indicators
void rgb_matrix_indicators_user(void);
// Hook into shutdown code
void shutdown_keylight(void);
void suspend_wakeup_init_keylight(void);
void suspend_power_down_keylight(void);
// These should be defined worst case on this file
void keylight_set_right(uint8_t red, uint8_t green, uint8_t blue);
void keylight_set_left(uint8_t red, uint8_t green, uint8_t blue);

+ 183
- 0
users/bbaserdem/bb-macro.c View File

@ -0,0 +1,183 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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 "bb-macro.h"
/* MACRO Definitions
* This file has my macros/unicodes
* Hooks for other functionality to inject itself into the process_record
*/
// Tap dance definitons
#ifdef TAP_DANCE_ENABLE
// Bigswitch tap dance code for the last key down event.
void bigswitch_fin(qk_tap_dance_state_t *state, void *user_data) {
switch (state->count) {
case 0:
// Change RGB mode
#ifdef RGBLIGHT_ENABLE
rgblight_step();
#endif
break;
case 1:
// Change RGB mode; but reverse
#ifdef RGBLIGHT_ENABLE
rgblight_step_reverse();
#endif
break;
case 2:
// Toggle RGB functions
#ifdef RGBLIGHT_ENABLE
rgblight_toggle();
#endif
break;
case 3:
// Change RGB hue
#ifdef RGBLIGHT_ENABLE
rgblight_increase_hue();
#endif
break;
case 4:
// Send OS + Escape; which screen locks in my OS
register_code(KC_LGUI);
register_code(KC_ESC);
break;
case 5:
// Send power keycode
register_code(KC_POWER);
break;
}
}
// Unregister the keycodes entered
void bigswitch_res (qk_tap_dance_state_t *state, void *user_data) {
switch (state->count) {
case 4:
unregister_code(KC_LGUI);
unregister_code(KC_ESC);
break;
case 5:
unregister_code(KC_POWER);
break;
}
}
qk_tap_dance_action_t tap_dance_actions[] = {
#ifdef AUDIO_ENABLE
// Music playback speed modulator
[TD_AUDIO_TEMPO] = ACTION_TAP_DANCE_DOUBLE(MU_SLOW, MU_FAST),
#endif
[TD_BIGSWITCH] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, bigswitch_fin, bigswitch_res),
};
#endif
// Unicode definitions; for single character keys
// We mask their definitions if unicode is not enabled
#ifdef UNICODEMAP_ENABLE
const uint32_t PROGMEM unicode_map[] = {
[UPC_A_CIRC] = 0x00C2, [LOW_A_CIRC] = 0x00E2, // Â â
[UPC_C_CEDI] = 0x00C7, [LOW_C_CEDI] = 0x00E7, // Ç ç
[UPC_G_BREV] = 0x011E, [LOW_G_BREV] = 0x001F, // Ğ ğ
[UPC_I_CIRC] = 0x00CE, [LOW_I_CIRC] = 0x00EE, // Î î
[UPC_I_DOTL] = 0x0049, [LOW_I_DOTL] = 0x0131, // I ı
[UPC_I_DOTT] = 0x0130, [LOW_I_DOTT] = 0x0069, // İ i
[UPC_O_DIAE] = 0x00D6, [LOW_O_DIAE] = 0x00F6, // Ö ö
[UPC_S_CEDI] = 0x015E, [LOW_S_CEDI] = 0x015F, // Ş ş
[UPC_U_CIRC] = 0x00DB, [LOW_U_CIRC] = 0x00FB, // Û û
[UPC_U_DIAE] = 0x00DC, [LOW_U_DIAE] = 0x00FC, // Ü ü
[UPC_ALPHA] = 0x0391, [LOW_ALPHA] = 0x03B1, // Α α
[UPC_BETA] = 0x0392, [LOW_BETA] = 0x03B2, // Β β
[UPC_GAMMA] = 0x0393, [LOW_GAMMA] = 0x03B3, // Γ γ
[UPC_DELTA] = 0x0394, [LOW_DELTA] = 0x03B4, // Δ δ
[UPC_EPSILON] = 0x0395, [LOW_EPSILON] = 0x03B5, // Ε ε
[UPC_ZETA] = 0x0396, [LOW_ZETA] = 0x03B6, // Ζ ζ
[UPC_ETA] = 0x0397, [LOW_ETA] = 0x03B7, // Η η
[UPC_THETA] = 0x0398, [LOW_THETA] = 0x03B8, // Θ θ
[UPC_IOTA] = 0x0399, [LOW_IOTA] = 0x03B9, // Ι ι
[UPC_KAPPA] = 0x039A, [LOW_KAPPA] = 0x03BA, // Κ κ
[UPC_LAMBDA] = 0x039B, [LOW_LAMBDA] = 0x03BB, // Λ λ
[UPC_MU] = 0x039C, [LOW_MU] = 0x03BC, // Μ μ
[UPC_NU] = 0x039D, [LOW_NU] = 0x03BD, // Ν ν
[UPC_XI] = 0x039E, [LOW_XI] = 0x03BE, // Ξ ξ
[UPC_OMICRON] = 0x039F, [LOW_OMICRON] = 0x03BF, // Ο ο
[UPC_PI] = 0x03A0, [LOW_PI] = 0x03C0, // Π π
[UPC_RHO] = 0x03A1, [LOW_RHO] = 0x03C1, // Ρ ρ
[UPC_SIGMA] = 0x03A3, [LOW_SIGMA] = 0x03C3, // Σ σ
[UPC_TAU] = 0x03A4, [LOW_TAU] = 0x03C4, // Τ τ
[UPC_UPSILON] = 0x03A5, [LOW_UPSILON] = 0x03C5, // Υ υ
[UPC_PHI] = 0x03A6, [LOW_PHI] = 0x03C6, // Φ φ
[UPC_CHI] = 0x03A7, [LOW_CHI] = 0x03C7, // Χ χ
[UPC_PSI] = 0x03A8, [LOW_PSI] = 0x03C8, // Ψ ψ
[UPC_OMEGA] = 0x03A9, [LOW_OMEGA] = 0x03C9, // Ω ω
[ELLIPSIS] = 0x2026, //
[PLANCK_CON] = 0x210F, //
[ANGSTROM] = 0x212B, //
[BITCOIN] = 0x20BF //
};
#endif
// Keycodes
bool process_record_macro(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// Plain macros
case BB_PGPK:
// My public PGP key
if (record->event.pressed) {
SEND_STRING("0B7151C823559DD8A7A04CE36426139E2F4C6CCE");
}
return false; break;
case DBL_ANG:
// Double angular bracket
if (record->event.pressed) {
SEND_STRING("<>"SS_TAP(X_LEFT));
}
return false; break;
case DBL_PAR:
// Double paranthesis
if (record->event.pressed) {
SEND_STRING("()"SS_TAP(X_LEFT));
}
return false; break;
case DBL_BRC:
// Double square brackets
if (record->event.pressed) {
SEND_STRING("[]"SS_TAP(X_LEFT));
}
return false; break;
case DBL_CBR:
// Double curly brackets
if (record->event.pressed) {
SEND_STRING("{}"SS_TAP(X_LEFT));
}
return false; break;
// Unicode macros
#ifdef UNICODEMAP_ENABLE
case TR_FLAG:
// Turkish flag
if (record->event.pressed) {
send_unicode_string("🇹🇷");
}
return false; break;
case BB_LENY:
// Lenny face: ( ͡° ͜ʖ ͡°)
if (record->event.pressed) {
send_unicode_hex_string("0028 0020 0361 00B0 0020 035C 0296 0020 0361 00B0 0029");
}
return false; break;
case BB_TABL:
// Table flip: \(°°)/
if (record->event.pressed) {
send_unicode_string("253B 2501 253B FE35 0020 005C 0028 00B0 25A1 00B0 0029 002F 0020 FE35 0020 253B 2501 253B");
}
return false; break;
#endif
}
return true;
}

+ 110
- 0
users/bbaserdem/bb-macro.h View File

@ -0,0 +1,110 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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
#include "bbaserdem.h"
/* This header file contains definitons regarding custom keycodes.
* - Both regular and unicode macros are dealt with in this file
*/
// These will be delegated to keymap specific stuff (weak definition)
bool process_record_macro(uint16_t keycode, keyrecord_t *record);
// Unicodemap implementation
#ifdef UNICODEMAP_ENABLE
enum userspace_unicodemap {
UPC_A_CIRC,
UPC_C_CEDI,
UPC_G_BREV,
UPC_I_CIRC,
UPC_I_DOTL,
UPC_I_DOTT,
UPC_O_DIAE,
UPC_S_CEDI,
UPC_U_CIRC,
UPC_U_DIAE,
LOW_A_CIRC,
LOW_C_CEDI,
LOW_G_BREV,
LOW_I_CIRC,
LOW_I_DOTL,
LOW_I_DOTT,
LOW_O_DIAE,
LOW_S_CEDI,
LOW_U_CIRC,
LOW_U_DIAE,
ELLIPSIS,
PLANCK_CON,
ANGSTROM,
MATHPI,
BITCOIN,
UPC_ALPHA,
UPC_BETA,
UPC_GAMMA,
UPC_DELTA,
UPC_EPSILON,
UPC_ZETA,
UPC_ETA,
UPC_THETA,
UPC_IOTA,
UPC_KAPPA,
UPC_LAMBDA,
UPC_MU,
UPC_NU,
UPC_XI,
UPC_OMICRON,
UPC_PI,
UPC_RHO,
UPC_SIGMA,
UPC_TAU,
UPC_UPSILON,
UPC_PHI,
UPC_CHI,
UPC_PSI,
UPC_OMEGA,
LOW_ALPHA,
LOW_BETA,
LOW_GAMMA,
LOW_DELTA,
LOW_EPSILON,
LOW_ZETA,
LOW_ETA,
LOW_THETA,
LOW_IOTA,
LOW_KAPPA,
LOW_LAMBDA,
LOW_MU,
LOW_NU,
LOW_XI,
LOW_OMICRON,
LOW_PI,
LOW_RHO,
LOW_SIGMA,
LOW_TAU,
LOW_UPSILON,
LOW_PHI,
LOW_CHI,
LOW_PSI,
LOW_OMEGA,
};
#endif
// Tap dance stuff
#ifdef TAP_DANCE_ENABLE
enum {
#ifdef AUDIO_ENABLE
TD_AUDIO_TEMPO,
#endif
TD_BIGSWITCH,
};
#endif

+ 162
- 0
users/bbaserdem/bb-oled.c View File

@ -0,0 +1,162 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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 "bb-oled.h"
//#include <stdio.h>
/* ROTARY ENCODER
* This contains my general rotary encoder code
* Encoders each have a list of different modes they can be in.
* Each mode also have an on click action as well.
* Modes can be cycled using either shift-click or ctrl-click
* Modes can be reset using OS click
* Some modes are only accessible through some keymap layers
*/
// Following line imports reading of RGB settings
#if defined RGBLIGHT_ENABLE
extern rgblight_config_t rgblight_config;
#elif defined RGB_MATRIX_ENABLE
extern rgb_config_t rgb_matrix_config;
#endif
static void render_qmk_logo(void) {
static const char PROGMEM qmk_logo[] = {
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0};
oled_write_P(qmk_logo, false);
}
static void render_status(void) {
// Function to print state information
uint8_t this_layer = get_highest_layer(layer_state);
uint8_t this_mod = get_mods();
#if defined WPM_ENABLE
static char temp[4] = {0};
#endif
// Line 1: Layer State
oled_write_P(PSTR("Layer: "), false);
switch (this_layer) {
case _BASE:
oled_write_P(PSTR("Default\n"), false);
break;
case _CHAR:
oled_write_P(PSTR("Sp. Chars\n"), false);
break;
case _GAME:
oled_write_P(PSTR("Gaming\n"), false);
break;
case _MEDI:
oled_write_P(PSTR("Media Ctr\n"), false);
break;
case _NAVI:
oled_write_P(PSTR("Navigation\n"), false);
break;
case _SYMB:
oled_write_P(PSTR("Symbols\n"), false);
break;
case _NUMB:
oled_write_P(PSTR("Numpad\n"), false);
break;
case _FUNC:
oled_write_P(PSTR("Funct Keys\n"), false);
break;
case _MOUS:
oled_write_P(PSTR("Mouse Keys\n"), false);
break;
case _MUSI:
oled_write_P(PSTR("Music Mode\n"), false);
break;
default:
oled_write_P(PSTR("???\n"), false);
}
// Line 2: Mod or info
switch (this_layer) {
// Show RGB mode as an overlay
#if defined RGBLIGHT_ENABLE
case _MEDI:
oled_write_P(PSTR("m:"), false);
itoa(rgblight_config.mode, temp, 10);
oled_write(temp, false);
oled_write_P(PSTR(" h:"), false);
itoa(rgblight_config.hsv.h, temp, 10);
oled_write(temp, false);
oled_write_P(PSTR(" s:"), false);
itoa(rgblight_config.hsv.s, temp, 10);
oled_write(temp, false);
oled_write_P(PSTR(" v:"), false);
itoa(rgblight_config.hsv.v, temp, 10);
oled_write(temp, false);
oled_write_P(PSTR("\n"), false);
break;
#elif defined RGB_MATRIX_ENABLE
case _MEDI:
oled_write_P(PSTR("m"), false);
itoa(rgb_matrix_config.mode, temp, 10);
oled_write(temp, false);
oled_write_P(PSTR(" h"), false);
itoa(rgb_matrix_config.hsv.h, temp, 10);
oled_write(temp, false);
oled_write_P(PSTR(" s"), false);
itoa(rgb_matrix_config.hsv.s, temp, 10);
oled_write(temp, false);
oled_write_P(PSTR(" v"), false);
itoa(rgb_matrix_config.hsv.v, temp, 10);
oled_write(temp, false);
oled_write_P(PSTR("\n"), false);
break;
#endif
// Show the modifier if nothing else is doing anything
default:
oled_write_P((this_mod & MOD_MASK_SHIFT ) ? PSTR("Shft ") : PSTR(" "), false);
oled_write_P((this_mod & MOD_MASK_CTRL ) ? PSTR("Ctrl ") : PSTR(" "), false);
oled_write_P((this_mod & MOD_MASK_ALT ) ? PSTR("Alt" ) : PSTR(" "), false);
oled_write_P((this_mod & MOD_BIT(KC_RALT)) ? PSTR("G ") : PSTR(" "), false);
oled_write_P((this_mod & MOD_MASK_GUI ) ? PSTR("Meta ") : PSTR(" "), false);
oled_write_P(PSTR("\n"), false);
break;
}
// Line 3: WPM
oled_write_P(PSTR("KM: Qwerty WPM: "), false);
#if defined WPM_ENABLE
itoa(get_current_wpm(), temp, 10);
oled_write(temp, false);
#else
oled_write_P(PSTR("N/A"), false);
#endif
oled_write_P(PSTR("\n"), false);
// Line 4: Encoder states
#ifdef ENCODER_ENABLE
oled_write_P(PSTR("EN0:"), false);
oled_encoder_state_5char(0, this_layer);
oled_write_P(PSTR(" EN1:"), false);
oled_encoder_state_5char(1, this_layer);
#endif
oled_write_P(PSTR("\n"), false);
}
void oled_task_user(void) {
if (is_keyboard_master()) {
#if defined(KEYBOARD_kyria_rev1)
render_qmk_logo();
#endif
render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
} else {
render_qmk_logo();
}
}

+ 18
- 0
users/bbaserdem/bb-oled.h View File

@ -0,0 +1,18 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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
#include "bbaserdem.h"
// Contain the main oled writer here
void oled_task_user(void);

+ 113
- 0
users/bbaserdem/bb-underglow.c View File

@ -0,0 +1,113 @@
/*
Copyright 2020 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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 "bb-underglow.h"
/* UNDERGLOW IMPLEMENTATION
*/
// Define the layer switching code
// An empty layer on the base
const rgblight_segment_t PROGMEM bb_base_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{0, 0, HSV_WHITE}
);
// Gaming layer is turquoise
const rgblight_segment_t PROGMEM bb_game_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{RGBLIGHT_LEFT_BEG, RGBLIGHT_LEFT_NUM, HSV_TURQUOISE}
);
// Character overlay is chartereuse
const rgblight_segment_t PROGMEM bb_char_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{0, RGBLED_NUM, HSV_CHARTREUSE}
);
// Right-hand layers
// Media layer is orange
const rgblight_segment_t PROGMEM bb_medi_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{RGBLIGHT_RIGHT_BEG, RGBLIGHT_RIGHT_NUM, 30, 255, 255
}
);
// Navigation layer is green
const rgblight_segment_t PROGMEM bb_navi_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{RGBLIGHT_RIGHT_BEG, RGBLIGHT_RIGHT_NUM, HSV_GREEN}
);
// Symbol layer is purple
const rgblight_segment_t PROGMEM bb_symb_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{RGBLIGHT_RIGHT_BEG, RGBLIGHT_RIGHT_NUM, HSV_PURPLE}
);
// Left-hand layers
// Number layer is blue
const rgblight_segment_t PROGMEM bb_numb_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{RGBLIGHT_LEFT_BEG, RGBLIGHT_LEFT_NUM, HSV_CYAN}
);
// Function layer is red
const rgblight_segment_t PROGMEM bb_func_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{RGBLIGHT_LEFT_BEG, RGBLIGHT_LEFT_NUM, HSV_RED}
);
// Pointer layer is yellow
const rgblight_segment_t PROGMEM bb_mous_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{RGBLIGHT_LEFT_BEG, RGBLIGHT_LEFT_NUM, HSV_YELLOW}
);
// Music playback layer is magenta
const rgblight_segment_t PROGMEM bb_musi_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{0, RGBLED_NUM, HSV_MAGENTA}
);
const rgblight_segment_t* const PROGMEM bb_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
bb_base_layer,
bb_char_layer,
bb_game_layer,
bb_medi_layer,
bb_navi_layer,
bb_symb_layer,
bb_numb_layer,
bb_func_layer,
bb_mous_layer,
bb_musi_layer
);
// Enable the LED switching layers
void keyboard_post_init_underglow(void) {
rgblight_layers = bb_rgb_layers;
// Default rgb mode is rainbow swirl; set this
rgblight_sethsv_noeeprom(100, 255, 255);
rgblight_mode_noeeprom(RGBLIGHT_MODE_RAINBOW_SWIRL + 0);
}
// Set RGBLIGHT state depending on layer
layer_state_t layer_state_set_underglow(layer_state_t state) {
// Activate layers if on that region
rgblight_set_layer_state(_BASE, layer_state_cmp(state, _BASE));
rgblight_set_layer_state(_GAME, layer_state_cmp(state, _GAME));
rgblight_set_layer_state(_CHAR, layer_state_cmp(state, _CHAR));
rgblight_set_layer_state(_MEDI, layer_state_cmp(state, _MEDI));
rgblight_set_layer_state(_NAVI, layer_state_cmp(state, _NAVI));
rgblight_set_layer_state(_SYMB, layer_state_cmp(state, _SYMB));
rgblight_set_layer_state(_NUMB, layer_state_cmp(state, _NUMB));
rgblight_set_layer_state(_FUNC, layer_state_cmp(state, _FUNC));
rgblight_set_layer_state(_MOUS, layer_state_cmp(state, _MOUS));
rgblight_set_layer_state(_MUSI, layer_state_cmp(state, _MUSI));
// Return so other stuff can be done
return state;
}
// Hook into shutdown code
void shutdown_underglow(void) {
// Make the LED's red on shutdown
rgblight_enable_noeeprom();
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
rgblight_sethsv(HSV_PINK);
}

+ 24
- 0
users/bbaserdem/bb-underglow.h View File

@ -0,0 +1,24 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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
#include "bbaserdem.h"
/* UNDERGLOW IMPLEMENTATION
*/
// Used to initialize layer switching overlay
void keyboard_post_init_underglow(void);
// Used to change RGB underglow layers on keymap layer change
layer_state_t layer_state_set_underglow(layer_state_t state);
// Hook into shutdown to show effect on shutdown
void shutdown_underglow(void);

+ 224
- 0
users/bbaserdem/bbaserdem.c View File

@ -0,0 +1,224 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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 "bbaserdem.h"
// Language imports
#include <sendstring_dvorak.h>
/*---------------------------*\
|*-----KEYBOARD PRE INIT-----*|
\*---------------------------*/
/* This code runs before anything is started.
* Good for early hardware setup
*/
__attribute__ ((weak)) void keyboard_pre_init_keymap(void) {}
__attribute__ ((weak)) void keyboard_pre_init_user(void) {
// Keymap specific stuff
keyboard_pre_init_keymap();
}
/*---------------------*\
|*-----MATRIX INIT-----*|
\*---------------------*/
/* This code runs once midway thru the firmware process.
* So far, sets the base layer and fixes unicode mode
*/
__attribute__ ((weak)) void matrix_init_keymap(void) {}
void matrix_init_user (void) {
// Keymap specific things
matrix_init_keymap();
}
/*----------------------------*\
|*-----KEYBOARD POST INIT-----*|
\*----------------------------*/
/* This code runs after anything is started.
* Good for late hardware setup, like setting up layer specifications
*/
__attribute__ ((weak)) void keyboard_post_init_keymap(void) {}
__attribute__ ((weak)) void keyboard_post_init_user(void) {
// Fix beginning base layer, in case some other firmware was flashed
// set_single_persistent_default_layer(_BASE);
// Backlight LED
#ifdef BACKLIGHT_ENABLE
keyboard_post_init_backlight();
#endif
// RGB underglow
#ifdef RGBLIGHT_ENABLE
keyboard_post_init_underglow();
#endif
// Encoders
#ifdef ENCODER_ENABLE
keyboard_post_init_encoder();
#endif
// Unicode mode
#ifdef UNICODEMAP_ENABLE
set_unicode_input_mode(UC_LNX);
#endif
// Keymap specific stuff
keyboard_post_init_keymap();
}
/*-----------------------*\
|*-----EECONFIG INIT-----*|
\*-----------------------*/
/* Default values to send to the eeprom on boot.
*/
__attribute__ ((weak)) void eeconfig_init_keymap(void) {}
void eeconfig_init_user(void) {
// Hook to keymap code
eeconfig_init_keymap();
}
/*------------------------*\
|*-----PROCESS RECORD-----*|
\*------------------------*/
/* Process record: custom keycodes to process here
* Allow also the following codes to hook here as well;
* Macro definitions
* Audio hooks
*/
__attribute__ ((weak))
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
__attribute__ ((weak))
bool process_record_audio(uint16_t keycode, keyrecord_t *record) {
return true;
}
__attribute__ ((weak))
bool process_record_macro(uint16_t keycode, keyrecord_t *record) {
return true;
}
__attribute__ ((weak))
bool process_record_encoder(uint16_t keycode, keyrecord_t *record) {
return true;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// Return after running through all individual hooks
return
process_record_keymap(keycode, record) &&
process_record_audio(keycode, record) &&
process_record_encoder(keycode, record) &&
process_record_macro(keycode, record);
}
/*---------------------*\
|*-----MATRIX SCAN-----*|
\*---------------------*/
/* This code runs every frame
* I used to check for layer switching here, but layer state is better used.
* Try to not put anything here; as it runs hundreds time per second-ish
*/
__attribute__ ((weak)) void matrix_scan_keymap(void) { }
void matrix_scan_user (void) {
// Keymap specific scan function
matrix_scan_keymap();
}
/*---------------------*\
|*-----LAYER STATE-----*|
\*---------------------*/
/* This code runs after every layer change
* State represents the new layer state.
*/
__attribute__ ((weak))
layer_state_t layer_state_set_keymap (layer_state_t state) {
return state;
}
layer_state_t layer_state_set_user(layer_state_t state) {
// Keymap layer state setting
state = layer_state_set_keymap(state);
// For underglow stuff
#ifdef RGBLIGHT_ENABLE
layer_state_set_underglow(state);
#endif
// Audio playback
#ifdef AUDIO_ENABLE
layer_state_set_audio(state);
#endif
return state;
}
/*-----------------------------*\
|*-----DEFAULT LAYER STATE-----*|
\*-----------------------------*/
/* This code runs after every time default base layer is changed
*/
__attribute__ ((weak))
layer_state_t default_layer_state_set_keymap (layer_state_t state) {
return state;
}
layer_state_t default_layer_state_set_user(layer_state_t state) {
// Keymap level code
state = default_layer_state_set_keymap(state);
return state;
}
/*------------------------*\
|*-----LED SET KEYMAP-----*|
\*------------------------*/
/* Code for LED indicators
* I'm not sure when exactly does this code run
*/
__attribute__ ((weak)) void led_set_keymap(uint8_t usb_led) {}
void led_set_user(uint8_t usb_led) {
led_set_keymap(usb_led);
}
/*-----------------*\
|*-----SUSPEND-----*|
\*-----------------*/
/* Suspend stuff here, mostly for the rgb lighting.
*/
__attribute__ ((weak)) void suspend_power_down_keymap (void) { }
void suspend_power_down_user(void) {
suspend_power_down_keymap();
// RGB matrix sleep hook
#ifdef RGB_MATRIX_ENABLE
suspend_power_down_keylight();
#endif
}
__attribute__ ((weak)) void suspend_wakeup_init_keymap (void) { }
void suspend_wakeup_init_user(void) {
suspend_wakeup_init_keymap();
// RGB matrix sleep hook
#ifdef RGB_MATRIX_ENABLE
suspend_wakeup_init_keylight();
#endif
}
/*------------------*\
|*-----SHUTDOWN-----*|
\*------------------*/
/* Shutdown stuff here; for when entering bootmode.
*/
__attribute__ ((weak)) void shutdown_keymap (void) { }
void shutdown_user(void) {
// Underglow LED hook on boot
#ifdef RGBLIGHT_ENABLE
shutdown_underglow();
#endif
// Perkey led hook on boot
#ifdef RGB_MATRIX_ENABLE
shutdown_keylight();
#endif
// Keymap hooks
shutdown_keymap();
}

+ 484
- 0
users/bbaserdem/bbaserdem.h View File

@ -0,0 +1,484 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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
#include QMK_KEYBOARD_H
/* Besides loading libraries and definitions, this file has my layout defs
* LAYOUTS:
* This file has a couple layouts I use; so that the general changes can be
* propagated by only editing this file.
*/
// Macros to use, this has base level code so not affected by enabled features
#include "bb-macro.h"
// Audio from onboard speakers
#ifdef AUDIO_ENABLE
#include "bb-audio.h"
#endif
// Underglow using rgb LEDs
#ifdef RGBLIGHT_ENABLE
#include "bb-underglow.h"
#endif
// Keycap backlight using non-rgb LEDs
#ifdef BACKLIGHT_ENABLE
#include "bb-backlight.h"
#endif
// Keycap backlight using rgb LEDs
#ifdef RGB_MATRIX_ENABLE
#include "bb-keylight.h"
#endif
// Rotary encoder
#ifdef ENCODER_ENABLE
#include "bb-encoder.h"
#endif
// Oled screen
#ifdef OLED_DRIVER_ENABLE
#include "bb-oled.h"
#endif
// Function definitions that can be accessed through specific keymaps
// Runs before all initialization
void keyboard_pre_init_keymap(void);
// For code that launches once midway through initialization
void matrix_init_keymap(void);
// For code that launches after initialization is finished.
void keyboard_post_init_keymap(void);
// This code also launches on boot; but used after eeprom is available to write
void eeconfig_init_keymap(void);
// These will be delegated to keymap specific stuff (weak definition)
bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
// This code runs on every tick
void matrix_scan_keymap(void);
// This code runs after every layer change
layer_state_t layer_state_set_keymap(layer_state_t state);
// This code runs when the default layer changes
layer_state_t default_layer_state_set_keymap (layer_state_t state);
// This code runs to set LED states
void led_set_keymap(uint8_t usb_led);
// For code that runs on suspend
void suspend_power_down_keymap(void);
void suspend_wakeup_init_keymap(void);
// For code that runs on powerdown
void shutdown_keymap(void);
// Make it so that keymaps can use KEYMAP_SAFE_RANGE for custom keycodes
#if defined(KEYMAP_SAFE_RANGE)
#define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE
#else
#define PLACEHOLDER_SAFE_RANGE SAFE_RANGE
#endif
// Custom macro keycode ranges
enum userspace_custom_keycodes {
// Safe stuff
BB_SAFE = PLACEHOLDER_SAFE_RANGE,
// Double entry macros
DBL_ANG,
DBL_PAR,
DBL_CBR,
DBL_BRC,
// Macro key
BB_PGPK,
// Unicode strings
#ifdef UNICODEMAP_ENABLE
BB_LENY,
BB_TABL,
TR_FLAG,
#endif
// Encoder buttons
#ifdef ENCODER_ENABLE
BB_ENC0,
BB_ENC1,
#endif
//use for keymap specific codes
KEYMAP_SAFE_RANGE
};
// Mask these keycodes if required features are not enabled
#ifndef UNICODEMAP_ENABLE
#define BB_LENY KC_NO
#define BB_TABL KC_NO
#define TR_FLAG KC_NO
#endif
#ifndef ENCODER_ENABLE
#define BB_ENC0 KC_NO
#define BB_ENC1 KC_NO
#endif
/// Enumerate of layers
enum userspace_layers {
_BASE = 0, // Base layer
_CHAR, // Characters layer
_GAME, // Game layer
_MEDI, // R3: Media layer
_NAVI, // R3: Navigation layer
_SYMB, // R1: Symbols layer
_NUMB, // L1: Numbers layer
_FUNC, // L2: Function keys layer
_MOUS, // L3: Mouse keys layer
_MUSI // Music overlay
};
// Use 7 wide characters for keymaps, to keep things aligned with 4 tabs
#define _______ KC_TRNS
#define XXXXXXX KC_NO
// These defines allow multiple multi-parameter definitions to expand
// for these boards
#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
#define LAYOUT_ortho_4x12_wrapper(...) LAYOUT_ortho_4x12(__VA_ARGS__)
#define LAYOUT_ortho_5x15_wrapper(...) LAYOUT_ortho_5x15(__VA_ARGS__)
#define LAYOUT_ortho_3x10_wrapper(...) LAYOUT_ortho_3x10(__VA_ARGS__)
#define LAYOUT_split_3x6_3_wrapper(...) LAYOUT_split_3x6_3(__VA_ARGS__)
#define LAYOUT_split_3x5_3_wrapper(...) LAYOUT_split_3x5_3(__VA_ARGS__)
// Masks
#define ___1___ _______
#define ___2___ _______,_______
#define ___3___ _______,_______,_______
#define ___4___ _______,_______,_______,_______
#define ___5___ _______,_______,_______,_______,_______
#define ___6___ _______,_______,_______,_______,_______,_______
#define xxx1xxx KC_NO
#define xxx2xxx KC_NO, KC_NO
#define xxx3xxx KC_NO, KC_NO, KC_NO
#define xxx4xxx KC_NO, KC_NO, KC_NO, KC_NO
#define xxx5xxx KC_NO, KC_NO, KC_NO, KC_NO, KC_NO
#define xxx6xxx KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO
#define xxx1xxx KC_NO
#define xxx3xxx KC_NO, KC_NO, KC_NO
#define xxx5xxx KC_NO, KC_NO, KC_NO, KC_NO, KC_NO
#define xxx6xxx KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO
// Quick macros: in dvorak
#define BB_UNDO LCTL(KC_SLSH) // Ctrl + Z
#define BB_REDO LCTL(KC_T) // Ctrl + Y
#define BB_YANK LCTL(KC_I) // Ctrl + C
#define BB_CUT LCTL(KC_B) // Ctrl + X
#define BB_PSTE LCTL(KC_DOT) // Ctrl + V
// Audio keys
#ifdef AUDIO_ENABLE
#define MU_REC KC_LCTL
#define MU_STOP KC_LALT
#define MU_PLAY KC_LGUI
#define MU_FAST KC_UP
#define MU_SLOW KC_DOWN
#define MU_MASK KC_A
#define BB_SND MU_ON
#ifdef TAP_DANCE_ENABLE
#define MU_TEMP TD(TD_AUDIO_TEMPO)
#else
#define MU_TEMP KC_DOWN
#endif
#else
#define MU_REC KC_NO
#define MU_STOP KC_NO
#define MU_PLAY KC_NO
#define MU_FAST KC_NO
#define MU_TEMP KC_NO
#define MU_SLOW KC_NO
#define MU_MASK KC_NO
#define BB_SND KC_MUTE
#endif
// Unicode keys
#ifdef UNICODEMAP_ENABLE
#define TR_ACIR XP(LOW_A_CIRC, UPC_A_CIRC )
#define TR_CCED XP(LOW_C_CEDI, UPC_C_CEDI )
#define TR_GBRE XP(LOW_G_BREV, LOW_G_BREV )
#define TR_ICIR XP(LOW_I_CIRC, LOW_I_CIRC )
#define TR_I_NO XP(LOW_I_DOTL, LOW_I_DOTL )
#define TR_IDOT XP(LOW_I_DOTT, LOW_I_DOTT )
#define TR_ODIA XP(LOW_O_DIAE, LOW_O_DIAE )
#define TR_SCED XP(LOW_S_CEDI, LOW_S_CEDI )
#define TR_UCIR XP(LOW_U_CIRC, LOW_U_CIRC )
#define TR_UDIA XP(LOW_U_DIAE, LOW_U_DIAE )
#define GR_ALP XP(LOW_ALPHA, UPC_ALPHA )
#define GR_BET XP(LOW_BETA, UPC_BETA )
#define GR_GAM XP(LOW_GAMMA, UPC_GAMMA )
#define GR_DEL XP(LOW_DELTA, UPC_DELTA )
#define GR_EPS XP(LOW_EPSILON,UPC_EPSILON)
#define GR_ZET XP(LOW_ZETA, UPC_ZETA )
#define GR_ETA XP(LOW_ETA, UPC_ETA )
#define GR_THE XP(LOW_THETA, UPC_THETA )
#define GR_IOT XP(LOW_IOTA, UPC_IOTA )
#define GR_KAP XP(LOW_KAPPA, UPC_KAPPA )
#define GR_LAM XP(LOW_LAMBDA, UPC_LAMBDA )
#define GR_MU XP(LOW_MU, UPC_MU )
#define GR_NU XP(LOW_NU, UPC_NU )
#define GR_XI XP(LOW_XI, UPC_XI )
#define GR_OMI XP(LOW_OMICRON,UPC_OMICRON)
#define GR_PI XP(LOW_PI, UPC_PI )
#define GR_RHO XP(LOW_RHO, UPC_RHO )
#define GR_SIG XP(LOW_SIGMA, UPC_SIGMA )
#define GR_TAU XP(LOW_TAU, UPC_TAU )
#define GR_UPS XP(LOW_UPSILON,UPC_UPSILON)
#define GR_PHI XP(LOW_PHI, UPC_PHI )
#define GR_CHI XP(LOW_CHI, UPC_CHI )
#define GR_PSI XP(LOW_PSI, UPC_PSI )
#define GR_OME XP(LOW_OMEGA, UPC_OMEGA )
#define BB_ELLI X(ELLIPSIS)
#define BB_PLNK X(PLANCK_CON)
#define BB_ANGS X(ANGSTROM)
#define BB_BITC X(BITCOIN)
#else
#define TR_ACIR KC_A
#define TR_CCED KC_C
#define TR_GBRE KC_G
#define TR_ICIR KC_I
#define TR_I_NO KC_I
#define TR_IDOT KC_I
#define TR_ODIA KC_O
#define TR_SCED KC_S
#define TR_UCIR KC_U
#define TR_UDIA KC_U
#define GR_ALP KC_NO
#define GR_BET KC_NO
#define GR_GAM KC_NO
#define GR_DEL KC_NO
#define GR_EPS KC_NO
#define GR_ZET KC_NO
#define GR_ETA KC_NO
#define GR_THE KC_NO
#define GR_IOT KC_NO
#define GR_KAP KC_NO
#define GR_LAM KC_NO
#define GR_MU KC_NO
#define GR_NU KC_NO
#define GR_XI KC_NO
#define GR_OMI KC_NO
#define GR_PI KC_NO
#define GR_RHO KC_NO
#define GR_SIG KC_NO
#define GR_TAU KC_NO
#define GR_UPS KC_NO
#define GR_PHI KC_NO
#define GR_CHI KC_NO
#define GR_PSI KC_NO
#define GR_OME KC_NO
#define BB_ELLI KC_NO
#define BB_PLNK KC_NO
#define BB_ANGS KC_NO
#define BB_BITC KC_NO
#endif
// MOD-tap definitions
#define GUI_A MT(MOD_LGUI, KC_A)
#define ALT_S MT(MOD_LALT, KC_S)
#define CTRL_D MT(MOD_LCTL, KC_D)
#define SHIFT_F MT(MOD_LSFT, KC_F)
#define ALTGR_X MT(MOD_RALT, KC_X)
#define GUI_SCL MT(MOD_RGUI, KC_SCLN)
#define ALT_L MT(MOD_LALT, KC_L)
#define CTRL_K MT(MOD_LCTL, KC_K)
#define SHIFT_J MT(MOD_LSFT, KC_J)
#define ALTGR_D MT(MOD_RALT, KC_DOT)
// Layer switches
#define MED_DEL LT(_MEDI, KC_DEL )
#define NAV_TAB LT(_NAVI, KC_TAB )
#define SYM_SPC LT(_SYMB, KC_SPC )
#define NUM_ENT LT(_NUMB, KC_ENT )
#define FUN_ESC LT(_FUNC, KC_ESC )
#define MOU_BSP LT(_MOUS, KC_BSPC)
// Layer switches
#define BB_CHAR OSL(_CHAR)
#define BB_GAME TG(_GAME)
#define BB_BIGS TD(TD_BIGSWITCH)
/* Base layout; (shown in DVORAK)
*
* ' " │ , < │ . > │ P │ Y │ / ? = + │ F │ G │ C │ R │ L │
*
* A O E U I \ | - _ D H T N S
* GuiAltCtrSft SftCtrAltGui
* ; : Q J K X ` ~ < > B M W V Z
* AltGr AltGr
* Del Tab Space Enter Esc BkSpc
* MedNavSym NumFunMou
* The thing about this layout is that these will fit most boards I have.
*/
#define _BL1_5_ KC_Q, KC_W, KC_E, KC_R, KC_T
#define _BR1_5_ KC_Y, KC_U, KC_I, KC_O, KC_P
#define _BL2_5_ GUI_A, ALT_S, CTRL_D, SHIFT_F,KC_G
#define _BR2_5_ KC_H, SHIFT_J,CTRL_K, ALT_L, GUI_SCL
#define _BL3_5_ KC_Z, ALTGR_X,KC_C, KC_V, KC_B
#define _BR3_5_ KC_N, KC_M, KC_COMM,ALTGR_D,KC_SLSH
#define _BL4_3_ MED_DEL,NAV_TAB,SYM_SPC
#define _BR4_3_ NUM_ENT,FUN_ESC,MOU_BSP
// The extra line for the 6th (or 0th) row
#define _BL1_1_ KC_LBRC
#define _BR1_1_ KC_RBRC
#define _BL2_1_ KC_BSLS
#define _BR2_1_ KC_QUOT
#define _BL3_1_ KC_GRV
#define _BR3_1_ KC_NUBS
/*
*
* TrFlgLennyTable π υ φ γ χ ρ λ
*
* α ο ε ψ ι δ η τ ν σ
*
* θ κ ξ β μ ω ζ
*
* Shf ... GPG Shf
*
* Extra characters layer
*/
#define _CL1_5_ TR_FLAG,BB_LENY,BB_TABL,GR_PI, GR_UPS
#define _CR1_5_ GR_PHI, GR_GAM, GR_CHI, GR_RHO, GR_LAM
#define _CL2_5_ GR_ALP, GR_OMI, GR_EPS, GR_PSI, GR_IOT
#define _CR2_5_ GR_DEL, GR_ETA, GR_TAU, GR_NU, GR_SIG
#define _CL3_5_ BB_BITC,GR_THE, BB_PLNK,GR_KAP, GR_XI
#define _CR3_5_ GR_BET, GR_MU, GR_OME, BB_ANGS,GR_ZET
#define _CL4_3_ KC_RSFT,BB_ELLI,BB_PGPK
#define _CR4_3_ XXXXXXX,XXXXXXX,KC_LSFT
/* Game layer; just assume dvorak here
*
* Q W E R T ` ~
*
* A S D F G Tab
*
* Z X C V B Shift
*
* SpaceEnter Esc
*
*/
#define _GA1_5_ KC_Q, KC_W, KC_E, KC_R, KC_T
#define _GA1_1_ KC_GRV
#define _GA2_5_ KC_A, KC_S, KC_D, KC_F, KC_G
#define _GA2_1_ KC_TAB
#define _GA3_5_ KC_Z, KC_X, KC_C, KC_V, KC_B
#define _GA3_1_ KC_LSFT
#define _GA4_3_ KC_SPC, KC_ENT, KC_ESC
/* Media layer
*
* Tog Mod Hue Sat Bri RGB
*
* Prev.VolDnVolUpNext Mut
*
* Tog Brth. Val RgbSpVeloc Led
*
* Sink Tog Music
*
*/
#define _ME1_5_ RGB_TOG,RGB_MOD,RGB_HUI,RGB_SAI,RGB_VAI
#define _ME2_5_ KC_MPRV,KC_VOLD,KC_VOLU,KC_MNXT,KC_MUTE
#define _ME3_5_ BL_TOGG,BL_BRTG,BL_STEP,RGB_SPD,VLK_TOG
#define _ME4_3_ KC_F13, KC_MPLY,MU_TOG
/* Navigation layer
*
* Redo PasteYank Cut PrScr
*
* Undo < v ^ >
*
* Ins Home PgDwnPgUp End
*
* Enter Esc BkSpc
*
*/
#define _NA1_5_ BB_REDO,BB_PSTE,BB_YANK,BB_CUT, KC_PSCR
#define _NA2_5_ BB_UNDO,KC_LEFT,KC_DOWN,KC_UP, KC_RGHT
#define _NA3_5_ KC_INS, KC_HOME,KC_PGDN,KC_PGUP,KC_END
#define _NA4_3_ KC_ENT, KC_ESC, KC_BSPC
/* Symbols layer (in DVORAK)
*
* ` ~ [ ] = + CpsLk
*
* / ? ( ) - _ CharL
*
* \ | { } < >
*
* Enter Esc BkSpc
*
*/
#define _SY1_5_ KC_GRV,KC_MINS,KC_EQL, KC_RBRC,BB_CHAR
#define _SY2_5_ KC_LBRC,KC_LPRN,KC_RPRN,KC_QUOT,KC_CAPS
#define _SY3_5_ KC_BSLS,KC_UNDS,KC_PLUS,KC_NUBS,LSFT(KC_NUBS)
#define _SY4_3_ KC_ENT, KC_ESC, KC_BSPC
/* Numbers layer (in DVORAK)
*
* , 7 & 8 * 9 ( 0 )
*
* . 4 $ 5 % 6 ^ - _
*
* / ? 1 ! 2 @ 3 # = +
*
* Del Tab Space
*
*/
#define _NU1_5_ KC_W, KC_7, KC_8, KC_9, KC_0
#define _NU2_5_ KC_E, KC_4, KC_5, KC_6, KC_QUOT
#define _NU3_5_ KC_LBRC,KC_1, KC_2, KC_3, KC_RBRC
#define _NU4_3_ KC_DEL, KC_TAB, KC_SPC
/* Function layer
*
* F01 F02 F03 F04 RESET
*
* F05 F06 F07 F08 EEPRM
*
* F09 F10 F11 F12 GameL
*
* Del Tab Space
*
*/
#define _FU1_5_ KC_F1, KC_F2, KC_F3, KC_F4, RESET
#define _FU2_5_ KC_F5, KC_F6, KC_F7, KC_F8, EEP_RST
#define _FU3_5_ KC_F9, KC_F10, KC_F11, KC_F12, BB_GAME
#define _FU4_3_ KC_DEL, KC_TAB, KC_SPC
/* Mouse layer
*
* Slow Right Mid Lft Fast
*
* |<| |v| |^| |>| Bt4
*
* <<< vvv ^^^ >>> Bt5
*
* Del Tab Space
*
*/
#define _MO1_5_ KC_ACL0,KC_BTN1,KC_BTN2,KC_BTN3,KC_ACL2
#define _MO2_5_ KC_MS_L,KC_MS_D,KC_MS_U,KC_MS_R,KC_BTN4
#define _MO3_5_ KC_WH_L,KC_WH_D,KC_WH_U,KC_WH_R,KC_BTN5
#define _MO4_3_ KC_DEL, KC_TAB, KC_SPC
/* Music layer
*
*
*
*
*
*
*
* RecStpPlyTmpModOff
*
*/
#define _MUL_3_ MU_REC, MU_STOP,MU_PLAY
#define _MUR_3_ MU_TEMP,MU_MOD, MU_TOG
#define _MU_01_ MU_MASK
#define _MU_02_ MU_MASK,MU_MASK
#define _MU_03_ MU_MASK,MU_MASK,MU_MASK
#define _MU_06_ MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK
#define _MU_08_ MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK
#define _MU_10_ MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK
#define _MU_12_ MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK

+ 139
- 0
users/bbaserdem/config.h View File

@ -0,0 +1,139 @@
/*
Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
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
/* CONFIG
* Common hardware configuration accross my boards
*/
// Space saving
#ifdef LOCKING_SUPPORT_ENABLE
# undef LOCKING_SUPPORT_ENABLE
#endif
#ifdef LOCKING_RESYNC_ENABLE
# undef LOCKING_RESYNC_ENABLE
#endif
#ifndef NO_DEBUG
#define NO_DEBUG
#endif
#if !defined(NO_PRINT) && !defined(CONSOLE_ENABLE)
#define NO_PRINT
#endif
// Unicode entry mode
#ifdef UNICODEMAP_ENABLE
#define UNICODE_SELECTED_MODES UC_LNX
// Adapt the unicode entry mode to dvorak
#ifdef UNICODE_KEY_LNX
#undef UNICODE_KEY_LNX
#endif
#define UNICODE_KEY_LNX LCTL(LSFT(KC_F))
#endif
// Mousekey mode
#ifdef MOUSEKEY_ENABLE
#define MK_COMBINED
#endif
// Tap-hold settings
#define TAPPING_TERM 200
#define TAP_CODE_DELAY 20
#define IGNORE_MOD_TAP_INTERRUPT
#define PERMISSIVE_HOLD
#define TAPPING_FORCE_HOLD
// Encoder settings
#ifdef ENCODER_ENABLE
#define ENCODER_RESOLUTION 2
#endif
// Backlight settings
#ifdef BACKLIGHT_ENABLE
// Turn on breathing only if audio is not enabled, due to hardware stuff
#ifndef AUDIO_ENABLE
#define BACKLIGHT_BREATHING
#define BREATHING_PERIOD 5
#endif
#endif
// Enable RGB LED sleep mode
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
#define RGB_DISABLE_WHEN_USB_SUSPENDED true
#endif
// Audio definitions
#ifdef AUDIO_ENABLE
// Make findable songs as defaults
#ifdef HOROLOGY
#define STARTUP_SONG SONG(HOROLOGY)
#endif
#ifdef PEOPLE_VULTURES
#define GOODBYE_SONG SONG(PEOPLE_VULTURES)
#endif
#ifdef NONAGON_INFINITY
#define MUSIC_ON_SONG SONG(NONAGON_INFINITY)
#endif
#ifdef WAH_WAH
#define MUSIC_OFF_SONG SONG(WAH_WAH)
#endif
// Audio code expects these to be defined
#ifdef BIG_FIG_WASP
#define GAME_ON_SONG SONG(BIG_FIG_WASP)
#else
#define GAME_ON_SONG SONG(USSR_ANTHEM)
#endif
#ifdef POLYGONDWANALAND
#define GAME_OFF_SONG SONG(POLYGONDWANALAND)
#else
#define GAME_OFF_SONG SONG(NOCTURNE_OP_9_NO_1)
#endif
#endif
// For underglow light
#ifdef RGBLIGHT_ENABLE
// Enable animations
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
#define RGBLIGHT_EFFECT_TWINKLE
// Enable layer switching code
#define RGBLIGHT_LAYERS
#define RGBLIGHT_MAX_LAYERS 10
#define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
// If these are not defined; just default to entire board for layer
#define RGBLIGHT_LEFT_BEG 0
#define RGBLIGHT_LEFT_NUM RGBLED_NUM
#define RGBLIGHT_RIGHT_BEG 0
#define RGBLIGHT_RIGHT_NUM RGBLED_NUM
#endif
// For perkey leds
#ifdef RGB_MATRIX_ENABLE
// Start using this mode
#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_RAINBOW_BEACON
#define RGB_MATRIX_STARTUP_HUE 100
#define RGB_MATRIX_STARTUP_SAT 255
#define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS
// Some config options
#define RGB_MATRIX_KEYPRESSES
#define RGB_MATRIX_KEYRELEASES
// Disable some animation modes
#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
#define DISABLE_RGB_MATRIX_BAND_RAINDROPS
#define DISABLE_RGB_MATRIX_BAND_JELLYBEAN_RAINDROPS
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
#endif

+ 83
- 0
users/bbaserdem/rules.mk View File

@ -0,0 +1,83 @@
# Copyright 2019 Batuhan Başerdem <baserdem.batuhan@gmail.com> @bbaserdem
# 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/>.
# Common compilation flags
EXTRAFLAGS += -flto # Used to make code smaller
LTO_ENABLE = yes
# These should be enabled in all boards
MOUSEKEY_ENABLE = yes # Mouse emulation keys
EXTRAKEY_ENABLE = yes # OS signals like volume control
UNICODEMAP_ENABLE = yes # Used for unicode character emulation
KEY_LOCK_ENABLE = yes # Allows locking any key. Not used in general
TAP_DANCE_ENABLE = yes # Tap dance keys; i don't use tap dance but I use tap-hold
VELOCIKEY_ENABLE = no # Modulate speed effects with typing speed
WPM_ENABLE = no # Get WPM reports as you type
# These should be disabled in all boards
BOOTMAGIC_ENABLE = no # Access to EEPROM settings, not needed
CONSOLE_ENABLE = no # Allows console output with a command
COMMAND_ENABLE = no # Some bootmagic thing i dont use
SLEEP_LED_ENABLE = no # Breathes LED's when computer is asleep. Untested.
NKRO_ENABLE = no # Default is 6KRO which is plenty
MIDI_ENABLE = no # Midi driver (untested)
UNICODE_ENABLE = no # We use unicodemap, not unicode
UCIS_ENABLE = no # We use unicodemap, not ucis
FAUXCLICKY_ENABLE = no # Emulates clicks using speaker, who would want this?
VARIABLE_TRACE = no # Allows debugging variables
API_SYSEX_ENABLE = no # Allows OS to send signals.
# Manually configure these on each keyboard individually
# BLUETOOTH_ENABLE # For bluetooth
# AUDIO_ENABLE # Audio stuff
# BACKLIGHT_ENABLE # Switch LEDs
# RGBLIGHT_ENABLE # LED strip
# RGB_MATRIX_ENABLE # Per-key RGB LED
# ENCODER_ENABLE # Rotary encoder
# Userspace code
SRC += bbaserdem.c
# Macros
SRC += bb-macro.c
# Audio code
ifeq ($(strip $(AUDIO_ENABLE)), yes)
SRC += bb-audio.c
endif
# Rotary encoder stuff
ifeq ($(strip $(ENCODER_ENABLE)), yes)
SRC += bb-encoder.c
endif
# Backlight code
ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
SRC += bb-backlight.c
endif
# RGB LED Underglow code
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
SRC += bb-underglow.c
endif
# OLED code
ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
SRC += bb-oled.c
endif
# RGB LED (Perkey) code
ifneq ($(strip $(RGB_MATRIX_ENABLE)),)
ifneq ($(strip $(RGB_MATRIX_ENABLE)), no)
SRC += bb-keylight.c
endif
endif

Loading…
Cancel
Save