summaryrefslogtreecommitdiff
path: root/keyboards/rubi/rubi.h
blob: e7c8ae137ad92f07adf781e9105eba9dbe39bb64 (plain)
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
/* Copyright 2021 gregorio
 *
 * 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/>.
 */
#pragma once

#include "quantum.h"

#define CALC_DIGITS 12

enum rubi_keycodes {
    ENC_PRESS = QK_KB_0,
    CL_PLUS,
    CL_STAR,
    CL_TYPE
};

enum oled_modes {
    OLED_MODE_DEFAULT,
    OLED_MODE_CALC,
    OLED_MODE_OFF,
    _NUM_OLED_MODES
};

enum encoder_modes {
    ENC_MODE_VOLUME,
    ENC_MODE_MEDIA,
    ENC_MODE_BRIGHTNESS,
    _NUM_ENCODER_MODES
};

extern uint8_t current_layer;
extern uint8_t oled_mode;
extern uint8_t encoder_mode;

extern char calc_result_display[CALC_DIGITS+1];
extern char calc_operator_display;
extern char calc_status_display[CALC_DIGITS+1];
extern uint8_t calc_display_lines;

bool process_record_user_oled(uint16_t keycode, keyrecord_t *record);
void change_oled_mode(void);

void change_encoder_mode(bool reverse);
uint16_t handle_encoder_cw(void);
uint16_t handle_encoder_ccw(void);
uint16_t handle_encoder_press(void);

void calcUpdate(void);
void calcInput(char input);
void calcOperands(void);