summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/mexsistor/ludmila/config.h58
-rw-r--r--keyboards/mexsistor/ludmila/info.json19
-rw-r--r--keyboards/mexsistor/ludmila/keymaps/default/keymap.c41
-rw-r--r--keyboards/mexsistor/ludmila/keymaps/default/readme.md1
-rw-r--r--keyboards/mexsistor/ludmila/ludmila.c17
-rw-r--r--keyboards/mexsistor/ludmila/ludmila.h36
-rw-r--r--keyboards/mexsistor/ludmila/matrix.c121
-rw-r--r--keyboards/mexsistor/ludmila/readme.md19
-rw-r--r--keyboards/mexsistor/ludmila/rules.mk25
9 files changed, 337 insertions, 0 deletions
diff --git a/keyboards/mexsistor/ludmila/config.h b/keyboards/mexsistor/ludmila/config.h
new file mode 100644
index 0000000000..b08739d66b
--- /dev/null
+++ b/keyboards/mexsistor/ludmila/config.h
@@ -0,0 +1,58 @@
+/*
+Copyright 2020 Kevin M.
+
+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 0x69CC
+#define PRODUCT_ID 0x6BF6
+#define DEVICE_VER 0x0001
+#define MANUFACTURER Kevin M.
+#define PRODUCT Ludmila Macropad
+#define DESCRIPTION Ludmila 4 switch + encoder macropad
+
+/* key matrix size */
+#define MATRIX_ROWS 3
+#define MATRIX_COLS 2
+
+/*
+ * 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, C7, F7 }
+#define MATRIX_COL_PINS { F4, F1 }
+#define UNUSED_PINS
+
+/* COL2ROW, ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+#define RGB_DI_PIN D1
+#define RGBLED_NUM 4
+#define RGBLIGHT_SLEEP
+#define RGBLIGHT_ANIMATIONS
+
+// Encoder
+#define ENCODERS_PAD_A { F6 }
+#define ENCODERS_PAD_B { F5 }
diff --git a/keyboards/mexsistor/ludmila/info.json b/keyboards/mexsistor/ludmila/info.json
new file mode 100644
index 0000000000..c134428f4b
--- /dev/null
+++ b/keyboards/mexsistor/ludmila/info.json
@@ -0,0 +1,19 @@
+{
+ "keyboard_name": "ludmila",
+ "url": "",
+ "maintainer": "Kevin M.",
+ "width": 4,
+ "height": 2,
+ "layouts": {
+ "LAYOUT": {
+ "layout": [
+ {"label": "SW1", "x": 0, "y": 0},
+ {"label": "SW3", "x": 1, "y": 0},
+ {"label": "Encoder", "x": 3, "y": 0},
+
+ {"label": "SW2", "x": 0, "y": 1},
+ {"label": "SW4", "x": 1, "y": 1}
+ ]
+ }
+ }
+}
diff --git a/keyboards/mexsistor/ludmila/keymaps/default/keymap.c b/keyboards/mexsistor/ludmila/keymaps/default/keymap.c
new file mode 100644
index 0000000000..ecb66d5df3
--- /dev/null
+++ b/keyboards/mexsistor/ludmila/keymaps/default/keymap.c
@@ -0,0 +1,41 @@
+/* Copyright 2020 Kevin M.
+ *
+ * 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
+enum keyboard_layers{
+ _BASE = 0,
+ _CONTROL
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [_BASE] = LAYOUT( /* Base */
+ KC_COPY, KC_PSCREEN, KC_MUTE,
+ KC_PASTE, KC_ENTER
+
+ ),
+
+};
+
+void encoder_update_user(uint8_t index, bool clockwise) {
+ if (index == 0) {
+ if (clockwise) {
+ tap_code(KC_VOLU);
+ } else {
+ tap_code(KC_VOLD);
+ }
+ }
+}
diff --git a/keyboards/mexsistor/ludmila/keymaps/default/readme.md b/keyboards/mexsistor/ludmila/keymaps/default/readme.md
new file mode 100644
index 0000000000..1fb3e58afe
--- /dev/null
+++ b/keyboards/mexsistor/ludmila/keymaps/default/readme.md
@@ -0,0 +1 @@
+# The default keymap for ludmila
diff --git a/keyboards/mexsistor/ludmila/ludmila.c b/keyboards/mexsistor/ludmila/ludmila.c
new file mode 100644
index 0000000000..4125d19671
--- /dev/null
+++ b/keyboards/mexsistor/ludmila/ludmila.c
@@ -0,0 +1,17 @@
+/* Copyright 2020 Kevin M.
+ *
+ * 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 "ludmila.h"
diff --git a/keyboards/mexsistor/ludmila/ludmila.h b/keyboards/mexsistor/ludmila/ludmila.h
new file mode 100644
index 0000000000..fc95a5492e
--- /dev/null
+++ b/keyboards/mexsistor/ludmila/ludmila.h
@@ -0,0 +1,36 @@
+/* Copyright 2020 Kevin M.
+ *
+ * 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"
+
+/* 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.
+ */
+#define LAYOUT( \
+ k00, k01, k20, \
+ k10, k11 \
+) { \
+ { k00, k01, }, \
+ { k10, k11, }, \
+ { k20 } \
+ }
diff --git a/keyboards/mexsistor/ludmila/matrix.c b/keyboards/mexsistor/ludmila/matrix.c
new file mode 100644
index 0000000000..338286a7db
--- /dev/null
+++ b/keyboards/mexsistor/ludmila/matrix.c
@@ -0,0 +1,121 @@
+/*
+Copyright 2012-2018 Jun Wako, Jack Humbert, Yiancar
+
+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 <stdint.h>
+#include <stdbool.h>
+#include "wait.h"
+#include "util.h"
+#include "matrix.h"
+#include "quantum.h"
+
+// Encoder things
+#define ENC_SW F7
+static bool read_encoder_switches(matrix_row_t current_matrix[], uint8_t current_row);
+
+static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
+static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
+
+/* matrix state(1:on, 0:off) */
+extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values
+extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values
+
+
+static void select_row(uint8_t row) {
+ setPinOutput(row_pins[row]);
+ writePinLow(row_pins[row]);
+}
+
+static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); }
+
+static void unselect_rows(void) {
+ for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
+ setPinInputHigh(row_pins[x]);
+ }
+}
+
+static void init_pins(void) {
+ unselect_rows();
+ for (uint8_t x = 0; x < MATRIX_COLS; x++) {
+ setPinInputHigh(col_pins[x]);
+ }
+}
+
+static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
+ // Store last value of row prior to reading
+ matrix_row_t last_row_value = current_matrix[current_row];
+
+ // Clear data in matrix row
+ current_matrix[current_row] = 0;
+
+ // Select row and wait for row selecton to stabilize
+ select_row(current_row);
+ wait_us(30);
+
+ // For each col...
+ for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
+ // Select the col pin to read (active low)
+ uint8_t pin_state = readPin(col_pins[col_index]);
+
+ // Populate the matrix row with the state of the col pin
+ current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index);
+ }
+
+ // Unselect row
+ unselect_row(current_row);
+
+ return (last_row_value != current_matrix[current_row]);
+}
+
+
+void matrix_init_custom(void) {
+ // initialize key pins
+ setPinInput(ENC_SW);
+ init_pins();
+}
+
+bool matrix_scan_custom(void) {
+ bool changed = false;
+
+ // Set row, read cols
+ for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
+ changed |= read_cols_on_row(raw_matrix, current_row);
+ }
+
+ // Read encoder switches, already debounced
+ changed |= read_encoder_switches(matrix, 2);
+
+ return changed;
+}
+
+static bool read_encoder_switches(matrix_row_t current_matrix[], uint8_t current_row) {
+ // Store last value of row prior to reading
+ matrix_row_t last_row_value = current_matrix[current_row];
+
+ // Clear data in matrix row
+ current_matrix[current_row] = 0;
+
+ // Debounce the encoder buttons using a shift register
+ static uint8_t btn_1_array;
+ bool btn_1_pressed = 0;
+ btn_1_array <<= 1;
+ btn_1_array |= readPin(ENC_SW);
+ (btn_1_array == 0b11111111) ? (btn_1_pressed = 1) : (btn_1_pressed = 0);
+
+ // Populate the matrix row with the state of the encoder
+ current_matrix[current_row] |= btn_1_pressed ? (1 << 0) : 0;
+
+ return (last_row_value != current_matrix[current_row]);
+}
diff --git a/keyboards/mexsistor/ludmila/readme.md b/keyboards/mexsistor/ludmila/readme.md
new file mode 100644
index 0000000000..93742ee764
--- /dev/null
+++ b/keyboards/mexsistor/ludmila/readme.md
@@ -0,0 +1,19 @@
+# ludmila
+
+![ludmila](https://mexsistor.com/wp-content/uploads/2020/09/IMG_2249-scaled.jpg)
+
+Ludmila v1 is a 4 Key Macropad with one rotary encoder.
+
+* Keyboard Maintainer: [Kevin M.](https://github.com/mexsistor)
+* Hardware Supported: Ludmila PCB (atmega32u4)
+* Hardware Availability: [Kevin M.](https://mexsistor.com/producto/ludmilapad/)
+
+Make example for this keyboard (after setting up your build environment):
+
+ make mexsistor/ludmila:default
+
+Flashing example for this keyboard:
+
+ make mexsistor/ludmila:default:flash
+
+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).
diff --git a/keyboards/mexsistor/ludmila/rules.mk b/keyboards/mexsistor/ludmila/rules.mk
new file mode 100644
index 0000000000..6066750612
--- /dev/null
+++ b/keyboards/mexsistor/ludmila/rules.mk
@@ -0,0 +1,25 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = atmel-dfu
+
+# Build Options
+# change yes to no to disable
+#
+CUSTOM_MATRIX = lite
+SRC = matrix.c
+BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
+MOUSEKEY_ENABLE = yes # 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 = no # USB Nkey Rollover
+BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
+BLUETOOTH_ENABLE = no # Enable Bluetooth
+AUDIO_ENABLE = no # Audio output
+ENCODER_ENABLE = yes