mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-12-26 02:58:06 +06:00
[Keyboard] Add Rubi Numpad (#12283)
Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
parent
2b8f1fcdfb
commit
1a3064afb1
65
keyboards/rubi/config.h
Normal file
65
keyboards/rubi/config.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
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 "config_common.h"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0x4752
|
||||
#define PRODUCT_ID 0x5242
|
||||
#define DEVICE_VER 0x0001
|
||||
#define MANUFACTURER gregorio
|
||||
#define PRODUCT Rubi
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 4
|
||||
|
||||
/*
|
||||
* Keyboard Matrix Assignments
|
||||
*
|
||||
* Change this to how you wired your keyboard
|
||||
* COLS: AVR pins used for columns, left to right
|
||||
* ROWS: AVR pins used for rows, top to bottom
|
||||
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
|
||||
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
|
||||
*
|
||||
*/
|
||||
#define MATRIX_ROW_PINS { F0, F1, F4, F5, F6 }
|
||||
#define MATRIX_COL_PINS { B3, B2, B1, F7 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
#define ENCODERS_PAD_A { D7 }
|
||||
#define ENCODERS_PAD_B { D6 }
|
||||
|
||||
/* COL2ROW, ROW2COL */
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
/* Locking resynchronize hack */
|
||||
#define LOCKING_RESYNC_ENABLE
|
||||
|
||||
/* disable these deprecated features by default */
|
||||
#define NO_ACTION_MACRO
|
||||
#define NO_ACTION_FUNCTION
|
||||
|
||||
#define OLED_FONT_H "lib/glcdfont.c"
|
31
keyboards/rubi/info.json
Normal file
31
keyboards/rubi/info.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"keyboard_name": "Rubi",
|
||||
"url": "https://github.com/ohchiko/qmk_firmware/tree/master/keyboards/rubi",
|
||||
"maintainer": "gregorio",
|
||||
"width": 4,
|
||||
"height": 5,
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{"x":3, "y":0},
|
||||
{"x":0, "y":1.25},
|
||||
{"x":1, "y":1.25},
|
||||
{"x":2, "y":1.25},
|
||||
{"x":3, "y":1.25},
|
||||
{"x":0, "y":2.25},
|
||||
{"x":1, "y":2.25},
|
||||
{"x":2, "y":2.25},
|
||||
{"x":3, "y":2.25, "h":2},
|
||||
{"x":0, "y":3.25},
|
||||
{"x":1, "y":3.25},
|
||||
{"x":2, "y":3.25},
|
||||
{"x":0, "y":4.25},
|
||||
{"x":1, "y":4.25},
|
||||
{"x":2, "y":4.25},
|
||||
{"x":3, "y":4.25, "h":2},
|
||||
{"x":0, "y":5.25, "w":2},
|
||||
{"x":2, "y":5.25}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
58
keyboards/rubi/keymaps/default/keymap.c
Normal file
58
keyboards/rubi/keymaps/default/keymap.c
Normal file
@ -0,0 +1,58 @@
|
||||
/* Copyright 2020 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/>.
|
||||
*/
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
|
||||
// enum custom_keycodes {
|
||||
// FIRST = NEW_SAFE_RANGE,
|
||||
// };
|
||||
|
||||
// Defines names for use in layer keycodes and the keymap
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Base */
|
||||
[0] = LAYOUT(
|
||||
ENC_PRESS,
|
||||
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
|
||||
KC_P7 , KC_P8 , KC_P9 , KC_PPLS,
|
||||
KC_P4 , KC_P5 , KC_P6 ,
|
||||
KC_P1 , KC_P2 , KC_P3 , KC_PENT,
|
||||
KC_P0 , LT(2, KC_PDOT)
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
KC_TRNS,
|
||||
KC_C , KC_SLSH, CL_STAR, KC_MINS,
|
||||
KC_7 , KC_8 , KC_9 , CL_PLUS,
|
||||
KC_4 , KC_5 , KC_6 ,
|
||||
KC_1 , KC_2 , KC_3 , KC_EQL,
|
||||
KC_0 , KC_DOT
|
||||
),
|
||||
[2] = LAYOUT(
|
||||
KC_TRNS,
|
||||
KC_TRNS, KC_N , KC_S , KC_R ,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS
|
||||
),
|
||||
[3] = LAYOUT(
|
||||
KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, RESET , KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS
|
||||
),
|
||||
};
|
4
keyboards/rubi/keymaps/default/readme.md
Normal file
4
keyboards/rubi/keymaps/default/readme.md
Normal file
@ -0,0 +1,4 @@
|
||||
# The default keymap for Rubi
|
||||
|
||||
[KLE](http://www.keyboard-layout-editor.com/#/gists/984e9039971cf4738d507150b4494190)
|
||||
![Rubi Default Keymap](https://i.imgur.com/bsG8BdW.jpg)
|
53
keyboards/rubi/keymaps/via/keymap.c
Normal file
53
keyboards/rubi/keymaps/via/keymap.c
Normal file
@ -0,0 +1,53 @@
|
||||
/* Copyright 2020 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/>.
|
||||
*/
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
// Defines names for use in layer keycodes and the keymap
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Base */
|
||||
[0] = LAYOUT(
|
||||
ENC_PRESS,
|
||||
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
|
||||
KC_P7 , KC_P8 , KC_P9 , KC_PPLS,
|
||||
KC_P4 , KC_P5 , KC_P6 ,
|
||||
KC_P1 , KC_P2 , KC_P3 , KC_PENT,
|
||||
KC_P0 , LT(2, KC_PDOT)
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
KC_TRNS,
|
||||
KC_C , KC_SLSH, CL_STAR, KC_MINS,
|
||||
KC_7 , KC_8 , KC_9 , CL_PLUS,
|
||||
KC_4 , KC_5 , KC_6 ,
|
||||
KC_1 , KC_2 , KC_3 , KC_EQL,
|
||||
KC_0 , KC_DOT
|
||||
),
|
||||
[2] = LAYOUT(
|
||||
KC_TRNS,
|
||||
KC_TRNS, KC_N , KC_S , KC_R ,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS
|
||||
),
|
||||
[3] = LAYOUT(
|
||||
KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, RESET , KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS
|
||||
),
|
||||
};
|
2
keyboards/rubi/keymaps/via/rules.mk
Normal file
2
keyboards/rubi/keymaps/via/rules.mk
Normal file
@ -0,0 +1,2 @@
|
||||
VIA_ENABLE = yes
|
||||
LTO_ENABLE = yes
|
261
keyboards/rubi/lib/calc.c
Normal file
261
keyboards/rubi/lib/calc.c
Normal file
@ -0,0 +1,261 @@
|
||||
/*
|
||||
This is the modified version of [calculator by MWWorks](https://github.com/MWWorks/mw_calc_numpad/blob/master/calc.c). Below is the quote from [MWWorks](https://github.com/MWWorks).
|
||||
|
||||
Calculator for QMK-based keyboard by MWWorks, https://mwworks.uk
|
||||
This is free, usual disclaimers, don't use it to calculate megaton yields, surgery plans, etc
|
||||
|
||||
I did not plan to reinvent the wheel for this - I figured surely somebody somewhere has working calculator code?
|
||||
Found lots but none that actually work like you expect a calculator to, hence DIYing it
|
||||
|
||||
As such, this is probably a bit janky, especially as I am a bit of a hack at C
|
||||
Seems to be working well, with occasional glitchs, solved by clearing it
|
||||
And some occasional floating-point issues - eg get a long decimal rather than the whole number you were expecting
|
||||
Feel free to fix it! I think it needs to detect the precision of the two operands and then figure out what the precision of the result should be
|
||||
|
||||
*/
|
||||
#include "rubi.h"
|
||||
|
||||
static uint8_t calc_current_operand = 0;
|
||||
static char calc_operand_0[CALC_DIGITS+1] = "";
|
||||
static char calc_operand_1[CALC_DIGITS+1] = "";
|
||||
char calc_result[CALC_DIGITS+1] = "";
|
||||
static char calc_status[CALC_DIGITS+1] = "";
|
||||
static char calc_operator = ' ';
|
||||
static bool calc_reset = false;
|
||||
|
||||
|
||||
void calcBegin(void){
|
||||
}
|
||||
|
||||
//update display
|
||||
void calcUpdate(void){
|
||||
if (calc_display_lines == 2) {
|
||||
if((calc_current_operand == 1) || (calc_reset)){
|
||||
strcpy(calc_status, calc_operand_0);
|
||||
if((strlen(calc_operand_0)>0) || (strlen(calc_operand_1)>0)){
|
||||
uint8_t len = strlen(calc_status);
|
||||
if (!(calc_operator == 's' || calc_operator == 'r' || calc_operator == 'n')) {
|
||||
calc_status[len] = calc_operator;
|
||||
}
|
||||
calc_status[len+1] = 0;
|
||||
if(calc_reset
|
||||
&& !(calc_operator == 's' || calc_operator == 'r' || calc_operator == 'n')){
|
||||
strncat(calc_status, calc_operand_1, CALC_DIGITS-strlen(calc_status));
|
||||
calc_operator = ' ';
|
||||
}
|
||||
}
|
||||
strcpy(calc_status_display, calc_status);
|
||||
}
|
||||
} else if (calc_display_lines == 1) {
|
||||
if(calc_reset
|
||||
&& !(calc_operator == 's' || calc_operator == 'r' || calc_operator == 'n')){
|
||||
calc_operator = ' ';
|
||||
}
|
||||
}
|
||||
calc_operator_display = calc_operator;
|
||||
strcpy(calc_result_display, calc_result);
|
||||
}
|
||||
|
||||
//perform calculation on the 2 operands
|
||||
void calcOperands(void){
|
||||
float result = 0;
|
||||
switch (calc_operator){
|
||||
|
||||
//standard operators
|
||||
case '+':
|
||||
result = strtod(calc_operand_0, NULL) + strtod(calc_operand_1, NULL);
|
||||
break;
|
||||
|
||||
case '-':
|
||||
result = strtod(calc_operand_0, NULL) - strtod(calc_operand_1, NULL);
|
||||
break;
|
||||
|
||||
case '/':
|
||||
result = strtod(calc_operand_0, NULL) / strtod(calc_operand_1, NULL);
|
||||
break;
|
||||
|
||||
case '*':
|
||||
result = strtod(calc_operand_0, NULL) * strtod(calc_operand_1, NULL);
|
||||
break;
|
||||
|
||||
//single operand operators - these are all in 2
|
||||
case 's':
|
||||
result = sqrt(strtod(calc_operand_0, NULL));
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
result = 1/(strtod(calc_operand_0, NULL));
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
//now convert the float result into a string
|
||||
//we know the total string size but we need to find the size of the integer component to know how much we have for decimals
|
||||
uint8_t magnitude = ceil(log10(result));
|
||||
uint8_t max_decimals = CALC_DIGITS-magnitude-1;
|
||||
//but max it at 7 because that seems the useful limit of our floats
|
||||
if(max_decimals>7){
|
||||
max_decimals = 7;
|
||||
}
|
||||
dtostrf(result, CALC_DIGITS, max_decimals, calc_result);
|
||||
|
||||
//now to clean up the result - we need it clean as it may be the input of next calculation
|
||||
//this seems a lot of code to format this string :| note that this c doesn't support float in sprintf
|
||||
uint8_t i;
|
||||
|
||||
//first find if theres a dot
|
||||
uint8_t dotpos = CALC_DIGITS+1;
|
||||
for(i=0; i<strlen(calc_result); i++){
|
||||
if(calc_result[i] == '.'){
|
||||
dotpos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//if there is, work back to it and remove trailing 0 or .
|
||||
if(dotpos>=0){
|
||||
for(i=strlen(calc_result)-1; i>=dotpos; i--){
|
||||
if((calc_result[i] == '0') || (calc_result[i] == '.')){
|
||||
calc_result[i] = 0;
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//now find how many leading spaces
|
||||
uint8_t spaces = 0;
|
||||
for(i=0; i<strlen(calc_result); i++){
|
||||
if(calc_result[i] == ' '){
|
||||
spaces++;
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//and shift the string
|
||||
for(i=0; i<strlen(calc_result)-spaces; i++){
|
||||
calc_result[i] = calc_result[i+spaces];
|
||||
}
|
||||
calc_result[strlen(calc_result)-spaces] = 0;
|
||||
|
||||
calcUpdate();
|
||||
//the result is available as the first operand for another calculation
|
||||
strcpy(calc_operand_0, calc_result);
|
||||
calc_operand_1[0] = 0;
|
||||
|
||||
}
|
||||
|
||||
void calcInput(char input){
|
||||
char *operand = calc_operand_0;
|
||||
if(calc_current_operand == 1){
|
||||
operand = calc_operand_1;
|
||||
}
|
||||
uint8_t len = strlen(operand);
|
||||
|
||||
if(
|
||||
((input >= 48) && (input <= 57)) ||
|
||||
(input == '.')
|
||||
){
|
||||
//if this is following an equals, then we start from scratch as if new calculation
|
||||
if(calc_reset == true){
|
||||
calc_reset = false;
|
||||
calc_current_operand = 0;
|
||||
calc_operand_0[0] = 0;
|
||||
calc_operand_1[0] = 0;
|
||||
operand = calc_operand_0;
|
||||
len = 0;
|
||||
}
|
||||
|
||||
if(len<CALC_DIGITS){
|
||||
operand[len] = input;
|
||||
operand[len+1] = 0;
|
||||
strcpy(calc_result, operand);
|
||||
calcUpdate();
|
||||
}
|
||||
|
||||
//special input to backspace
|
||||
}else if(input == 'x'){
|
||||
operand[len-1] = 0;
|
||||
strcpy(calc_result, operand);
|
||||
calcUpdate();
|
||||
|
||||
//clear
|
||||
}else if(input == 'c'){
|
||||
operand[0] = 0;
|
||||
calc_operand_0[0] = 0;
|
||||
calc_operand_1[0] = 0;
|
||||
calc_operator = ' ';
|
||||
calc_reset = true;
|
||||
strcpy(calc_result, operand);
|
||||
calcUpdate();
|
||||
|
||||
//special input switch neg/pos
|
||||
}else if((input == 'n') && (len>0)){
|
||||
uint8_t i;
|
||||
|
||||
if(operand[0] == '-'){
|
||||
for(i=1; i<=len; i++){
|
||||
operand[i-1] = operand[i];
|
||||
}
|
||||
}else if(len<CALC_DIGITS){
|
||||
for(i=0; i<=len; i++){
|
||||
operand[len-i+1] = operand[len-i];
|
||||
}
|
||||
operand[0] = '-';
|
||||
}
|
||||
calc_operator = input;
|
||||
strcpy(calc_result, operand);
|
||||
calcUpdate();
|
||||
|
||||
|
||||
//standard 2 operand operators
|
||||
}else if((input == '+') || (input == '-') || (input == '*') || (input == '/')){
|
||||
|
||||
//get ready for second operand
|
||||
if(calc_current_operand == 0){
|
||||
calc_operator = input;
|
||||
calc_current_operand = 1;
|
||||
calcUpdate();
|
||||
|
||||
//we pressed = we now expect a new second operand
|
||||
}else if(calc_reset){
|
||||
calc_operator = input;
|
||||
calc_reset = false;
|
||||
calc_operand_1[0] = 0;
|
||||
calcUpdate();
|
||||
|
||||
}else {
|
||||
//if we use this on the second operand, calculate first, then ready for a second operand again
|
||||
if (strlen(calc_operand_1)>0){
|
||||
calcOperands();
|
||||
}
|
||||
calc_operand_1[0] = 0;
|
||||
calc_operator = input;
|
||||
calcUpdate();
|
||||
}
|
||||
|
||||
|
||||
}else if(input == '='){
|
||||
//only accept = if we are on the second operand
|
||||
if(calc_current_operand == 1){
|
||||
//keep the second operand for a subsequent press of =; but flag to reset if start entry of new operand
|
||||
calc_reset = true;
|
||||
calcOperands();
|
||||
}
|
||||
|
||||
//single operands - square root and reciprocal - needs to operate on 0 so it works after a previous = result
|
||||
}else if((input == 's') || (input == 'r')){
|
||||
//but maybe we started entering 1
|
||||
if(calc_current_operand == 1 && !calc_reset){
|
||||
strcpy(calc_operand_0, calc_operand_1);
|
||||
}
|
||||
calc_current_operand = 1;
|
||||
calc_operand_1[0] = 0;
|
||||
calc_operator = input;
|
||||
calc_reset = true; //simulate another =
|
||||
calcOperands();
|
||||
|
||||
}
|
||||
|
||||
}
|
115
keyboards/rubi/lib/encoder.c
Normal file
115
keyboards/rubi/lib/encoder.c
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include "rubi.h"
|
||||
|
||||
void change_encoder_mode(bool reverse) {
|
||||
if (reverse) {
|
||||
if (encoder_mode == 0) {
|
||||
encoder_mode = _NUM_ENCODER_MODES - 1;
|
||||
} else {
|
||||
encoder_mode = encoder_mode - 1;
|
||||
}
|
||||
} else {
|
||||
encoder_mode = (encoder_mode + 1) % _NUM_ENCODER_MODES;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t handle_encoder_cw(void) {
|
||||
uint16_t mapped_code = 0;
|
||||
|
||||
if (oled_mode == OLED_MODE_CALC) {
|
||||
layer_on(2);
|
||||
return mapped_code;
|
||||
}
|
||||
|
||||
switch (encoder_mode) {
|
||||
default:
|
||||
case ENC_MODE_VOLUME:
|
||||
mapped_code = KC_VOLU;
|
||||
break;
|
||||
case ENC_MODE_MEDIA:
|
||||
mapped_code = KC_MEDIA_NEXT_TRACK;
|
||||
break;
|
||||
case ENC_MODE_BRIGHTNESS:
|
||||
mapped_code = KC_BRIGHTNESS_UP;
|
||||
break;
|
||||
}
|
||||
|
||||
return mapped_code;
|
||||
}
|
||||
|
||||
uint16_t handle_encoder_ccw(void) {
|
||||
uint16_t mapped_code = 0;
|
||||
|
||||
if (oled_mode == OLED_MODE_CALC) {
|
||||
layer_off(2);
|
||||
return mapped_code;
|
||||
}
|
||||
|
||||
switch (encoder_mode) {
|
||||
default:
|
||||
case ENC_MODE_VOLUME:
|
||||
mapped_code = KC_VOLD;
|
||||
break;
|
||||
case ENC_MODE_MEDIA:
|
||||
mapped_code = KC_MEDIA_PREV_TRACK;
|
||||
break;
|
||||
case ENC_MODE_BRIGHTNESS:
|
||||
mapped_code = KC_BRIGHTNESS_DOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
return mapped_code;
|
||||
}
|
||||
|
||||
uint16_t handle_encoder_press(void) {
|
||||
uint16_t mapped_code = 0;
|
||||
if (get_highest_layer(layer_state) == 1) {
|
||||
if (oled_mode == OLED_MODE_CALC) {
|
||||
layer_on(3);
|
||||
}
|
||||
layer_off(1);
|
||||
return mapped_code;
|
||||
} else if (get_highest_layer(layer_state) == 2) {
|
||||
if (oled_mode == OLED_MODE_CALC) {
|
||||
layer_off(1);
|
||||
layer_on(3);
|
||||
} else {
|
||||
layer_on(1);
|
||||
}
|
||||
layer_off(2);
|
||||
return mapped_code;
|
||||
} else if (get_highest_layer(layer_state) == 3) {
|
||||
if (oled_mode == OLED_MODE_OFF) {
|
||||
layer_off(3);
|
||||
}
|
||||
return mapped_code;
|
||||
}
|
||||
|
||||
switch (encoder_mode) {
|
||||
default:
|
||||
case ENC_MODE_VOLUME:
|
||||
mapped_code = KC_MUTE;
|
||||
break;
|
||||
case ENC_MODE_MEDIA:
|
||||
mapped_code = KC_MEDIA_PLAY_PAUSE;
|
||||
break;
|
||||
}
|
||||
|
||||
return mapped_code;
|
||||
}
|
246
keyboards/rubi/lib/glcdfont.c
Normal file
246
keyboards/rubi/lib/glcdfont.c
Normal file
@ -0,0 +1,246 @@
|
||||
/* 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 "progmem.h"
|
||||
|
||||
|
||||
const unsigned char font[] PROGMEM = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00,
|
||||
0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00,
|
||||
0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00,
|
||||
0x18, 0x3C, 0x7E, 0xBC, 0x18, 0x00,
|
||||
0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00,
|
||||
0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00,
|
||||
0x00, 0x18, 0x3C, 0x18, 0x00, 0x00,
|
||||
0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00,
|
||||
0x00, 0x18, 0x24, 0x18, 0x00, 0x00,
|
||||
0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00,
|
||||
0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00,
|
||||
0x26, 0x29, 0x79, 0x29, 0x26, 0x00,
|
||||
0x40, 0x7F, 0x05, 0x05, 0x07, 0x00,
|
||||
0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00,
|
||||
0x5A, 0x3C, 0x66, 0x3C, 0x5A, 0x00,
|
||||
0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00,
|
||||
0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00,
|
||||
0x14, 0x22, 0x7F, 0x22, 0x14, 0x00,
|
||||
0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00,
|
||||
0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00,
|
||||
0x00, 0x66, 0x89, 0x95, 0x6A, 0x00,
|
||||
0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
|
||||
0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00,
|
||||
0x08, 0x04, 0x7E, 0x04, 0x08, 0x00,
|
||||
0x10, 0x20, 0x7E, 0x20, 0x10, 0x00,
|
||||
0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00,
|
||||
0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00,
|
||||
0x1E, 0x10, 0x10, 0x10, 0x10, 0x00,
|
||||
0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00,
|
||||
0x30, 0x38, 0x3E, 0x38, 0x30, 0x00,
|
||||
0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x5E, 0x00, 0x00, 0x00,
|
||||
0x00, 0x06, 0x00, 0x06, 0x00, 0x00,
|
||||
0x14, 0x3E, 0x14, 0x3E, 0x14, 0x00,
|
||||
0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00,
|
||||
0x26, 0x16, 0x08, 0x34, 0x32, 0x00,
|
||||
0x36, 0x4A, 0x56, 0x20, 0x50, 0x00,
|
||||
0x00, 0x0A, 0x06, 0x00, 0x00, 0x00,
|
||||
0x00, 0x3C, 0x42, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x42, 0x3C, 0x00, 0x00,
|
||||
0x14, 0x08, 0x3E, 0x08, 0x14, 0x00,
|
||||
0x08, 0x08, 0x3E, 0x08, 0x08, 0x00,
|
||||
0x00, 0xA0, 0x60, 0x00, 0x00, 0x00,
|
||||
0x08, 0x08, 0x08, 0x08, 0x08, 0x00,
|
||||
0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
|
||||
0x20, 0x10, 0x08, 0x04, 0x02, 0x00,
|
||||
0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00,
|
||||
0x00, 0x42, 0x7F, 0x40, 0x00, 0x00,
|
||||
0x72, 0x49, 0x49, 0x49, 0x46, 0x00,
|
||||
0x21, 0x41, 0x45, 0x45, 0x3B, 0x00,
|
||||
0x38, 0x26, 0x21, 0x7F, 0x20, 0x00,
|
||||
0x2F, 0x49, 0x49, 0x49, 0x31, 0x00,
|
||||
0x3E, 0x49, 0x49, 0x49, 0x31, 0x00,
|
||||
0x01, 0x01, 0x61, 0x19, 0x07, 0x00,
|
||||
0x36, 0x49, 0x49, 0x49, 0x36, 0x00,
|
||||
0x4E, 0x51, 0x51, 0x51, 0x3E, 0x00,
|
||||
0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
|
||||
0x00, 0x40, 0x34, 0x00, 0x00, 0x00,
|
||||
0x00, 0x08, 0x14, 0x22, 0x00, 0x00,
|
||||
0x14, 0x14, 0x14, 0x14, 0x14, 0x00,
|
||||
0x00, 0x00, 0x22, 0x14, 0x08, 0x00,
|
||||
0x00, 0x04, 0x52, 0x0A, 0x04, 0x00,
|
||||
0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00,
|
||||
0x7E, 0x09, 0x09, 0x09, 0x7E, 0x00,
|
||||
0x7F, 0x49, 0x49, 0x49, 0x36, 0x00,
|
||||
0x3E, 0x41, 0x41, 0x41, 0x22, 0x00,
|
||||
0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00,
|
||||
0x7F, 0x49, 0x49, 0x49, 0x41, 0x00,
|
||||
0x7F, 0x09, 0x09, 0x09, 0x01, 0x00,
|
||||
0x3E, 0x41, 0x49, 0x49, 0x3A, 0x00,
|
||||
0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00,
|
||||
0x00, 0x00, 0x7F, 0x00, 0x00, 0x00,
|
||||
0x20, 0x41, 0x41, 0x3F, 0x00, 0x00,
|
||||
0x7F, 0x08, 0x14, 0x22, 0x41, 0x00,
|
||||
0x7F, 0x40, 0x40, 0x40, 0x40, 0x00,
|
||||
0x7F, 0x02, 0x04, 0x02, 0x7F, 0x00,
|
||||
0x7F, 0x02, 0x04, 0x08, 0x7F, 0x00,
|
||||
0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00,
|
||||
0x7F, 0x09, 0x09, 0x09, 0x06, 0x00,
|
||||
0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00,
|
||||
0x7F, 0x09, 0x19, 0x29, 0x46, 0x00,
|
||||
0x26, 0x49, 0x49, 0x49, 0x32, 0x00,
|
||||
0x01, 0x01, 0x7F, 0x01, 0x01, 0x00,
|
||||
0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00,
|
||||
0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00,
|
||||
0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00,
|
||||
0x63, 0x14, 0x08, 0x14, 0x63, 0x00,
|
||||
0x07, 0x08, 0x70, 0x08, 0x07, 0x00,
|
||||
0x61, 0x51, 0x49, 0x45, 0x43, 0x00,
|
||||
0x00, 0x7F, 0x41, 0x41, 0x00, 0x00,
|
||||
0x02, 0x04, 0x08, 0x10, 0x20, 0x00,
|
||||
0x00, 0x00, 0x41, 0x41, 0x7F, 0x00,
|
||||
0x04, 0x02, 0x01, 0x02, 0x04, 0x00,
|
||||
0x40, 0x40, 0x40, 0x40, 0x40, 0x00,
|
||||
0x00, 0x00, 0x06, 0x0A, 0x00, 0x00,
|
||||
0x20, 0x54, 0x54, 0x54, 0x78, 0x00,
|
||||
0x7E, 0x48, 0x48, 0x48, 0x30, 0x00,
|
||||
0x30, 0x48, 0x48, 0x48, 0x48, 0x00,
|
||||
0x30, 0x48, 0x48, 0x48, 0x7E, 0x00,
|
||||
0x38, 0x54, 0x54, 0x54, 0x58, 0x00,
|
||||
0x00, 0x08, 0x7C, 0x0A, 0x00, 0x00,
|
||||
0x98, 0xA4, 0xA4, 0xA4, 0x78, 0x00,
|
||||
0x7E, 0x08, 0x08, 0x08, 0x70, 0x00,
|
||||
0x00, 0x00, 0x7A, 0x00, 0x00, 0x00,
|
||||
0x20, 0x40, 0x40, 0x3A, 0x00, 0x00,
|
||||
0x7E, 0x10, 0x28, 0x44, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7E, 0x40, 0x00, 0x00,
|
||||
0x7C, 0x04, 0x78, 0x04, 0x78, 0x00,
|
||||
0x7C, 0x04, 0x04, 0x04, 0x78, 0x00,
|
||||
0x38, 0x44, 0x44, 0x44, 0x38, 0x00,
|
||||
0xFC, 0x24, 0x24, 0x24, 0x18, 0x00,
|
||||
0x18, 0x24, 0x24, 0x24, 0xFC, 0x00,
|
||||
0x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
|
||||
0x48, 0x54, 0x54, 0x54, 0x24, 0x00,
|
||||
0x00, 0x04, 0x7E, 0x44, 0x00, 0x00,
|
||||
0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
|
||||
0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
|
||||
0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
|
||||
0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
|
||||
0x5C, 0xA0, 0xA0, 0xA0, 0x7C, 0x00,
|
||||
0x44, 0x64, 0x54, 0x4C, 0x44, 0x00,
|
||||
0x00, 0x08, 0x36, 0x41, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
|
||||
0x00, 0x41, 0x36, 0x08, 0x00, 0x00,
|
||||
0x02, 0x01, 0x02, 0x04, 0x02, 0x00,
|
||||
0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00,
|
||||
0x7E, 0xFF, 0x81, 0xFB, 0xF7, 0xEF,
|
||||
0x81, 0xFF, 0xC1, 0xBF, 0xBF, 0xBF,
|
||||
0xC1, 0xFF, 0x81, 0xFB, 0xF7, 0xFB,
|
||||
0x81, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x7E, 0xFF, 0xC3, 0xBD, 0xBD, 0xBD,
|
||||
0xDB, 0xFF, 0x83, 0xED, 0xED, 0xED,
|
||||
0x83, 0xFF, 0x81, 0xED, 0xED, 0xED,
|
||||
0xF3, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x7E, 0xFF, 0xE1, 0xDF, 0xBF, 0xDF,
|
||||
0xE1, 0xFF, 0xC3, 0xBD, 0xBD, 0xBD,
|
||||
0xC3, 0xFF, 0x81, 0xBF, 0xBF, 0xBF,
|
||||
0xBF, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x7E, 0xFF, 0x81, 0xB5, 0xB5, 0xB5,
|
||||
0xCB, 0xFF, 0x81, 0xED, 0xCD, 0xAD,
|
||||
0xB3, 0xFF, 0xFD, 0xFD, 0x81, 0xFD,
|
||||
0xFD, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x7E, 0xFF, 0xC3, 0xBD, 0xBD, 0xBD,
|
||||
0xDB, 0xFF, 0x83, 0xED, 0xED, 0xED,
|
||||
0x83, 0xFF, 0x81, 0xBF, 0xBF, 0xBF,
|
||||
0xBF, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x08, 0x08, 0x3E,
|
||||
0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x08, 0x08, 0x08,
|
||||
0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3E, 0x6F, 0x5F, 0x63,
|
||||
0x7B, 0x7B, 0x3E, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3E, 0x7F, 0x59, 0x6F,
|
||||
0x77, 0x7B, 0x3E, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x14, 0x08, 0x3E,
|
||||
0x08, 0x14, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x08, 0x08, 0x2A,
|
||||
0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7E, 0x04, 0x08, 0x10,
|
||||
0x7E, 0x00, 0x3E, 0x40, 0x40, 0x40,
|
||||
0x3E, 0x00, 0x7E, 0x04, 0x08, 0x04,
|
||||
0x7E, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3C, 0x42, 0x42, 0x42,
|
||||
0x24, 0x00, 0x7C, 0x12, 0x12, 0x12,
|
||||
0x7C, 0x00, 0x7E, 0x12, 0x12, 0x12,
|
||||
0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x7E, 0xFF, 0x81, 0xFB, 0xE7, 0xFB,
|
||||
0x81, 0xFF, 0x81, 0xB5, 0xB5, 0xB5,
|
||||
0xBD, 0xFF, 0x81, 0xBD, 0xBD, 0xBD,
|
||||
0xC3, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x7E, 0xFF, 0x81, 0xB5, 0xB5, 0xB5,
|
||||
0xCB, 0xFF, 0x81, 0xEF, 0xF7, 0xEB,
|
||||
0x9D, 0xFF, 0x81, 0xBF, 0xBF, 0xBF,
|
||||
0xBF, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x7E, 0xFF, 0x81, 0xED, 0xED, 0xED,
|
||||
0xF3, 0xFF, 0x83, 0xED, 0xED, 0xED,
|
||||
0x83, 0xFF, 0x81, 0xBD, 0xBD, 0xBD,
|
||||
0xC3, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3E, 0x77, 0x6F, 0x77,
|
||||
0x7B, 0x77, 0x3E, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x08, 0x10, 0x08,
|
||||
0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3E, 0x77, 0x77, 0x55,
|
||||
0x77, 0x77, 0x3E, 0x00, 0x00, 0x00,
|
||||
0x7E, 0xFF, 0xB3, 0xAD, 0xAD, 0xAD,
|
||||
0xDB, 0xFF, 0xC3, 0xBD, 0xBD, 0xBD,
|
||||
0xDB, 0xFF, 0x81, 0xED, 0xCD, 0xAD,
|
||||
0xB3, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x10, 0x20, 0x1C,
|
||||
0x04, 0x04, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3C, 0x42, 0x42, 0x42,
|
||||
0x24, 0x00, 0x7C, 0x12, 0x12, 0x12,
|
||||
0x7C, 0x00, 0x7E, 0x40, 0x40, 0x40,
|
||||
0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7E, 0x12, 0x12, 0x12,
|
||||
0x0C, 0x00, 0x7C, 0x12, 0x12, 0x12,
|
||||
0x7C, 0x00, 0x7E, 0x42, 0x42, 0x42,
|
||||
0x3C, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x7E, 0xFF, 0xC3, 0xBD, 0xBD, 0xBD,
|
||||
0xC3, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x7E, 0xFF, 0xFF, 0xBB, 0x81, 0xBF,
|
||||
0xFF, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x7E, 0xFF, 0x9B, 0xAD, 0xAD, 0xAD,
|
||||
0xB3, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x7E, 0xFF, 0xDD, 0xBD, 0xB5, 0xB5,
|
||||
0xC9, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x7E, 0xFF, 0xE7, 0xEB, 0xED, 0x81,
|
||||
0xFF, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x7E, 0xFF, 0xD1, 0xB5, 0xB5, 0xB5,
|
||||
0xCD, 0xFF, 0x7E, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3E, 0x77, 0x77, 0x41,
|
||||
0x77, 0x77, 0x3E, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3E, 0x77, 0x77, 0x77,
|
||||
0x77, 0x77, 0x3E, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3E, 0x6B, 0x77, 0x41,
|
||||
0x77, 0x6B, 0x3E, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x4C, 0x52, 0x52, 0x52,
|
||||
0x24, 0x00, 0x3C, 0x42, 0x42, 0x42,
|
||||
0x24, 0x00, 0x7E, 0x12, 0x32, 0x52,
|
||||
0x4C, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x26, 0x10,
|
||||
0x08, 0x04, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
268
keyboards/rubi/lib/oled.c
Normal file
268
keyboards/rubi/lib/oled.c
Normal file
@ -0,0 +1,268 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "./lib/oled.h"
|
||||
|
||||
bool process_record_user_oled(uint16_t keycode, keyrecord_t *record) {
|
||||
return process_record_user(keycode, record);
|
||||
}
|
||||
|
||||
void change_oled_mode(void) {
|
||||
oled_mode = (oled_mode + 1) % _NUM_OLED_MODES;
|
||||
}
|
||||
|
||||
void render_layer_section(void) {
|
||||
// Layer indicators
|
||||
static const char PROGMEM layer_0[] = {0xc8, 0xc9, 0};
|
||||
static const char PROGMEM layer_1[] = {0xca, 0xcb, 0};
|
||||
static const char PROGMEM layer_2[] = {0xcc, 0xcd, 0};
|
||||
static const char PROGMEM layer_3[] = {0xce, 0xcf, 0};
|
||||
|
||||
oled_set_cursor(oled_max_chars()-15, 0);
|
||||
oled_write_P(PSTR("LAYER"), false);
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case 0:
|
||||
oled_write_P(layer_0, false);
|
||||
break;
|
||||
case 1:
|
||||
oled_write_P(layer_1, false);
|
||||
break;
|
||||
case 2:
|
||||
oled_write_P(layer_2, false);
|
||||
break;
|
||||
case 3:
|
||||
oled_write_P(layer_3, false);
|
||||
break;
|
||||
default:
|
||||
oled_write_P(PSTR("? "), false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void render_encoder_section(void) {
|
||||
static const char PROGMEM enc_vol[] = {0x88, 0x89, 0x8a, 0x8b, 0};
|
||||
static const char PROGMEM enc_med[] = {0xa8, 0xa9, 0xaa, 0xab, 0};
|
||||
static const char PROGMEM enc_brt[] = {0x8c, 0x8d, 0x8e, 0x8f, 0};
|
||||
|
||||
oled_set_cursor(oled_max_chars()-7, 0);
|
||||
oled_write_P(PSTR("ENC"), false);
|
||||
switch (encoder_mode) {
|
||||
default:
|
||||
case ENC_MODE_VOLUME:
|
||||
oled_write_P(enc_vol, false);
|
||||
break;
|
||||
case ENC_MODE_MEDIA:
|
||||
oled_write_P(enc_med, false);
|
||||
break;
|
||||
case ENC_MODE_BRIGHTNESS:
|
||||
oled_write_P(enc_brt, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void render_numlock_section(void) {
|
||||
static const char PROGMEM num_on[] = {0x80, 0x81, 0x82, 0x83, 0};
|
||||
static const char PROGMEM num_off[] = {0xa0, 0xa1, 0xa2, 0xa3, 0};
|
||||
static const char PROGMEM cap_on[] = {0x84, 0x85, 0x86, 0x87, 0};
|
||||
static const char PROGMEM cap_off[] = {0xa4, 0xa5, 0xa6, 0xa7, 0};
|
||||
static const char PROGMEM scr_on[] = {0xba, 0xbb, 0xbc, 0xbd, 0};
|
||||
static const char PROGMEM scr_off[] = {0xda, 0xdb, 0xdc, 0xdd, 0};
|
||||
|
||||
led_t led_state = host_keyboard_led_state();
|
||||
|
||||
oled_set_cursor(oled_max_chars()-12, 3);
|
||||
// num lock
|
||||
oled_write_P(led_state.num_lock ? num_on : num_off, false);
|
||||
oled_write_P(led_state.caps_lock ? cap_on : cap_off, false);
|
||||
oled_write_P(led_state.scroll_lock ? scr_on : scr_off, false);
|
||||
}
|
||||
|
||||
void render_mode_section(void) {
|
||||
static const char PROGMEM pad_on[] = {0xb0, 0xb1, 0xb2, 0xb3, 0};
|
||||
static const char PROGMEM pad_off[] = {0xc4, 0xc5, 0xc6, 0xc7, 0};
|
||||
static const char PROGMEM cal_on[] = {0x90, 0x91, 0x92, 0x93, 0};
|
||||
static const char PROGMEM cal_off[] = {0xc0, 0xc1, 0xc2, 0xc3, 0};
|
||||
|
||||
if (oled_mode == OLED_MODE_CALC) {
|
||||
oled_set_cursor(0, 0);
|
||||
oled_write_P(pad_off, false);
|
||||
oled_set_cursor(0, 1);
|
||||
oled_write_P(cal_on, false);
|
||||
} else {
|
||||
oled_set_cursor(0, 0);
|
||||
oled_write_P(pad_on, false);
|
||||
oled_set_cursor(0, 1);
|
||||
oled_write_P(cal_off, false);
|
||||
}
|
||||
}
|
||||
|
||||
void render_calc_section(void) {
|
||||
static const char PROGMEM add_on[] = {0xd4, 0xd5, 0};
|
||||
static const char PROGMEM add_off[] = {0x94, 0x95, 0};
|
||||
static const char PROGMEM sub_on[] = {0xd6, 0xd7, 0};
|
||||
static const char PROGMEM sub_off[] = {0x96, 0x97, 0};
|
||||
static const char PROGMEM mul_on[] = {0xd8, 0xd9, 0};
|
||||
static const char PROGMEM mul_off[] = {0x9c, 0x9d, 0};
|
||||
static const char PROGMEM div_on[] = {0xb8, 0xb9, 0};
|
||||
static const char PROGMEM div_off[] = {0x9e, 0x9f, 0};
|
||||
static const char PROGMEM sqr_on[] = {0x98, 0x99, 0};
|
||||
static const char PROGMEM sqr_off[] = {0xbe, 0xbf, 0};
|
||||
static const char PROGMEM rec_on[] = {0x9a, 0x9b, 0};
|
||||
static const char PROGMEM rec_off[] = {0xde, 0xdf, 0};
|
||||
static const char PROGMEM neg_on[] = {0xb4, 0xb5, 0};
|
||||
static const char PROGMEM neg_off[] = {0xb6, 0xb7, 0};
|
||||
|
||||
|
||||
if (oled_mode == OLED_MODE_CALC) {
|
||||
if (get_highest_layer(layer_state) == 1) {
|
||||
oled_set_cursor(oled_max_chars()-8, 0);
|
||||
|
||||
switch (calc_operator_display) {
|
||||
case '+':
|
||||
oled_write_P(div_off, false);
|
||||
oled_write_P(mul_off, false);
|
||||
oled_write_P(sub_off, false);
|
||||
oled_write_P(add_on, false);
|
||||
break;
|
||||
case '-':
|
||||
oled_write_P(div_off, false);
|
||||
oled_write_P(mul_off, false);
|
||||
oled_write_P(sub_on, false);
|
||||
oled_write_P(add_off, false);
|
||||
break;
|
||||
case '*':
|
||||
oled_write_P(div_off, false);
|
||||
oled_write_P(mul_on, false);
|
||||
oled_write_P(sub_off, false);
|
||||
oled_write_P(add_off, false);
|
||||
break;
|
||||
case '/':
|
||||
oled_write_P(div_on, false);
|
||||
oled_write_P(mul_off, false);
|
||||
oled_write_P(sub_off, false);
|
||||
oled_write_P(add_off, false);
|
||||
break;
|
||||
case 's':
|
||||
case 'r':
|
||||
case 'n':
|
||||
layer_on(2);
|
||||
break;
|
||||
default:
|
||||
oled_write_P(div_off, false);
|
||||
oled_write_P(mul_off, false);
|
||||
oled_write_P(sub_off, false);
|
||||
oled_write_P(add_off, false);
|
||||
break;
|
||||
}
|
||||
} else if (get_highest_layer(layer_state) == 2) {
|
||||
oled_set_cursor(oled_max_chars()-6, 0);
|
||||
|
||||
switch (calc_operator_display) {
|
||||
case '+':
|
||||
case '-':
|
||||
case '*':
|
||||
case '/':
|
||||
layer_off(2);
|
||||
break;
|
||||
case 's':
|
||||
oled_write_P(neg_off, false);
|
||||
oled_write_P(sqr_on, false);
|
||||
oled_write_P(rec_off, false);
|
||||
break;
|
||||
case 'r':
|
||||
oled_write_P(neg_off, false);
|
||||
oled_write_P(sqr_off, false);
|
||||
oled_write_P(rec_on, false);
|
||||
break;
|
||||
case 'n':
|
||||
oled_write_P(neg_on, false);
|
||||
oled_write_P(sqr_off, false);
|
||||
oled_write_P(rec_off, false);
|
||||
break;
|
||||
default:
|
||||
oled_write_P(neg_off, false);
|
||||
oled_write_P(sqr_off, false);
|
||||
oled_write_P(rec_off, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (calc_display_lines == 1) {
|
||||
oled_set_cursor(oled_max_chars()-strlen(calc_result_display)-2, 3);
|
||||
oled_write_char(calc_operator_display, false);
|
||||
} else if (calc_display_lines == 2) {
|
||||
oled_set_cursor(oled_max_chars()-strlen(calc_status_display), 2);
|
||||
oled_write(calc_status_display, false);
|
||||
}
|
||||
oled_set_cursor(oled_max_chars()-strlen(calc_result_display), 3);
|
||||
oled_write(calc_result_display, false);
|
||||
}
|
||||
}
|
||||
|
||||
static void render_logo(void) {
|
||||
oled_write_raw_P(raw_logo, sizeof(raw_logo));
|
||||
}
|
||||
|
||||
void render_frame(void) {
|
||||
if (oled_logo_expired) {
|
||||
if (oled_mode == OLED_MODE_DEFAULT) {
|
||||
render_mode_section();
|
||||
render_layer_section();
|
||||
render_encoder_section();
|
||||
render_numlock_section();
|
||||
} else if (oled_mode == OLED_MODE_CALC) {
|
||||
render_mode_section();
|
||||
render_calc_section();
|
||||
} else if (oled_mode == OLED_MODE_OFF) {
|
||||
if (is_oled_on()) {
|
||||
oled_off();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
render_logo();
|
||||
oled_logo_expired = timer_elapsed(oled_logo_timer) > OLED_LOGO_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((weak)) void oled_task_user(void) {
|
||||
if (timer_elapsed(oled_frame_timer) > OLED_FRAME_TIMEOUT) {
|
||||
oled_clear();
|
||||
oled_frame_timer = timer_read();
|
||||
render_frame();
|
||||
}
|
||||
|
||||
if (get_highest_layer(layer_state) == 1) {
|
||||
oled_mode = OLED_MODE_CALC;
|
||||
} else if (get_highest_layer(layer_state) == 2) {
|
||||
if (IS_LAYER_ON(1)) {
|
||||
oled_mode = OLED_MODE_CALC;
|
||||
} else {
|
||||
oled_mode = OLED_MODE_DEFAULT;
|
||||
}
|
||||
} else if (get_highest_layer(layer_state) == 3) {
|
||||
oled_mode = OLED_MODE_OFF;
|
||||
} else {
|
||||
oled_mode = OLED_MODE_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
||||
oled_logo_timer = timer_read();
|
||||
oled_frame_timer = timer_read();
|
||||
return rotation;
|
||||
}
|
32
keyboards/rubi/lib/oled.h
Normal file
32
keyboards/rubi/lib/oled.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
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
|
||||
|
||||
#define OLED_FRAME_TIMEOUT (1000 / 30) // 30 fps
|
||||
#define OLED_LOGO_TIMEOUT 3000 // 3 sec
|
||||
|
||||
static uint16_t oled_frame_timer = 0;
|
||||
static uint16_t oled_logo_timer = 0;
|
||||
static bool oled_logo_expired = false;
|
||||
|
||||
static const char PROGMEM raw_logo[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,128,128,128,128, 0, 0, 0, 0, 0, 0, 0,128,128,128,128,128,128,128,128,128,128,128, 0, 0, 0, 0, 0, 0,128,128,128,128, 0, 0, 0, 0, 0, 0,128,128,128,128, 0, 0,128,128,128,128,128,128,128,128,128,128,128, 0, 0, 0, 0, 0,128,128,128,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,224,112,184,220,204,182,123,254,251,187,223,231,203,126,254, 0, 0, 0, 0, 0, 0,255, 0, 0, 0,248, 8, 8, 8, 8, 8,249,225, 2, 12,248, 0, 0,255,255,255,255, 0, 0, 0, 0, 0, 0,255,255,255,255, 0, 0,255,255,255,255,199,199,199,199,199,207,255,255,254,124, 0, 0,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,127,191,188,211,223,223,247,187,187,252,126,123,247,239,223,190,115,142, 0, 0, 0, 0, 0,255, 0, 0, 0,227, 34, 34, 34, 98,194, 1, 56,236,135, 1, 0, 0, 31, 63,127,255,248,240,240,240,240,248,255,127, 63, 31, 0, 0,255,255,255,255,227,227,227,227,227,243,255,255,127, 62, 0, 0,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
23
keyboards/rubi/readme.md
Normal file
23
keyboards/rubi/readme.md
Normal file
@ -0,0 +1,23 @@
|
||||
# Rubi
|
||||
|
||||
![Rubi](https://i.imgur.com/XUzxe0rh.jpg)
|
||||
|
||||
[Proto Album](https://imgur.com/a/QVtU7hV)
|
||||
|
||||
A 4x5 layout numpad with rotary encoder, LED indicator and OLED screen, featuring a basic calculator inside the OLED screen. The PCB supports both hotswap and solderable switch. Currently the PCB and case can only be purchased in Indonesia.
|
||||
|
||||
* Keyboard Maintainer: [ohchiko](https://github.com/ohchiko)
|
||||
* Hardware Supported: Rubi PCB Rev. A, ATMega32u4
|
||||
* Hardware Availability: Local Indonesia GB.
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make rubi:default
|
||||
|
||||
Flashing example for this keyboard:
|
||||
|
||||
make rubi:default:flash
|
||||
|
||||
To put this keyboard into bootloader mode (for flashing firmware), simply activate layer 3 and press the middle key (key "5" on the proto picture) on the default keymap.
|
||||
|
||||
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
108
keyboards/rubi/rubi.c
Normal file
108
keyboards/rubi/rubi.c
Normal file
@ -0,0 +1,108 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
#include "rubi.h"
|
||||
|
||||
uint8_t oled_mode = OLED_MODE_DEFAULT;
|
||||
|
||||
char calc_result_display[CALC_DIGITS+1] = "";
|
||||
char calc_operator_display = ' ';
|
||||
char calc_status_display[CALC_DIGITS+1] = "";
|
||||
uint8_t calc_display_lines = 2;
|
||||
|
||||
const char keycode_to_ascii_lut[58] = {0, 0, 0, 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 0, 0, 0, '\t', ' ', '-', '=', '[', ']', '\\', 0, ';', '\'', '`', ',', '.', '/'};
|
||||
|
||||
uint8_t encoder_mode = ENC_MODE_VOLUME;
|
||||
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode < 58 && keycode != KC_TAB) {
|
||||
if (record->event.pressed) {
|
||||
calcInput(keycode_to_ascii_lut[(uint8_t)keycode]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
switch (keycode) {
|
||||
case ENC_PRESS:
|
||||
if (record->event.pressed) {
|
||||
uint16_t mapped_code = handle_encoder_press();
|
||||
if (mapped_code != 0) {
|
||||
tap_code16(mapped_code);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case CL_PLUS:
|
||||
if (record->event.pressed) {
|
||||
calcInput('+');
|
||||
}
|
||||
return false;
|
||||
case CL_STAR:
|
||||
if (record->event.pressed) {
|
||||
calcInput('*');
|
||||
}
|
||||
return false;
|
||||
case CL_TYPE:
|
||||
if (record->event.pressed) {
|
||||
send_string(calc_result_display);
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return process_record_user_oled(keycode, record);
|
||||
}
|
||||
|
||||
|
||||
bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
if (res) {
|
||||
writePin(C6, led_state.num_lock);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__ ((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
|
||||
if (index == 0) {
|
||||
if (get_highest_layer(layer_state) == 0) {
|
||||
uint16_t mapped_code = 0;
|
||||
if (clockwise) {
|
||||
mapped_code = handle_encoder_cw();
|
||||
} else {
|
||||
mapped_code = handle_encoder_ccw();
|
||||
}
|
||||
if (mapped_code != 0) {
|
||||
tap_code16(mapped_code);
|
||||
}
|
||||
} else {
|
||||
if (clockwise) {
|
||||
if (oled_mode == OLED_MODE_CALC) {
|
||||
handle_encoder_cw();
|
||||
} else if (oled_mode == OLED_MODE_DEFAULT) {
|
||||
change_encoder_mode(false);
|
||||
}
|
||||
} else {
|
||||
if (oled_mode == OLED_MODE_CALC) {
|
||||
handle_encoder_ccw();
|
||||
} else if (oled_mode == OLED_MODE_DEFAULT) {
|
||||
change_encoder_mode(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void encoder_update_kb(uint8_t index, bool clockwise) {
|
||||
encoder_update_user(index, clockwise);
|
||||
}
|
102
keyboards/rubi/rubi.h
Normal file
102
keyboards/rubi/rubi.h
Normal file
@ -0,0 +1,102 @@
|
||||
/* 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 = SAFE_RANGE,
|
||||
CL_PLUS,
|
||||
CL_STAR,
|
||||
CL_TYPE,
|
||||
NEW_SAFE_RANGE
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
/* This is a shortcut to help you visually see your layout.
|
||||
*
|
||||
* The first section contains all of the arguments representing the physical
|
||||
* layout of the board and position of the keys.
|
||||
*
|
||||
* The second converts the arguments into a two-dimensional array which
|
||||
* represents the switch matrix.
|
||||
*/
|
||||
|
||||
/* Rubi matrix layout
|
||||
* ,---------------.
|
||||
* | 23|
|
||||
* |---------------|
|
||||
* | 00| 01| 02| 03|
|
||||
* |---------------|
|
||||
* | 10| 11| 12| |
|
||||
* |-----------| 13|
|
||||
* | 20| 21| 22| |
|
||||
* |---------------|
|
||||
* | 30| 31| 32| |
|
||||
* |-----------| 33|
|
||||
* | 41 | 42| |
|
||||
* `---------------'
|
||||
*/
|
||||
#define LAYOUT( \
|
||||
k23, \
|
||||
k00, k01, k02, k03, \
|
||||
k10, k11, k12, k13, \
|
||||
k20, k21, k22, \
|
||||
k30, k31, k32, k33, \
|
||||
k41, k42 \
|
||||
) { \
|
||||
{ k00, k01, k02, k03 }, \
|
||||
{ k10, k11, k12, k13 }, \
|
||||
{ k20, k21, k22, k23 }, \
|
||||
{ k30, k31, k32, k33 }, \
|
||||
{ KC_NO, k41, k42, KC_NO } \
|
||||
}
|
28
keyboards/rubi/rules.mk
Normal file
28
keyboards/rubi/rules.mk
Normal file
@ -0,0 +1,28 @@
|
||||
# MCU name
|
||||
MCU = atmega32u4
|
||||
|
||||
# Bootloader selection
|
||||
BOOTLOADER = atmel-dfu
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
|
||||
MOUSEKEY_ENABLE = no # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = no # Console for debug
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
OLED_DRIVER_ENABLE = yes
|
||||
ENCODER_ENABLE = yes
|
||||
|
||||
SRC += lib/oled.c \
|
||||
lib/encoder.c \
|
||||
lib/calc.c
|
Loading…
Reference in New Issue
Block a user