Skip to content

Commit 5f3786d

Browse files
zvecrptrxyz
authored andcommitted
Migrate boston_meetup/2019 away from QWIIC_DRIVERS (qmk#14413)
1 parent 4dfcaf4 commit 5f3786d

File tree

5 files changed

+68
-224
lines changed

5 files changed

+68
-224
lines changed

keyboards/boston_meetup/2019/2019.c

Lines changed: 52 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1515
*/
1616
#include "2019.h"
17-
#include "qwiic.h"
18-
#include "action_layer.h"
19-
#include "haptic.h"
2017

2118
#ifdef RGB_MATRIX_ENABLE
2219
#include "rgb_matrix.h"
@@ -33,184 +30,70 @@ led_config_t g_led_config = { {
3330
} };
3431
#endif
3532

36-
uint8_t *o_fb;
37-
38-
uint16_t counterst = 0;
39-
40-
41-
42-
#ifdef QWIIC_MICRO_OLED_ENABLE
43-
44-
/* screen off after this many milliseconds */
45-
#include "timer.h"
46-
#define ScreenOffInterval 60000 /* milliseconds */
47-
static uint16_t last_flush;
48-
49-
volatile uint8_t led_numlock = false;
50-
volatile uint8_t led_capslock = false;
51-
volatile uint8_t led_scrolllock = false;
52-
53-
static uint8_t layer;
54-
static bool queue_for_send = false;
55-
static uint8_t encoder_value = 32;
56-
33+
#ifdef OLED_ENABLE
5734
__attribute__ ((weak))
58-
void draw_ui(void) {
59-
clear_buffer();
60-
last_flush = timer_read();
61-
send_command(DISPLAYON);
62-
63-
/* Boston MK title is 55 x 10 pixels */
64-
#define NAME_X 0
65-
#define NAME_Y 0
66-
67-
draw_string(NAME_X + 1, NAME_Y + 2, "BOSTON MK", PIXEL_ON, NORM, 0);
68-
69-
/* Layer indicator is 41 x 10 pixels */
70-
#define LAYER_INDICATOR_X 60
71-
#define LAYER_INDICATOR_Y 0
35+
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
36+
return OLED_ROTATION_180;
37+
}
7238

73-
draw_string(LAYER_INDICATOR_X + 1, LAYER_INDICATOR_Y + 2, "LAYER", PIXEL_ON, NORM, 0);
74-
draw_rect_filled_soft(LAYER_INDICATOR_X + 32, LAYER_INDICATOR_Y + 1, 9, 9, PIXEL_ON, NORM);
75-
draw_char(LAYER_INDICATOR_X + 34, LAYER_INDICATOR_Y + 2, layer + 0x30, PIXEL_ON, XOR, 0);
39+
__attribute__ ((weak))
40+
void oled_task_user(void) {
41+
oled_write_P(PSTR("BOSTON MK LAYER "), false);
42+
oled_write_char(get_highest_layer(layer_state) + 0x30, true);
43+
44+
led_t led_state = host_keyboard_led_state();
45+
oled_set_cursor(18, 0);
46+
oled_write_P(PSTR("NUM"), led_state.num_lock);
47+
oled_set_cursor(18, 1);
48+
oled_write_P(PSTR("CAP"), led_state.caps_lock);
49+
oled_set_cursor(18, 2);
50+
oled_write_P(PSTR("SCR"), led_state.scroll_lock);
51+
52+
uint8_t mod_state = get_mods();
53+
oled_set_cursor(10, 3);
54+
oled_write_P(PSTR("S"), mod_state & MOD_MASK_SHIFT);
55+
oled_advance_char();
56+
oled_write_P(PSTR("C"), mod_state & MOD_MASK_CTRL);
57+
oled_advance_char();
58+
oled_write_P(PSTR("A"), mod_state & MOD_MASK_ALT);
59+
oled_advance_char();
60+
oled_write_P(PSTR("G"), mod_state & MOD_MASK_GUI);
61+
oled_advance_char();
7662

7763
/* Matrix display is 12 x 12 pixels */
7864
#define MATRIX_DISPLAY_X 8
7965
#define MATRIX_DISPLAY_Y 16
8066

81-
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
82-
for (uint8_t y = 0; y < MATRIX_COLS; y++) {
83-
draw_pixel(MATRIX_DISPLAY_X + y + y + 2, MATRIX_DISPLAY_Y + x + x + 2,(matrix_get_row(x) & (1 << y)) > 0, NORM);
84-
draw_pixel(MATRIX_DISPLAY_X + y + y + 3, MATRIX_DISPLAY_Y + x + x + 2,(matrix_get_row(x) & (1 << y)) > 0, NORM);
85-
draw_pixel(MATRIX_DISPLAY_X + y + y + 2, MATRIX_DISPLAY_Y + x + x + 3,(matrix_get_row(x) & (1 << y)) > 0, NORM);
86-
draw_pixel(MATRIX_DISPLAY_X + y + y + 3, MATRIX_DISPLAY_Y + x + x + 3,(matrix_get_row(x) & (1 << y)) > 0, NORM);
87-
67+
// matrix
68+
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
69+
for (uint8_t y = 0; y < MATRIX_COLS; y++) {
70+
bool on = (matrix_get_row(x) & (1 << y)) > 0;
71+
oled_write_pixel(MATRIX_DISPLAY_X + y + y + 2, MATRIX_DISPLAY_Y + x + x + 2, on);
72+
oled_write_pixel(MATRIX_DISPLAY_X + y + y + 3, MATRIX_DISPLAY_Y + x + x + 2, on);
73+
oled_write_pixel(MATRIX_DISPLAY_X + y + y + 2, MATRIX_DISPLAY_Y + x + x + 3, on);
74+
oled_write_pixel(MATRIX_DISPLAY_X + y + y + 3, MATRIX_DISPLAY_Y + x + x + 3, on);
75+
}
8876
}
89-
}
90-
draw_rect_soft(MATRIX_DISPLAY_X, MATRIX_DISPLAY_Y, 12, 12, PIXEL_ON, NORM);
91-
/* hadron oled location on thumbnail */
92-
draw_rect_filled_soft(MATRIX_DISPLAY_X + 5, MATRIX_DISPLAY_Y + 2, 6, 2, PIXEL_ON, NORM);
93-
/*
94-
draw_rect_soft(0, 13, 64, 6, PIXEL_ON, NORM);
95-
draw_line_vert(encoder_value, 13, 6, PIXEL_ON, NORM);
96-
97-
*/
98-
99-
/* Mod display is 41 x 16 pixels */
100-
#define MOD_DISPLAY_X 60
101-
#define MOD_DISPLAY_Y 20
102-
103-
uint8_t mods = get_mods();
104-
if (mods & MOD_LSFT) {
105-
draw_rect_filled_soft(MOD_DISPLAY_X + 0, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM);
106-
draw_string(MOD_DISPLAY_X + 3, MOD_DISPLAY_Y + 2, "S", PIXEL_OFF, NORM, 0);
107-
} else {
108-
draw_string(MOD_DISPLAY_X + 3, MOD_DISPLAY_Y + 2, "S", PIXEL_ON, NORM, 0);
109-
}
110-
if (mods & MOD_LCTL) {
111-
draw_rect_filled_soft(MOD_DISPLAY_X + 10, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM);
112-
draw_string(MOD_DISPLAY_X + 13, MOD_DISPLAY_Y + 2, "C", PIXEL_OFF, NORM, 0);
113-
} else {
114-
draw_string(MOD_DISPLAY_X + 13, MOD_DISPLAY_Y + 2, "C", PIXEL_ON, NORM, 0);
115-
}
116-
if (mods & MOD_LALT) {
117-
draw_rect_filled_soft(MOD_DISPLAY_X + 20, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM);
118-
draw_string(MOD_DISPLAY_X + 23, MOD_DISPLAY_Y + 2, "A", PIXEL_OFF, NORM, 0);
119-
} else {
120-
draw_string(MOD_DISPLAY_X + 23, MOD_DISPLAY_Y + 2, "A", PIXEL_ON, NORM, 0);
121-
}
122-
if (mods & MOD_LGUI) {
123-
draw_rect_filled_soft(MOD_DISPLAY_X + 30, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM);
124-
draw_string(MOD_DISPLAY_X + 33, MOD_DISPLAY_Y + 2, "G", PIXEL_OFF, NORM, 0);
125-
} else {
126-
draw_string(MOD_DISPLAY_X + 33, MOD_DISPLAY_Y + 2, "G", PIXEL_ON, NORM, 0);
127-
}
128-
129-
/* Lock display is 23 x 32 */
130-
#define LOCK_DISPLAY_X 104
131-
#define LOCK_DISPLAY_Y 0
13277

133-
if (led_numlock == true) {
134-
draw_rect_filled_soft(LOCK_DISPLAY_X, LOCK_DISPLAY_Y, 5 + (3 * 6), 9, PIXEL_ON, NORM);
135-
draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 1, "NUM", PIXEL_OFF, NORM, 0);
136-
} else if (led_numlock == false) {
137-
draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 1, "NUM", PIXEL_ON, NORM, 0);
138-
}
139-
if (led_capslock == true) {
140-
draw_rect_filled_soft(LOCK_DISPLAY_X + 0, LOCK_DISPLAY_Y + 11, 5 + (3 * 6), 9, PIXEL_ON, NORM);
141-
draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 11 +1, "CAP", PIXEL_OFF, NORM, 0);
142-
} else if (led_capslock == false) {
143-
draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 11 +1, "CAP", PIXEL_ON, NORM, 0);
144-
}
145-
146-
if (led_scrolllock == true) {
147-
draw_rect_filled_soft(LOCK_DISPLAY_X + 0, LOCK_DISPLAY_Y + 22, 5 + (3 * 6), 9, PIXEL_ON, NORM);
148-
draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 22 +1, "SCR", PIXEL_OFF, NORM, 0);
149-
} else if (led_scrolllock == false) {
150-
draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 22 +1, "SCR", PIXEL_ON, NORM, 0);
151-
}
152-
send_buffer();
153-
}
154-
155-
void led_set_user(uint8_t usb_led) {
156-
if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
157-
if (led_numlock == false){led_numlock = true;}
158-
} else {
159-
if (led_numlock == true){led_numlock = false;}
78+
// outline
79+
for (uint8_t x = 0; x < 12; x++) {
80+
oled_write_pixel(MATRIX_DISPLAY_X + x, MATRIX_DISPLAY_Y, true);
81+
oled_write_pixel(MATRIX_DISPLAY_X + x, MATRIX_DISPLAY_Y + 12, true);
16082
}
161-
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
162-
if (led_capslock == false){led_capslock = true;}
163-
} else {
164-
if (led_capslock == true){led_capslock = false;}
83+
for (uint8_t y = 0; y < 12; y++) {
84+
oled_write_pixel(MATRIX_DISPLAY_X, MATRIX_DISPLAY_Y+y, true);
85+
oled_write_pixel(MATRIX_DISPLAY_X + 12, MATRIX_DISPLAY_Y+y, true);
16586
}
166-
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
167-
if (led_scrolllock == false){led_scrolllock = true;}
168-
} else {
169-
if (led_scrolllock == true){led_scrolllock = false;}
170-
}
171-
}
172-
173-
uint32_t layer_state_set_kb(uint32_t state) {
174-
state = layer_state_set_user(state);
175-
layer = biton32(state);
176-
queue_for_send = true;
177-
return state;
178-
}
179-
180-
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
181-
queue_for_send = true;
182-
return process_record_user(keycode, record);
183-
}
18487

185-
bool encoder_update_kb(uint8_t index, bool clockwise) {
186-
encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64;
187-
queue_for_send = true;
188-
return true;
189-
}
190-
191-
#endif
88+
// oled location
89+
for (uint8_t x = 0; x < 6; x++) {
90+
oled_write_pixel(MATRIX_DISPLAY_X + 5 + x, MATRIX_DISPLAY_Y + 2, true);
91+
oled_write_pixel(MATRIX_DISPLAY_X + 5 + x, MATRIX_DISPLAY_Y + 3, true);
92+
}
19293

193-
void matrix_init_kb(void) {
194-
queue_for_send = true;
195-
matrix_init_user();
94+
// bodge for layer number left hand side
95+
for (uint8_t y = 0; y < 8; y++) {
96+
oled_write_pixel(95, 0 + y, true);
97+
}
19698
}
197-
198-
void matrix_scan_kb(void) {
199-
if (queue_for_send) {
200-
#ifdef QWIIC_MICRO_OLED_ENABLE
201-
draw_ui();
20299
#endif
203-
queue_for_send = false;
204-
}
205-
#ifdef QWIIC_MICRO_OLED_ENABLE
206-
if (timer_elapsed(last_flush) > ScreenOffInterval) {
207-
send_command(DISPLAYOFF); /* 0xAE */
208-
}
209-
#endif
210-
if (counterst == 0) {
211-
//testPatternFB(o_fb);
212-
}
213-
counterst = (counterst + 1) % 1024;
214-
//rgblight_task();
215-
matrix_scan_user();
216-
}

keyboards/boston_meetup/2019/config.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,9 @@
4646
#define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f
4747
#endif
4848

49-
//configure qwiic micro_oled driver for the 128x32 oled
50-
#ifdef QWIIC_MICRO_OLED_ENABLE
49+
// configure oled driver for the 128x32 oled
50+
#define OLED_UPDATE_INTERVAL 33 // ~30fps
5151

52-
#undef I2C_ADDRESS_SA0_1
53-
#define I2C_ADDRESS_SA0_1 0b0111100
54-
#define LCDWIDTH 128
55-
#define LCDHEIGHT 32
56-
#define micro_oled_rotate_180
57-
58-
#endif
5952
/*
6053
* Keyboard Matrix Assignments
6154
*

keyboards/boston_meetup/2019/keymaps/default/keymap.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ enum custom_layers {
1313
};
1414

1515
enum custom_keycodes {
16-
BASE = SAFE_RANGE,
17-
LOWER,
16+
LOWER = SAFE_RANGE,
1817
RAISE,
19-
KC_DEMOMACRO
2018
};
2119

2220
// Custom macros
@@ -27,7 +25,6 @@ enum custom_keycodes {
2725
// Requires KC_TRNS/_______ for the trigger key in the destination layer
2826
#define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor
2927
#define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise
30-
#define DEMOMACRO KC_DEMOMACRO // Sample for macros
3128

3229

3330
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -115,14 +112,6 @@ layer_state_t layer_state_set_user(layer_state_t state) {
115112

116113
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
117114
switch (keycode) {
118-
case KC_DEMOMACRO:
119-
if (record->event.pressed) {
120-
// when keycode KC_DEMOMACRO is pressed
121-
SEND_STRING("QMK is the best thing ever!");
122-
} else {
123-
// when keycode KC_DEMOMACRO is released
124-
}
125-
break;
126115
case LOWER:
127116
if (record->event.pressed) {
128117
//not sure how to have keyboard check mode and set it to a variable, so my work around

keyboards/boston_meetup/2019/keymaps/readme.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

keyboards/boston_meetup/2019/rules.mk

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@ BOOTLOADER = stm32-dfu
88
# Build Options
99
# comment out to disable the options.
1010
#
11-
BACKLIGHT_ENABLE = no
12-
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
13-
MOUSEKEY_ENABLE = yes # Mouse keys
14-
EXTRAKEY_ENABLE = yes # Audio control and System control
15-
CONSOLE_ENABLE = no # Console for debug
16-
COMMAND_ENABLE = no # Commands for debug and configuration
17-
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
18-
NKRO_ENABLE = yes # USB Nkey Rollover
19-
CUSTOM_MATRIX = no # Custom matrix file
20-
AUDIO_ENABLE = yes
11+
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
12+
MOUSEKEY_ENABLE = yes # Mouse keys
13+
EXTRAKEY_ENABLE = yes # Audio control and System control
14+
CONSOLE_ENABLE = no # Console for debug
15+
COMMAND_ENABLE = no # Commands for debug and configuration
16+
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
17+
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
18+
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
19+
NKRO_ENABLE = yes # USB Nkey Rollover
20+
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
21+
AUDIO_ENABLE = yes # Audio output
2122
RGBLIGHT_ENABLE = no
2223
RGB_MATRIX_ENABLE = no
2324
RGB_MATRIX_DRIVER = WS2812
2425
HAPTIC_ENABLE += DRV2605L
25-
QWIIC_ENABLE = yes
26-
QWIIC_DRIVERS += MICRO_OLED
26+
OLED_ENABLE = yes
27+
OLED_DRIVER = SSD1306

0 commit comments

Comments
 (0)