summaryrefslogtreecommitdiffstats
path: root/platforms/chibios/drivers/uart.c
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2022-09-17 11:24:03 +1000
committerGitHub <noreply@github.com>2022-09-17 02:24:03 +0100
commit33c47fe0106b5b1ec307d81bc6ee92cce3be50d5 (patch)
treee26ba41279d66bc82b86aaaabced1013a243ce7c /platforms/chibios/drivers/uart.c
parent786fabc144b9ae101c9040c83907d9728d28af07 (diff)
Add UART support for Kinetis boards (#18370)
* Add UART support for Kinetis boards * Default PAL mode for GPIOV1
Diffstat (limited to 'platforms/chibios/drivers/uart.c')
-rw-r--r--platforms/chibios/drivers/uart.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/platforms/chibios/drivers/uart.c b/platforms/chibios/drivers/uart.c
index 396803f33b..b16130d80b 100644
--- a/platforms/chibios/drivers/uart.c
+++ b/platforms/chibios/drivers/uart.c
@@ -18,7 +18,9 @@
#include "quantum.h"
-#if defined(WB32F3G71xx) || defined(WB32FQ95xx)
+#if defined(MCU_KINETIS)
+static SerialConfig serialConfig = {SERIAL_DEFAULT_BITRATE};
+#elif defined(WB32F3G71xx) || defined(WB32FQ95xx)
static SerialConfig serialConfig = {SERIAL_DEFAULT_BITRATE, SD1_WRDLEN, SD1_STPBIT, SD1_PARITY, SD1_ATFLCT};
#else
static SerialConfig serialConfig = {SERIAL_DEFAULT_BITRATE, SD1_CR1, SD1_CR2, SD1_CR3};
@@ -30,11 +32,15 @@ void uart_init(uint32_t baud) {
if (!is_initialised) {
is_initialised = true;
+#if defined(MCU_KINETIS)
+ serialConfig.sc_speed = baud;
+#else
serialConfig.speed = baud;
+#endif
#if defined(USE_GPIOV1)
- palSetLineMode(SD1_TX_PIN, PAL_MODE_ALTERNATE_OPENDRAIN);
- palSetLineMode(SD1_RX_PIN, PAL_MODE_ALTERNATE_OPENDRAIN);
+ palSetLineMode(SD1_TX_PIN, SD1_TX_PAL_MODE);
+ palSetLineMode(SD1_RX_PIN, SD1_RX_PAL_MODE);
#else
palSetLineMode(SD1_TX_PIN, PAL_MODE_ALTERNATE(SD1_TX_PAL_MODE) | PAL_OUTPUT_TYPE_OPENDRAIN);
palSetLineMode(SD1_RX_PIN, PAL_MODE_ALTERNATE(SD1_RX_PAL_MODE) | PAL_OUTPUT_TYPE_OPENDRAIN);