diff --git a/keyboards/yandrstudio/boy40ble/boy40ble.c b/keyboards/yandrstudio/boy40ble/boy40ble.c
new file mode 100644
index 000000000000..b4bd89447994
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/boy40ble.c
@@ -0,0 +1,50 @@
+/* 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 .
+ */
+#include QMK_KEYBOARD_H
+
+
+#ifdef RGB_MATRIX_ENABLE
+led_config_t g_led_config = {
+ {
+ { 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, 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 }, \
+ },
+ {
+ // LED Index to Physical Position
+ {0,0}
+ },
+ {
+ // LED Index to Flag
+ 4
+ }
+};
+
+
+#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
diff --git a/keyboards/yandrstudio/boy40ble/boy40ble.h b/keyboards/yandrstudio/boy40ble/boy40ble.h
new file mode 100644
index 000000000000..7e7f678cae8c
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/boy40ble.h
@@ -0,0 +1,30 @@
+/* Copyright 2020 zvecr
+ *
+ * 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 "quantum.h"
+
+#define LAYOUT( \
+ K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, \
+ K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K111, \
+ K200, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, \
+ K300, K301, K302, K304, K307, K309, K310, K311 \
+) { \
+ { K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011 }, \
+ { K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, KC_NO, K111 }, \
+ { K200, KC_NO, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211 }, \
+ { K300, K301, K302, KC_NO, K304, KC_NO, KC_NO, K307, KC_NO, K309, K310, K311 } \
+}
diff --git a/keyboards/yandrstudio/boy40ble/config.h b/keyboards/yandrstudio/boy40ble/config.h
new file mode 100644
index 000000000000..18c398ce2a86
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/config.h
@@ -0,0 +1,53 @@
+/* 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"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xAA96
+#define PRODUCT_ID 0xAAA6
+#define DEVICE_VER 0x0001
+#define MANUFACTURER JasonRen biu
+#define PRODUCT boy40ble
+
+/* key matrix size */
+#define MATRIX_ROWS 4
+#define MATRIX_COLS 12
+
+// 0 1 2 3 4 5 6 7 8 9 10 11 12 13
+#define MATRIX_COL_PINS { A4, B15, B14, B13,B12,C13, B9, B8, B5,B4, B3, A15}
+#define MATRIX_ROW_PINS { B10, A8, A5, C14}
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION ROW2COL
+
+
+// enable the nkro when using the VIA.
+#define FORCE_NKRO
+
+// fix VIA RGB_light
+#define VIA_HAS_BROKEN_KEYCODES
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCE 5
+
+
+
+
diff --git a/keyboards/yandrstudio/boy40ble/f401/board.h b/keyboards/yandrstudio/boy40ble/f401/board.h
new file mode 100644
index 000000000000..d6432824e162
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/f401/board.h
@@ -0,0 +1,25 @@
+/* Copyright 2020 Nick Brassel (tzarc)
+ *
+ * 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 3 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 "board.h"
+
+
+#undef STM32_HSECLK
+#define STM32_HSECLK 8000000
+
+
+#define BOARD_YANDR_BIU_F401
diff --git a/keyboards/yandrstudio/boy40ble/f401/chconf.h b/keyboards/yandrstudio/boy40ble/f401/chconf.h
new file mode 100644
index 000000000000..4820db8dcbeb
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/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/boy40ble/f401/config.h b/keyboards/yandrstudio/boy40ble/f401/config.h
new file mode 100644
index 000000000000..bbf426b84bcf
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/f401/config.h
@@ -0,0 +1,61 @@
+/* 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 A7
+# 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 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
+
+
+#ifdef RGBLIGHT_ENABLE
+
+# define RGB_DI_PIN A7
+# 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.
+
+#endif
+
+
+
diff --git a/keyboards/yandrstudio/boy40ble/f401/eep/eeprom_stm32.c b/keyboards/yandrstudio/boy40ble/f401/eep/eeprom_stm32.c
new file mode 100644
index 000000000000..12071a21291e
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/f401/eep/eeprom_stm32.c
@@ -0,0 +1,217 @@
+/*
+ * This software is experimental and a work in progress.
+ * Under no circumstances should these files be used in relation to any critical system(s).
+ * Use of these files is at your own risk.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * This files are free to use from http://engsta.com/stm32-flash-memory-eeprom-emulator/ by
+ * Artur F.
+ *
+ * Modifications for QMK and STM32F303 by Yiancar
+ * update for STM32F4 support and the the flashing algorithm by yulei
+ * Adjust the file structure to custom EEPROM_DRIVER by jiaxin96 for support stm32f401cc
+ */
+
+#include
+#include
+#include "eeprom_stm32_custom.h"
+#include "eeprom_driver.h"
+/*****************************************************************************
+ * Allows to use the internal flash to store non volatile data. To initialize
+ * the functionality use the EEPROM_Init() function. Be sure that by reprogramming
+ * of the controller just affected pages will be deleted. In other case the non
+ * volatile data will be lost.
+ ******************************************************************************/
+
+/* Private macro -------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/* Functions -----------------------------------------------------------------*/
+
+#define IS_VALID_ADDRESS(x) ((x) < FEE_MAX_BYTES)
+
+uint8_t DataBuf[FEE_MAX_BYTES];
+static void EEPROM_Backup(void);
+static FLASH_Status EEPROM_Restore(void);
+static uint32_t EEPROM_FindValidAddress(void);
+static void EEPROM_Clear(void);
+
+/*****************************************************************************
+ * Unlock the FLASH programming and initialized the DataBuf
+ ******************************************************************************/
+uint16_t EEPROM_Init(void) {
+ // unlock flash
+ FLASH_Unlock();
+
+ // initialize DataBuf
+ EEPROM_Backup();
+
+ // Clear Flags
+ // FLASH_ClearFlag(FLASH_SR_EOP|FLASH_SR_PGERR|FLASH_SR_WRPERR);
+
+ return FEE_DENSITY_BYTES;
+}
+void eeprom_driver_init(void) {
+ EEPROM_Init();
+}
+
+/*****************************************************************************
+ * Erase the whole reserved Flash Space used for user Data
+ ******************************************************************************/
+void EEPROM_Erase(void) {
+ // erase all flash pages
+ EEPROM_Clear();
+
+ // reset the content of the buffer
+ memset(&DataBuf[0], FEE_EMPTY_BYTE, sizeof(DataBuf));
+}
+void eeprom_driver_erase(void) {
+ EEPROM_Erase();
+}
+/*****************************************************************************
+ * Write data with its eeprom address to flash if there has empty words,
+ * otherwise backup the current valid data, erase all flash pages,
+ * and finally restore the valid data.
+ *******************************************************************************/
+uint16_t EEPROM_WriteDataByte(uint16_t Address, uint8_t DataByte) {
+ FLASH_Status FlashStatus = FLASH_COMPLETE;
+
+ uint32_t addr;
+ // exit if not a valid address
+ if (!IS_VALID_ADDRESS(Address)) {
+ return 0;
+ }
+
+// we are sure the address will not be out of bound
+#pragma GCC diagnostic ignored "-Warray-bounds"
+ // same value, do not need program
+ if (DataBuf[Address] == DataByte) {
+ return FlashStatus;
+ }
+
+ // find the address can be written
+ addr = EEPROM_FindValidAddress();
+ DataBuf[Address] = DataByte;
+#pragma GCC diagnostic pop
+ if (addr == FEE_EMPTY_VALUE) {
+ // EEPROM is full, need to erase and reprogramming
+ EEPROM_Clear();
+ EEPROM_Restore();
+ } else {
+ FLASH_ProgramHalfWord(FEE_ADDR_ADDRESS(addr), Address);
+ FLASH_ProgramHalfWord(FEE_DATA_ADDRESS(addr), DataByte);
+ }
+
+ return FlashStatus;
+}
+/*****************************************************************************
+ * Read once data byte from a specified address.
+ *******************************************************************************/
+uint8_t EEPROM_ReadDataByte(uint16_t Address) {
+ if (!IS_VALID_ADDRESS(Address)) {
+ return FEE_EMPTY_BYTE;
+ }
+
+ // Get Byte from caches
+ return DataBuf[Address];
+}
+
+/*****************************************************************************
+ * helper functions
+ *******************************************************************************/
+// backup the current data
+void EEPROM_Backup(void)
+{
+ uint32_t begin = FEE_PAGE_BASE_ADDRESS;
+ uint32_t end = FEE_PAGE_END_ADDRESS;
+ memset(&DataBuf[0], FEE_EMPTY_BYTE, sizeof(DataBuf));
+ while( begin < end) {
+ uint16_t addr = *(__IO uint16_t*)(FEE_ADDR_ADDRESS(begin));
+ if (IS_VALID_ADDRESS(addr)) {
+ DataBuf[addr] = *(__IO uint16_t*)(FEE_DATA_ADDRESS(begin));
+ } else if( addr == FEE_EMPTY_WORD) {
+ uint16_t data = *(__IO uint16_t*)(FEE_DATA_ADDRESS(begin));
+ if (data == FEE_EMPTY_WORD) {
+ // we reached the end of valid data
+ break;
+ }
+ }
+ begin += 4;
+ }
+}
+// restore data from DataBuf
+FLASH_Status EEPROM_Restore(void) {
+ uint32_t cur = FEE_PAGE_BASE_ADDRESS;
+ for (uint8_t i = 0; i < FEE_MAX_BYTES; i++) {
+ if (DataBuf[i] != FEE_EMPTY_BYTE) {
+ FLASH_ProgramHalfWord(FEE_ADDR_ADDRESS(cur), i);
+ FLASH_ProgramHalfWord(FEE_DATA_ADDRESS(cur), DataBuf[i]);
+ cur += 4;
+ }
+ }
+ return FLASH_COMPLETE;
+}
+// find an empty place for programming
+uint32_t EEPROM_FindValidAddress(void) {
+ uint32_t begin = FEE_PAGE_BASE_ADDRESS;
+ uint32_t end = FEE_PAGE_END_ADDRESS;
+ while( begin < end) {
+ uint32_t data = *(__IO uint32_t*)(begin);
+ if (data == FEE_EMPTY_VALUE) {
+ return begin;
+ }
+ begin += 4;
+ }
+ return FEE_EMPTY_VALUE;
+}
+
+void EEPROM_Clear(void)
+{
+#if defined(EEPROM_EMU_STM32F401xC)
+ FLASH_ErasePage(FEE_SECTOR_ID);
+#else
+ int page_num = 0;
+
+ // delete all pages from specified start page to the last page
+ do {
+ FLASH_ErasePage(FEE_PAGE_BASE_ADDRESS + (page_num * FEE_PAGE_SIZE));
+ page_num++;
+ } while (page_num < FEE_DENSITY_PAGES);
+#endif
+}
+/*****************************************************************************
+ * Wrap library in AVR style functions.
+ *******************************************************************************/
+uint8_t eeprom_read_byte_f4(const uint8_t *Address) {
+ const uint16_t p = (const uint32_t)Address;
+ return EEPROM_ReadDataByte(p);
+}
+
+void eeprom_write_byte_f4(uint8_t *Address, uint8_t Value) {
+ uint16_t p = (uint32_t)Address;
+ EEPROM_WriteDataByte(p, Value);
+}
+
+
+void eeprom_read_block(void *buf, const void *addr, size_t len) {
+ const uint8_t *p = (const uint8_t *)addr;
+ uint8_t * dest = (uint8_t *)buf;
+ while (len--) {
+ *dest++ = eeprom_read_byte_f4(p++);
+ }
+}
+
+void eeprom_write_block(const void *buf, void *addr, size_t len) {
+ uint8_t * p = (uint8_t *)addr;
+ const uint8_t *src = (const uint8_t *)buf;
+ while (len--) {
+ eeprom_write_byte_f4(p++, *src++);
+ }
+}
+
+
diff --git a/keyboards/yandrstudio/boy40ble/f401/eep/eeprom_stm32_custom.h b/keyboards/yandrstudio/boy40ble/f401/eep/eeprom_stm32_custom.h
new file mode 100644
index 000000000000..096842aaaf16
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/f401/eep/eeprom_stm32_custom.h
@@ -0,0 +1,104 @@
+/*
+ * This software is experimental and a work in progress.
+ * Under no circumstances should these files be used in relation to any critical system(s).
+ * Use of these files is at your own risk.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * This files are free to use from http://engsta.com/stm32-flash-memory-eeprom-emulator/ by
+ * Artur F.
+ *
+ * Modifications for QMK and STM32F303 by Yiancar
+ *
+ * This library assumes 8-bit data locations. To add a new MCU, please provide the flash
+ * page size and the total flash size in Kb. The number of available pages must be a multiple
+ * of 2. Only half of the pages account for the total EEPROM size.
+ * This library also assumes that the pages are not used by the firmware.
+ * Adjust the file structure to custom EEPROM_DRIVER by jiaxin96 for support stm32f401cc
+ */
+
+#pragma once
+
+#include
+#include
+#include "flash_stm32.h"
+
+// HACK ALERT. This definition may not match your processor
+// To Do. Work out correct value for EEPROM_PAGE_SIZE on the STM32F103CT6 etc
+#if defined(EEPROM_EMU_STM32F303xC)
+# define MCU_STM32F303CC
+#elif defined(EEPROM_EMU_STM32F103xB)
+# define MCU_STM32F103RB
+#elif defined(EEPROM_EMU_STM32F072xB)
+# define MCU_STM32F072CB
+#elif defined(EEPROM_EMU_STM32F042x6)
+# define MCU_STM32F042K6
+#elif defined(EEPROM_EMU_STM32F401xC)
+# define MCU_STM32F401xC
+#else
+# error "not implemented."
+#endif
+
+
+
+
+
+#ifndef EEPROM_PAGE_SIZE
+# if defined(MCU_STM32F103RB) || defined(MCU_STM32F042K6)
+# define FEE_PAGE_SIZE (uint16_t)0x400 // Page size = 1KByte
+# define FEE_DENSITY_PAGES 4 // How many pages are used
+# elif defined(MCU_STM32F103ZE) || defined(MCU_STM32F103RE) || defined(MCU_STM32F103RD) || defined(MCU_STM32F303CC) || defined(MCU_STM32F072CB)
+# define FEE_PAGE_SIZE (uint16_t)0x800 // Page size = 2KByte
+# define FEE_DENSITY_PAGES 4 // How many pages are used
+# elif defined(MCU_STM32F401xC)
+# define FEE_PAGE_SIZE (uint32_t)0x20000 // Page size = 128KByte
+# define FEE_DENSITY_PAGES 1 // How many pages are used
+# define FEE_SECTOR_ID 5 // sector id of the flash
+# else
+# error "No MCU type specified. Add something like -DMCU_STM32F103RB to your compiler arguments (probably in a Makefile)."
+# endif
+#endif
+
+#ifndef EEPROM_START_ADDRESS
+# if defined(MCU_STM32F103RB) || defined(MCU_STM32F072CB)
+# define FEE_MCU_FLASH_SIZE 128 // Size in Kb
+# elif defined(MCU_STM32F042K6)
+# define FEE_MCU_FLASH_SIZE 32 // Size in Kb
+# elif defined(MCU_STM32F103ZE) || defined(MCU_STM32F103RE)
+# define FEE_MCU_FLASH_SIZE 512 // Size in Kb
+# elif defined(MCU_STM32F103RD)
+# define FEE_MCU_FLASH_SIZE 384 // Size in Kb
+# elif defined(MCU_STM32F303CC)
+# define FEE_MCU_FLASH_SIZE 256 // Size in Kb
+# elif defined(MCU_STM32F401xC)
+# define FEE_MCU_FLASH_SIZE 256 // Size in Kb
+# else
+# error "No MCU type specified. Add something like -DMCU_STM32F103RB to your compiler arguments (probably in a Makefile)."
+# endif
+#endif
+
+// DONT CHANGE
+// Choose location for the first EEPROM Page address on the top of flash
+// #define FEE_PAGE_BASE_ADDRESS ((uint32_t)(0x8000000 + FEE_MCU_FLASH_SIZE * 1024 - FEE_DENSITY_PAGES * FEE_PAGE_SIZE))
+// #define FEE_DENSITY_BYTES ((FEE_PAGE_SIZE / 2) * FEE_DENSITY_PAGES - 1)
+// #define FEE_LAST_PAGE_ADDRESS (FEE_PAGE_BASE_ADDRESS + (FEE_PAGE_SIZE * FEE_DENSITY_PAGES))
+// #define FEE_EMPTY_WORD ((uint16_t)0xFFFF)
+// #define FEE_ADDR_OFFSET(Address) (Address * 2) // 1Byte per Word will be saved to preserve Flash
+
+#define FEE_PAGE_END_ADDRESS ((uint32_t)(0x08000000 + FEE_MCU_FLASH_SIZE * 1024))
+#define FEE_PAGE_BASE_ADDRESS ((uint32_t)((FEE_PAGE_END_ADDRESS) - FEE_DENSITY_PAGES * FEE_PAGE_SIZE))
+#define FEE_DENSITY_BYTES ((FEE_PAGE_SIZE / 4) * FEE_DENSITY_PAGES - 1) // 4 Bytes for address, value pair
+//#define FEE_LAST_PAGE_ADDRESS (FEE_PAGE_BASE_ADDRESS + (FEE_PAGE_SIZE * FEE_DENSITY_PAGES))
+#define FEE_EMPTY_BYTE ((uint8_t)0xFF)
+#define FEE_EMPTY_WORD ((uint16_t)0xFFFF)
+#define FEE_EMPTY_VALUE ((uint32_t)0xFFFFFFFF)
+//#define FEE_ADDR_OFFSET(Address) (Address * 2) // 1 Byte per Word will be saved to preserve Flash
+#define FEE_DATA_ADDRESS(Address) ((Address)+2) // flash address of the eeprom data
+#define FEE_ADDR_ADDRESS(Address) (Address) // flash address of the eeprom address
+#define FEE_MAX_BYTES ((FEE_DENSITY_BYTES+1) > 1024 ? 1024 : (FEE_DENSITY_BYTES+1)) // eeprom size
+
diff --git a/keyboards/yandrstudio/boy40ble/f401/eep/flash_stm32.c b/keyboards/yandrstudio/boy40ble/f401/eep/flash_stm32.c
new file mode 100644
index 000000000000..c3f1937c5258
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/f401/eep/flash_stm32.c
@@ -0,0 +1,223 @@
+/*
+ * This software is experimental and a work in progress.
+ * Under no circumstances should these files be used in relation to any critical system(s).
+ * Use of these files is at your own risk.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * This files are free to use from https://github.com/rogerclarkmelbourne/Arduino_STM32 and
+ * https://github.com/leaflabs/libmaple
+ *
+ * Modifications for QMK and STM32F303 by Yiancar
+ * Adjust the file structure to custom EEPROM_DRIVER by jiaxin96 for support stm32f401cc
+ */
+
+#if defined(EEPROM_EMU_STM32F303xC)
+# define STM32F303xC
+# include "stm32f3xx.h"
+#elif defined(EEPROM_EMU_STM32F103xB)
+# define STM32F103xB
+# include "stm32f1xx.h"
+#elif defined(EEPROM_EMU_STM32F072xB)
+# define STM32F072xB
+# include "stm32f0xx.h"
+#elif defined(EEPROM_EMU_STM32F042x6)
+# define STM32F042x6
+# include "stm32f0xx.h"
+#elif defined(EEPROM_EMU_STM32F401xC)
+# define STM32F401xC
+# include "stm32f4xx.h"
+#else
+# error "not implemented."
+#endif
+
+
+#include "flash_stm32.h"
+
+#if defined(EEPROM_EMU_STM32F103xB)
+# define FLASH_SR_WRPERR FLASH_SR_WRPRTERR
+#endif
+
+#if defined(EEPROM_EMU_STM32F401xC)
+# define FLASH_PSIZE_HFWORD FLASH_CR_PSIZE_0
+# define FLASH_PSIZE_WORD FLASH_CR_PSIZE_1
+# define FLASH_CR_SNB_POS 3
+/* the flash key was not defined in the CMSIS used by current chibios */
+#define FLASH_KEY1 0x45670123U
+#define FLASH_KEY2 0xCDEF89ABU
+# define FLASH_SR_FLAGS (FLASH_SR_PGAERR|FLASH_SR_PGPERR|FLASH_SR_PGSERR|FLASH_SR_WRPERR)
+#else
+# define FLASH_SR_FLAGS (FLASH_SR_EOP | FLASH_SR_PGERR | FLASH_SR_WRPERR)
+#endif
+
+/* Delay definition */
+#define EraseTimeout ((uint32_t)0x00000FFF)
+#define ProgramTimeout ((uint32_t)0x0000001F)
+
+#define ASSERT(exp) (void)((0))
+
+/**
+ * @brief Inserts a time delay.
+ * @param None
+ * @retval None
+ */
+static void delay(void) {
+ __IO uint32_t i = 0;
+ for (i = 0xFF; i != 0; i--) {
+ }
+}
+
+/**
+ * @brief Returns the FLASH Status.
+ * @param None
+ * @retval FLASH Status: The returned value can be: FLASH_BUSY, FLASH_ERROR_PG,
+ * FLASH_ERROR_WRP or FLASH_COMPLETE
+ */
+FLASH_Status FLASH_GetStatus(void) {
+ if ((FLASH->SR & FLASH_SR_BSY) == FLASH_SR_BSY) return FLASH_BUSY;
+
+#if defined(EEPROM_EMU_STM32F401xC)
+ if ((FLASH->SR & (FLASH_SR_PGSERR | FLASH_SR_PGPERR | FLASH_SR_PGAERR))) return FLASH_ERROR_PG;
+ if ((FLASH->SR & FLASH_SR_WRPERR)) return FLASH_ERROR_WRP;
+#else
+ if ((FLASH->SR & FLASH_SR_PGERR) != 0) return FLASH_ERROR_PG;
+ if ((FLASH->SR & FLASH_SR_WRPERR) != 0) return FLASH_ERROR_WRP;
+ if ((FLASH->SR & FLASH_OBR_OPTERR) != 0) return FLASH_ERROR_OPT;
+#endif
+
+ return FLASH_COMPLETE;
+}
+
+/**
+ * @brief Waits for a Flash operation to complete or a TIMEOUT to occur.
+ * @param Timeout: FLASH progamming Timeout
+ * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
+ * FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout) {
+ FLASH_Status status;
+
+ /* Check for the Flash Status */
+ status = FLASH_GetStatus();
+ /* Wait for a Flash operation to complete or a TIMEOUT to occur */
+ while ((status == FLASH_BUSY) && (Timeout != 0x00)) {
+ delay();
+ status = FLASH_GetStatus();
+ Timeout--;
+ }
+ if (Timeout == 0) status = FLASH_TIMEOUT;
+ /* Return the operation status */
+ return status;
+}
+
+/**
+ * @brief Erases a specified FLASH page.
+ * @param Page_Address: The page address or sector to be erased.
+ * @retval FLASH Status: The returned value can be: FLASH_BUSY, FLASH_ERROR_PG,
+ * FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_ErasePage(uint32_t Page) {
+ FLASH_Status status = FLASH_COMPLETE;
+ /* Check the parameters */
+ //ASSERT(IS_FLASH_ADDRESS(Page_Address));
+ /* Wait for last operation to be completed */
+ status = FLASH_WaitForLastOperation(EraseTimeout);
+
+ if (status == FLASH_COMPLETE) {
+ /* if the previous operation is completed, proceed to erase the page */
+#if defined(EEPROM_EMU_STM32F401xC)
+ FLASH->CR &= ~FLASH_CR_SNB;
+ FLASH->CR |= FLASH_CR_SER | (Page << FLASH_CR_SNB_POS);
+#else
+ FLASH->CR |= FLASH_CR_PER;
+ FLASH->AR = Page;
+#endif
+ FLASH->CR |= FLASH_CR_STRT;
+
+ /* Wait for last operation to be completed */
+ status = FLASH_WaitForLastOperation(EraseTimeout);
+ /* clear the SER or PER Bit */
+#if defined(EEPROM_EMU_STM32F401xC)
+ FLASH->CR &= ~(FLASH_CR_SER | FLASH_CR_SNB);
+#else
+ FLASH->CR &= ~FLASH_CR_PER;
+#endif
+ FLASH_ClearFlag(FLASH_SR_FLAGS);
+ }
+ /* Return the Erase Status */
+ return status;
+}
+
+/**
+ * @brief Programs a half word at a specified address.
+ * @param Address: specifies the address to be programmed.
+ * @param Data: specifies the data to be programmed.
+ * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
+ * FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data) {
+ FLASH_Status status = FLASH_BAD_ADDRESS;
+ if ((Address % sizeof(uint16_t) != 0 ) || !IS_FLASH_ADDRESS(Address)) {
+ return status;
+ }
+
+ /* Wait for last operation to be completed */
+ status = FLASH_WaitForLastOperation(ProgramTimeout);
+ if (status == FLASH_COMPLETE) {
+ /* if the previous operation is completed, proceed to program the new data */
+#if defined(EEPROM_EMU_STM32F401xC)
+ FLASH->CR &= ~FLASH_CR_PSIZE;
+ FLASH->CR |= FLASH_PSIZE_HFWORD;
+#endif
+ FLASH->CR |= FLASH_CR_PG;
+ *(__IO uint16_t*)Address = Data;
+ /* Wait for last operation to be completed */
+ status = FLASH_WaitForLastOperation(ProgramTimeout);
+ if (status != FLASH_TIMEOUT) {
+ /* if the program operation is completed, disable the PG Bit */
+ FLASH->CR &= ~FLASH_CR_PG;
+ }
+ FLASH_ClearFlag(FLASH_SR_FLAGS);
+ }
+ return status;
+}
+
+/**
+ * @brief Unlocks the FLASH Program Erase Controller.
+ * @param None
+ * @retval None
+ */
+void FLASH_Unlock(void) {
+ /* Authorize the FPEC Access */
+ FLASH->KEYR = FLASH_KEY1;
+ FLASH->KEYR = FLASH_KEY2;
+}
+
+/**
+ * @brief Locks the FLASH Program Erase Controller.
+ * @param None
+ * @retval None
+ */
+void FLASH_Lock(void) {
+ /* Set the Lock Bit to lock the FPEC and the FCR */
+ FLASH->CR |= FLASH_CR_LOCK;
+}
+
+/**
+ * @brief Clears the FLASH's pending flags.
+ * @param FLASH_FLAG: specifies the FLASH flags to clear.
+ * This parameter can be any combination of the following values:
+ * @arg FLASH_FLAG_PGERR: FLASH Programming error flag flag
+ * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag
+ * @arg FLASH_FLAG_EOP: FLASH End of Programming flag
+ * @retval None
+ */
+void FLASH_ClearFlag(uint32_t FLASH_FLAG) {
+ /* Clear the flags */
+ FLASH->SR |= FLASH_FLAG;
+}
diff --git a/keyboards/yandrstudio/boy40ble/f401/halconf.h b/keyboards/yandrstudio/boy40ble/f401/halconf.h
new file mode 100644
index 000000000000..cf6a19cb5a43
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/f401/halconf.h
@@ -0,0 +1,43 @@
+/* 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
+#include_next
+
+#pragma once
+#include_next
+
+#undef HAL_USE_SERIAL
+#define HAL_USE_SERIAL TRUE
+
+#undef HAL_USE_PWM
+#define HAL_USE_PWM TRUE
+
+#undef HAL_USE_ADC
+#define HAL_USE_ADC TRUE
+
+
+#undef SERIAL_USB_BUFFERS_SIZE
+#define SERIAL_USB_BUFFERS_SIZE 256
+
+#undef SERIAL_BUFFERS_SIZE
+#define SERIAL_BUFFERS_SIZE 128
+
+#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/boy40ble/f401/matrix.c b/keyboards/yandrstudio/boy40ble/f401/matrix.c
new file mode 100644
index 000000000000..d7040e338fbe
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/f401/matrix.c
@@ -0,0 +1,236 @@
+/* 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 .
+ */
+
+#include
+#include
+#include "util.h"
+#include "matrix.h"
+#include "debounce.h"
+#include "quantum.h"
+
+#ifdef DIRECT_PINS
+static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS;
+#elif (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW)
+static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
+static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
+#endif
+
+/* 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 inline void setPinOutput_writeLow(pin_t pin) {
+ ATOMIC_BLOCK_FORCEON {
+ setPinOutput(pin);
+ writePinLow(pin);
+ }
+}
+
+static inline void setPinInputHigh_atomic(pin_t pin) {
+ ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); }
+}
+
+// matrix code
+
+#ifdef DIRECT_PINS
+
+static void init_pins(void) {
+ for (int row = 0; row < MATRIX_ROWS; row++) {
+ for (int col = 0; col < MATRIX_COLS; col++) {
+ pin_t pin = direct_pins[row][col];
+ if (pin != NO_PIN) {
+ setPinInputHigh(pin);
+ }
+ }
+ }
+}
+
+static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
+ // Start with a clear matrix row
+ matrix_row_t current_row_value = 0;
+
+ for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
+ pin_t pin = direct_pins[current_row][col_index];
+ if (pin != NO_PIN) {
+ current_row_value |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index);
+ }
+ }
+
+ // If the row has changed, store the row and return the changed flag.
+ if (current_matrix[current_row] != current_row_value) {
+ current_matrix[current_row] = current_row_value;
+ return true;
+ }
+ return false;
+}
+
+#elif defined(DIODE_DIRECTION)
+# if (DIODE_DIRECTION == COL2ROW)
+
+static void select_col(uint8_t col) { palSetLine(col_pins[col]); }
+
+static void unselect_col(uint8_t col) { palClearLine(col_pins[col]); }
+
+static void unselect_rows(void) {
+ for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
+ palSetLineMode(row_pins[x], PAL_MODE_INPUT_PULLDOWN);
+ }
+}
+
+static void init_pins(void) {
+ unselect_rows();
+ for (uint8_t x = 0; x < MATRIX_COLS; x++) {
+ palSetLineMode(col_pins[x], PAL_MODE_OUTPUT_PUSHPULL);
+ }
+ for (uint8_t x = 0; x < MATRIX_COLS; x++) {
+ palClearLine(col_pins[x]);
+ }
+}
+
+static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
+ bool matrix_changed = false;
+
+ // Select col
+ select_col(current_col);
+ matrix_output_select_delay();
+
+ // For each row...
+ for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
+ // Store last value of row prior to reading
+ matrix_row_t last_row_value = current_matrix[row_index];
+ matrix_row_t current_row_value = last_row_value;
+
+ // Check row pin state
+ if (readPin(row_pins[row_index]) == 1) {
+ // Pin HI, set col bit
+ current_row_value |= (MATRIX_ROW_SHIFTER << current_col);
+ } else {
+ // Pin LO, clear col bit
+ current_row_value &= ~(MATRIX_ROW_SHIFTER << current_col);
+ }
+
+ // Determine if the matrix changed state
+ if ((last_row_value != current_row_value)) {
+ matrix_changed |= true;
+ current_matrix[row_index] = current_row_value;
+ }
+ }
+
+ // Unselect col
+ unselect_col(current_col);
+ if (current_col + 1 < MATRIX_COLS) {
+ matrix_output_unselect_delay(); // wait for col signal to go HIGH
+ }
+
+ return matrix_changed;
+}
+
+# elif (DIODE_DIRECTION == ROW2COL)
+
+static void select_row(uint8_t row) { palSetLine(row_pins[row]); }
+
+static void unselect_row(uint8_t row) { palClearLine(row_pins[row]); }
+
+static void unselect_cols(void) {
+ for (uint8_t x = 0; x < MATRIX_COLS; x++) {
+ palSetLineMode(col_pins[x], PAL_MODE_INPUT_PULLDOWN);
+ }
+}
+
+static void init_pins(void) {
+ unselect_cols();
+ for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
+ palSetLineMode(row_pins[x], PAL_MODE_OUTPUT_PUSHPULL);
+ }
+ for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
+ palClearLine(row_pins[x]);
+ }
+}
+
+
+static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
+ // Start with a clear matrix row
+ matrix_row_t current_row_value = 0;
+
+ // Select row
+ select_row(current_row);
+ matrix_output_select_delay();
+
+ // 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_row_value |= pin_state ? (MATRIX_ROW_SHIFTER << col_index) : 0;
+ }
+
+ // Unselect row
+ unselect_row(current_row);
+ if (current_row + 1 < MATRIX_ROWS) {
+ matrix_output_unselect_delay(); // wait for row signal to go HIGH
+ }
+
+ // If the row has changed, store the row and return the changed flag.
+ if (current_matrix[current_row] != current_row_value) {
+ current_matrix[current_row] = current_row_value;
+ return true;
+ }
+ return false;
+}
+
+# else
+# error DIODE_DIRECTION must be one of COL2ROW or ROW2COL!
+# endif
+#else
+# error DIODE_DIRECTION is not defined!
+#endif
+
+void matrix_init(void) {
+ // initialize key pins
+ init_pins();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ raw_matrix[i] = 0;
+ matrix[i] = 0;
+ }
+
+ debounce_init(MATRIX_ROWS);
+
+ matrix_init_quantum();
+}
+
+uint8_t matrix_scan(void) {
+ bool changed = false;
+
+#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW)
+ // Set col, read rows
+ for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
+ changed |= read_rows_on_col(raw_matrix, current_col);
+ }
+#elif (DIODE_DIRECTION == ROW2COL)
+ // 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);
+ }
+#endif
+
+ debounce(raw_matrix, matrix, MATRIX_ROWS, changed);
+
+ matrix_scan_quantum();
+ return (uint8_t)changed;
+}
diff --git a/keyboards/yandrstudio/boy40ble/f401/mcuconf.h b/keyboards/yandrstudio/boy40ble/f401/mcuconf.h
new file mode 100644
index 000000000000..6f3d7c97c20a
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/f401/mcuconf.h
@@ -0,0 +1,89 @@
+/* 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
+
+#include_next
+
+
+#undef STM32_SERIAL_USE_USART1
+#define STM32_SERIAL_USE_USART1 TRUE
+
+
+#undef STM32_ADC_USE_ADC1
+#define STM32_ADC_USE_ADC1 TRUE
+
+#undef STM32_PWM_USE_TIM3
+#define STM32_PWM_USE_TIM3 TRUE
+
+#undef STM32_NO_INIT
+#undef STM32_HSI_ENABLED
+#undef STM32_LSI_ENABLED
+#undef STM32_HSE_ENABLED
+#undef STM32_LSE_ENABLED
+#undef STM32_CLOCK48_REQUIRED
+#undef STM32_SW
+#undef STM32_PLLSRC
+#undef STM32_PLLM_VALUE
+#undef STM32_PLLN_VALUE
+#undef STM32_PLLP_VALUE
+#undef STM32_PLLQ_VALUE
+#undef STM32_HPRE
+#undef STM32_PPRE1
+#undef STM32_PPRE2
+#undef STM32_RTCSEL
+#undef STM32_RTCPRE_VALUE
+#undef STM32_MCO1SEL
+#undef STM32_MCO1PRE
+#undef STM32_MCO2SEL
+#undef STM32_MCO2PRE
+#undef STM32_I2SSRC
+#undef STM32_PLLI2SN_VALUE
+#undef STM32_PLLI2SR_VALUE
+#undef STM32_PVD_ENABLE
+#undef STM32_PLS
+#undef STM32_BKPRAM_ENABLE
+
+#define STM32_NO_INIT FALSE
+#define STM32_HSI_ENABLED TRUE
+#define STM32_LSI_ENABLED TRUE
+#define STM32_HSE_ENABLED TRUE
+#define STM32_LSE_ENABLED FALSE
+#define STM32_CLOCK48_REQUIRED TRUE
+#define STM32_SW STM32_SW_PLL
+#define STM32_PLLSRC STM32_PLLSRC_HSE
+#define STM32_PLLM_VALUE 8
+#define STM32_PLLN_VALUE 192
+#define STM32_PLLP_VALUE 4
+#define STM32_PLLQ_VALUE 4
+#define STM32_HPRE STM32_HPRE_DIV1
+#define STM32_PPRE1 STM32_PPRE1_DIV4
+#define STM32_PPRE2 STM32_PPRE2_DIV2
+#define STM32_RTCSEL STM32_RTCSEL_LSI
+#define STM32_RTCPRE_VALUE 8
+#define STM32_MCO1SEL STM32_MCO1SEL_HSI
+#define STM32_MCO1PRE STM32_MCO1PRE_DIV1
+#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
+#define STM32_MCO2PRE STM32_MCO2PRE_DIV5
+#define STM32_I2SSRC STM32_I2SSRC_CKIN
+#define STM32_PLLI2SN_VALUE 192
+#define STM32_PLLI2SR_VALUE 5
+#define STM32_PVD_ENABLE FALSE
+#define STM32_PLS STM32_PLS_LEV0
+#define STM32_BKPRAM_ENABLE FALSE
+
+
+
diff --git a/keyboards/yandrstudio/boy40ble/f401/rules.mk b/keyboards/yandrstudio/boy40ble/f401/rules.mk
new file mode 100644
index 000000000000..1f96d65a537c
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/f401/rules.mk
@@ -0,0 +1,24 @@
+# MCU name
+MCU = STM32F401
+
+# Address of the bootloader in system memory
+STM32_BOOTLOADER_ADDRESS = 0x1FFF0000
+# Bootloader selection
+BOOTLOADER = stm32-dfu
+
+# # project specific file
+CUSTOM_MATRIX = lite # for using the A9 pin as matrix io
+QUANTUM_SRC += matrix.c
+
+
+# RGB_MATRIX_ENABLE = yes
+# RGB_MATRIX_DRIVER = WS2812
+RGBLIGHT_ENABLE = yes
+RGBLIGHT_DRIVER = WS2812
+WS2812_DRIVER = pwm
+
+EEPROM_DRIVER = custom
+SRC += eep/eeprom_stm32.c
+SRC += eep/flash_stm32.c
+OPT_DEFS += -DEEPROM_EMU_STM32F401xC
+COMMON_VPATH += keyboards/yandrstudio/tdcq68/f401/eep
diff --git a/keyboards/yandrstudio/boy40ble/keymaps/ble/keymap.c b/keyboards/yandrstudio/boy40ble/keymaps/ble/keymap.c
new file mode 100644
index 000000000000..21ee16fc0fa7
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/keymaps/ble/keymap.c
@@ -0,0 +1,125 @@
+/* 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 .
+ */
+#include QMK_KEYBOARD_H
+#include "outputselect.h"
+#include "biu_ble_common.h"
+
+enum keyboard_keycodes {
+ BLE_TOG = SAFE_RANGE, // ble
+ USB_TOG, // usb
+ BAU_TOG, // if ble then usb, if usb then ble, Ble And Usb toggle
+ BL_SW_0, // ble id 0
+ BL_SW_1,
+ BL_SW_2,
+ BL_SW_3,
+ BLE_DEL, // delete current ble bound
+ BLE_CLR, // delete all ble bound
+ NEW_SAFE_RANGE // Important!
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ LAYOUT(
+ KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_RSFT,
+ KC_LCTL, TO(2), KC_PSCR, KC_SPC, MO(1), KC_SLSH, KC_SCLN, KC_QUES),
+ LAYOUT(
+ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
+ KC_TAB, KC_BSLS, KC_QUOT, KC_GRV, KC_LABK, KC_RABK, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_DEL,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, BLE_TOG, USB_TOG, BL_SW_0, BL_SW_1, BLE_DEL, BLE_CLR,
+ KC_TRNS, KC_LGUI, KC_LALT, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+ LAYOUT(
+ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
+ 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_UP, KC_TRNS,
+ KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT),
+ 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
+};
+
+void keyboard_post_init_user(void) {
+ palSetLineMode(A6, PAL_MODE_OUTPUT_PUSHPULL);
+ palClearLine(A6);
+ // eeconfig_init();
+ // uart_init(115200);
+ debug_enable=true;
+ // debug_matrix=true;
+ // debug_keyboard=true;
+ // //debug_mouse=true;
+
+}
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ if (record->event.pressed) {
+ uprintf("KL: kc: 0x%04X, col: %u, row: %u, pressed: %b, time: %u, interrupt: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
+ }
+ switch(keycode) {
+ case BLE_TOG:
+ if (record->event.pressed) {
+ set_output(OUTPUT_BLUETOOTH);
+ bluetooth_clear_buf();
+ }
+ return false;
+ case USB_TOG:
+ if (record->event.pressed) {
+ set_output(OUTPUT_USB);
+ }
+ return false;
+ case BAU_TOG:
+ if (record->event.pressed) {
+ if (where_to_send() == OUTPUT_USB) {
+ // TODO: restart ble
+ set_output(OUTPUT_BLUETOOTH);
+ bluetooth_clear_buf();
+ } else {
+ //ToDO: disconnect ble
+ set_output(OUTPUT_USB);
+ }
+ }
+ return false;
+ case BL_SW_0:
+ case BL_SW_1:
+ case BL_SW_2:
+ case BL_SW_3:
+ if (record->event.pressed) {
+ // TODO: restart ble
+ set_output(OUTPUT_BLUETOOTH);
+ bluetooth_clear_buf();
+ bluetooth_switch_one(keycode - BL_SW_0);
+ }
+ return false;
+ case BLE_DEL:
+ if (record->event.pressed) {
+ if (where_to_send() == OUTPUT_BLUETOOTH) {
+ bluetooth_unpair_current();
+ }
+ }
+ return false;
+ case BLE_CLR:
+ if (record->event.pressed) {
+ if (where_to_send() == OUTPUT_BLUETOOTH) {
+ bluetooth_unpair_all();
+ }
+ }
+ return false;
+ default:
+ return true;
+ }
+ return true;
+}
diff --git a/keyboards/yandrstudio/boy40ble/keymaps/ble/rules.mk b/keyboards/yandrstudio/boy40ble/keymaps/ble/rules.mk
new file mode 100644
index 000000000000..d9ccf952b754
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/keymaps/ble/rules.mk
@@ -0,0 +1,4 @@
+VIA_ENABLE = yes
+CONSOLE_ENABLE = yes # Console for debug
+
+BIU_BLE5_ENABLE = yes
diff --git a/keyboards/yandrstudio/boy40ble/readme.md b/keyboards/yandrstudio/boy40ble/readme.md
new file mode 100644
index 000000000000..1cf6a10ac73e
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/readme.md
@@ -0,0 +1,15 @@
+m60ble
+===
+
+A 61 keys keyboard with rgb (keys and underground) and bluetooth 5.x.
+This keyboard use 8mhz HSE and STM32F401 as MCU.
+
+Keyboard Maintainer: https://github.com/jiaxin96
+Hardware Supported: yp980ble
+Hardware Availability: https://github.com/Oh-My-Mechanical-Keyboard
+
+Make example for this keyboard (after setting up your build environment):
+
+ make yandrstudio/boy40ble/f401:ble
+
+See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
diff --git a/keyboards/yandrstudio/boy40ble/rules.mk b/keyboards/yandrstudio/boy40ble/rules.mk
new file mode 100644
index 000000000000..7f0ecba167bf
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/rules.mk
@@ -0,0 +1,14 @@
+# Build Options
+# 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
+EXTRAKEY_ENABLE = yes # Audio control and System control
+CONSOLE_ENABLE = no # 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
+# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+NKRO_ENABLE = yes # USB Nkey Rollover
+
diff --git a/keyboards/yandrstudio/boy40ble/via-info.json b/keyboards/yandrstudio/boy40ble/via-info.json
new file mode 100644
index 000000000000..33f5da83d849
--- /dev/null
+++ b/keyboards/yandrstudio/boy40ble/via-info.json
@@ -0,0 +1,91 @@
+{
+ "name": "Boy40_Y&R",
+ "vendorId": "0xAA96",
+ "productId": "0xAAA6",
+ "lighting": "qmk_rgblight",
+ "matrix": { "rows": 4, "cols": 12 },
+ "layouts": {
+ "keymap": [
+ [
+ "0,0",
+ "0,1",
+ "0,2",
+ "0,3",
+ "0,4",
+ "0,5",
+ "0,6",
+ "0,7",
+ "0,8",
+ "0,9",
+ "0,10",
+ "0,11"
+ ],
+ [
+ {
+ "w": 1.25
+ },
+ "1,0",
+ "1,1",
+ "1,2",
+ "1,3",
+ "1,4",
+ "1,5",
+ "1,6",
+ "1,7",
+ "1,8",
+ "1,9",
+ {
+ "w": 1.75
+ },
+ "1,11"
+ ],
+ [
+ {
+ "w": 1.75
+ },
+ "2,0",
+ "2,2",
+ "2,3",
+ "2,4",
+ "2,5",
+ "2,6",
+ "2,7",
+ "2,8",
+ "2,9\n.",
+ "2,10",
+ {
+ "w": 1.25
+ },
+ "2,11"
+ ],
+ [
+ {
+ "w": 1.25
+ },
+ "3,0",
+ "3,1",
+ {
+ "w": 1.25
+ },
+ "3,2",
+ {
+ "w": 2.25
+ },
+ "3,4",
+ {
+ "w": 2.75
+ },
+ "3,7",
+ {
+ "w": 1.25
+ },
+ "3,9",
+ "3,10",
+ {
+ "w": 1.25
+ },
+ "3,11"
+ ]
+ ]
+ }
+}
diff --git a/keyboards/yandrstudio/yp980ble/f401/config.h b/keyboards/yandrstudio/yp980ble/f401/config.h
index b1cbebcf69da..266754f06d86 100644
--- a/keyboards/yandrstudio/yp980ble/f401/config.h
+++ b/keyboards/yandrstudio/yp980ble/f401/config.h
@@ -21,15 +21,15 @@
/* RGN Matrix */
#ifdef RGB_MATRIX_ENABLE
-# define RGB_DI_PIN A7
+# define RGB_DI_PIN B8
# define RGBLED_NUM 79
# define DRIVER_LED_TOTAL RGBLED_NUM
-#define WS2812_PWM_DRIVER PWMD3 // default: PWMD2
-#define WS2812_PWM_CHANNEL 2 // default: 2
+#define WS2812_PWM_DRIVER PWMD4 // default: PWMD2
+#define WS2812_PWM_CHANNEL 3 // 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_DMA_STREAM STM32_DMA1_STREAM6 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
+#define WS2812_DMA_CHANNEL 2 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 180
@@ -44,16 +44,17 @@
#ifdef RGBLIGHT_ENABLE
-# define RGB_DI_PIN A7
+# define RGB_DI_PIN B8
# define RGBLED_NUM 79
# define DRIVER_LED_TOTAL RGBLED_NUM
+# define RGBLIGHT_LIMIT_VAL 150
+# define RGBLIGHT_SLEEP
-
-#define WS2812_PWM_DRIVER PWMD3 // default: PWMD2
-#define WS2812_PWM_CHANNEL 2 // default: 2
+#define WS2812_PWM_DRIVER PWMD4 // default: PWMD2
+#define WS2812_PWM_CHANNEL 3 // 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_DMA_STREAM STM32_DMA1_STREAM6 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
+#define WS2812_DMA_CHANNEL 2 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
#endif
diff --git a/keyboards/yandrstudio/yp980ble/f401/halconf.h b/keyboards/yandrstudio/yp980ble/f401/halconf.h
index fca80d9a88ba..fe048fe8eea4 100644
--- a/keyboards/yandrstudio/yp980ble/f401/halconf.h
+++ b/keyboards/yandrstudio/yp980ble/f401/halconf.h
@@ -20,13 +20,8 @@
#pragma once
#include_next
-#undef HAL_USE_SERIAL
-#define HAL_USE_SERIAL TRUE
-
-
-#undef HAL_USE_ADC
-#define HAL_USE_ADC TRUE
-
+#undef HAL_USE_PWM
+#define HAL_USE_PWM TRUE
#undef SERIAL_USB_BUFFERS_SIZE
#define SERIAL_USB_BUFFERS_SIZE 256
diff --git a/keyboards/yandrstudio/yp980ble/f401/mcuconf.h b/keyboards/yandrstudio/yp980ble/f401/mcuconf.h
index 0751fd9a6891..827247eac669 100644
--- a/keyboards/yandrstudio/yp980ble/f401/mcuconf.h
+++ b/keyboards/yandrstudio/yp980ble/f401/mcuconf.h
@@ -19,12 +19,8 @@
#include_next
-#undef STM32_SERIAL_USE_USART1
-#define STM32_SERIAL_USE_USART1 TRUE
-
-
-#undef STM32_ADC_USE_ADC1
-#define STM32_ADC_USE_ADC1 TRUE
+#undef STM32_PWM_USE_TIM4
+#define STM32_PWM_USE_TIM4 TRUE
#undef STM32_NO_INIT
diff --git a/keyboards/yandrstudio/yp980ble/f401/rules.mk b/keyboards/yandrstudio/yp980ble/f401/rules.mk
index 73bbf1d3f2cb..1f96d65a537c 100644
--- a/keyboards/yandrstudio/yp980ble/f401/rules.mk
+++ b/keyboards/yandrstudio/yp980ble/f401/rules.mk
@@ -13,7 +13,9 @@ QUANTUM_SRC += matrix.c
# RGB_MATRIX_ENABLE = yes
# RGB_MATRIX_DRIVER = WS2812
-# WS2812_DRIVER = pwm
+RGBLIGHT_ENABLE = yes
+RGBLIGHT_DRIVER = WS2812
+WS2812_DRIVER = pwm
EEPROM_DRIVER = custom
SRC += eep/eeprom_stm32.c
diff --git a/keyboards/yandrstudio/yp980ble/keymaps/ble/keymap.c b/keyboards/yandrstudio/yp980ble/keymaps/ble/keymap.c
index 9498a94b7831..f551f32f34dc 100644
--- a/keyboards/yandrstudio/yp980ble/keymaps/ble/keymap.c
+++ b/keyboards/yandrstudio/yp980ble/keymaps/ble/keymap.c
@@ -64,15 +64,24 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
+void keyboard_post_init_user(void) {
+ // eeconfig_init();
+ // uart_init(115200);
+ debug_enable=true;
+ // debug_matrix=true;
+ // debug_keyboard=true;
+ // //debug_mouse=true;
+}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- // if (record->event.pressed) {
- // uprintf("KL: kc: 0x%04X, col: %u, row: %u, pressed: %b, time: %u, interrupt: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
- // }
+ if (record->event.pressed) {
+ uprintf("KL: kc: 0x%04X, col: %u, row: %u, pressed: %b, time: %u, interrupt: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
+ }
switch(keycode) {
case BLE_TOG:
if (record->event.pressed) {
set_output(OUTPUT_BLUETOOTH);
+ bluetooth_clear_buf();
}
return false;
case USB_TOG:
@@ -83,8 +92,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case BAU_TOG:
if (record->event.pressed) {
if (where_to_send() == OUTPUT_USB) {
+ // TODO: restart ble
set_output(OUTPUT_BLUETOOTH);
+ bluetooth_clear_buf();
} else {
+ //ToDO: disconnect ble
set_output(OUTPUT_USB);
}
}
@@ -94,17 +106,24 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case BL_SW_2:
case BL_SW_3:
if (record->event.pressed) {
+ // TODO: restart ble
+ set_output(OUTPUT_BLUETOOTH);
+ bluetooth_clear_buf();
bluetooth_switch_one(keycode - BL_SW_0);
}
return false;
case BLE_DEL:
if (record->event.pressed) {
- bluetooth_unpair_current();
+ if (where_to_send() == OUTPUT_BLUETOOTH) {
+ bluetooth_unpair_current();
+ }
}
return false;
case BLE_CLR:
if (record->event.pressed) {
- bluetooth_unpair_all();
+ if (where_to_send() == OUTPUT_BLUETOOTH) {
+ bluetooth_unpair_all();
+ }
}
return false;
default:
diff --git a/keyboards/yandrstudio/yp980ble/keymaps/via/keymap.c b/keyboards/yandrstudio/yp980ble/keymaps/via/keymap.c
index 3a1f0fc09685..ad2fb5ea8052 100644
--- a/keyboards/yandrstudio/yp980ble/keymaps/via/keymap.c
+++ b/keyboards/yandrstudio/yp980ble/keymaps/via/keymap.c
@@ -28,6 +28,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_MINS, KC_EQL, KC_BSPC, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_P3, KC_ENT,
KC_F11, KC_F12, KC_DEL, KC_HOME, KC_PGUP, KC_PGDN, KC_SLSH, KC_UP, KC_LSFT, KC_P1, KC_P2),
LAYOUT(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_VAD, RGB_MOD, 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,
+ 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, 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, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS),
+ LAYOUT(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_VAD, RGB_MOD, 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,
+ 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, 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, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS),
+ LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_VAD, RGB_MOD, 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,
diff --git a/keyboards/yandrstudio/yp980ble/readme.md b/keyboards/yandrstudio/yp980ble/readme.md
index 022c6bb61817..fbecf02e47bb 100644
--- a/keyboards/yandrstudio/yp980ble/readme.md
+++ b/keyboards/yandrstudio/yp980ble/readme.md
@@ -10,6 +10,6 @@ Hardware Availability: https://github.com/Oh-My-Mechanical-Keyboard
Make example for this keyboard (after setting up your build environment):
- make yandrstudio/yp980ble/f401:ble
+ make yp980ble/f401:ble
See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
diff --git a/keyboards/yandrstudio/yp980ble/rules.mk b/keyboards/yandrstudio/yp980ble/rules.mk
index e53f7e76fc3b..b244656b49c5 100644
--- a/keyboards/yandrstudio/yp980ble/rules.mk
+++ b/keyboards/yandrstudio/yp980ble/rules.mk
@@ -3,14 +3,12 @@
#
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
+MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # 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
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
-NKRO_ENABLE = no # USB Nkey Rollover
+NKRO_ENABLE = yes # USB Nkey Rollover
diff --git a/keyboards/yandrstudio/zhou75/config.h b/keyboards/yandrstudio/zhou75/config.h
new file mode 100644
index 000000000000..722ccf941852
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/config.h
@@ -0,0 +1,44 @@
+/* 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"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xAA96
+#define PRODUCT_ID 0xAAA7
+#define DEVICE_VER 0x0001
+#define MANUFACTURER JasonRen biu
+#define PRODUCT zhou75
+
+// enable the nkro when using the VIA.
+#define FORCE_NKRO
+
+// fix VIA RGB_light
+#define VIA_HAS_BROKEN_KEYCODES
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCE 5
+
+// #define DEBUG_MATRIX_SCAN_RATE
+
+#define USB_POLLING_INTERVAL_MS 1
+#define QMK_KEYS_PER_SCAN 4
+
+#define TAP_CODE_DELAY 15
diff --git a/keyboards/yandrstudio/zhou75/f401/board.h b/keyboards/yandrstudio/zhou75/f401/board.h
new file mode 100644
index 000000000000..1a46a8194575
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/f401/board.h
@@ -0,0 +1,25 @@
+/* Copyright 2020 Nick Brassel (tzarc)
+ *
+ * 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 3 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 "board.h"
+
+
+#undef STM32_HSECLK
+#define STM32_HSECLK 16000000
+
+
+#define BOARD_YANDR_BIU_F401
diff --git a/keyboards/yandrstudio/zhou75/f401/chconf.h b/keyboards/yandrstudio/zhou75/f401/chconf.h
new file mode 100644
index 000000000000..b69c1fca78bf
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/f401/chconf.h
@@ -0,0 +1,36 @@
+/* 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_ST_RESOLUTION 16
+
+#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/zhou75/f401/config.h b/keyboards/yandrstudio/zhou75/f401/config.h
new file mode 100644
index 000000000000..083ad80957c5
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/f401/config.h
@@ -0,0 +1,89 @@
+/* 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"
+
+/* key matrix size */
+#define MATRIX_ROWS 6
+#define MATRIX_COLS 15
+
+// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
+#define MATRIX_COL_PINS { A6, A3, A7, B0, B1, B10, A2, B13, C13, C15, A15, B3, B4, B6, B9}
+#define MATRIX_ROW_PINS { A9, A8, B15, B14, A1, C14}
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION ROW2COL
+
+
+/* RGN Matrix */
+#ifdef RGB_MATRIX_ENABLE
+
+# define RGB_DI_PIN B5
+# define RGBLED_NUM 81
+# 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 150
+# define RGBLIGHT_VAL_STEP 15
+# define RGB_DISABLE_WHEN_USB_SUSPENDED true
+# define RGB_MATRIX_CENTER { 32, 96 }
+# define RGB_MATRIX_KEYPRESSES
+# define RGB_MATRIX_FRAMEBUFFER_EFFECTS
+# define RGBLIGHT_ANIMATIONS
+
+// # define WS2812_BYTE_ORDER WS2812_BYTE_ORDER_RGB
+
+#endif
+
+
+#ifdef RGBLIGHT_ENABLE
+
+# define RGB_DI_PIN B5
+# define RGBLED_NUM 81
+# define DRIVER_LED_TOTAL RGBLED_NUM
+# define RGBLIGHT_LIMIT_VAL 150
+# define RGBLIGHT_SLEEP
+
+#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_BYTE_ORDER WS2812_BYTE_ORDER_RGB
+
+#endif
+
+
+
+#ifdef ENCODER_ENABLE
+
+#define ENCODERS_PAD_A { B7, A5 }
+#define ENCODERS_PAD_B { B8, A6 }
+
+#define ENCODER_RESOLUTIONS { 2, 2 }
+
+#endif
diff --git a/keyboards/yandrstudio/zhou75/f401/eep/eeprom_stm32.c b/keyboards/yandrstudio/zhou75/f401/eep/eeprom_stm32.c
new file mode 100644
index 000000000000..12071a21291e
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/f401/eep/eeprom_stm32.c
@@ -0,0 +1,217 @@
+/*
+ * This software is experimental and a work in progress.
+ * Under no circumstances should these files be used in relation to any critical system(s).
+ * Use of these files is at your own risk.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * This files are free to use from http://engsta.com/stm32-flash-memory-eeprom-emulator/ by
+ * Artur F.
+ *
+ * Modifications for QMK and STM32F303 by Yiancar
+ * update for STM32F4 support and the the flashing algorithm by yulei
+ * Adjust the file structure to custom EEPROM_DRIVER by jiaxin96 for support stm32f401cc
+ */
+
+#include
+#include
+#include "eeprom_stm32_custom.h"
+#include "eeprom_driver.h"
+/*****************************************************************************
+ * Allows to use the internal flash to store non volatile data. To initialize
+ * the functionality use the EEPROM_Init() function. Be sure that by reprogramming
+ * of the controller just affected pages will be deleted. In other case the non
+ * volatile data will be lost.
+ ******************************************************************************/
+
+/* Private macro -------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/* Functions -----------------------------------------------------------------*/
+
+#define IS_VALID_ADDRESS(x) ((x) < FEE_MAX_BYTES)
+
+uint8_t DataBuf[FEE_MAX_BYTES];
+static void EEPROM_Backup(void);
+static FLASH_Status EEPROM_Restore(void);
+static uint32_t EEPROM_FindValidAddress(void);
+static void EEPROM_Clear(void);
+
+/*****************************************************************************
+ * Unlock the FLASH programming and initialized the DataBuf
+ ******************************************************************************/
+uint16_t EEPROM_Init(void) {
+ // unlock flash
+ FLASH_Unlock();
+
+ // initialize DataBuf
+ EEPROM_Backup();
+
+ // Clear Flags
+ // FLASH_ClearFlag(FLASH_SR_EOP|FLASH_SR_PGERR|FLASH_SR_WRPERR);
+
+ return FEE_DENSITY_BYTES;
+}
+void eeprom_driver_init(void) {
+ EEPROM_Init();
+}
+
+/*****************************************************************************
+ * Erase the whole reserved Flash Space used for user Data
+ ******************************************************************************/
+void EEPROM_Erase(void) {
+ // erase all flash pages
+ EEPROM_Clear();
+
+ // reset the content of the buffer
+ memset(&DataBuf[0], FEE_EMPTY_BYTE, sizeof(DataBuf));
+}
+void eeprom_driver_erase(void) {
+ EEPROM_Erase();
+}
+/*****************************************************************************
+ * Write data with its eeprom address to flash if there has empty words,
+ * otherwise backup the current valid data, erase all flash pages,
+ * and finally restore the valid data.
+ *******************************************************************************/
+uint16_t EEPROM_WriteDataByte(uint16_t Address, uint8_t DataByte) {
+ FLASH_Status FlashStatus = FLASH_COMPLETE;
+
+ uint32_t addr;
+ // exit if not a valid address
+ if (!IS_VALID_ADDRESS(Address)) {
+ return 0;
+ }
+
+// we are sure the address will not be out of bound
+#pragma GCC diagnostic ignored "-Warray-bounds"
+ // same value, do not need program
+ if (DataBuf[Address] == DataByte) {
+ return FlashStatus;
+ }
+
+ // find the address can be written
+ addr = EEPROM_FindValidAddress();
+ DataBuf[Address] = DataByte;
+#pragma GCC diagnostic pop
+ if (addr == FEE_EMPTY_VALUE) {
+ // EEPROM is full, need to erase and reprogramming
+ EEPROM_Clear();
+ EEPROM_Restore();
+ } else {
+ FLASH_ProgramHalfWord(FEE_ADDR_ADDRESS(addr), Address);
+ FLASH_ProgramHalfWord(FEE_DATA_ADDRESS(addr), DataByte);
+ }
+
+ return FlashStatus;
+}
+/*****************************************************************************
+ * Read once data byte from a specified address.
+ *******************************************************************************/
+uint8_t EEPROM_ReadDataByte(uint16_t Address) {
+ if (!IS_VALID_ADDRESS(Address)) {
+ return FEE_EMPTY_BYTE;
+ }
+
+ // Get Byte from caches
+ return DataBuf[Address];
+}
+
+/*****************************************************************************
+ * helper functions
+ *******************************************************************************/
+// backup the current data
+void EEPROM_Backup(void)
+{
+ uint32_t begin = FEE_PAGE_BASE_ADDRESS;
+ uint32_t end = FEE_PAGE_END_ADDRESS;
+ memset(&DataBuf[0], FEE_EMPTY_BYTE, sizeof(DataBuf));
+ while( begin < end) {
+ uint16_t addr = *(__IO uint16_t*)(FEE_ADDR_ADDRESS(begin));
+ if (IS_VALID_ADDRESS(addr)) {
+ DataBuf[addr] = *(__IO uint16_t*)(FEE_DATA_ADDRESS(begin));
+ } else if( addr == FEE_EMPTY_WORD) {
+ uint16_t data = *(__IO uint16_t*)(FEE_DATA_ADDRESS(begin));
+ if (data == FEE_EMPTY_WORD) {
+ // we reached the end of valid data
+ break;
+ }
+ }
+ begin += 4;
+ }
+}
+// restore data from DataBuf
+FLASH_Status EEPROM_Restore(void) {
+ uint32_t cur = FEE_PAGE_BASE_ADDRESS;
+ for (uint8_t i = 0; i < FEE_MAX_BYTES; i++) {
+ if (DataBuf[i] != FEE_EMPTY_BYTE) {
+ FLASH_ProgramHalfWord(FEE_ADDR_ADDRESS(cur), i);
+ FLASH_ProgramHalfWord(FEE_DATA_ADDRESS(cur), DataBuf[i]);
+ cur += 4;
+ }
+ }
+ return FLASH_COMPLETE;
+}
+// find an empty place for programming
+uint32_t EEPROM_FindValidAddress(void) {
+ uint32_t begin = FEE_PAGE_BASE_ADDRESS;
+ uint32_t end = FEE_PAGE_END_ADDRESS;
+ while( begin < end) {
+ uint32_t data = *(__IO uint32_t*)(begin);
+ if (data == FEE_EMPTY_VALUE) {
+ return begin;
+ }
+ begin += 4;
+ }
+ return FEE_EMPTY_VALUE;
+}
+
+void EEPROM_Clear(void)
+{
+#if defined(EEPROM_EMU_STM32F401xC)
+ FLASH_ErasePage(FEE_SECTOR_ID);
+#else
+ int page_num = 0;
+
+ // delete all pages from specified start page to the last page
+ do {
+ FLASH_ErasePage(FEE_PAGE_BASE_ADDRESS + (page_num * FEE_PAGE_SIZE));
+ page_num++;
+ } while (page_num < FEE_DENSITY_PAGES);
+#endif
+}
+/*****************************************************************************
+ * Wrap library in AVR style functions.
+ *******************************************************************************/
+uint8_t eeprom_read_byte_f4(const uint8_t *Address) {
+ const uint16_t p = (const uint32_t)Address;
+ return EEPROM_ReadDataByte(p);
+}
+
+void eeprom_write_byte_f4(uint8_t *Address, uint8_t Value) {
+ uint16_t p = (uint32_t)Address;
+ EEPROM_WriteDataByte(p, Value);
+}
+
+
+void eeprom_read_block(void *buf, const void *addr, size_t len) {
+ const uint8_t *p = (const uint8_t *)addr;
+ uint8_t * dest = (uint8_t *)buf;
+ while (len--) {
+ *dest++ = eeprom_read_byte_f4(p++);
+ }
+}
+
+void eeprom_write_block(const void *buf, void *addr, size_t len) {
+ uint8_t * p = (uint8_t *)addr;
+ const uint8_t *src = (const uint8_t *)buf;
+ while (len--) {
+ eeprom_write_byte_f4(p++, *src++);
+ }
+}
+
+
diff --git a/keyboards/yandrstudio/zhou75/f401/eep/eeprom_stm32_custom.h b/keyboards/yandrstudio/zhou75/f401/eep/eeprom_stm32_custom.h
new file mode 100644
index 000000000000..70beda433bbc
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/f401/eep/eeprom_stm32_custom.h
@@ -0,0 +1,106 @@
+/*
+ * This software is experimental and a work in progress.
+ * Under no circumstances should these files be used in relation to any critical system(s).
+ * Use of these files is at your own risk.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * This files are free to use from http://engsta.com/stm32-flash-memory-eeprom-emulator/ by
+ * Artur F.
+ *
+ *
+ * This library assumes 8-bit data locations. To add a new MCU, please provide the flash
+ * page size and the total flash size in Kb. The number of available pages must be a multiple
+ * of 2. Only half of the pages account for the total EEPROM size.
+ * This library also assumes that the pages are not used by the firmware.
+ *
+ * Modifications for QMK and STM32F303 by Yiancar
+ * update for STM32F4 support and the the flashing algorithm by yulei
+ * Adjust the file structure to custom EEPROM_DRIVER by jiaxin96 for support stm32f401cc
+ */
+
+#pragma once
+
+#include
+#include
+#include "flash_stm32.h"
+
+// HACK ALERT. This definition may not match your processor
+// To Do. Work out correct value for EEPROM_PAGE_SIZE on the STM32F103CT6 etc
+#if defined(EEPROM_EMU_STM32F303xC)
+# define MCU_STM32F303CC
+#elif defined(EEPROM_EMU_STM32F103xB)
+# define MCU_STM32F103RB
+#elif defined(EEPROM_EMU_STM32F072xB)
+# define MCU_STM32F072CB
+#elif defined(EEPROM_EMU_STM32F042x6)
+# define MCU_STM32F042K6
+#elif defined(EEPROM_EMU_STM32F401xC)
+# define MCU_STM32F401xC
+#else
+# error "not implemented."
+#endif
+
+
+
+
+
+#ifndef EEPROM_PAGE_SIZE
+# if defined(MCU_STM32F103RB) || defined(MCU_STM32F042K6)
+# define FEE_PAGE_SIZE (uint16_t)0x400 // Page size = 1KByte
+# define FEE_DENSITY_PAGES 4 // How many pages are used
+# elif defined(MCU_STM32F103ZE) || defined(MCU_STM32F103RE) || defined(MCU_STM32F103RD) || defined(MCU_STM32F303CC) || defined(MCU_STM32F072CB)
+# define FEE_PAGE_SIZE (uint16_t)0x800 // Page size = 2KByte
+# define FEE_DENSITY_PAGES 4 // How many pages are used
+# elif defined(MCU_STM32F401xC)
+# define FEE_PAGE_SIZE (uint32_t)0x20000 // Page size = 128KByte
+# define FEE_DENSITY_PAGES 1 // How many pages are used
+# define FEE_SECTOR_ID 5 // sector id of the flash
+# else
+# error "No MCU type specified. Add something like -DMCU_STM32F103RB to your compiler arguments (probably in a Makefile)."
+# endif
+#endif
+
+#ifndef EEPROM_START_ADDRESS
+# if defined(MCU_STM32F103RB) || defined(MCU_STM32F072CB)
+# define FEE_MCU_FLASH_SIZE 128 // Size in Kb
+# elif defined(MCU_STM32F042K6)
+# define FEE_MCU_FLASH_SIZE 32 // Size in Kb
+# elif defined(MCU_STM32F103ZE) || defined(MCU_STM32F103RE)
+# define FEE_MCU_FLASH_SIZE 512 // Size in Kb
+# elif defined(MCU_STM32F103RD)
+# define FEE_MCU_FLASH_SIZE 384 // Size in Kb
+# elif defined(MCU_STM32F303CC)
+# define FEE_MCU_FLASH_SIZE 256 // Size in Kb
+# elif defined(MCU_STM32F401xC)
+# define FEE_MCU_FLASH_SIZE 256 // Size in Kb
+# else
+# error "No MCU type specified. Add something like -DMCU_STM32F103RB to your compiler arguments (probably in a Makefile)."
+# endif
+#endif
+
+// DONT CHANGE
+// Choose location for the first EEPROM Page address on the top of flash
+// #define FEE_PAGE_BASE_ADDRESS ((uint32_t)(0x8000000 + FEE_MCU_FLASH_SIZE * 1024 - FEE_DENSITY_PAGES * FEE_PAGE_SIZE))
+// #define FEE_DENSITY_BYTES ((FEE_PAGE_SIZE / 2) * FEE_DENSITY_PAGES - 1)
+// #define FEE_LAST_PAGE_ADDRESS (FEE_PAGE_BASE_ADDRESS + (FEE_PAGE_SIZE * FEE_DENSITY_PAGES))
+// #define FEE_EMPTY_WORD ((uint16_t)0xFFFF)
+// #define FEE_ADDR_OFFSET(Address) (Address * 2) // 1Byte per Word will be saved to preserve Flash
+
+#define FEE_PAGE_END_ADDRESS ((uint32_t)(0x08000000 + FEE_MCU_FLASH_SIZE * 1024))
+#define FEE_PAGE_BASE_ADDRESS ((uint32_t)((FEE_PAGE_END_ADDRESS) - FEE_DENSITY_PAGES * FEE_PAGE_SIZE))
+#define FEE_DENSITY_BYTES ((FEE_PAGE_SIZE / 4) * FEE_DENSITY_PAGES - 1) // 4 Bytes for address, value pair
+//#define FEE_LAST_PAGE_ADDRESS (FEE_PAGE_BASE_ADDRESS + (FEE_PAGE_SIZE * FEE_DENSITY_PAGES))
+#define FEE_EMPTY_BYTE ((uint8_t)0xFF)
+#define FEE_EMPTY_WORD ((uint16_t)0xFFFF)
+#define FEE_EMPTY_VALUE ((uint32_t)0xFFFFFFFF)
+//#define FEE_ADDR_OFFSET(Address) (Address * 2) // 1 Byte per Word will be saved to preserve Flash
+#define FEE_DATA_ADDRESS(Address) ((Address)+2) // flash address of the eeprom data
+#define FEE_ADDR_ADDRESS(Address) (Address) // flash address of the eeprom address
+#define FEE_MAX_BYTES ((FEE_DENSITY_BYTES+1) > 1024 ? 1024 : (FEE_DENSITY_BYTES+1)) // eeprom size
+
diff --git a/keyboards/yandrstudio/zhou75/f401/eep/flash_stm32.c b/keyboards/yandrstudio/zhou75/f401/eep/flash_stm32.c
new file mode 100644
index 000000000000..c3f1937c5258
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/f401/eep/flash_stm32.c
@@ -0,0 +1,223 @@
+/*
+ * This software is experimental and a work in progress.
+ * Under no circumstances should these files be used in relation to any critical system(s).
+ * Use of these files is at your own risk.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * This files are free to use from https://github.com/rogerclarkmelbourne/Arduino_STM32 and
+ * https://github.com/leaflabs/libmaple
+ *
+ * Modifications for QMK and STM32F303 by Yiancar
+ * Adjust the file structure to custom EEPROM_DRIVER by jiaxin96 for support stm32f401cc
+ */
+
+#if defined(EEPROM_EMU_STM32F303xC)
+# define STM32F303xC
+# include "stm32f3xx.h"
+#elif defined(EEPROM_EMU_STM32F103xB)
+# define STM32F103xB
+# include "stm32f1xx.h"
+#elif defined(EEPROM_EMU_STM32F072xB)
+# define STM32F072xB
+# include "stm32f0xx.h"
+#elif defined(EEPROM_EMU_STM32F042x6)
+# define STM32F042x6
+# include "stm32f0xx.h"
+#elif defined(EEPROM_EMU_STM32F401xC)
+# define STM32F401xC
+# include "stm32f4xx.h"
+#else
+# error "not implemented."
+#endif
+
+
+#include "flash_stm32.h"
+
+#if defined(EEPROM_EMU_STM32F103xB)
+# define FLASH_SR_WRPERR FLASH_SR_WRPRTERR
+#endif
+
+#if defined(EEPROM_EMU_STM32F401xC)
+# define FLASH_PSIZE_HFWORD FLASH_CR_PSIZE_0
+# define FLASH_PSIZE_WORD FLASH_CR_PSIZE_1
+# define FLASH_CR_SNB_POS 3
+/* the flash key was not defined in the CMSIS used by current chibios */
+#define FLASH_KEY1 0x45670123U
+#define FLASH_KEY2 0xCDEF89ABU
+# define FLASH_SR_FLAGS (FLASH_SR_PGAERR|FLASH_SR_PGPERR|FLASH_SR_PGSERR|FLASH_SR_WRPERR)
+#else
+# define FLASH_SR_FLAGS (FLASH_SR_EOP | FLASH_SR_PGERR | FLASH_SR_WRPERR)
+#endif
+
+/* Delay definition */
+#define EraseTimeout ((uint32_t)0x00000FFF)
+#define ProgramTimeout ((uint32_t)0x0000001F)
+
+#define ASSERT(exp) (void)((0))
+
+/**
+ * @brief Inserts a time delay.
+ * @param None
+ * @retval None
+ */
+static void delay(void) {
+ __IO uint32_t i = 0;
+ for (i = 0xFF; i != 0; i--) {
+ }
+}
+
+/**
+ * @brief Returns the FLASH Status.
+ * @param None
+ * @retval FLASH Status: The returned value can be: FLASH_BUSY, FLASH_ERROR_PG,
+ * FLASH_ERROR_WRP or FLASH_COMPLETE
+ */
+FLASH_Status FLASH_GetStatus(void) {
+ if ((FLASH->SR & FLASH_SR_BSY) == FLASH_SR_BSY) return FLASH_BUSY;
+
+#if defined(EEPROM_EMU_STM32F401xC)
+ if ((FLASH->SR & (FLASH_SR_PGSERR | FLASH_SR_PGPERR | FLASH_SR_PGAERR))) return FLASH_ERROR_PG;
+ if ((FLASH->SR & FLASH_SR_WRPERR)) return FLASH_ERROR_WRP;
+#else
+ if ((FLASH->SR & FLASH_SR_PGERR) != 0) return FLASH_ERROR_PG;
+ if ((FLASH->SR & FLASH_SR_WRPERR) != 0) return FLASH_ERROR_WRP;
+ if ((FLASH->SR & FLASH_OBR_OPTERR) != 0) return FLASH_ERROR_OPT;
+#endif
+
+ return FLASH_COMPLETE;
+}
+
+/**
+ * @brief Waits for a Flash operation to complete or a TIMEOUT to occur.
+ * @param Timeout: FLASH progamming Timeout
+ * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
+ * FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout) {
+ FLASH_Status status;
+
+ /* Check for the Flash Status */
+ status = FLASH_GetStatus();
+ /* Wait for a Flash operation to complete or a TIMEOUT to occur */
+ while ((status == FLASH_BUSY) && (Timeout != 0x00)) {
+ delay();
+ status = FLASH_GetStatus();
+ Timeout--;
+ }
+ if (Timeout == 0) status = FLASH_TIMEOUT;
+ /* Return the operation status */
+ return status;
+}
+
+/**
+ * @brief Erases a specified FLASH page.
+ * @param Page_Address: The page address or sector to be erased.
+ * @retval FLASH Status: The returned value can be: FLASH_BUSY, FLASH_ERROR_PG,
+ * FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_ErasePage(uint32_t Page) {
+ FLASH_Status status = FLASH_COMPLETE;
+ /* Check the parameters */
+ //ASSERT(IS_FLASH_ADDRESS(Page_Address));
+ /* Wait for last operation to be completed */
+ status = FLASH_WaitForLastOperation(EraseTimeout);
+
+ if (status == FLASH_COMPLETE) {
+ /* if the previous operation is completed, proceed to erase the page */
+#if defined(EEPROM_EMU_STM32F401xC)
+ FLASH->CR &= ~FLASH_CR_SNB;
+ FLASH->CR |= FLASH_CR_SER | (Page << FLASH_CR_SNB_POS);
+#else
+ FLASH->CR |= FLASH_CR_PER;
+ FLASH->AR = Page;
+#endif
+ FLASH->CR |= FLASH_CR_STRT;
+
+ /* Wait for last operation to be completed */
+ status = FLASH_WaitForLastOperation(EraseTimeout);
+ /* clear the SER or PER Bit */
+#if defined(EEPROM_EMU_STM32F401xC)
+ FLASH->CR &= ~(FLASH_CR_SER | FLASH_CR_SNB);
+#else
+ FLASH->CR &= ~FLASH_CR_PER;
+#endif
+ FLASH_ClearFlag(FLASH_SR_FLAGS);
+ }
+ /* Return the Erase Status */
+ return status;
+}
+
+/**
+ * @brief Programs a half word at a specified address.
+ * @param Address: specifies the address to be programmed.
+ * @param Data: specifies the data to be programmed.
+ * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
+ * FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data) {
+ FLASH_Status status = FLASH_BAD_ADDRESS;
+ if ((Address % sizeof(uint16_t) != 0 ) || !IS_FLASH_ADDRESS(Address)) {
+ return status;
+ }
+
+ /* Wait for last operation to be completed */
+ status = FLASH_WaitForLastOperation(ProgramTimeout);
+ if (status == FLASH_COMPLETE) {
+ /* if the previous operation is completed, proceed to program the new data */
+#if defined(EEPROM_EMU_STM32F401xC)
+ FLASH->CR &= ~FLASH_CR_PSIZE;
+ FLASH->CR |= FLASH_PSIZE_HFWORD;
+#endif
+ FLASH->CR |= FLASH_CR_PG;
+ *(__IO uint16_t*)Address = Data;
+ /* Wait for last operation to be completed */
+ status = FLASH_WaitForLastOperation(ProgramTimeout);
+ if (status != FLASH_TIMEOUT) {
+ /* if the program operation is completed, disable the PG Bit */
+ FLASH->CR &= ~FLASH_CR_PG;
+ }
+ FLASH_ClearFlag(FLASH_SR_FLAGS);
+ }
+ return status;
+}
+
+/**
+ * @brief Unlocks the FLASH Program Erase Controller.
+ * @param None
+ * @retval None
+ */
+void FLASH_Unlock(void) {
+ /* Authorize the FPEC Access */
+ FLASH->KEYR = FLASH_KEY1;
+ FLASH->KEYR = FLASH_KEY2;
+}
+
+/**
+ * @brief Locks the FLASH Program Erase Controller.
+ * @param None
+ * @retval None
+ */
+void FLASH_Lock(void) {
+ /* Set the Lock Bit to lock the FPEC and the FCR */
+ FLASH->CR |= FLASH_CR_LOCK;
+}
+
+/**
+ * @brief Clears the FLASH's pending flags.
+ * @param FLASH_FLAG: specifies the FLASH flags to clear.
+ * This parameter can be any combination of the following values:
+ * @arg FLASH_FLAG_PGERR: FLASH Programming error flag flag
+ * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag
+ * @arg FLASH_FLAG_EOP: FLASH End of Programming flag
+ * @retval None
+ */
+void FLASH_ClearFlag(uint32_t FLASH_FLAG) {
+ /* Clear the flags */
+ FLASH->SR |= FLASH_FLAG;
+}
diff --git a/keyboards/yandrstudio/zhou75/f401/halconf.h b/keyboards/yandrstudio/zhou75/f401/halconf.h
new file mode 100644
index 000000000000..c03bc49506d1
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/f401/halconf.h
@@ -0,0 +1,35 @@
+/* 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
+#include_next
+
+#undef HAL_USE_PWM
+#define HAL_USE_PWM TRUE
+
+#undef SERIAL_USB_BUFFERS_SIZE
+#define SERIAL_USB_BUFFERS_SIZE 256
+
+#undef SERIAL_BUFFERS_SIZE
+#define SERIAL_BUFFERS_SIZE 128
+
+#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/zhou75/f401/matrix.c b/keyboards/yandrstudio/zhou75/f401/matrix.c
new file mode 100644
index 000000000000..d7040e338fbe
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/f401/matrix.c
@@ -0,0 +1,236 @@
+/* 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 .
+ */
+
+#include
+#include
+#include "util.h"
+#include "matrix.h"
+#include "debounce.h"
+#include "quantum.h"
+
+#ifdef DIRECT_PINS
+static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS;
+#elif (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW)
+static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
+static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
+#endif
+
+/* 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 inline void setPinOutput_writeLow(pin_t pin) {
+ ATOMIC_BLOCK_FORCEON {
+ setPinOutput(pin);
+ writePinLow(pin);
+ }
+}
+
+static inline void setPinInputHigh_atomic(pin_t pin) {
+ ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); }
+}
+
+// matrix code
+
+#ifdef DIRECT_PINS
+
+static void init_pins(void) {
+ for (int row = 0; row < MATRIX_ROWS; row++) {
+ for (int col = 0; col < MATRIX_COLS; col++) {
+ pin_t pin = direct_pins[row][col];
+ if (pin != NO_PIN) {
+ setPinInputHigh(pin);
+ }
+ }
+ }
+}
+
+static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
+ // Start with a clear matrix row
+ matrix_row_t current_row_value = 0;
+
+ for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
+ pin_t pin = direct_pins[current_row][col_index];
+ if (pin != NO_PIN) {
+ current_row_value |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index);
+ }
+ }
+
+ // If the row has changed, store the row and return the changed flag.
+ if (current_matrix[current_row] != current_row_value) {
+ current_matrix[current_row] = current_row_value;
+ return true;
+ }
+ return false;
+}
+
+#elif defined(DIODE_DIRECTION)
+# if (DIODE_DIRECTION == COL2ROW)
+
+static void select_col(uint8_t col) { palSetLine(col_pins[col]); }
+
+static void unselect_col(uint8_t col) { palClearLine(col_pins[col]); }
+
+static void unselect_rows(void) {
+ for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
+ palSetLineMode(row_pins[x], PAL_MODE_INPUT_PULLDOWN);
+ }
+}
+
+static void init_pins(void) {
+ unselect_rows();
+ for (uint8_t x = 0; x < MATRIX_COLS; x++) {
+ palSetLineMode(col_pins[x], PAL_MODE_OUTPUT_PUSHPULL);
+ }
+ for (uint8_t x = 0; x < MATRIX_COLS; x++) {
+ palClearLine(col_pins[x]);
+ }
+}
+
+static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
+ bool matrix_changed = false;
+
+ // Select col
+ select_col(current_col);
+ matrix_output_select_delay();
+
+ // For each row...
+ for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
+ // Store last value of row prior to reading
+ matrix_row_t last_row_value = current_matrix[row_index];
+ matrix_row_t current_row_value = last_row_value;
+
+ // Check row pin state
+ if (readPin(row_pins[row_index]) == 1) {
+ // Pin HI, set col bit
+ current_row_value |= (MATRIX_ROW_SHIFTER << current_col);
+ } else {
+ // Pin LO, clear col bit
+ current_row_value &= ~(MATRIX_ROW_SHIFTER << current_col);
+ }
+
+ // Determine if the matrix changed state
+ if ((last_row_value != current_row_value)) {
+ matrix_changed |= true;
+ current_matrix[row_index] = current_row_value;
+ }
+ }
+
+ // Unselect col
+ unselect_col(current_col);
+ if (current_col + 1 < MATRIX_COLS) {
+ matrix_output_unselect_delay(); // wait for col signal to go HIGH
+ }
+
+ return matrix_changed;
+}
+
+# elif (DIODE_DIRECTION == ROW2COL)
+
+static void select_row(uint8_t row) { palSetLine(row_pins[row]); }
+
+static void unselect_row(uint8_t row) { palClearLine(row_pins[row]); }
+
+static void unselect_cols(void) {
+ for (uint8_t x = 0; x < MATRIX_COLS; x++) {
+ palSetLineMode(col_pins[x], PAL_MODE_INPUT_PULLDOWN);
+ }
+}
+
+static void init_pins(void) {
+ unselect_cols();
+ for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
+ palSetLineMode(row_pins[x], PAL_MODE_OUTPUT_PUSHPULL);
+ }
+ for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
+ palClearLine(row_pins[x]);
+ }
+}
+
+
+static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
+ // Start with a clear matrix row
+ matrix_row_t current_row_value = 0;
+
+ // Select row
+ select_row(current_row);
+ matrix_output_select_delay();
+
+ // 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_row_value |= pin_state ? (MATRIX_ROW_SHIFTER << col_index) : 0;
+ }
+
+ // Unselect row
+ unselect_row(current_row);
+ if (current_row + 1 < MATRIX_ROWS) {
+ matrix_output_unselect_delay(); // wait for row signal to go HIGH
+ }
+
+ // If the row has changed, store the row and return the changed flag.
+ if (current_matrix[current_row] != current_row_value) {
+ current_matrix[current_row] = current_row_value;
+ return true;
+ }
+ return false;
+}
+
+# else
+# error DIODE_DIRECTION must be one of COL2ROW or ROW2COL!
+# endif
+#else
+# error DIODE_DIRECTION is not defined!
+#endif
+
+void matrix_init(void) {
+ // initialize key pins
+ init_pins();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ raw_matrix[i] = 0;
+ matrix[i] = 0;
+ }
+
+ debounce_init(MATRIX_ROWS);
+
+ matrix_init_quantum();
+}
+
+uint8_t matrix_scan(void) {
+ bool changed = false;
+
+#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW)
+ // Set col, read rows
+ for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
+ changed |= read_rows_on_col(raw_matrix, current_col);
+ }
+#elif (DIODE_DIRECTION == ROW2COL)
+ // 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);
+ }
+#endif
+
+ debounce(raw_matrix, matrix, MATRIX_ROWS, changed);
+
+ matrix_scan_quantum();
+ return (uint8_t)changed;
+}
diff --git a/keyboards/yandrstudio/zhou75/f401/mcuconf.h b/keyboards/yandrstudio/zhou75/f401/mcuconf.h
new file mode 100644
index 000000000000..404ac6ddda6a
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/f401/mcuconf.h
@@ -0,0 +1,86 @@
+/* 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
+
+#include_next
+
+#undef STM32_PWM_USE_TIM3
+#define STM32_PWM_USE_TIM3 TRUE
+
+#undef STM32_ST_USE_TIMER
+#define STM32_ST_USE_TIMER 2
+
+#undef STM32_NO_INIT
+#undef STM32_HSI_ENABLED
+#undef STM32_LSI_ENABLED
+#undef STM32_HSE_ENABLED
+#undef STM32_LSE_ENABLED
+#undef STM32_CLOCK48_REQUIRED
+#undef STM32_SW
+#undef STM32_PLLSRC
+#undef STM32_PLLM_VALUE
+#undef STM32_PLLN_VALUE
+#undef STM32_PLLP_VALUE
+#undef STM32_PLLQ_VALUE
+#undef STM32_HPRE
+#undef STM32_PPRE1
+#undef STM32_PPRE2
+#undef STM32_RTCSEL
+#undef STM32_RTCPRE_VALUE
+#undef STM32_MCO1SEL
+#undef STM32_MCO1PRE
+#undef STM32_MCO2SEL
+#undef STM32_MCO2PRE
+#undef STM32_I2SSRC
+#undef STM32_PLLI2SN_VALUE
+#undef STM32_PLLI2SR_VALUE
+#undef STM32_PVD_ENABLE
+#undef STM32_PLS
+#undef STM32_BKPRAM_ENABLE
+
+#define STM32_NO_INIT FALSE
+#define STM32_HSI_ENABLED TRUE
+#define STM32_LSI_ENABLED TRUE
+#define STM32_HSE_ENABLED TRUE
+#define STM32_LSE_ENABLED FALSE
+#define STM32_CLOCK48_REQUIRED TRUE
+#define STM32_SW STM32_SW_PLL
+#define STM32_PLLSRC STM32_PLLSRC_HSE
+#define STM32_PLLM_VALUE 16
+#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
+#define STM32_MCO1SEL STM32_MCO1SEL_HSI
+#define STM32_MCO1PRE STM32_MCO1PRE_DIV1
+#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
+#define STM32_MCO2PRE STM32_MCO2PRE_DIV5
+#define STM32_I2SSRC STM32_I2SSRC_CKIN
+#define STM32_PLLI2SN_VALUE 192
+#define STM32_PLLI2SR_VALUE 5
+#define STM32_PVD_ENABLE FALSE
+#define STM32_PLS STM32_PLS_LEV0
+#define STM32_BKPRAM_ENABLE FALSE
+
+
diff --git a/keyboards/yandrstudio/zhou75/f401/rules.mk b/keyboards/yandrstudio/zhou75/f401/rules.mk
new file mode 100644
index 000000000000..0a1f4180ebc2
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/f401/rules.mk
@@ -0,0 +1,33 @@
+# MCU name
+MCU = STM32F401
+
+# Address of the bootloader in system memory
+STM32_BOOTLOADER_ADDRESS = 0x1FFF0000
+
+# Bootloader selection
+BOOTLOADER = stm32-dfu
+
+# # project specific file
+CUSTOM_MATRIX = lite # for using the A9 pin as matrix io
+QUANTUM_SRC += matrix.c
+
+RGB_MATRIX_ENABLE = yes
+RGB_MATRIX_DRIVER = WS2812
+# RGBLIGHT_ENABLE = yes
+# RGBLIGHT_DRIVER = WS2812
+WS2812_DRIVER = pwm
+
+
+ENCODER_ENABLE = yes
+
+
+# EEPROM_DRIVER = spi
+EEPROM_DRIVER = custom
+SRC += eep/eeprom_stm32.c
+SRC += eep/flash_stm32.c
+OPT_DEFS += -DEEPROM_EMU_STM32F401xC
+COMMON_VPATH += keyboards/yandrstudio/whiteMouse28T/f401/eep
+
+
+# Enter lower-power sleep mode when on the ChibiOS idle thread
+OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
diff --git a/keyboards/yandrstudio/zhou75/info-via-encoder.json b/keyboards/yandrstudio/zhou75/info-via-encoder.json
new file mode 100644
index 000000000000..21bb72ea98d2
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/info-via-encoder.json
@@ -0,0 +1,193 @@
+{
+ "name": "zhou75_Y&R",
+ "vendorId": "0xAA96",
+ "productId": "0xAAA7",
+ "lighting": {
+ "extends": "none",
+ "keycodes": "qmk"
+ },
+ "matrix": {
+ "rows": 6,
+ "cols": 15
+ },
+ "layouts": {
+ "keymap":
+ [
+ [
+ "5,4",
+ {
+ "x": 17
+ },
+ "5,7"
+ ],
+ [
+ {
+ "y": -0.5,
+ "x": 1.5
+ },
+ "0,0",
+ {
+ "x": 0.5
+ },
+ "0,2",
+ "0,3",
+ "0,4",
+ "0,5",
+ {
+ "x": 0.5
+ },
+ "0,6",
+ "0,7",
+ "0,8",
+ "0,9",
+ {
+ "x": 0.5
+ },
+ "0,10",
+ "0,11",
+ "0,12",
+ "0,13",
+ {
+ "x": 0.5
+ },
+ "0,14"
+ ],
+ [
+ {
+ "y": -0.5
+ },
+ "5,5",
+ {
+ "x": 17
+ },
+ "5,8"
+ ],
+ [
+ {
+ "x": 1.5
+ },
+ "1,0",
+ "1,1",
+ "1,2",
+ "1,3",
+ "1,4",
+ "1,5",
+ "1,6",
+ "1,7",
+ "1,8",
+ "1,9",
+ "1,10",
+ "1,11",
+ "1,12",
+ {
+ "w": 2
+ },
+ "1,13",
+ "1,14"
+ ],
+ [
+ {
+ "x": 1.5,
+ "w": 1.5
+ },
+ "2,0",
+ "2,1",
+ "2,2",
+ "2,3",
+ "2,4",
+ "2,5",
+ "2,6",
+ "2,7",
+ "2,8",
+ "2,9",
+ "2,10",
+ "2,11",
+ "2,12",
+ {
+ "w": 1.5
+ },
+ "2,13",
+ "2,14"
+ ],
+ [
+ {
+ "x": 1.5,
+ "w": 1.75
+ },
+ "3,0",
+ "3,1",
+ "3,2",
+ "3,3",
+ "3,4",
+ "3,5",
+ "3,6",
+ "3,7",
+ "3,8",
+ "3,9",
+ "3,10",
+ "3,11",
+ {
+ "w": 2.25
+ },
+ "3,13",
+ "3,14"
+ ],
+ [
+ {
+ "x": 1.5,
+ "w": 2.25
+ },
+ "4,0",
+ "4,2",
+ "4,3",
+ "4,4",
+ "4,5",
+ "4,6",
+ "4,7",
+ "4,8",
+ "4,9",
+ "4,10",
+ "4,11",
+ {
+ "w": 1.75
+ },
+ "4,12",
+ "4,13",
+ "4,14"
+ ],
+ [
+ {
+ "x": 1.5,
+ "w": 1.25
+ },
+ "5,0",
+ {
+ "w": 1.25
+ },
+ "5,1",
+ {
+ "w": 1.25
+ },
+ "5,3",
+ {
+ "w": 6.25
+ },
+ "5,6",
+ {
+ "w": 1.25
+ },
+ "5,10",
+ {
+ "w": 1.25
+ },
+ "5,11",
+ {
+ "x": 0.5
+ },
+ "5,12",
+ "5,13",
+ "5,14"
+ ]
+ ]
+ }
+}
diff --git a/keyboards/yandrstudio/zhou75/info-via.json b/keyboards/yandrstudio/zhou75/info-via.json
new file mode 100644
index 000000000000..a5dea801a9ac
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/info-via.json
@@ -0,0 +1,168 @@
+{
+ "name": "zhou75_Y&R",
+ "vendorId": "0xAA96",
+ "productId": "0xAAA7",
+ "lighting": {
+ "extends": "none",
+ "keycodes": "qmk"
+ },
+ "matrix": {
+ "rows": 6,
+ "cols": 15
+ },
+ "layouts": {
+ "keymap":
+ [
+ [
+ "0,0",
+ {
+ "x": 0.5
+ },
+ "0,2",
+ "0,3",
+ "0,4",
+ "0,5",
+ {
+ "x": 0.5
+ },
+ "0,6",
+ "0,7",
+ "0,8",
+ "0,9",
+ {
+ "x": 0.5
+ },
+ "0,10",
+ "0,11",
+ "0,12",
+ "0,13",
+ {
+ "x": 0.5
+ },
+ "0,14"
+ ],
+ [
+ {
+ "y": 0.5
+ },
+ "1,0",
+ "1,1",
+ "1,2",
+ "1,3",
+ "1,4",
+ "1,5",
+ "1,6",
+ "1,7",
+ "1,8",
+ "1,9",
+ "1,10",
+ "1,11",
+ "1,12",
+ {
+ "w": 2
+ },
+ "1,13",
+ "1,14"
+ ],
+ [
+ {
+ "w": 1.5
+ },
+ "2,0",
+ "2,1",
+ "2,2",
+ "2,3",
+ "2,4",
+ "2,5",
+ "2,6",
+ "2,7",
+ "2,8",
+ "2,9",
+ "2,10",
+ "2,11",
+ "2,12",
+ {
+ "w": 1.5
+ },
+ "2,13",
+ "2,14"
+ ],
+ [
+ {
+ "w": 1.75
+ },
+ "3,0",
+ "3,1",
+ "3,2",
+ "3,3",
+ "3,4",
+ "3,5",
+ "3,6",
+ "3,7",
+ "3,8",
+ "3,9",
+ "3,10",
+ "3,11",
+ {
+ "w": 2.25
+ },
+ "3,13",
+ "3,14"
+ ],
+ [
+ {
+ "w": 2.25
+ },
+ "4,0",
+ "4,2",
+ "4,3",
+ "4,4",
+ "4,5",
+ "4,6",
+ "4,7",
+ "4,8",
+ "4,9",
+ "4,10",
+ "4,11",
+ {
+ "w": 1.75
+ },
+ "4,12",
+ "4,13",
+ "4,14"
+ ],
+ [
+ {
+ "w": 1.25
+ },
+ "5,0",
+ {
+ "w": 1.25
+ },
+ "5,1",
+ {
+ "w": 1.25
+ },
+ "5,3",
+ {
+ "w": 6.25
+ },
+ "5,6",
+ {
+ "w": 1.25
+ },
+ "5,10",
+ {
+ "w": 1.25
+ },
+ "5,11",
+ {
+ "x": 0.5
+ },
+ "5,12",
+ "5,13",
+ "5,14"
+ ]
+ ]
+ }
+}
diff --git a/keyboards/yandrstudio/zhou75/keymaps/default/keymap.c b/keyboards/yandrstudio/zhou75/keymaps/default/keymap.c
new file mode 100644
index 000000000000..f946b0be2e30
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/keymaps/default/keymap.c
@@ -0,0 +1,91 @@
+/* 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 .
+ */
+#include QMK_KEYBOARD_H
+
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ LAYOUT(
+ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,
+
+ KC_GRV, 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_INS,
+ 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_PGUP,
+ KC_LSFT, 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_PGDN,
+ KC_LCTL, KC_LGUI, KC_LALT, KC_PGUP, KC_PGDN,KC_SPC, KC_VOLU, KC_VOLD, KC_RALT, M(1), KC_LEFT, KC_DOWN, KC_RGHT),
+
+ 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, 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, RGB_TOG, RGB_MOD, RGB_MODE_REVERSE, RGB_VAI, RGB_VAD, 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, 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, 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, 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, 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)
+
+};
+
+
+#ifdef ENCODER_ENABLE
+
+
+bool encoder_update_user(uint8_t index, bool clockwise) {
+
+
+ // uprintf("%ud g_rgb_time scale8\n", scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4));
+
+ return false;
+
+ switch (index)
+ {
+ case 0:
+ if (clockwise) {
+ tap_code16(KC_PGUP);
+ } else {
+ tap_code16(KC_PGDN);
+ }
+ break;
+ case 1:
+ if (clockwise) {
+ tap_code16(KC_VOLU);
+ } else {
+ tap_code16(KC_VOLD);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return false;
+}
+#endif
diff --git a/keyboards/yandrstudio/zhou75/keymaps/via/keymap.c b/keyboards/yandrstudio/zhou75/keymaps/via/keymap.c
new file mode 100644
index 000000000000..1f3690f41796
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/keymaps/via/keymap.c
@@ -0,0 +1,115 @@
+/* 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 .
+ */
+#include QMK_KEYBOARD_H
+
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ LAYOUT(
+ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,
+
+ KC_GRV, 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_INS,
+ 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_PGUP,
+ KC_LSFT, 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_PGDN,
+ KC_LCTL, KC_LGUI, KC_LALT, KC_PGUP, KC_PGDN,KC_SPC, KC_VOLU, KC_VOLD, KC_RALT, M(1), KC_LEFT, KC_DOWN, KC_RGHT),
+
+ 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, 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, RGB_TOG, RGB_MOD, RGB_MODE_REVERSE, RGB_VAI, RGB_VAD, 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, 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, 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, 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, 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)
+
+};
+
+
+#ifdef ENCODER_ENABLE
+
+
+bool encoder_update_user(uint8_t index, bool clockwise) {
+
+
+ // uprintf("%ud g_rgb_time scale8\n", scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4));
+
+ return false;
+
+ switch (index)
+ {
+ case 0:
+ if (clockwise) {
+ uint16_t keycode = dynamic_keymap_get_keycode(biton32(layer_state), 5, 4);
+ if (keycode >= MACRO00 && keycode <= MACRO15) {
+ dynamic_keymap_macro_send(keycode - MACRO00);
+ } else {
+ tap_code16(keycode);
+ }
+ } else {
+ uint16_t keycode = dynamic_keymap_get_keycode(biton32(layer_state), 5, 5);
+ if (keycode >= MACRO00 && keycode <= MACRO15) {
+ dynamic_keymap_macro_send(keycode - MACRO00);
+ } else {
+ tap_code16(keycode);
+ }
+ }
+ break;
+ case 1:
+ if (clockwise) {
+ uint16_t keycode = dynamic_keymap_get_keycode(biton32(layer_state), 5, 7);
+ if (keycode >= MACRO00 && keycode <= MACRO15) {
+ dynamic_keymap_macro_send(keycode - MACRO00);
+ } else {
+ tap_code16(keycode);
+ }
+ } else {
+ uint16_t keycode = dynamic_keymap_get_keycode(biton32(layer_state), 5, 8);
+ if (keycode >= MACRO00 && keycode <= MACRO15) {
+ dynamic_keymap_macro_send(keycode - MACRO00);
+ } else {
+ tap_code16(keycode);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+
+#endif
+
+
diff --git a/keyboards/yandrstudio/zhou75/keymaps/via/rules.mk b/keyboards/yandrstudio/zhou75/keymaps/via/rules.mk
new file mode 100644
index 000000000000..1e5b99807cb7
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/keymaps/via/rules.mk
@@ -0,0 +1 @@
+VIA_ENABLE = yes
diff --git a/keyboards/yandrstudio/zhou75/readme.md b/keyboards/yandrstudio/zhou75/readme.md
new file mode 100644
index 000000000000..f1c593ab06f9
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/readme.md
@@ -0,0 +1,15 @@
+zhou75 version 1.0
+===
+
+A 87% keys keyboard with rgb (keys).
+This keyboard use 8mhz HSE and STM32F401 as MCU.
+
+Keyboard Maintainer: https://github.com/jiaxin96
+Hardware Supported: zhou75
+Hardware Availability: https://github.com/Oh-My-Mechanical-Keyboard
+
+Make example for this keyboard (after setting up your build environment):
+
+ make yandrstudio/zhou75/f401:via
+
+See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
diff --git a/keyboards/yandrstudio/zhou75/rules.mk b/keyboards/yandrstudio/zhou75/rules.mk
new file mode 100644
index 000000000000..24fe138d7d7b
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/rules.mk
@@ -0,0 +1,14 @@
+# Build Options
+# 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 = yes # Mouse keys
+EXTRAKEY_ENABLE = yes # Audio control and System control
+CONSOLE_ENABLE = yes # Console for debug
+# COMMAND_ENABLE = yes # Commands for debug and configuration
+# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+NKRO_ENABLE = yes # USB Nkey Rollover
+NO_USB_STARTUP_CHECK = no # Disable initialization only when usb is plugged in
+
+
diff --git a/keyboards/yandrstudio/zhou75/zhou75.c b/keyboards/yandrstudio/zhou75/zhou75.c
new file mode 100644
index 000000000000..2fad5aa83cbc
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/zhou75.c
@@ -0,0 +1,62 @@
+/* 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 .
+ */
+#include QMK_KEYBOARD_H
+
+
+
+#ifdef RGB_MATRIX_ENABLE
+led_config_t g_led_config = {
+ {
+ { 0, NO_LED, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
+ { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28},
+ { 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43},
+ { 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, NO_LED, 56, 57},
+ { 58, NO_LED, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71},
+ { 72, 73, NO_LED, 74, NO_LED, NO_LED, 75, NO_LED, NO_LED, NO_LED, 76, 77, 78, 79, 80},
+ },
+ {
+ // LED Index to Physical Position
+ {0,0}, {32,0}, {48,0}, {64,0}, {80,0}, {96,0}, {112,0}, {128,0}, {144,0}, {160,0}, {176,0}, {192,0}, {208,0}, {224,0}, \
+ {0,13}, {16,13}, {32,13}, {48,13}, {64,13}, {80,13}, {96,13}, {112,13}, {128,13}, {144,13}, {160,13}, {176,13}, {192,13}, {208,13}, {224,13}, \
+ {0,26}, {16,26}, {32,26}, {48,26}, {64,26}, {80,26}, {96,26}, {112,26}, {128,26}, {144,26}, {160,26}, {176,26}, {192,26}, {208,26}, {224,26}, \
+ {0,38}, {16,38}, {32,38}, {48,38}, {64,38}, {80,38}, {96,38}, {112,38}, {128,38}, {144,38}, {160,38}, {176,38}, {192,38}, {224,38}, \
+ {0,51}, {32,51}, {48,51}, {64,51}, {80,51}, {96,51}, {112,51}, {128,51}, {144,51}, {160,51}, {176,51}, {192,51}, {208,51}, {224,51}, \
+ {0,64}, {16,64}, {48,64}, {96,64}, {160,64}, {176,64}, {192,64}, {208,64}, {224,64}
+ },
+ {
+ // LED Index to Flag
+ 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, 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
+ }
+};
+
+
+#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
diff --git a/keyboards/yandrstudio/zhou75/zhou75.h b/keyboards/yandrstudio/zhou75/zhou75.h
new file mode 100644
index 000000000000..3b3007c6c705
--- /dev/null
+++ b/keyboards/yandrstudio/zhou75/zhou75.h
@@ -0,0 +1,34 @@
+/* Copyright 2020 zvecr
+ *
+ * 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 "quantum.h"
+
+#define LAYOUT( \
+ K000, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \
+ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214, \
+ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, K314, \
+ K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K413, K414, \
+ K500, K502, K503, K504, K505, K506, K507, K508, K509, K510, K511, K512, K513, K514, \
+ K600, K601, K603, K604, K605, K606, K607, K608, K610, K611, K612, K613, K614 \
+) { \
+ { K000, KC_NO, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \
+ { K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214 }, \
+ { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, K314 }, \
+ { K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, KC_NO, K413, K414 }, \
+ { K500, KC_NO, K502, K503, K504, K505, K506, K507, K508, K509, K510, K511, K512, K513, K514 }, \
+ { K600, K601, KC_NO, K603, K604, K605, K606, K607, K608, KC_NO, K610, K611, K612, K613, K614 } \
+}