diff options
Diffstat (limited to 'keyboards/boston_meetup/2019/2019.c')
-rw-r--r-- | keyboards/boston_meetup/2019/2019.c | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/keyboards/boston_meetup/2019/2019.c b/keyboards/boston_meetup/2019/2019.c new file mode 100644 index 000000000..e558048f6 --- /dev/null +++ b/keyboards/boston_meetup/2019/2019.c | |||
@@ -0,0 +1,98 @@ | |||
1 | /* Copyright 2019 ishtob | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #include "2019.h" | ||
17 | |||
18 | #ifdef RGB_MATRIX_ENABLE | ||
19 | #include "rgb_matrix.h" | ||
20 | |||
21 | led_config_t g_led_config = { { | ||
22 | { 5, NO_LED, NO_LED, 0 }, | ||
23 | { NO_LED, NO_LED, NO_LED, NO_LED }, | ||
24 | { 4, NO_LED, NO_LED, 1 }, | ||
25 | { 3, NO_LED, NO_LED, 2 } | ||
26 | }, { | ||
27 | { 188, 16 }, { 187, 48 }, { 149, 64 }, { 112, 64 }, { 37, 48 }, { 38, 16 } | ||
28 | }, { | ||
29 | 4, 4, 4, 4, 4, 4 | ||
30 | } }; | ||
31 | #endif | ||
32 | |||
33 | #ifdef OLED_ENABLE | ||
34 | oled_rotation_t oled_init_kb(oled_rotation_t rotation) { return OLED_ROTATION_180; } | ||
35 | |||
36 | bool oled_task_kb(void) { | ||
37 | if (!oled_task_user()) { | ||
38 | return false; | ||
39 | } | ||
40 | oled_write_P(PSTR("BOSTON MK LAYER"), false); | ||
41 | oled_advance_char(); | ||
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(); | ||
62 | |||
63 | /* Matrix display is 12 x 12 pixels */ | ||
64 | #define MATRIX_DISPLAY_X 8 | ||
65 | #define MATRIX_DISPLAY_Y 16 | ||
66 | |||
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 | |||
72 | // force on for oled location | ||
73 | if((x == 0) && (y >= (MATRIX_COLS - 2))) on = 1; | ||
74 | |||
75 | oled_write_pixel(MATRIX_DISPLAY_X + y + y + 2, MATRIX_DISPLAY_Y + x + x + 2, on); | ||
76 | oled_write_pixel(MATRIX_DISPLAY_X + y + y + 3, MATRIX_DISPLAY_Y + x + x + 2, on); | ||
77 | oled_write_pixel(MATRIX_DISPLAY_X + y + y + 2, MATRIX_DISPLAY_Y + x + x + 3, on); | ||
78 | oled_write_pixel(MATRIX_DISPLAY_X + y + y + 3, MATRIX_DISPLAY_Y + x + x + 3, on); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | // outline | ||
83 | for (uint8_t x = 0; x < 12; x++) { | ||
84 | oled_write_pixel(MATRIX_DISPLAY_X + x, MATRIX_DISPLAY_Y, true); | ||
85 | oled_write_pixel(MATRIX_DISPLAY_X + x, MATRIX_DISPLAY_Y + 12, true); | ||
86 | } | ||
87 | for (uint8_t y = 0; y < 12; y++) { | ||
88 | oled_write_pixel(MATRIX_DISPLAY_X, MATRIX_DISPLAY_Y+y, true); | ||
89 | oled_write_pixel(MATRIX_DISPLAY_X + 12, MATRIX_DISPLAY_Y+y, true); | ||
90 | } | ||
91 | |||
92 | // bodge for layer number left hand side | ||
93 | for (uint8_t y = 0; y < 8; y++) { | ||
94 | oled_write_pixel(95, 0 + y, true); | ||
95 | } | ||
96 | return false; | ||
97 | } | ||
98 | #endif | ||