From cf46f1e52bf3392261be7758db978665803bbae5 Mon Sep 17 00:00:00 2001
From: jiaxin96 <572673807@qq.com>
Date: Mon, 14 Jun 2021 14:17:03 +0800
Subject: [PATCH] fix eeprom bug
---
keyboards/yandrstudio/whiteMouse28T/config.h | 21 -----
.../yandrstudio/whiteMouse28T/f401/chconf.h | 34 +++++++
.../yandrstudio/whiteMouse28T/f401/config.h | 94 +++++++++++++++++++
.../yandrstudio/whiteMouse28T/f401/halconf.h | 9 +-
.../yandrstudio/whiteMouse28T/f401/mcuconf.h | 9 +-
.../yandrstudio/whiteMouse28T/f401/rules.mk | 8 ++
.../yandrstudio/whiteMouse28T/info-via.json | 6 --
.../whiteMouse28T/keymaps/default/keymap.c | 3 +-
.../whiteMouse28T/keymaps/via/keymap.c | 27 +++++-
keyboards/yandrstudio/whiteMouse28T/rules.mk | 10 +-
.../yandrstudio/whiteMouse28T/whiteMouse28T.c | 26 ++---
11 files changed, 193 insertions(+), 54 deletions(-)
create mode 100644 keyboards/yandrstudio/whiteMouse28T/f401/chconf.h
create mode 100644 keyboards/yandrstudio/whiteMouse28T/f401/config.h
diff --git a/keyboards/yandrstudio/whiteMouse28T/config.h b/keyboards/yandrstudio/whiteMouse28T/config.h
index 3db8cd2482f6..08dae645004a 100644
--- a/keyboards/yandrstudio/whiteMouse28T/config.h
+++ b/keyboards/yandrstudio/whiteMouse28T/config.h
@@ -50,25 +50,4 @@
-/* RGN Matrix */
-#ifdef RGB_MATRIX_ENABLE
-
-# define RGB_DI_PIN B5
-# define RGBLED_NUM 2
-# define DRIVER_LED_TOTAL RGBLED_NUM
-
-
-# define WS2812_SPI SPID1 // default: SPID1
-# define WS2812_SPI_MOSI_PAL_MODE 5
-
-# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 180
-# define RGBLIGHT_VAL_STEP 18
-# define RGB_DISABLE_WHEN_USB_SUSPENDED true
-# define RGB_MATRIX_CENTER { 32, 96 }
-# define RGB_MATRIX_KEYPRESSES
-# define RGB_MATRIX_FRAMEBUFFER_EFFECTS
-
-#endif
-
-
diff --git a/keyboards/yandrstudio/whiteMouse28T/f401/chconf.h b/keyboards/yandrstudio/whiteMouse28T/f401/chconf.h
new file mode 100644
index 000000000000..4820db8dcbeb
--- /dev/null
+++ b/keyboards/yandrstudio/whiteMouse28T/f401/chconf.h
@@ -0,0 +1,34 @@
+/* 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 .
+ */
+
+#pragma once
+
+#define CH_CFG_ST_FREQUENCY 10000
+
+#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
+
+#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
+
+#define CH_CFG_FACTORY_SEMAPHORES TRUE
+
+#define CH_CFG_FACTORY_MAILBOXES TRUE
+
+#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
+
+#define CH_CFG_FACTORY_PIPES TRUE
+
+#include_next
+
diff --git a/keyboards/yandrstudio/whiteMouse28T/f401/config.h b/keyboards/yandrstudio/whiteMouse28T/f401/config.h
new file mode 100644
index 000000000000..d342f2855e86
--- /dev/null
+++ b/keyboards/yandrstudio/whiteMouse28T/f401/config.h
@@ -0,0 +1,94 @@
+/* Copyright 2021 JasonRen(biu)
+ *
+ * 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 "config_common.h"
+
+
+/* RGN Matrix */
+#ifdef RGB_MATRIX_ENABLE
+
+# define RGB_DI_PIN B5
+# define RGBLED_NUM 1
+# 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_STREAM2 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
+#define WS2812_DMA_CHANNEL 5 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
+
+# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 100
+# define RGBLIGHT_VAL_STEP 18
+# define RGB_DISABLE_WHEN_USB_SUSPENDED true
+# define RGB_MATRIX_CENTER { 32, 96 }
+# define RGB_MATRIX_KEYPRESSES
+# define RGB_MATRIX_FRAMEBUFFER_EFFECTS
+
+// # define WS2812_EXTERNAL_PULLUP
+# define WS2812_BYTE_ORDER WS2812_BYTE_ORDER_RGB
+#endif
+
+
+#ifdef RGBLIGHT_ENABLE
+
+# define RGB_DI_PIN B5
+# define RGBLED_NUM 1
+# 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_STREAM2 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
+#define WS2812_DMA_CHANNEL 5 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
+
+
+// # define WS2812_EXTERNAL_PULLUP
+# define WS2812_BYTE_ORDER WS2812_BYTE_ORDER_RGB
+
+#endif
+
+#ifdef EEPROM_SPI
+
+# define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4
+# define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 3
+# define EXTERNAL_EEPROM_BYTE_COUNT 32768
+# define EXTERNAL_EEPROM_PAGE_SIZE 64
+# define EXTERNAL_EEPROM_ADDRESS_SIZE 2
+
+
+# define SPI_DRIVER SPID1
+# define SPI_SCK_PIN A5
+# define SPI_MOSI_PIN A7
+# define SPI_MISO_PIN A6
+
+# ifdef VIA_ENABLE
+# define VIA_EEPROM_LAYOUT_OPTIONS_SIZE 2
+# define DYNAMIC_KEYMAP_LAYER_COUNT 20
+# define DYNAMIC_KEYMAP_MACRO_COUNT 30
+# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 10240
+# endif
+
+#else
+
+# define TRANSIENT_EEPROM_SIZE 1024
+
+#endif
+
+// #define DEBUG_MATRIX_SCAN_RATE
+
+
diff --git a/keyboards/yandrstudio/whiteMouse28T/f401/halconf.h b/keyboards/yandrstudio/whiteMouse28T/f401/halconf.h
index 3c35122cf29d..6ce8503fb4f8 100644
--- a/keyboards/yandrstudio/whiteMouse28T/f401/halconf.h
+++ b/keyboards/yandrstudio/whiteMouse28T/f401/halconf.h
@@ -18,8 +18,8 @@
#pragma once
#include_next
-// #undef HAL_USE_PWM
-// #define HAL_USE_PWM TRUE
+#undef HAL_USE_PWM
+#define HAL_USE_PWM TRUE
// #define HAL_USE_SERIAL TRUE
@@ -30,5 +30,8 @@
#undef HAL_USE_SPI
#define HAL_USE_SPI TRUE
-
+#undef SPI_USE_WAIT
+#define SPI_USE_WAIT TRUE
+#undef SPI_SELECT_MODE
+#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
diff --git a/keyboards/yandrstudio/whiteMouse28T/f401/mcuconf.h b/keyboards/yandrstudio/whiteMouse28T/f401/mcuconf.h
index ec7ed63a1488..49983c27dd81 100644
--- a/keyboards/yandrstudio/whiteMouse28T/f401/mcuconf.h
+++ b/keyboards/yandrstudio/whiteMouse28T/f401/mcuconf.h
@@ -18,10 +18,12 @@
#include_next
-#undef STM32_SPI_USE_SPI1
-#define STM32_SPI_USE_SPI1 TRUE
+#undef STM32_PWM_USE_TIM3
+#define STM32_PWM_USE_TIM3 TRUE
+#undef STM32_SPI_USE_SPI1
+#define STM32_SPI_USE_SPI1 TRUE
#undef STM32_NO_INIT
#undef STM32_HSI_ENABLED
@@ -63,8 +65,11 @@
#define STM32_PLLN_VALUE 192
#define STM32_PLLP_VALUE 4
#define STM32_PLLQ_VALUE 4
+// AHB prescaler value.
#define STM32_HPRE STM32_HPRE_DIV1
+//APB1 prescaler value.
#define STM32_PPRE1 STM32_PPRE1_DIV4
+//APB2 prescaler value.
#define STM32_PPRE2 STM32_PPRE2_DIV2
#define STM32_RTCSEL STM32_RTCSEL_LSI
#define STM32_RTCPRE_VALUE 8
diff --git a/keyboards/yandrstudio/whiteMouse28T/f401/rules.mk b/keyboards/yandrstudio/whiteMouse28T/f401/rules.mk
index 1f81ff6f41f1..32c777db1e7d 100644
--- a/keyboards/yandrstudio/whiteMouse28T/f401/rules.mk
+++ b/keyboards/yandrstudio/whiteMouse28T/f401/rules.mk
@@ -4,8 +4,16 @@ MCU = STM32F401
# Address of the bootloader in system memory
STM32_BOOTLOADER_ADDRESS = 0x1FFF0000
+# Bootloader selection
+BOOTLOADER = stm32-dfu
+
CUSTOM_MATRIX = lite # for using the A9 pin as matrix io
# # project specific file
QUANTUM_SRC += matrix.c
+
+
+WS2812_DRIVER = pwm
+
+# EEPROM_DRIVER = spi
diff --git a/keyboards/yandrstudio/whiteMouse28T/info-via.json b/keyboards/yandrstudio/whiteMouse28T/info-via.json
index 98ec08a819b5..2750601ee257 100644
--- a/keyboards/yandrstudio/whiteMouse28T/info-via.json
+++ b/keyboards/yandrstudio/whiteMouse28T/info-via.json
@@ -20,13 +20,7 @@
"0,6"
],
[
- {
- "f": 1
- },
"1,0",
- {
- "f": 3
- },
"1,1",
"1,2",
"1,3",
diff --git a/keyboards/yandrstudio/whiteMouse28T/keymaps/default/keymap.c b/keyboards/yandrstudio/whiteMouse28T/keymaps/default/keymap.c
index c05dd6d79bab..04d6d44712e3 100644
--- a/keyboards/yandrstudio/whiteMouse28T/keymaps/default/keymap.c
+++ b/keyboards/yandrstudio/whiteMouse28T/keymaps/default/keymap.c
@@ -21,6 +21,5 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H,
- KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, KC_TRNS, KC_RCTL)
-
+ RGB_TOG, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, KC_TRNS, KC_RCTL)
};
diff --git a/keyboards/yandrstudio/whiteMouse28T/keymaps/via/keymap.c b/keyboards/yandrstudio/whiteMouse28T/keymaps/via/keymap.c
index 4d2d33d932f4..6effcb532d9a 100644
--- a/keyboards/yandrstudio/whiteMouse28T/keymaps/via/keymap.c
+++ b/keyboards/yandrstudio/whiteMouse28T/keymaps/via/keymap.c
@@ -17,14 +17,35 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- LAYOUT(
+ LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H,
- KC_LSFT, KC_Z, KC_X, KC_C, KC_V, MO(1), KC_RSFT),
+ RGB_TOG, KC_Z, KC_X, KC_C, KC_V, MO(1), KC_RSFT),
+ LAYOUT(
+ 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, 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, KC_TRNS, KC_TRNS),
+ LAYOUT(
+ 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, 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, KC_TRNS, KC_TRNS),
LAYOUT(
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, 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, KC_TRNS, KC_TRNS)
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
};
+
+
+// void keyboard_post_init_user(void) {
+// eeconfig_init();
+// // Customise these values to desired behaviour
+// // debug_enable=true;
+// // debug_matrix=false;
+// // debug_keyboard=true;
+// //debug_mouse=true;
+// }
+
diff --git a/keyboards/yandrstudio/whiteMouse28T/rules.mk b/keyboards/yandrstudio/whiteMouse28T/rules.mk
index bd13750b554e..a2e0638abb18 100644
--- a/keyboards/yandrstudio/whiteMouse28T/rules.mk
+++ b/keyboards/yandrstudio/whiteMouse28T/rules.mk
@@ -2,10 +2,10 @@
# change yes to no to disable
#
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
-# KEYBOARD_SHARED_EP = yes # Free up some extra endpoints - needed if console+mouse+extra
-MOUSEKEY_ENABLE = no # Mouse keys
+KEYBOARD_SHARED_EP = yes # Free up some extra endpoints - needed if console+mouse+extra
+MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
-CONSOLE_ENABLE = no # Console for debug
+CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = yes # 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
@@ -13,5 +13,7 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = WS2812
-WS2812_DRIVER = spi
+
+# RGBLIGHT_ENABLE = yes
+# RGBLIGHT_DRIVER = WS2812
diff --git a/keyboards/yandrstudio/whiteMouse28T/whiteMouse28T.c b/keyboards/yandrstudio/whiteMouse28T/whiteMouse28T.c
index f699d1a5cd36..e61ab4870a11 100644
--- a/keyboards/yandrstudio/whiteMouse28T/whiteMouse28T.c
+++ b/keyboards/yandrstudio/whiteMouse28T/whiteMouse28T.c
@@ -21,19 +21,19 @@
#ifdef RGB_MATRIX_ENABLE
led_config_t g_led_config = {
{
- { 0, 1, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, \
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, \
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, \
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, \
+ { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, 0 }, \
},
{
// LED Index to Physical Position
- {0, 0}, {16, 0}
+ {0, 0}
},
{
// LED Index to Flag
- 4, 4
+ 4
}
};
@@ -50,14 +50,14 @@ led_config_t g_led_config = {
#endif
-#ifdef RGB_DISABLE_WHEN_USB_SUSPENDED
-void suspend_power_down_kb(void) {
- rgb_matrix_set_suspend_state(true);
- suspend_power_down_user();
-}
+// #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
+// void suspend_wakeup_init_kb(void) {
+// rgb_matrix_set_suspend_state(false);
+// suspend_wakeup_init_user();
+// }
+// #endif