summaryrefslogtreecommitdiffstats
path: root/platforms/chibios/drivers/serial_usart.h
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2022-06-17 22:06:44 +0200
committerGitHub <noreply@github.com>2022-06-17 22:06:44 +0200
commit6d67e9df4be6981de05517626c1a504da31abf16 (patch)
treeb7a88df60d68f4e19d85c722bf6e8c7ace26483c /platforms/chibios/drivers/serial_usart.h
parente44604c25667acb03e40b5f1f64f464a6d3f5ffe (diff)
[Core] Allow usage of ChibiOS's SIO driver for split keyboards (#15907)
Diffstat (limited to 'platforms/chibios/drivers/serial_usart.h')
-rw-r--r--platforms/chibios/drivers/serial_usart.h39
1 files changed, 21 insertions, 18 deletions
diff --git a/platforms/chibios/drivers/serial_usart.h b/platforms/chibios/drivers/serial_usart.h
index 81fe9e0113..98c634dac0 100644
--- a/platforms/chibios/drivers/serial_usart.h
+++ b/platforms/chibios/drivers/serial_usart.h
@@ -1,18 +1,5 @@
-/* Copyright 2021 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 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 <http://www.gnu.org/licenses/>.
- */
+// Copyright 2021 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
@@ -23,8 +10,24 @@
#include <ch.h>
#include <hal.h>
-#if !defined(SERIAL_USART_DRIVER)
-# define SERIAL_USART_DRIVER SD1
+#if HAL_USE_SERIAL
+
+typedef SerialDriver QMKSerialDriver;
+typedef SerialConfig QMKSerialConfig;
+
+# if !defined(SERIAL_USART_DRIVER)
+# define SERIAL_USART_DRIVER SD1
+# endif
+
+#elif HAL_USE_SIO
+
+typedef SIODriver QMKSerialDriver;
+typedef SIOConfig QMKSerialConfig;
+
+# if !defined(SERIAL_USART_DRIVER)
+# define SERIAL_USART_DRIVER SIOD1
+# endif
+
#endif
#if !defined(USE_GPIOV1)
@@ -113,4 +116,4 @@
# define SERIAL_USART_TIMEOUT 20
#endif
-#define HANDSHAKE_MAGIC 7
+#define HANDSHAKE_MAGIC 7U