-
Notifications
You must be signed in to change notification settings - Fork 0
/
chiffre_oled.c
123 lines (110 loc) · 5.59 KB
/
chiffre_oled.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* Copyright (C) 2021 @dreipunkteinsvier
*
* 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 QMK_KEYBOARD_H
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_90; // rotates for proper orientation
}
void render_lechiffre_logo(void) {
static const char PROGMEM lechiffre_logo[] = {
// 'ChurchOfChiffreSmall', 32x20px
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0xc0, 0x00, 0xe0, 0x00, 0xf0, 0x00, 0xf0, 0x10, 0x10, 0x00,
0xe0, 0x20, 0x20, 0x00, 0xc0, 0xc0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x40, 0x00, 0x00,
0x00, 0x00, 0x06, 0x0f, 0x19, 0x00, 0x3f, 0x06, 0x7f, 0x00, 0xff, 0x00, 0xff, 0x06, 0x06, 0x00,
0x7f, 0x06, 0x06, 0x00, 0x3f, 0x06, 0x1e, 0x17, 0x00, 0x06, 0x0f, 0x1f, 0x36, 0x26, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
oled_write_raw_P(lechiffre_logo, sizeof(lechiffre_logo));
}
void render_lechiffre_logo_large(void) {
static const char PROGMEM lechiffre_logo_large[] = {
// 'ChurchOfChiffre', 32x75px
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xf0, 0xf8, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0xf8, 0xf8,
0xf8, 0xf8, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xf0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff,
0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe0, 0xf0, 0xf8, 0x3c, 0x1c, 0x1c, 0x3c, 0xfc,
0xfc, 0xfc, 0x38, 0x18, 0x18, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0xe0, 0xe6, 0x67, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xe7, 0xe7,
0xe7, 0xe7, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x9c, 0x9f, 0x9f, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x9f, 0x9f,
0x9f, 0x9f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x18, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x7f, 0x7f,
0x7f, 0x7f, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x00, 0x00,
0x00, 0x00, 0x06, 0x4e, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce,
0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0x4e, 0x06, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x09, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x3f, 0x3f,
0x3f, 0x3f, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x19, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7e, 0xfc,
0xfc, 0x7e, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
oled_write_raw_P(lechiffre_logo_large, sizeof(lechiffre_logo_large));
}
static void render_layer_status(void) {
oled_write_P(PSTR("-----"), false);
switch (get_highest_layer(layer_state)) {
case 0:
oled_write_P(PSTR("QWRTY"), false);
break;
case 1:
oled_write_P(PSTR("COLDH"), false);
break;
case 2:
oled_write_ln_P(PSTR(" NAV"), false);
break;
case 3:
oled_write_ln_P(PSTR(" MED"), false);
break;
case 4:
oled_write_ln_P(PSTR(" NAV"), false);
break;
case 5:
oled_write_ln_P(PSTR(" FUN"), false);
break;
default:
oled_write_ln_P(PSTR("?????"), false);
}
}
void render_keylock_status(led_t led_state) {
oled_write_P(PSTR("-----"), false);
oled_write_P(PSTR("C"), led_state.caps_lock);
oled_write_P(PSTR(" "), false);
oled_write_P(PSTR("N"), led_state.num_lock);
oled_write_P(PSTR(" "), false);
oled_write_P(PSTR("S"), led_state.scroll_lock);
//oled_write_ln_P(PSTR(" "), false);
}
void render_mod_status(uint8_t modifiers) {
oled_write_P(PSTR("-----"), false);
oled_write_ln_P(PSTR("SHFT"), (modifiers & MOD_MASK_SHIFT));
oled_write_ln_P(PSTR("ALT"), (modifiers & MOD_MASK_ALT));
oled_write_ln_P(PSTR("CTRL"), (modifiers & MOD_MASK_CTRL));
oled_write_ln_P(PSTR("GUI"), (modifiers & MOD_MASK_GUI));
}
bool oled_task_user(void) {
// render_lechiffre_logo();
// oled_set_cursor(0,3);
// render_layer_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
// render_mod_status(get_mods()|get_oneshot_mods());
// render_keylock_status(host_keyboard_led_state());
oled_set_cursor(0,1);
render_lechiffre_logo_large();
oled_set_cursor(0,12);
render_layer_status();
return false;
}