Browse Source

fixed pull request changes

pull/23040/head
georgsnarbuts 2 months ago
parent
commit
010d6041e6
9 changed files with 48 additions and 59 deletions
  1. +0
    -5
      keyboards/kalkulators/config.h
  2. +2
    -22
      keyboards/kalkulators/info.json
  3. +24
    -7
      keyboards/kalkulators/kalkulators.c
  4. +0
    -0
      keyboards/kalkulators/kalkulators.h
  5. +4
    -4
      keyboards/kalkulators/keymaps/default/keymap.c
  6. +15
    -16
      keyboards/kalkulators/keymaps/via/keymap.c
  7. +1
    -1
      keyboards/kalkulators/readme.md
  8. +1
    -3
      keyboards/kalkulators/rules.mk
  9. +1
    -1
      keyboards/kalkulators/tm1638.c

+ 0
- 5
keyboards/kalkulators/config.h View File

@ -3,11 +3,6 @@
#pragma once
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
#define TM1638_CLK_PIN A8
#define TM1638_DIO_PIN A9
#define TM1638_STB_PIN B15


+ 2
- 22
keyboards/kalkulators/info.json View File

@ -21,7 +21,8 @@
"usb": {
"device_version": "1.0.0",
"pid": "0x4B4C",
"vid": "0x474E"
"vid": "0x474E",
"no_startup_check": true
},
"layouts": {
"LAYOUT_calc": {
@ -44,27 +45,6 @@
{"matrix": [4, 2], "x": 2, "y": 4},
{"matrix": [3, 3], "x": 3, "y": 3, "h": 2}
]
},
"LAYOUT_numpad": {
"layout": [
{"matrix": [0, 0], "x": 0, "y": 0},
{"matrix": [0, 1], "x": 1, "y": 0},
{"matrix": [0, 2], "x": 2, "y": 0},
{"matrix": [0, 3], "x": 3, "y": 0},
{"matrix": [1, 0], "x": 0, "y": 1},
{"matrix": [1, 1], "x": 1, "y": 1},
{"matrix": [1, 2], "x": 2, "y": 1},
{"matrix": [2, 0], "x": 0, "y": 2},
{"matrix": [2, 1], "x": 1, "y": 2},
{"matrix": [2, 2], "x": 2, "y": 2},
{"matrix": [1, 3], "x": 3, "y": 1, "h": 2},
{"matrix": [3, 0], "x": 0, "y": 3},
{"matrix": [3, 1], "x": 1, "y": 3},
{"matrix": [3, 2], "x": 2, "y": 3},
{"matrix": [4, 0], "x": 0, "y": 4, "w": 2},
{"matrix": [4, 2], "x": 2, "y": 4},
{"matrix": [3, 3], "x": 3, "y": 3, "h": 2}
]
}
}
}

keyboards/kalkulators/calc.c → keyboards/kalkulators/kalkulators.c View File

@ -20,11 +20,12 @@
#include <math.h>
#include <ctype.h>
#include <string.h>
#include "kalkulators.h"
#include "halconf.h"
#include "tm1638.h"
#include "usb_util.h"
#include "wait.h"
#include "calc.h"
// calculate the number of whole digits and decimal digits in a double
void countDigitsAndDecimalPlaces(double input, int *wholeDigits, int *decimalPlaces) {
@ -63,8 +64,25 @@ void countDigitsAndDecimalPlaces(double input, int *wholeDigits, int *decimalPla
}
}
enum custom_keycodes { KC_cl = QK_USER, KC_div, KC_times, KC_minus, KC_seven, KC_eight, KC_nine, KC_four, KC_five, KC_six, KC_plus, KC_one, KC_two, KC_three, KC_zero, KC_dot, KC_equals };
enum custom_keycodes {
KC_cl = QK_KB_0,
KC_div,
KC_times,
KC_minus,
KC_seven,
KC_eight,
KC_nine,
KC_four,
KC_five,
KC_six,
KC_plus,
KC_one,
KC_two,
KC_three,
KC_zero,
KC_dot,
KC_equals
};
typedef struct {
double accumulator;
char current_input[8];
@ -389,7 +407,7 @@ void process_input(double input) {
}
// listens for keypresses
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch (keycode) {
case KC_cl:
@ -446,9 +464,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
}
return true;
}
return true;
return process_record_user(keycode, record);
};
};

keyboards/kalkulators/calc.h → keyboards/kalkulators/kalkulators.h View File


+ 4
- 4
keyboards/kalkulators/keymaps/default/keymap.c View File

@ -7,7 +7,7 @@
#include "tm1638.h"
#include "wait.h"
#include "usb_util.h"
#include "calc.h"
#include "kalkulators.h"
int brightness_level = 7;
@ -70,7 +70,7 @@ void keyboard_post_init_user(void) {
};
enum custom_keycodes {
KC_cl = QK_USER,
KC_cl = QK_KB_0,
KC_div,
KC_times,
KC_minus,
@ -104,7 +104,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* 0 .
*
*/
[0] = LAYOUT_numpad(
[0] = LAYOUT_calc(
KC_DELETE, KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9,
KC_P4, KC_P5, KC_P6, KC_PPLS,
@ -113,7 +113,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[1] = LAYOUT_calc(
QK_USER, KC_div, KC_times, KC_minus,
QK_KB_0, KC_div, KC_times, KC_minus,
KC_seven, KC_eight, KC_nine,
KC_four, KC_five, KC_six, KC_plus,
KC_one, KC_two, KC_three,


+ 15
- 16
keyboards/kalkulators/keymaps/via/keymap.c View File

@ -7,7 +7,7 @@
#include "tm1638.h"
#include "wait.h"
#include "usb_util.h"
#include "calc.h"
#include "kalkulators.h"
int brightness_level = 7;
@ -71,27 +71,26 @@ void keyboard_post_init_user(void) {
};
enum custom_keycodes {
KC_cl = QK_USER,
KC_div,
KC_times,
KC_cl = QK_KB_0,
KC_div,
KC_times,
KC_minus,
KC_seven,
KC_eight,
KC_seven,
KC_eight,
KC_nine,
KC_four,
KC_five,
KC_six,
KC_four,
KC_five,
KC_six,
KC_plus,
KC_one,
KC_two,
KC_one,
KC_two,
KC_three,
KC_zero,
KC_dot,
KC_zero,
KC_dot,
KC_equals
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
*
@ -106,7 +105,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* 0 .
*
*/
[0] = LAYOUT_numpad(
[0] = LAYOUT_calc(
KC_DELETE, KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9,
KC_P4, KC_P5, KC_P6, KC_PPLS,
@ -115,7 +114,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[1] = LAYOUT_calc(
QK_USER, KC_div, KC_times, KC_minus,
QK_KB_0, KC_div, KC_times, KC_minus,
KC_seven, KC_eight, KC_nine,
KC_four, KC_five, KC_six, KC_plus,
KC_one, KC_two, KC_three,


+ 1
- 1
keyboards/kalkulators/readme.md View File

@ -11,7 +11,7 @@ USB-C, STM32F072, TM1638 LED controller, 1xAA battery.
Make example for this keyboard (after setting up your build environment):
qmk compile -kb kalkulators -km via
make kalkulators:default
Flashing example for this keyboard:


+ 1
- 3
keyboards/kalkulators/rules.mk View File

@ -1,3 +1 @@
# This file intentionally left blank
SRC += tm1638.c calc.c
NO_USB_STARTUP_CHECK = yes
SRC += tm1638.c

+ 1
- 1
keyboards/kalkulators/tm1638.c View File

@ -20,11 +20,11 @@
#include "gpio.h"
#include "progmem.h"
#include "wait.h"
#include QMK_KEYBOARD_H
#include <stdio.h>
#include "halconf.h"
#include "print.h"
#include <math.h>
#include "kalkulators.h"
#ifndef TM1638_CLK_PIN
# error tm1638: no CLK pin defined!


Loading…
Cancel
Save