diff --git a/keyboards/handwired/onekey/stm32f405_weact/board.h b/keyboards/handwired/onekey/stm32f405_weact/board.h new file mode 100644 index 000000000000..e7f163b8ef22 --- /dev/null +++ b/keyboards/handwired/onekey/stm32f405_weact/board.h @@ -0,0 +1,10 @@ +// Copyright 2024 Sergey Vlasov (@sigprof) +// SPDX-License-Identifier: GPL-2.0-or-later +#pragma once + +#include_next + +#undef STM32_HSECLK +#define STM32_HSECLK 8000000 + +#define BOARD_OTG2_USES_ULPI diff --git a/keyboards/handwired/onekey/stm32f405_weact/config.h b/keyboards/handwired/onekey/stm32f405_weact/config.h new file mode 100644 index 000000000000..9150927b93c7 --- /dev/null +++ b/keyboards/handwired/onekey/stm32f405_weact/config.h @@ -0,0 +1,10 @@ +// Copyright 2024 Sergey Vlasov (@sigprof) +// SPDX-License-Identifier: GPL-2.0-or-later +#pragma once + +#define ADC_PIN A0 + +#define SOLENOID_PINS { C6, C7, C8, C9 } +#define SOLENOID_PINS_ACTIVE_STATE { high, high, low } + +#define USB_DRIVER USBD2 diff --git a/keyboards/handwired/onekey/stm32f405_weact/keyboard.json b/keyboards/handwired/onekey/stm32f405_weact/keyboard.json new file mode 100644 index 000000000000..f2f4f604f087 --- /dev/null +++ b/keyboards/handwired/onekey/stm32f405_weact/keyboard.json @@ -0,0 +1,9 @@ +{ + "keyboard_name": "Onekey WeAct STM32F405 + USB3300", + "processor": "STM32F405", + "bootloader": "stm32-dfu", + "matrix_pins": { + "cols": ["A1"], + "rows": ["A2"] + } +} diff --git a/keyboards/handwired/onekey/stm32f405_weact/mcuconf.h b/keyboards/handwired/onekey/stm32f405_weact/mcuconf.h new file mode 100644 index 000000000000..beb2927a6d2c --- /dev/null +++ b/keyboards/handwired/onekey/stm32f405_weact/mcuconf.h @@ -0,0 +1,17 @@ +// Copyright 2024 Sergey Vlasov (@sigprof) +// SPDX-License-Identifier: GPL-2.0-or-later +#pragma once + +#include_next + +#undef STM32_PLLM_VALUE +#define STM32_PLLM_VALUE 8 + +#undef STM32_USB_USE_OTG1 +#define STM32_USB_USE_OTG1 FALSE + +#undef STM32_USB_USE_OTG2 +#define STM32_USB_USE_OTG2 TRUE + +#undef STM32_USE_USB_OTG2_HS +#define STM32_USE_USB_OTG2_HS TRUE diff --git a/keyboards/handwired/onekey/stm32f405_weact/stm32f405_weact.c b/keyboards/handwired/onekey/stm32f405_weact/stm32f405_weact.c new file mode 100644 index 000000000000..e094f75e8a18 --- /dev/null +++ b/keyboards/handwired/onekey/stm32f405_weact/stm32f405_weact.c @@ -0,0 +1,40 @@ +// Copyright 2024 Sergey Vlasov (@sigprof) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + + +#define ULPI_PIN_MODE (PAL_MODE_ALTERNATE(10) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_FLOATING) + +#define ULPI_STP_PIN C0 +#define ULPI_DIR_PIN C2 +#define ULPI_NXT_PIN C3 +#define ULPI_CLK_PIN A5 +#define ULPI_D0_PIN A3 +#define ULPI_D1_PIN B0 +#define ULPI_D2_PIN B1 +#define ULPI_D3_PIN B10 +#define ULPI_D4_PIN B11 +#define ULPI_D5_PIN B12 +#define ULPI_D6_PIN B13 +#define ULPI_D7_PIN B5 + +#define ULPI_RST_PIN A6 + +void board_init(void) { + palSetLineMode(ULPI_STP_PIN, ULPI_PIN_MODE); + palSetLineMode(ULPI_DIR_PIN, ULPI_PIN_MODE); + palSetLineMode(ULPI_NXT_PIN, ULPI_PIN_MODE); + palSetLineMode(ULPI_CLK_PIN, ULPI_PIN_MODE); + palSetLineMode(ULPI_D0_PIN, ULPI_PIN_MODE); + palSetLineMode(ULPI_D1_PIN, ULPI_PIN_MODE); + palSetLineMode(ULPI_D2_PIN, ULPI_PIN_MODE); + palSetLineMode(ULPI_D3_PIN, ULPI_PIN_MODE); + palSetLineMode(ULPI_D4_PIN, ULPI_PIN_MODE); + palSetLineMode(ULPI_D5_PIN, ULPI_PIN_MODE); + palSetLineMode(ULPI_D6_PIN, ULPI_PIN_MODE); + palSetLineMode(ULPI_D7_PIN, ULPI_PIN_MODE); + + gpio_set_pin_output(ULPI_RST_PIN); + gpio_write_pin_low(ULPI_RST_PIN); +}