updated barobord default to support encoders and OLED

This commit is contained in:
Sadek Baroudi 2021-09-22 12:55:14 -07:00
parent dfec58bd8a
commit 863af4e7e4
2 changed files with 126 additions and 4 deletions

View File

@ -35,7 +35,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LCTL_T(KC_A), LGUI_T(KC_S), LALT_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, RSFT_T(KC_J), RALT_T(KC_K), RGUI_T(KC_L), RCTL_T(KC_SCLN),
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH,
_______, _______, LOWER, KC_ENT, KC_QUOT, KC_BSPC, KC_SPC, RAISE, _______, _______,
_______, _______ // These are for the rotary encoders
KC_MUTE, LCTL(KC_BSPC) // These are for the rotary encoders
),
/* Colemak
@ -60,7 +60,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LCTL_T(KC_A), LGUI_T(KC_R), LALT_T(KC_S), LSFT_T(KC_T), KC_G, KC_M, RSFT_T(KC_N), RALT_T(KC_E), RGUI_T(KC_I), RCTL_T(KC_O),
KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH,
_______, _______, LOWER, KC_ENT, KC_QUOT, KC_BSPC, KC_SPC, RAISE, _______, _______,
_______, _______ // These are for the rotary encoders
KC_MUTE, LCTL(KC_BSPC) // These are for the rotary encoders
),
/* Raise
@ -136,3 +136,124 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
}
#ifdef ENCODER_ENABLE
bool encoder_update_user(uint8_t index, bool clockwise) {
// default behavior if undefined
if (index == 0) {
// Conditional to reverse the direction of encoder number 1
// The reason I have this is that for some of my boards, it supports two different types of encoders, and they may differ in direction
#ifdef ENCODERS_A_REVERSE
if (!clockwise) {
#else
if (clockwise) {
#endif
#if defined(RGBLIGHT_ENABLE) && defined(ENCODERS_FOR_RGB)
rgblight_increase_hue();
#else
tap_code(KC_VOLU);
#endif
} else {
#if defined(RGBLIGHT_ENABLE) && defined(ENCODERS_FOR_RGB)
rgblight_decrease_hue();
#else
tap_code(KC_VOLD);
#endif
}
#ifdef RGBLIGHT_ENABLE
rgb_set_user_config_from_current_values();
#endif
}
else if (index == 1) {
// Conditional to reverse the direction of encoder number 1
// The reason I have this is that for some of my boards, it supports two different types of encoders, and they may differ in direction
#ifdef ENCODERS_B_REVERSE
if (!clockwise) {
#else
if (clockwise) {
#endif
#if defined(RGBLIGHT_ENABLE) && defined(ENCODERS_FOR_RGB)
rgblight_step();
#else
tap_code16(C(KC_RGHT));
#endif
}
else{
#if defined(RGBLIGHT_ENABLE) && defined(ENCODERS_FOR_RGB)
rgblight_step_reverse();
#else
tap_code16(C(KC_LEFT));
#endif
}
#if defined(RGBLIGHT_ENABLE) && defined(ENCODERS_FOR_RGB)
rgb_set_user_config_from_current_values();
#endif
}
return true;
}
#endif
#ifdef OLED_DRIVER_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_180;
}
// Commenting out logo as it takes up a lot of space :(
static void render_logo(void) {
// barobord logo, 128x32px
static const char PROGMEM barobord_logo[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
0x01, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 0x07, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x8f, 0x07, 0x07, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x41, 0x41, 0x41,
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x07, 0x8f, 0xff, 0xff, 0xff, 0xff,
0xff, 0x8f, 0x07, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7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0, 0xc1, 0xcd, 0xcd, 0xcc, 0xc0, 0xc1, 0xe1, 0xe3, 0xff, 0xff, 0xe3,
0xe1, 0xc1, 0xc1, 0xcd, 0xcc, 0xcc, 0xcd, 0xc1, 0xc1, 0xe1, 0xe3, 0xff, 0xff, 0xc1, 0xc0, 0xc0,
0xc1, 0xf9, 0xfd, 0xfc, 0xfc, 0xff, 0xe3, 0xe1, 0xc1, 0xc0, 0xcc, 0xcd, 0xcd, 0xc9, 0xc0, 0xc0,
0xc0, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
oled_write_raw_P(barobord_logo, sizeof(barobord_logo));
}
void oled_task_user(void) {
// If you don't want to display the logo, switch
if (false) {
//render_status();
} else if (true) {
render_logo();
} else {
//render_logo_text();
}
}
#endif

View File

@ -34,5 +34,6 @@ UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
ENCODER_ENABLE = no
EXTRAFLAGS += -flto
ENCODER_ENABLE = yes
OLED_DRIVER_ENABLE = yes # this can be yes or no depending on if you have an OLED
#EXTRAFLAGS += -flto