aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHorrorTroll <[email protected]>2025-01-14 12:20:36 +0700
committerGitHub <[email protected]>2025-01-13 21:20:36 -0800
commit7f1c236c75b0a92b952882c6f211f78157978f63 (patch)
tree70b464d064e35ebe0d32c70fb4233778d5d75dde
parenteb29f8befc61cec38293fbc368cc90d6eff79771 (diff)
downloadqmk_firmware-7f1c236c75b0a92b952882c6f211f78157978f63.tar.gz
qmk_firmware-7f1c236c75b0a92b952882c6f211f78157978f63.zip
Bugfix and update for AT32F415 (#24807)
-rw-r--r--drivers/led/apa102.c2
-rw-r--r--keyboards/handwired/onekey/at_start_f415/board.h4
-rw-r--r--keyboards/handwired/onekey/at_start_f415/config.h4
-rw-r--r--keyboards/handwired/onekey/at_start_f415/halconf.h4
-rw-r--r--keyboards/handwired/onekey/at_start_f415/keyboard.json4
-rw-r--r--keyboards/handwired/onekey/at_start_f415/mcuconf.h4
-rw-r--r--platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.c4
-rw-r--r--platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.h28
-rw-r--r--platforms/chibios/boards/GENERIC_AT32_F415XX/configs/config.h4
-rw-r--r--platforms/chibios/boards/GENERIC_AT32_F415XX/configs/mcuconf.h16
-rw-r--r--platforms/chibios/chibios_config.h4
11 files changed, 46 insertions, 32 deletions
diff --git a/drivers/led/apa102.c b/drivers/led/apa102.c
index 6e87d48b96..6a13153374 100644
--- a/drivers/led/apa102.c
+++ b/drivers/led/apa102.c
@@ -24,7 +24,7 @@
# elif defined(PROTOCOL_CHIBIOS)
# include "hal.h"
# include "chibios_config.h"
-# if defined(STM32F0XX) || defined(STM32F1XX) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX) || defined(GD32VF103) || defined(MCU_RP)
+# if defined(STM32F0XX) || defined(STM32F1XX) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX) || defined(AT32F415) || defined(GD32VF103) || defined(MCU_RP)
# define APA102_NOPS (100 / (1000000000L / (CPU_CLOCK / 4))) // This calculates how many loops of 4 nops to run to delay 100 ns
# else
# error APA102_NOPS configuration required
diff --git a/keyboards/handwired/onekey/at_start_f415/board.h b/keyboards/handwired/onekey/at_start_f415/board.h
index f4adc2d418..a31d8f8e37 100644
--- a/keyboards/handwired/onekey/at_start_f415/board.h
+++ b/keyboards/handwired/onekey/at_start_f415/board.h
@@ -1,5 +1,5 @@
-// Copyright 2023-2024 HorrorTroll <https://github.com/HorrorTroll>
-// Copyright 2023-2024 Zhaqian <https://github.com/zhaqian12>
+// Copyright 2023-2025 HorrorTroll <https://github.com/HorrorTroll>
+// Copyright 2023-2025 Zhaqian <https://github.com/zhaqian12>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
diff --git a/keyboards/handwired/onekey/at_start_f415/config.h b/keyboards/handwired/onekey/at_start_f415/config.h
index 0e47e813c5..41aece900c 100644
--- a/keyboards/handwired/onekey/at_start_f415/config.h
+++ b/keyboards/handwired/onekey/at_start_f415/config.h
@@ -1,5 +1,5 @@
-// Copyright 2023-2024 HorrorTroll <https://github.com/HorrorTroll>
-// Copyright 2023-2024 Zhaqian <https://github.com/zhaqian12>
+// Copyright 2023-2025 HorrorTroll <https://github.com/HorrorTroll>
+// Copyright 2023-2025 Zhaqian <https://github.com/zhaqian12>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
diff --git a/keyboards/handwired/onekey/at_start_f415/halconf.h b/keyboards/handwired/onekey/at_start_f415/halconf.h
index 1423633d15..e3c075936d 100644
--- a/keyboards/handwired/onekey/at_start_f415/halconf.h
+++ b/keyboards/handwired/onekey/at_start_f415/halconf.h
@@ -1,5 +1,5 @@
-// Copyright 2023-2024 HorrorTroll <https://github.com/HorrorTroll>
-// Copyright 2023-2024 Zhaqian <https://github.com/zhaqian12>
+// Copyright 2023-2025 HorrorTroll <https://github.com/HorrorTroll>
+// Copyright 2023-2025 Zhaqian <https://github.com/zhaqian12>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
diff --git a/keyboards/handwired/onekey/at_start_f415/keyboard.json b/keyboards/handwired/onekey/at_start_f415/keyboard.json
index f598923a6a..6e5683a474 100644
--- a/keyboards/handwired/onekey/at_start_f415/keyboard.json
+++ b/keyboards/handwired/onekey/at_start_f415/keyboard.json
@@ -17,4 +17,8 @@
"ws2812": {
"pin": "B0"
}
+ "apa102": {
+ "data_pin": "B0",
+ "clock_pin": "B1"
+ }
}
diff --git a/keyboards/handwired/onekey/at_start_f415/mcuconf.h b/keyboards/handwired/onekey/at_start_f415/mcuconf.h
index 9bc11d507c..246f6762d3 100644
--- a/keyboards/handwired/onekey/at_start_f415/mcuconf.h
+++ b/keyboards/handwired/onekey/at_start_f415/mcuconf.h
@@ -1,5 +1,5 @@
-// Copyright 2023-2024 HorrorTroll <https://github.com/HorrorTroll>
-// Copyright 2023-2024 Zhaqian <https://github.com/zhaqian12>
+// Copyright 2023-2025 HorrorTroll <https://github.com/HorrorTroll>
+// Copyright 2023-2025 Zhaqian <https://github.com/zhaqian12>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
diff --git a/platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.c b/platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.c
index 28cf7c18e0..26b1974e4a 100644
--- a/platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.c
+++ b/platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.c
@@ -1,7 +1,7 @@
/*
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2024 HorrorTroll
- ChibiOS - Copyright (C) 2023..2024 Zhaqian
+ ChibiOS - Copyright (C) 2023..2025 HorrorTroll
+ ChibiOS - Copyright (C) 2023..2025 Zhaqian
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.h b/platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.h
index c3ade198ba..b4909b0a29 100644
--- a/platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.h
+++ b/platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.h
@@ -1,7 +1,7 @@
/*
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2024 HorrorTroll
- ChibiOS - Copyright (C) 2023..2024 Zhaqian
+ ChibiOS - Copyright (C) 2023..2025 HorrorTroll
+ ChibiOS - Copyright (C) 2023..2025 Zhaqian
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -50,6 +50,14 @@
#define AT32F415KB
/*
+ * GPIO settings, allow unused GPIO for smaller chip packages.
+ */
+#if defined(AT32F415KB) || defined(AT32F415KC)
+#define AT32_HAS_GPIOC TRUE
+#define AT32_HAS_GPIOF TRUE
+#endif
+
+/*
* IO pins assignments.
*/
#define GPIOA_PIN0 0U
@@ -142,21 +150,21 @@
* 6 - Open Drain output 2MHz.
* 7 - Open Drain output 50MHz.
* 8 - Digital input with Pull-Up or Pull-Down resistor depending on ODT.
- * 9 - Alternate Push Pull output 10MHz.
- * A - Alternate Push Pull output 2MHz.
- * B - Alternate Push Pull output 50MHz.
+ * 9 - Multiplexing Push Pull output 10MHz.
+ * A - Multiplexing Push Pull output 2MHz.
+ * B - Multiplexing Push Pull output 50MHz.
* C - Reserved.
- * D - Alternate Open Drain output 10MHz.
- * E - Alternate Open Drain output 2MHz.
- * F - Alternate Open Drain output 50MHz.
+ * D - Multiplexing Open Drain output 10MHz.
+ * E - Multiplexing Open Drain output 2MHz.
+ * F - Multiplexing Open Drain output 50MHz.
* Please refer to the AT32 Reference Manual for details.
*/
/*
* Port A setup.
*/
-#define VAL_GPIOACFGLR 0x88888B88 /* PA7...PA0 */
-#define VAL_GPIOACFGHR 0x888888B8 /* PA15...PA8 */
+#define VAL_GPIOACFGLR 0x88888888 /* PA7...PA0 */
+#define VAL_GPIOACFGHR 0x88888888 /* PA15...PA8 */
#define VAL_GPIOAODT 0xFFFFFFFF
/*
diff --git a/platforms/chibios/boards/GENERIC_AT32_F415XX/configs/config.h b/platforms/chibios/boards/GENERIC_AT32_F415XX/configs/config.h
index da60447a0a..01d9a47aac 100644
--- a/platforms/chibios/boards/GENERIC_AT32_F415XX/configs/config.h
+++ b/platforms/chibios/boards/GENERIC_AT32_F415XX/configs/config.h
@@ -1,5 +1,5 @@
-// Copyright 2023-2024 HorrorTroll <https://github.com/HorrorTroll>
-// Copyright 2023-2024 Zhaqian <https://github.com/zhaqian12>
+// Copyright 2023-2025 HorrorTroll <https://github.com/HorrorTroll>
+// Copyright 2023-2025 Zhaqian <https://github.com/zhaqian12>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
diff --git a/platforms/chibios/boards/GENERIC_AT32_F415XX/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_AT32_F415XX/configs/mcuconf.h
index d148379fe1..e218e4791a 100644
--- a/platforms/chibios/boards/GENERIC_AT32_F415XX/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_AT32_F415XX/configs/mcuconf.h
@@ -1,7 +1,7 @@
/*
ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2024 HorrorTroll
- ChibiOS - Copyright (C) 2023..2024 Zhaqian
+ ChibiOS - Copyright (C) 2023..2025 HorrorTroll
+ ChibiOS - Copyright (C) 2023..2025 Zhaqian
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -63,7 +63,7 @@
#define AT32_USBDIV AT32_USBDIV_DIV3
#define AT32_CLKOUT_SEL AT32_CLKOUT_SEL_NOCLOCK
#define AT32_CLKOUTDIV AT32_CLKOUTDIV_DIV1
-#define AT32_ERTCSEL AT32_ERTCSEL_HEXTDIV
+#define AT32_ERTCSEL AT32_ERTCSEL_NOCLOCK
#define AT32_PVM_ENABLE FALSE
#define AT32_PVMSEL AT32_PVMSEL_LEV1
@@ -136,10 +136,10 @@
#define AT32_I2C_USE_I2C1 FALSE
#define AT32_I2C_USE_I2C2 FALSE
#define AT32_I2C_BUSY_TIMEOUT 50
-#define AT32_I2C_I2C1_IRQ_PRIORITY 5
-#define AT32_I2C_I2C2_IRQ_PRIORITY 5
#define AT32_I2C_I2C1_DMA_PRIORITY 3
#define AT32_I2C_I2C2_DMA_PRIORITY 3
+#define AT32_I2C_I2C1_IRQ_PRIORITY 5
+#define AT32_I2C_I2C2_IRQ_PRIORITY 5
#define AT32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
/*
@@ -151,8 +151,6 @@
#define AT32_ICU_USE_TMR4 FALSE
#define AT32_ICU_USE_TMR5 FALSE
#define AT32_ICU_USE_TMR9 FALSE
-#define AT32_ICU_USE_TMR10 FALSE
-#define AT32_ICU_USE_TMR11 FALSE
/*
* PWM driver system settings.
@@ -216,9 +214,13 @@
#define AT32_UART_USE_USART1 FALSE
#define AT32_UART_USE_USART2 FALSE
#define AT32_UART_USE_USART3 FALSE
+#define AT32_UART_USE_UART4 FALSE
+#define AT32_UART_USE_UART5 FALSE
#define AT32_UART_USART1_DMA_PRIORITY 0
#define AT32_UART_USART2_DMA_PRIORITY 0
#define AT32_UART_USART3_DMA_PRIORITY 0
+#define AT32_UART_UART4_DMA_PRIORITY 0
+#define AT32_UART_UART5_DMA_PRIORITY 0
#define AT32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
/*
diff --git a/platforms/chibios/chibios_config.h b/platforms/chibios/chibios_config.h
index 95136baf30..9ef8e9b4fe 100644
--- a/platforms/chibios/chibios_config.h
+++ b/platforms/chibios/chibios_config.h
@@ -149,8 +149,8 @@
# if defined(AT32F415)
# define USE_GPIOV1
# define USE_I2CV1
-# define PAL_MODE_ALTERNATE_OPENDRAIN PAL_MODE_AT32_ALTERNATE_OPENDRAIN
-# define PAL_MODE_ALTERNATE_PUSHPULL PAL_MODE_AT32_ALTERNATE_PUSHPULL
+# define PAL_MODE_ALTERNATE_OPENDRAIN PAL_MODE_AT32_MUX_OPENDRAIN
+# define PAL_MODE_ALTERNATE_PUSHPULL PAL_MODE_AT32_MUX_PUSHPULL
# define AUDIO_PWM_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
# endif
#endif