Migrate boston_meetup/2019 away from QWIIC_DRIVERS (#14413)
parent
cb4346edb7
commit
219d955787
|
@ -14,9 +14,6 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "2019.h"
|
#include "2019.h"
|
||||||
#include "qwiic.h"
|
|
||||||
#include "action_layer.h"
|
|
||||||
#include "haptic.h"
|
|
||||||
|
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
#ifdef RGB_MATRIX_ENABLE
|
||||||
#include "rgb_matrix.h"
|
#include "rgb_matrix.h"
|
||||||
|
@ -33,184 +30,70 @@ led_config_t g_led_config = { {
|
||||||
} };
|
} };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t *o_fb;
|
#ifdef OLED_ENABLE
|
||||||
|
__attribute__ ((weak))
|
||||||
uint16_t counterst = 0;
|
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
||||||
|
return OLED_ROTATION_180;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef QWIIC_MICRO_OLED_ENABLE
|
|
||||||
|
|
||||||
/* screen off after this many milliseconds */
|
|
||||||
#include "timer.h"
|
|
||||||
#define ScreenOffInterval 60000 /* milliseconds */
|
|
||||||
static uint16_t last_flush;
|
|
||||||
|
|
||||||
volatile uint8_t led_numlock = false;
|
|
||||||
volatile uint8_t led_capslock = false;
|
|
||||||
volatile uint8_t led_scrolllock = false;
|
|
||||||
|
|
||||||
static uint8_t layer;
|
|
||||||
static bool queue_for_send = false;
|
|
||||||
static uint8_t encoder_value = 32;
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
__attribute__ ((weak))
|
||||||
void draw_ui(void) {
|
void oled_task_user(void) {
|
||||||
clear_buffer();
|
oled_write_P(PSTR("BOSTON MK LAYER "), false);
|
||||||
last_flush = timer_read();
|
oled_write_char(get_highest_layer(layer_state) + 0x30, true);
|
||||||
send_command(DISPLAYON);
|
|
||||||
|
|
||||||
/* Boston MK title is 55 x 10 pixels */
|
led_t led_state = host_keyboard_led_state();
|
||||||
#define NAME_X 0
|
oled_set_cursor(18, 0);
|
||||||
#define NAME_Y 0
|
oled_write_P(PSTR("NUM"), led_state.num_lock);
|
||||||
|
oled_set_cursor(18, 1);
|
||||||
|
oled_write_P(PSTR("CAP"), led_state.caps_lock);
|
||||||
|
oled_set_cursor(18, 2);
|
||||||
|
oled_write_P(PSTR("SCR"), led_state.scroll_lock);
|
||||||
|
|
||||||
draw_string(NAME_X + 1, NAME_Y + 2, "BOSTON MK", PIXEL_ON, NORM, 0);
|
uint8_t mod_state = get_mods();
|
||||||
|
oled_set_cursor(10, 3);
|
||||||
/* Layer indicator is 41 x 10 pixels */
|
oled_write_P(PSTR("S"), mod_state & MOD_MASK_SHIFT);
|
||||||
#define LAYER_INDICATOR_X 60
|
oled_advance_char();
|
||||||
#define LAYER_INDICATOR_Y 0
|
oled_write_P(PSTR("C"), mod_state & MOD_MASK_CTRL);
|
||||||
|
oled_advance_char();
|
||||||
draw_string(LAYER_INDICATOR_X + 1, LAYER_INDICATOR_Y + 2, "LAYER", PIXEL_ON, NORM, 0);
|
oled_write_P(PSTR("A"), mod_state & MOD_MASK_ALT);
|
||||||
draw_rect_filled_soft(LAYER_INDICATOR_X + 32, LAYER_INDICATOR_Y + 1, 9, 9, PIXEL_ON, NORM);
|
oled_advance_char();
|
||||||
draw_char(LAYER_INDICATOR_X + 34, LAYER_INDICATOR_Y + 2, layer + 0x30, PIXEL_ON, XOR, 0);
|
oled_write_P(PSTR("G"), mod_state & MOD_MASK_GUI);
|
||||||
|
oled_advance_char();
|
||||||
|
|
||||||
/* Matrix display is 12 x 12 pixels */
|
/* Matrix display is 12 x 12 pixels */
|
||||||
#define MATRIX_DISPLAY_X 8
|
#define MATRIX_DISPLAY_X 8
|
||||||
#define MATRIX_DISPLAY_Y 16
|
#define MATRIX_DISPLAY_Y 16
|
||||||
|
|
||||||
|
// matrix
|
||||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||||
for (uint8_t y = 0; y < MATRIX_COLS; y++) {
|
for (uint8_t y = 0; y < MATRIX_COLS; y++) {
|
||||||
draw_pixel(MATRIX_DISPLAY_X + y + y + 2, MATRIX_DISPLAY_Y + x + x + 2,(matrix_get_row(x) & (1 << y)) > 0, NORM);
|
bool on = (matrix_get_row(x) & (1 << y)) > 0;
|
||||||
draw_pixel(MATRIX_DISPLAY_X + y + y + 3, MATRIX_DISPLAY_Y + x + x + 2,(matrix_get_row(x) & (1 << y)) > 0, NORM);
|
oled_write_pixel(MATRIX_DISPLAY_X + y + y + 2, MATRIX_DISPLAY_Y + x + x + 2, on);
|
||||||
draw_pixel(MATRIX_DISPLAY_X + y + y + 2, MATRIX_DISPLAY_Y + x + x + 3,(matrix_get_row(x) & (1 << y)) > 0, NORM);
|
oled_write_pixel(MATRIX_DISPLAY_X + y + y + 3, MATRIX_DISPLAY_Y + x + x + 2, on);
|
||||||
draw_pixel(MATRIX_DISPLAY_X + y + y + 3, MATRIX_DISPLAY_Y + x + x + 3,(matrix_get_row(x) & (1 << y)) > 0, NORM);
|
oled_write_pixel(MATRIX_DISPLAY_X + y + y + 2, MATRIX_DISPLAY_Y + x + x + 3, on);
|
||||||
|
oled_write_pixel(MATRIX_DISPLAY_X + y + y + 3, MATRIX_DISPLAY_Y + x + x + 3, on);
|
||||||
}
|
|
||||||
}
|
|
||||||
draw_rect_soft(MATRIX_DISPLAY_X, MATRIX_DISPLAY_Y, 12, 12, PIXEL_ON, NORM);
|
|
||||||
/* hadron oled location on thumbnail */
|
|
||||||
draw_rect_filled_soft(MATRIX_DISPLAY_X + 5, MATRIX_DISPLAY_Y + 2, 6, 2, PIXEL_ON, NORM);
|
|
||||||
/*
|
|
||||||
draw_rect_soft(0, 13, 64, 6, PIXEL_ON, NORM);
|
|
||||||
draw_line_vert(encoder_value, 13, 6, PIXEL_ON, NORM);
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Mod display is 41 x 16 pixels */
|
|
||||||
#define MOD_DISPLAY_X 60
|
|
||||||
#define MOD_DISPLAY_Y 20
|
|
||||||
|
|
||||||
uint8_t mods = get_mods();
|
|
||||||
if (mods & MOD_LSFT) {
|
|
||||||
draw_rect_filled_soft(MOD_DISPLAY_X + 0, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM);
|
|
||||||
draw_string(MOD_DISPLAY_X + 3, MOD_DISPLAY_Y + 2, "S", PIXEL_OFF, NORM, 0);
|
|
||||||
} else {
|
|
||||||
draw_string(MOD_DISPLAY_X + 3, MOD_DISPLAY_Y + 2, "S", PIXEL_ON, NORM, 0);
|
|
||||||
}
|
|
||||||
if (mods & MOD_LCTL) {
|
|
||||||
draw_rect_filled_soft(MOD_DISPLAY_X + 10, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM);
|
|
||||||
draw_string(MOD_DISPLAY_X + 13, MOD_DISPLAY_Y + 2, "C", PIXEL_OFF, NORM, 0);
|
|
||||||
} else {
|
|
||||||
draw_string(MOD_DISPLAY_X + 13, MOD_DISPLAY_Y + 2, "C", PIXEL_ON, NORM, 0);
|
|
||||||
}
|
|
||||||
if (mods & MOD_LALT) {
|
|
||||||
draw_rect_filled_soft(MOD_DISPLAY_X + 20, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM);
|
|
||||||
draw_string(MOD_DISPLAY_X + 23, MOD_DISPLAY_Y + 2, "A", PIXEL_OFF, NORM, 0);
|
|
||||||
} else {
|
|
||||||
draw_string(MOD_DISPLAY_X + 23, MOD_DISPLAY_Y + 2, "A", PIXEL_ON, NORM, 0);
|
|
||||||
}
|
|
||||||
if (mods & MOD_LGUI) {
|
|
||||||
draw_rect_filled_soft(MOD_DISPLAY_X + 30, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM);
|
|
||||||
draw_string(MOD_DISPLAY_X + 33, MOD_DISPLAY_Y + 2, "G", PIXEL_OFF, NORM, 0);
|
|
||||||
} else {
|
|
||||||
draw_string(MOD_DISPLAY_X + 33, MOD_DISPLAY_Y + 2, "G", PIXEL_ON, NORM, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Lock display is 23 x 32 */
|
|
||||||
#define LOCK_DISPLAY_X 104
|
|
||||||
#define LOCK_DISPLAY_Y 0
|
|
||||||
|
|
||||||
if (led_numlock == true) {
|
|
||||||
draw_rect_filled_soft(LOCK_DISPLAY_X, LOCK_DISPLAY_Y, 5 + (3 * 6), 9, PIXEL_ON, NORM);
|
|
||||||
draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 1, "NUM", PIXEL_OFF, NORM, 0);
|
|
||||||
} else if (led_numlock == false) {
|
|
||||||
draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 1, "NUM", PIXEL_ON, NORM, 0);
|
|
||||||
}
|
|
||||||
if (led_capslock == true) {
|
|
||||||
draw_rect_filled_soft(LOCK_DISPLAY_X + 0, LOCK_DISPLAY_Y + 11, 5 + (3 * 6), 9, PIXEL_ON, NORM);
|
|
||||||
draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 11 +1, "CAP", PIXEL_OFF, NORM, 0);
|
|
||||||
} else if (led_capslock == false) {
|
|
||||||
draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 11 +1, "CAP", PIXEL_ON, NORM, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (led_scrolllock == true) {
|
|
||||||
draw_rect_filled_soft(LOCK_DISPLAY_X + 0, LOCK_DISPLAY_Y + 22, 5 + (3 * 6), 9, PIXEL_ON, NORM);
|
|
||||||
draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 22 +1, "SCR", PIXEL_OFF, NORM, 0);
|
|
||||||
} else if (led_scrolllock == false) {
|
|
||||||
draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 22 +1, "SCR", PIXEL_ON, NORM, 0);
|
|
||||||
}
|
|
||||||
send_buffer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void led_set_user(uint8_t usb_led) {
|
|
||||||
if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
|
|
||||||
if (led_numlock == false){led_numlock = true;}
|
|
||||||
} else {
|
|
||||||
if (led_numlock == true){led_numlock = false;}
|
|
||||||
}
|
|
||||||
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
|
|
||||||
if (led_capslock == false){led_capslock = true;}
|
|
||||||
} else {
|
|
||||||
if (led_capslock == true){led_capslock = false;}
|
|
||||||
}
|
|
||||||
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
|
|
||||||
if (led_scrolllock == false){led_scrolllock = true;}
|
|
||||||
} else {
|
|
||||||
if (led_scrolllock == true){led_scrolllock = false;}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t layer_state_set_kb(uint32_t state) {
|
// outline
|
||||||
state = layer_state_set_user(state);
|
for (uint8_t x = 0; x < 12; x++) {
|
||||||
layer = biton32(state);
|
oled_write_pixel(MATRIX_DISPLAY_X + x, MATRIX_DISPLAY_Y, true);
|
||||||
queue_for_send = true;
|
oled_write_pixel(MATRIX_DISPLAY_X + x, MATRIX_DISPLAY_Y + 12, true);
|
||||||
return state;
|
}
|
||||||
|
for (uint8_t y = 0; y < 12; y++) {
|
||||||
|
oled_write_pixel(MATRIX_DISPLAY_X, MATRIX_DISPLAY_Y+y, true);
|
||||||
|
oled_write_pixel(MATRIX_DISPLAY_X + 12, MATRIX_DISPLAY_Y+y, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
// oled location
|
||||||
queue_for_send = true;
|
for (uint8_t x = 0; x < 6; x++) {
|
||||||
return process_record_user(keycode, record);
|
oled_write_pixel(MATRIX_DISPLAY_X + 5 + x, MATRIX_DISPLAY_Y + 2, true);
|
||||||
|
oled_write_pixel(MATRIX_DISPLAY_X + 5 + x, MATRIX_DISPLAY_Y + 3, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
// bodge for layer number left hand side
|
||||||
encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64;
|
for (uint8_t y = 0; y < 8; y++) {
|
||||||
queue_for_send = true;
|
oled_write_pixel(95, 0 + y, true);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
queue_for_send = true;
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
if (queue_for_send) {
|
|
||||||
#ifdef QWIIC_MICRO_OLED_ENABLE
|
|
||||||
draw_ui();
|
|
||||||
#endif
|
|
||||||
queue_for_send = false;
|
|
||||||
}
|
|
||||||
#ifdef QWIIC_MICRO_OLED_ENABLE
|
|
||||||
if (timer_elapsed(last_flush) > ScreenOffInterval) {
|
|
||||||
send_command(DISPLAYOFF); /* 0xAE */
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (counterst == 0) {
|
|
||||||
//testPatternFB(o_fb);
|
|
||||||
}
|
|
||||||
counterst = (counterst + 1) % 1024;
|
|
||||||
//rgblight_task();
|
|
||||||
matrix_scan_user();
|
|
||||||
}
|
|
||||||
|
|
|
@ -46,16 +46,9 @@
|
||||||
#define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f
|
#define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//configure qwiic micro_oled driver for the 128x32 oled
|
// configure oled driver for the 128x32 oled
|
||||||
#ifdef QWIIC_MICRO_OLED_ENABLE
|
#define OLED_UPDATE_INTERVAL 33 // ~30fps
|
||||||
|
|
||||||
#undef I2C_ADDRESS_SA0_1
|
|
||||||
#define I2C_ADDRESS_SA0_1 0b0111100
|
|
||||||
#define LCDWIDTH 128
|
|
||||||
#define LCDHEIGHT 32
|
|
||||||
#define micro_oled_rotate_180
|
|
||||||
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* Keyboard Matrix Assignments
|
* Keyboard Matrix Assignments
|
||||||
*
|
*
|
||||||
|
|
|
@ -13,10 +13,8 @@ enum custom_layers {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum custom_keycodes {
|
enum custom_keycodes {
|
||||||
BASE = SAFE_RANGE,
|
LOWER = SAFE_RANGE,
|
||||||
LOWER,
|
|
||||||
RAISE,
|
RAISE,
|
||||||
KC_DEMOMACRO
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Custom macros
|
// Custom macros
|
||||||
|
@ -27,7 +25,6 @@ enum custom_keycodes {
|
||||||
// Requires KC_TRNS/_______ for the trigger key in the destination layer
|
// Requires KC_TRNS/_______ for the trigger key in the destination layer
|
||||||
#define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor
|
#define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor
|
||||||
#define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise
|
#define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise
|
||||||
#define DEMOMACRO KC_DEMOMACRO // Sample for macros
|
|
||||||
|
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
@ -115,14 +112,6 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case KC_DEMOMACRO:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
// when keycode KC_DEMOMACRO is pressed
|
|
||||||
SEND_STRING("QMK is the best thing ever!");
|
|
||||||
} else {
|
|
||||||
// when keycode KC_DEMOMACRO is released
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LOWER:
|
case LOWER:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
//not sure how to have keyboard check mode and set it to a variable, so my work around
|
//not sure how to have keyboard check mode and set it to a variable, so my work around
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
# How to add your own keymap
|
|
||||||
|
|
||||||
Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`:
|
|
||||||
|
|
||||||
_[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author]
|
|
||||||
|
|
||||||
\* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements
|
|
||||||
|
|
||||||
and contain the following files:
|
|
||||||
|
|
||||||
* `keymap.c`
|
|
||||||
* `readme.md` *recommended*
|
|
||||||
* `config.h` *optional*, found automatically when compiling
|
|
||||||
* `Makefile` *optional*, found automatically when compling
|
|
||||||
|
|
||||||
When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format:
|
|
||||||
|
|
||||||
* **folder_name** description
|
|
||||||
|
|
||||||
# List of 2019 keymaps
|
|
||||||
|
|
||||||
* **default** default 2019 macropad layout
|
|
|
@ -8,19 +8,20 @@ BOOTLOADER = stm32-dfu
|
||||||
# Build Options
|
# Build Options
|
||||||
# comment out to disable the options.
|
# comment out to disable the options.
|
||||||
#
|
#
|
||||||
BACKLIGHT_ENABLE = no
|
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
|
||||||
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
|
|
||||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||||
CONSOLE_ENABLE = no # Console for debug
|
CONSOLE_ENABLE = no # Console for debug
|
||||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
NKRO_ENABLE = yes # USB Nkey Rollover
|
NKRO_ENABLE = yes # USB Nkey Rollover
|
||||||
CUSTOM_MATRIX = no # Custom matrix file
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||||
AUDIO_ENABLE = yes
|
AUDIO_ENABLE = yes # Audio output
|
||||||
RGBLIGHT_ENABLE = no
|
RGBLIGHT_ENABLE = no
|
||||||
RGB_MATRIX_ENABLE = no
|
RGB_MATRIX_ENABLE = no
|
||||||
RGB_MATRIX_DRIVER = WS2812
|
RGB_MATRIX_DRIVER = WS2812
|
||||||
HAPTIC_ENABLE += DRV2605L
|
HAPTIC_ENABLE += DRV2605L
|
||||||
QWIIC_ENABLE = yes
|
OLED_ENABLE = yes
|
||||||
QWIIC_DRIVERS += MICRO_OLED
|
OLED_DRIVER = SSD1306
|
||||||
|
|
Loading…
Reference in New Issue