rubi.h (1622B)
1 /* Copyright 2021 gregorio 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 #pragma once 17 18 #include "quantum.h" 19 20 #define CALC_DIGITS 12 21 22 enum rubi_keycodes { 23 ENC_PRESS = QK_KB_0, 24 CL_PLUS, 25 CL_STAR, 26 CL_TYPE 27 }; 28 29 enum oled_modes { 30 OLED_MODE_DEFAULT, 31 OLED_MODE_CALC, 32 OLED_MODE_OFF, 33 _NUM_OLED_MODES 34 }; 35 36 enum encoder_modes { 37 ENC_MODE_VOLUME, 38 ENC_MODE_MEDIA, 39 ENC_MODE_BRIGHTNESS, 40 _NUM_ENCODER_MODES 41 }; 42 43 extern uint8_t current_layer; 44 extern uint8_t oled_mode; 45 extern uint8_t encoder_mode; 46 47 extern char calc_result_display[CALC_DIGITS+1]; 48 extern char calc_operator_display; 49 extern char calc_status_display[CALC_DIGITS+1]; 50 extern uint8_t calc_display_lines; 51 52 bool process_record_user_oled(uint16_t keycode, keyrecord_t *record); 53 void change_oled_mode(void); 54 55 void change_encoder_mode(bool reverse); 56 uint16_t handle_encoder_cw(void); 57 uint16_t handle_encoder_ccw(void); 58 uint16_t handle_encoder_press(void); 59 60 void calcUpdate(void); 61 void calcInput(char input); 62 void calcOperands(void);