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
|
// Copyright 2022 Jose Pablo Ramirez (@jpe230)
// SPDX-License-Identifier: GPL-2.0-or-later
#include "jpe230.h"
#include "indicators.h"
extern uint8_t logged_row, logged_col;
extern uint32_t oled_timer;
extern const uint8_t key_frame[4];
static uint32_t frame_limiter;
void oled_render_layer_state(void) {
int current_layer_idx = get_highest_layer(layer_state | default_layer_state);
static int current_frame = 0;
static bool first_run = 1;
if(first_run){
first_run = 0;
char clear[ANIM_SIZE] = {0};
memset(clear, 0, ANIM_SIZE);
oled_write_raw_P(clear, ANIM_SIZE);
frame_limiter = timer_read();
return;
}
if (timer_elapsed(frame_limiter) < 12) {
return;
}
frame_limiter = timer_read();
if(current_frame < key_frame[current_layer_idx]){
current_frame = (current_frame + 1) % IDLE_FRAMES;
change_frame_up(current_frame);
}else if(current_frame > key_frame[current_layer_idx]) {
current_frame = (current_frame - 1) % IDLE_FRAMES;
change_frame_down(IDLE_FRAMES - current_frame - 1);
}
}
void render_master_oled() {
if (timer_elapsed32(oled_timer) > CUSTOM_OLED_TIMEOUT) {
oled_off();
return;
}
oled_on();
/* Render the layar state */
oled_render_layer_state();
/* Move cursor bellow the graphic */
oled_set_cursor(0, 12);
/* Print logged col and row
* Format: 00x00
*/
char logged_matrix[9] = {0};
sprintf(logged_matrix, "%02dx%02d", logged_col, logged_row);
/* Write a separator char: ◆,
* make sure to add a NULL terminator otherwise strlen could fail
*/
static const char PROGMEM separator[] = {4, 4, 4, 4, 4, 0};
oled_write(separator, false);
/* Write logged matrix position */
oled_write(logged_matrix, false);
/* Write another separator */
oled_write(separator, false);
/* Write scanrate */
oled_write(get_u16_str(get_matrix_scan_rate(), ' '), false);
}
oled_rotation_t rotate_master(oled_rotation_t rotation) {return OLED_ROTATION_270;}
|