Skip to content

Commit

Permalink
add final80v2 and yp980ble
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaxin96 committed Jun 21, 2021
1 parent 50e5c4b commit 8d0cf13
Show file tree
Hide file tree
Showing 41 changed files with 7,367 additions and 27 deletions.
83 changes: 83 additions & 0 deletions keyboards/yandrstudio/final80v2/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#ifndef CONFIG_H
#define CONFIG_H

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0002
#define MANUFACTURER Neilzx - Design
#define PRODUCT Final80 % v2
#define DESCRIPTION STM32 based 80% keyboard with full rgb, oled and encoder.

/* key matrix set */
#define MATRIX_ROWS 6
#define MATRIX_COLS 15

#define MATRIX_ROW_PINS { A10, A9, A1, A0, B8, B9 }
#define MATRIX_COL_PINS { A8, B15, B14, B13, B12, B11, B10, B1, B0, A6, A5, A4, A3, A2, C13 }
#define DIODE_DIRECTION ROW2COL
#define DEBOUNCE 5

/* RGN Matrix */
#ifdef RGB_MATRIX_ENABLE
# define RGB_DI_PIN A7
# define RGBLED_NUM 100
# define DRIVER_LED_TOTAL RGBLED_NUM

# define WS2812_PWM_DRIVER PWMD3 // default: PWMD2
# define WS2812_PWM_CHANNEL 2 // default: 2
# define WS2812_PWM_PAL_MODE 2 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2
# define WS2812_DMA_STREAM STM32_DMA1_STREAM3 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
# define WS2812_DMA_CHANNEL 3 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.

# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255 // 最大亮度限制
# define RGB_DISABLE_WHEN_USB_SUSPENDED true
# define RGB_MATRIX_CENTER { 96, 32 }
# define RGB_MATRIX_KEYPRESSES
# define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#endif

/* Encoder */
#ifdef ENCODER_ENABLE
# define ENCODERS_PAD_A { B4 }
# define ENCODERS_PAD_B { B5 }
# define ENCODER_RESOLUTION 4
//# define ENCODER_DIRECTION_FLIP // 如果旋钮反向,启用此处
#endif

/* MOUSEKEY */
#ifdef MOUSEKEY_ENABLE
# define MOUSEKEY_DELAY 0
# define MOUSEKEY_INTERVAL 17
# define MK_3_SPEED
# define MK_MOMENTARY_ACCEL
# define MK_C_OFFSET_UNMOD 64 // MOUSEKEY移动鼠标指针一次64像素
# define MK_C_INTERVAL_UNMOD 17
#endif

/* OLED */
#ifdef OLED_DRIVER_ENABLE
# define OLED_DISPLAY_128X64
# define I2C_DRIVER I2CD1
//# define OLED_IC OLED_IC_SH1106 // 选用1.3寸SH1106主控OLED时打开, 0.96寸SSD1306主控OLED注释掉本行。
//# define OLED_COLUMN_OFFSET 2 // 调整OLED纵向偏移,0.96寸SSD1306主控OLED注释掉本行。
# define I2C1_TIMINGR_PRESC 0U
# define I2C1_TIMINGR_SCLDEL 7U
# define I2C1_TIMINGR_SDADEL 0U
# define I2C1_TIMINGR_SCLH 38U
# define I2C1_TIMINGR_SCLL 129U
# define OLED_TIMEOUT 60000 // 60秒无操作关闭OLED
# define OLED_FONT_HEIGHT 8
# define OLED_FONT_WIDTH 6
# define OLED_FONT_H "neil_font.c"
#endif

/* Others */
#define TAP_HOLD_CAPS_DELAY 10

#ifdef CONSOLE_ENABLE
# define DEBUG_MATRIX_SCAN_RATE
#endif
#endif
79 changes: 79 additions & 0 deletions keyboards/yandrstudio/final80v2/final80v2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#include "final80v2.h"

#ifdef RGB_MATRIX_ENABLE

# define XX NO_LED
led_config_t g_led_config = { //
{
// Key Matrix to LED Index
{4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, XX}, //
{31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, XX}, //
{32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, XX}, //
{58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, XX, XX}, //
{59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, XX, 70, 71, 72}, //
{81, 80, 79, XX, XX, 78, XX, XX, XX, 77, XX, 76, 75, 74, 73}, // !! 轴灯对应矩阵的接线顺序
},
{
// LED Index to Physical Position
{214, 4}, {220, 11}, {214, 18}, {206, 11}, // First 4 for encoder.
{2, 3}, {19, 3}, {32, 3}, {45, 3}, {59, 3}, {76, 3}, {89, 3}, {103, 3}, {116, 3}, {133, 3}, {147, 3}, {160, 3}, {173, 3}, {191, 3}, // row0
{184, 16}, {163, 16}, {150, 16}, {136, 16}, {123, 16}, {110, 16}, {96, 16}, {83, 16}, {69, 16}, {56, 16}, {42, 16}, {29, 16}, {16, 16}, {2, 16}, // row1
{5, 27}, {22, 27}, {36, 27}, {49, 27}, {63, 27}, {76, 27}, {89, 27}, {103, 27}, {116, 27}, {130, 27}, {143, 27}, {157, 27}, {170, 27}, {187, 27}, // row2
{182, 38}, {160, 38}, {146, 38}, {133, 38}, {119, 38}, {106, 38}, {93, 38}, {79, 38}, {66, 38}, {52, 38}, {39, 38}, {26, 38}, {7, 38}, // row3
{10, 49}, {32, 49}, {46, 49}, {59, 49}, {73, 49}, {86, 49}, {99, 49}, {113, 49}, {126, 49}, {140, 49}, {153, 49}, {178, 49}, {207, 52}, {221, 63}, // row4
{207, 63}, {193, 63}, {175, 60}, {160, 60}, {145, 60}, {89, 60}, {34, 60}, {19, 60}, {3, 60}, // row5
{1, 64}, {43, 64}, {72, 64}, {104, 64}, {137, 64}, {180, 64}, {224, 64}, {224, 46}, {224, 29}, {224, 1}, {180, 1}, {147, 1}, {116.1}, {77, 1}, {45, 1}, {1, 1}, {1, 27}, {1, 41}, // Last 18 for backlight.
//!! 按接线顺序排列轴灯的物理位置
},

{
// LED Index to Flag
8, 8, 8, 8, //
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //
1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, //
1, 1, 1, 4, 1, 4, 1, 4, 4, //
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, //!! 每个灯是干啥用的

}};

// {旋钮背光用作层指示灯} -----------------------------------------------//
void rgb_matrix_indicators_kb(void) {
if (host_keyboard_led_state().caps_lock) { // Capslock = RED
rgb_matrix_set_color(0, 200, 0, 0);
rgb_matrix_set_color(1, 200, 0, 0);
rgb_matrix_set_color(2, 200, 0, 0);
rgb_matrix_set_color(3, 200, 0, 0);
} else if (get_autoshift_state()) { // AUTO_SHIFT = GREEN
rgb_matrix_set_color(0, 0, 200, 0);
rgb_matrix_set_color(1, 0, 200, 0);
rgb_matrix_set_color(2, 0, 200, 0);
rgb_matrix_set_color(3, 0, 200, 0);
} else if (biton32(layer_state) == 1) { // UPPER_LAYER = BLUE
rgb_matrix_set_color(0, 0, 0, 200);
rgb_matrix_set_color(1, 0, 0, 200);
rgb_matrix_set_color(2, 0, 0, 200);
rgb_matrix_set_color(3, 0, 0, 200);
} else {
rgb_matrix_set_color(0, 0, 0, 0);
rgb_matrix_set_color(1, 0, 0, 0);
rgb_matrix_set_color(2, 0, 0, 0);
rgb_matrix_set_color(3, 0, 0, 0);
}
}

#endif

#ifdef RGB_DISABLE_WHEN_USB_SUSPENDED
void suspend_power_down_kb(void) {
rgb_matrix_set_suspend_state(true);
suspend_power_down_user();
}

void suspend_wakeup_init_kb(void) {
rgb_matrix_set_suspend_state(false);
suspend_wakeup_init_user();
}
#endif
22 changes: 22 additions & 0 deletions keyboards/yandrstudio/final80v2/final80v2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef FINAL80V2_H
#define FINAL80V2_H

#include "quantum.h"

#define LAYOUT(\
K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \
K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, \
K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, \
K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, \
K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K412, K413, K414, \
K500, K501, K502, K505, K509, K511, K512, K513, K514 \
)\
{\
{K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \
{K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, KC_NO}, \
{K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, KC_NO}, \
{K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, KC_NO,KC_NO}, \
{K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, KC_NO,K412, K413, K414 }, \
{K500, K501, K502, KC_NO,KC_NO,K505, KC_NO,KC_NO,KC_NO,K509, KC_NO,K511, K512, K513, K514 } \
}
#endif
26 changes: 26 additions & 0 deletions keyboards/yandrstudio/final80v2/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* Copyright 2020 QMK
*
* 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:https://www.gnu.org/licenses/>.
*/


#pragma once

#include_next <halconf.h>

#undef HAL_USE_I2C
#define HAL_USE_I2C TRUE

#undef HAL_USE_PWM
#define HAL_USE_PWM TRUE
Loading

0 comments on commit 8d0cf13

Please sign in to comment.