From 9f4f1de0019fe04354643c3719d273af436db525 Mon Sep 17 00:00:00 2001 From: David Hoelscher Date: Fri, 7 Jul 2023 09:31:47 -0500 Subject: Add EVO70 R2 Keyboard (#21321) --- keyboards/custommk/evo70_r2/config.h | 90 ++++++++++++ keyboards/custommk/evo70_r2/halconf.h | 36 +++++ keyboards/custommk/evo70_r2/info.json | 152 +++++++++++++++++++++ .../custommk/evo70_r2/keymaps/default/keymap.c | 33 +++++ keyboards/custommk/evo70_r2/keymaps/via/config.h | 13 ++ keyboards/custommk/evo70_r2/keymaps/via/keymap.c | 33 +++++ keyboards/custommk/evo70_r2/keymaps/via/rules.mk | 2 + keyboards/custommk/evo70_r2/matrix.c | 117 ++++++++++++++++ keyboards/custommk/evo70_r2/mcuconf.h | 58 ++++++++ keyboards/custommk/evo70_r2/readme.md | 21 +++ keyboards/custommk/evo70_r2/rules.mk | 11 ++ 11 files changed, 566 insertions(+) create mode 100644 keyboards/custommk/evo70_r2/config.h create mode 100644 keyboards/custommk/evo70_r2/halconf.h create mode 100644 keyboards/custommk/evo70_r2/info.json create mode 100644 keyboards/custommk/evo70_r2/keymaps/default/keymap.c create mode 100644 keyboards/custommk/evo70_r2/keymaps/via/config.h create mode 100644 keyboards/custommk/evo70_r2/keymaps/via/keymap.c create mode 100644 keyboards/custommk/evo70_r2/keymaps/via/rules.mk create mode 100644 keyboards/custommk/evo70_r2/matrix.c create mode 100644 keyboards/custommk/evo70_r2/mcuconf.h create mode 100644 keyboards/custommk/evo70_r2/readme.md create mode 100644 keyboards/custommk/evo70_r2/rules.mk (limited to 'keyboards') diff --git a/keyboards/custommk/evo70_r2/config.h b/keyboards/custommk/evo70_r2/config.h new file mode 100644 index 0000000000..25ab789d75 --- /dev/null +++ b/keyboards/custommk/evo70_r2/config.h @@ -0,0 +1,90 @@ +/* Copyright 2023 David Hoelscher (@customMK) + * + * 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 . + */ + +#pragma once + +// No VBUS sense needed +#define BOARD_OTG_NOVBUSSENS 1 + +#define STM32_LSECLK 32768 + +#define MATRIX_ROWS 5 +#define MATRIX_COLS 16 +#define MATRIX_ROW_PINS { A8, A1, A2, B1, A7 } + +// FRAM configuration +#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A0 +#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 4 // 48MHz / 4 = 12MHz; max supported by MB85R64 is 20MHz + +// External flash configuration +#define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN B12 +#define EXTERNAL_FLASH_SPI_CLOCK_DIVISOR 1 // 48MHz; max supported by W25Q128JV is 133MHz +#define EXTERNAL_FLASH_SIZE (16 * 1024 * 1024) //128Mbit or 16MByte +#define EXTERNAL_FLASH_SPI_TIMEOUT 200000 //datasheet max is 200seconds for flash chip erase + +// SPI Configuration +#define SPI_DRIVER SPID1 +#define SPI_SCK_PIN B3 +#define SPI_SCK_PAL_MODE 5 +#define SPI_MOSI_PIN B5 +#define SPI_MOSI_PAL_MODE 5 +#define SPI_MISO_PIN B4 +#define SPI_MISO_PAL_MODE 5 + + +// SPI LCD Configuration +#define LCD_RST_PIN B2 +#define LCD_CS_PIN A9 +#define LCD_DC_PIN B0 +#ifndef LCD_ACTIVITY_TIMEOUT + #define LCD_ACTIVITY_TIMEOUT 30000 +#endif + +// I2C OLED Configuration +#define I2C1_SCL_PIN B6 +#define I2C1_SDA_PIN B9 + +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 + +#define OLED_DISABLE_TIMEOUT + +#define COL_SHIFT_IN_PIN B14 +#define COL_SHIFT_CLK_PIN B15 + +#define QUANTUM_PAINTER_SUPPORTS_256_PALETTE TRUE +#define QUANTUM_PAINTER_SUPPORTS_NATIVE_COLORS TRUE + +#define OLED_UPDATE_INTERVAL 66 + +#define BACKLIGHT_PWM_DRIVER PWMD3 +#define BACKLIGHT_PWM_CHANNEL 1 +#define BACKLIGHT_PAL_MODE 2 + +#define WS2812_PWM_DRIVER PWMD1 +#define WS2812_PWM_CHANNEL 3 +#define WS2812_PWM_PAL_MODE 1 +#define WS2812_DMA_STREAM STM32_DMA2_STREAM5 +#define WS2812_DMA_CHANNEL 6 + +#define TAP_CODE_DELAY 10 + +#define AUDIO_PIN B8 +#define AUDIO_PWM_DRIVER PWMD4 +#define AUDIO_PWM_CHANNEL 3 +#define AUDIO_PWM_PAL_MODE 2 +#define AUDIO_STATE_TIMER GPTD5 +#define AUDIO_INIT_DELAY diff --git a/keyboards/custommk/evo70_r2/halconf.h b/keyboards/custommk/evo70_r2/halconf.h new file mode 100644 index 0000000000..5268fe5de6 --- /dev/null +++ b/keyboards/custommk/evo70_r2/halconf.h @@ -0,0 +1,36 @@ +/* Copyright 2023 David Hoelscher (@customMK) + * + * 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 . + */ + +#pragma once + +#define HAL_USE_I2C TRUE + +#define HAL_USE_PWM TRUE + +#define HAL_USE_RTC TRUE + +#define HAL_USE_SPI TRUE + +#define HAL_USE_GPT TRUE + +#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD + +#define SERIAL_BUFFERS_SIZE 256 + +// This enables interrupt-driven mode +#define SPI_USE_WAIT TRUE + +#include_next diff --git a/keyboards/custommk/evo70_r2/info.json b/keyboards/custommk/evo70_r2/info.json new file mode 100644 index 0000000000..772325e7f8 --- /dev/null +++ b/keyboards/custommk/evo70_r2/info.json @@ -0,0 +1,152 @@ +{ + "keyboard_name": "EVO70 R2", + "url": "https://shop.custommk.com/collections/evo70/products/evo70", + "maintainer": "customMK", + "manufacturer": "customMK", + "tags": ["70%", "encoder", "underglow", "backlight"], + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true, + "encoder": true, + "quantum_painter": true, + "oled": true, + "rgblight": true, + "backlight": true, + "audio": true + }, + "usb": { + "vid": "0xF35B", + "pid": "0xFAB6", + "device_version": "1.0.0" + }, + "diode_direction": "ROW2COL", + "processor": "STM32F411", + "bootloader": "stm32-dfu", + "rgblight": { + "led_count": 48, + "hue_steps": 4, + "saturation_steps": 8, + "brightness_steps": 4, + "max_brightness": 128, + "layers": { + "enabled": true + }, + "animations": { + "alternating": true, + "breathing": true, + "christmas": true, + "knight": true, + "rainbo_mood": true, + "rainbow_swirl": true, + "rgb_test": true, + "snake": true, + "static_gradient": true, + "twinkle": true + } + }, + "ws2812": { + "driver": "pwm", + "pin": "A10" + }, + "backlight": { + "driver": "pwm", + "breathing": true, + "breathing_period": 6, + "levels": 17, + "pin": "A6" + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"Encoder", "matrix": [1, 0], "x":0.5, "y":0}, + {"label":"Esc", "matrix": [0, 0], "x":2.5, "y":0}, + {"label":"1", "matrix": [0, 2], "x":3.5, "y":0}, + {"label":"2", "matrix": [0, 3], "x":4.5, "y":0}, + {"label":"3", "matrix": [0, 4], "x":5.5, "y":0}, + {"label":"4", "matrix": [0, 5], "x":6.5, "y":0}, + {"label":"5", "matrix": [0, 6], "x":7.5, "y":0}, + {"label":"6", "matrix": [0, 7], "x":8.5, "y":0}, + {"label":"7", "matrix": [0, 8], "x":9.5, "y":0}, + {"label":"8", "matrix": [0, 9], "x":10.5, "y":0}, + {"label":"9", "matrix": [0, 10], "x":11.5, "y":0}, + {"label":"0", "matrix": [0, 11], "x":12.5, "y":0}, + {"label":"-", "matrix": [0, 12], "x":13.5, "y":0}, + {"label":"=", "matrix": [0, 13], "x":14.5, "y":0}, + {"label":"Backspace", "matrix": [0, 14], "x":15.5, "y":0, "w":2}, + {"label":"Delete", "matrix": [0, 15], "x":17.5, "y":0}, + + {"label":"Tab", "matrix": [1, 1], "x":2.5, "y":1, "w":1.5}, + {"label":"Q", "matrix": [1, 2], "x":4, "y":1}, + {"label":"W", "matrix": [1, 3], "x":5, "y":1}, + {"label":"E", "matrix": [1, 4], "x":6, "y":1}, + {"label":"R", "matrix": [1, 5], "x":7, "y":1}, + {"label":"T", "matrix": [1, 6], "x":8, "y":1}, + {"label":"Y", "matrix": [1, 7], "x":9, "y":1}, + {"label":"U", "matrix": [1, 8], "x":10, "y":1}, + {"label":"I", "matrix": [1, 9], "x":11, "y":1}, + {"label":"O", "matrix": [1, 10], "x":12, "y":1}, + {"label":"P", "matrix": [1, 11], "x":13, "y":1}, + {"label":"[", "matrix": [1, 12], "x":14, "y":1}, + {"label":"]", "matrix": [1, 13], "x":15, "y":1}, + {"label":"\\", "matrix": [1, 14], "x":16, "y":1, "w":1.5}, + {"label":"PgUp", "matrix": [1, 15], "x":17.5, "y":1}, + + {"label":"F1", "matrix": [2, 2], "x":0, "y":2}, + {"label":"F2", "matrix": [2, 0], "x":1, "y":2}, + {"label":"Caps Lock", "matrix": [2, 1], "x":2.5, "y":2, "w":1.75}, + {"label":"A", "matrix": [2, 3], "x":4.25, "y":2}, + {"label":"S", "matrix": [2, 4], "x":5.25, "y":2}, + {"label":"D", "matrix": [2, 5], "x":6.25, "y":2}, + {"label":"F", "matrix": [2, 6], "x":7.25, "y":2}, + {"label":"G", "matrix": [2, 7], "x":8.25, "y":2}, + {"label":"H", "matrix": [2, 8], "x":9.25, "y":2}, + {"label":"J", "matrix": [2, 9], "x":10.25, "y":2}, + {"label":"K", "matrix": [2, 10], "x":11.25, "y":2}, + {"label":"L", "matrix": [2, 11], "x":12.25, "y":2}, + {"label":";", "matrix": [2, 12], "x":13.25, "y":2}, + {"label":"'", "matrix": [2, 13], "x":14.25, "y":2}, + {"label":"Enter", "matrix": [2, 14], "x":15.25, "y":2, "w":2.25}, + {"label":"PgDn", "matrix": [2, 15], "x":17.5, "y":2}, + + {"label":"F3", "matrix": [3, 1], "x":0, "y":3}, + {"label":"F4", "matrix": [3, 0], "x":1, "y":3}, + {"label":"Shift", "matrix": [3, 2], "x":2.5, "y":3, "w":1.25}, + {"label":"\u2298", "matrix": [0, 1], "x":3.75, "y":3, "w":1}, + {"label":"Z", "matrix": [3, 3], "x":4.75, "y":3}, + {"label":"X", "matrix": [3, 4], "x":5.75, "y":3}, + {"label":"C", "matrix": [3, 5], "x":6.75, "y":3}, + {"label":"V", "matrix": [3, 6], "x":7.75, "y":3}, + {"label":"B", "matrix": [3, 7], "x":8.75, "y":3}, + {"label":"N", "matrix": [3, 8], "x":9.75, "y":3}, + {"label":"M", "matrix": [3, 9], "x":10.75, "y":3}, + {"label":",", "matrix": [3, 10], "x":11.75, "y":3}, + {"label":".", "matrix": [3, 11], "x":12.75, "y":3}, + {"label":"/", "matrix": [3, 12], "x":13.75, "y":3}, + {"label":"Shift", "matrix": [3, 13], "x":14.75, "y":3, "w":1.75}, + {"label":"Up", "matrix": [3, 14], "x":16.5, "y":3}, + {"label":"End", "matrix": [3, 15], "x":17.5, "y":3}, + + {"label":"F5", "matrix": [4, 3], "x":0, "y":4}, + {"label":"F6", "matrix": [4, 0], "x":1, "y":4}, + {"label":"Ctrl", "matrix": [4, 1], "x":2.5, "y":4, "w":1.25}, + {"label":"GUI", "matrix": [4, 2], "x":3.75, "y":4, "w":1.25}, + {"label":"Alt", "matrix": [4, 4], "x":5, "y":4, "w":1.25}, + {"label":"Space", "matrix": [4, 7], "x":6.25, "y":4, "w":6.25}, + {"label":"Alt", "matrix": [4, 10], "x":12.5, "y":4, "w":1.25}, + {"label":"Ctrl", "matrix": [4, 11], "x":13.75, "y":4, "w":1.25}, + {"label":"Left", "matrix": [4, 13], "x":15.5, "y":4}, + {"label":"Down", "matrix": [4, 14], "x":16.5, "y":4}, + {"label":"Right", "matrix": [4, 15], "x":17.5, "y":4} + ] + } + }, + "encoder": { + "rotary": [ + { "pin_a": "B7", "pin_b": "A4", "resolution": 2} + ] + } +} \ No newline at end of file diff --git a/keyboards/custommk/evo70_r2/keymaps/default/keymap.c b/keyboards/custommk/evo70_r2/keymaps/default/keymap.c new file mode 100644 index 0000000000..9dc7beabdd --- /dev/null +++ b/keyboards/custommk/evo70_r2/keymaps/default/keymap.c @@ -0,0 +1,33 @@ +/* Copyright 2023 David Hoelscher (@customMK) + * + * 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 . + */ + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [0] = LAYOUT( + KC_ESC, KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, + KC_F1, KC_F2, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_F3, KC_F4, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, + KC_F5, KC_F6, KC_LCTL, KC_LWIN, KC_LALT, KC_SPACE, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), +}; +#endif \ No newline at end of file diff --git a/keyboards/custommk/evo70_r2/keymaps/via/config.h b/keyboards/custommk/evo70_r2/keymaps/via/config.h new file mode 100644 index 0000000000..52e3afa69f --- /dev/null +++ b/keyboards/custommk/evo70_r2/keymaps/via/config.h @@ -0,0 +1,13 @@ +// Copyright 2023 David Hoelscher (@customMK) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +// With 8k FRAM, max out dynamic keymap layers and macros +// 5x16 matrix (160 bytes) and one encoder (4 bytes) consume 164 bytes per layer +// 32 layers consumes 5248 bytes +#define DYNAMIC_KEYMAP_LAYER_COUNT 32 + +// Most of the remaining space can be used for macros +// QMK Macro keycode range allows up to 128 macros +#define DYNAMIC_KEYMAP_MACRO_COUNT 128 diff --git a/keyboards/custommk/evo70_r2/keymaps/via/keymap.c b/keyboards/custommk/evo70_r2/keymaps/via/keymap.c new file mode 100644 index 0000000000..a971aa4e28 --- /dev/null +++ b/keyboards/custommk/evo70_r2/keymaps/via/keymap.c @@ -0,0 +1,33 @@ +/* Copyright 2023 David Hoelscher (@customMK) + * + * 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 . + */ + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [0] = LAYOUT( + KC_ESC, KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, + KC_F1, KC_F2, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_F3, KC_F4, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, + KC_F5, KC_F6, KC_LCTL, KC_LWIN, KC_LALT, KC_SPACE, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) } +}; +#endif \ No newline at end of file diff --git a/keyboards/custommk/evo70_r2/keymaps/via/rules.mk b/keyboards/custommk/evo70_r2/keymaps/via/rules.mk new file mode 100644 index 0000000000..4253f570f0 --- /dev/null +++ b/keyboards/custommk/evo70_r2/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes \ No newline at end of file diff --git a/keyboards/custommk/evo70_r2/matrix.c b/keyboards/custommk/evo70_r2/matrix.c new file mode 100644 index 0000000000..99a23a4542 --- /dev/null +++ b/keyboards/custommk/evo70_r2/matrix.c @@ -0,0 +1,117 @@ +// Copyright 2023 David Hoelscher (@customMK) +// SPDX-License-Identifier: GPL-2.0-or-later +#include "quantum.h" + +// Pin definitions +static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; + +void matrix_wait_for_pin(pin_t pin, uint8_t target_state) { + rtcnt_t start = chSysGetRealtimeCounterX(); + rtcnt_t end = start + 5000; + while (chSysIsCounterWithinX(chSysGetRealtimeCounterX(), start, end)) { + if (readPin(pin) == target_state) { + break; + } + } +} + +void matrix_wait_for_port(stm32_gpio_t *port, uint32_t target_bitmask) { + rtcnt_t start = chSysGetRealtimeCounterX(); + rtcnt_t end = start + 5000; + while (chSysIsCounterWithinX(chSysGetRealtimeCounterX(), start, end)) { + if ((palReadPort(port) & target_bitmask) == target_bitmask) { + break; + } + } +} + +void shift_pulse_clock(void) { + writePinHigh(COL_SHIFT_CLK_PIN); + matrix_wait_for_pin(COL_SHIFT_CLK_PIN, 1); + writePinLow(COL_SHIFT_CLK_PIN); +} + +void matrix_init_custom(void) { + //set all row pins as input with pullups + for (int i = 0; i < MATRIX_ROWS; ++i) { + writePinHigh(row_pins[i]); + setPinInputHigh(row_pins[i]); + } + + //set all column pins high in ROW2COL matrix + setPinOutput(COL_SHIFT_IN_PIN); + setPinOutput(COL_SHIFT_CLK_PIN); + writePinHigh(COL_SHIFT_IN_PIN); + matrix_wait_for_pin(COL_SHIFT_IN_PIN, 1); + + for (int i = 0; i < MATRIX_COLS; ++i) { + shift_pulse_clock(); + } + +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + static matrix_row_t temp_matrix[MATRIX_ROWS] = {0}; + + writePinLow(COL_SHIFT_IN_PIN); + matrix_wait_for_pin(COL_SHIFT_IN_PIN, 0); + + // Setup the output column pin + shift_pulse_clock(); + + writePinHigh(COL_SHIFT_IN_PIN); + for (int current_col = 0; current_col < MATRIX_COLS; ++current_col) { + + // Read the column ports + uint32_t gpio_a = palReadPort(GPIOA); + uint32_t gpio_b = palReadPort(GPIOB); + + // row 0, pin A8 + int current_row = 0; + if ((gpio_a & (1 << 8)) >> 8) { + temp_matrix[current_row] &= ~(1ul << current_col); + } else { + temp_matrix[current_row] |= (1ul << current_col); + } + // row 1, pin A1 + current_row = 1; + if ((gpio_a & (1 << 1)) >> 1) { + temp_matrix[current_row] &= ~(1ul << current_col); + } else { + temp_matrix[current_row] |= (1ul << current_col); + } + // row 2, pin A2 + current_row = 2; + if ((gpio_a & (1 << 2)) >> 2) { + temp_matrix[current_row] &= ~(1ul << current_col); + } else { + temp_matrix[current_row] |= (1ul << current_col); + } + // row 3, pin B3 + current_row = 3; + if ((gpio_b & (1 << 1)) >> 1) { + temp_matrix[current_row] &= ~(1ul << current_col); + } else { + temp_matrix[current_row] |= (1ul << current_col); + } + // row 4, pin A7 + current_row = 4; + if ((gpio_a & (1 << 7)) >> 7) { + temp_matrix[current_row] &= ~(1ul << current_col); + } else { + temp_matrix[current_row] |= (1ul << current_col); + } + + // Setup the output column pin + shift_pulse_clock(); + + } + + // Check if matrix has changed, return the last-read data + bool changed = memcmp(current_matrix, temp_matrix, sizeof(temp_matrix)) != 0; + if (changed) { + memcpy(current_matrix, temp_matrix, sizeof(temp_matrix)); + } + shift_pulse_clock(); + return changed; +} diff --git a/keyboards/custommk/evo70_r2/mcuconf.h b/keyboards/custommk/evo70_r2/mcuconf.h new file mode 100644 index 0000000000..afaa692ab8 --- /dev/null +++ b/keyboards/custommk/evo70_r2/mcuconf.h @@ -0,0 +1,58 @@ +/* Copyright 2023 David Hoelscher (@customMK) + * + * 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 . + */ + +#pragma once + +#include_next + +#undef STM32_LSE_ENABLED +#define STM32_LSE_ENABLED TRUE + +#undef STM32_RTCSEL +#define STM32_RTCSEL STM32_RTCSEL_LSE + +// Used for underglow +#undef STM32_PWM_USE_TIM1 //timer 1 channel 3 +#define STM32_PWM_USE_TIM1 TRUE + +// Used for backlight +//#undef STM32_PWM_USE_TIM2 //timer 2 channel ? +//#define STM32_PWM_USE_TIM2 TRUE + +// Used for backlight +#undef STM32_PWM_USE_TIM3 //timer 3 channel 1 +#define STM32_PWM_USE_TIM3 TRUE + +// Used for backlight +//#undef STM32_GPT_USE_TIM3 //timer 3 channel 1 +//#define STM32_GPT_USE_TIM3 TRUE + +// Used for backlight +#undef STM32_PWM_USE_TIM4 //timer 4 channel ? +#define STM32_PWM_USE_TIM4 TRUE + +// Used for backlight +#undef STM32_GPT_USE_TIM5 //timer 5 channel ? +#define STM32_GPT_USE_TIM5 TRUE + +// Used for FRAM and flash in example code +#undef STM32_SPI_USE_SPI1 +#define STM32_SPI_USE_SPI1 TRUE + +// Used for OLED +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE + diff --git a/keyboards/custommk/evo70_r2/readme.md b/keyboards/custommk/evo70_r2/readme.md new file mode 100644 index 0000000000..ac2f638cb2 --- /dev/null +++ b/keyboards/custommk/evo70_r2/readme.md @@ -0,0 +1,21 @@ +# EVO70 R2 + +EVO70 R2 is a 70% keyboard (65% w/left side function cluster) designed and produced by customMK. + +![EVO70 R2](https://i.imgur.com/B1QMuIxh.jpeg) + +* Keyboard Maintainer: [customMK](https://github.com/customMK) +* Hardware Supported: EVO70 R2 +* Hardware Availability: [customMK](https://shop.custommk.com/collections/evo70/products/evo70) + +Make example for this keyboard (after setting up your build environment): + + make custommk/evo70_r2:default + +Flashing example for this keyboard: + + make custommk/evo70_r2:default:flash + +To enter the bootloader, run the flashing command above, and then either plug in the USB connection while holding the top-left key, or alternatively, plug in the USB connection and then press the reset button on the PCB located under the space bar. + +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/custommk/evo70_r2/rules.mk b/keyboards/custommk/evo70_r2/rules.mk new file mode 100644 index 0000000000..b79d08c6b7 --- /dev/null +++ b/keyboards/custommk/evo70_r2/rules.mk @@ -0,0 +1,11 @@ +AUDIO_DRIVER = pwm_hardware + +# project specific files +SRC += matrix.c + +EEPROM_DRIVER = spi + +QUANTUM_PAINTER_DRIVERS = st7735_spi + +CUSTOM_MATRIX = lite +CIE1931_CURVE = yes \ No newline at end of file -- cgit v1.2.3