-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patholed.c
38 lines (31 loc) · 1.06 KB
/
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
#pragma once
#include "progmem.h"
#include "animation.c"
extern uint8_t is_master;
static uint16_t oled_timer = 0;
//SSD1306 OLED update loop, make sure to enable OLED_ENABLE=yes in rules.mk
#ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (!is_keyboard_master())
return OLED_ROTATION_270; // flips the display 180 degrees if offhand
return rotation;
}
// When you add source files to SRC in rules.mk, you can use functions.
const char *read_layer_state(void);
void set_keylog(uint16_t keycode, keyrecord_t *record);
const char *read_keylog(void);
const char *read_keylogs(void);
void render_animation(uint8_t frame) {
oled_write_raw_P(animation[frame], sizeof(animation[frame]));
}
void oled_task_user(void) {
if (is_keyboard_master()) {
// If you want to change the display of OLED, you need to change here
oled_write_ln(read_layer_state(), false);
oled_write_ln(read_keylog(), false);
oled_write_ln(read_keylogs(), false);
} else {
render_animation((timer_read() / 60) % 8);
}
}
#endif // OLED_ENABLE