aboutsummaryrefslogtreecommitdiff
path: root/platforms/chibios/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'platforms/chibios/drivers')
-rw-r--r--platforms/chibios/drivers/audio_pwm_hardware.c18
-rw-r--r--platforms/chibios/drivers/backlight_pwm.c4
-rw-r--r--platforms/chibios/drivers/i2c_master.c43
-rw-r--r--platforms/chibios/drivers/i2c_master.h49
-rw-r--r--platforms/chibios/drivers/spi_master.c43
-rw-r--r--platforms/chibios/drivers/spi_master.h102
-rw-r--r--platforms/chibios/drivers/uart.h200
-rw-r--r--platforms/chibios/drivers/uart_serial.c83
-rw-r--r--platforms/chibios/drivers/uart_sio.c67
9 files changed, 226 insertions, 383 deletions
diff --git a/platforms/chibios/drivers/audio_pwm_hardware.c b/platforms/chibios/drivers/audio_pwm_hardware.c
index 1ba7ec13bc..afa341abb6 100644
--- a/platforms/chibios/drivers/audio_pwm_hardware.c
+++ b/platforms/chibios/drivers/audio_pwm_hardware.c
@@ -41,18 +41,19 @@ static float channel_1_frequency = 0.0f;
void channel_1_set_frequency(float freq) {
channel_1_frequency = freq;
+ pwmcnt_t period;
+ pwmcnt_t width;
if (freq <= 0.0) {
- // a pause/rest has freq=0
- return;
+ period = 2;
+ width = 0;
+ } else {
+ period = (pwmCFG.frequency / freq);
+ width = (pwmcnt_t)(((period) * (pwmcnt_t)((100 - note_timbre) * 100)) / (pwmcnt_t)(10000));
}
-
- pwmcnt_t period = (pwmCFG.frequency / freq);
chSysLockFromISR();
pwmChangePeriodI(&AUDIO_PWM_DRIVER, period);
- pwmEnableChannelI(&AUDIO_PWM_DRIVER, AUDIO_PWM_CHANNEL - 1,
- // adjust the duty-cycle so that the output is for 'note_timbre' duration HIGH
- PWM_PERCENTAGE_TO_WIDTH(&AUDIO_PWM_DRIVER, (100 - note_timbre) * 100));
+ pwmEnableChannelI(&AUDIO_PWM_DRIVER, AUDIO_PWM_CHANNEL - 1, width);
chSysUnlockFromISR();
}
@@ -67,6 +68,9 @@ void channel_1_start(void) {
void channel_1_stop(void) {
pwmStop(&AUDIO_PWM_DRIVER);
+ pwmStart(&AUDIO_PWM_DRIVER, &pwmCFG);
+ pwmEnableChannel(&AUDIO_PWM_DRIVER, AUDIO_PWM_CHANNEL - 1, 0);
+ pwmStop(&AUDIO_PWM_DRIVER);
}
static virtual_timer_t audio_vt;
diff --git a/platforms/chibios/drivers/backlight_pwm.c b/platforms/chibios/drivers/backlight_pwm.c
index 25fe7962b0..47ad008415 100644
--- a/platforms/chibios/drivers/backlight_pwm.c
+++ b/platforms/chibios/drivers/backlight_pwm.c
@@ -28,9 +28,9 @@
// Support for pins which are on TIM1_CH1N
#ifdef BACKLIGHT_PWM_COMPLEMENTARY_OUTPUT
# if BACKLIGHT_ON_STATE == 1
-# define PWM_OUTPUT_MODE PWM_COMPLEMENTARY_OUTPUT_ACTIVE_LOW;
-# else
# define PWM_OUTPUT_MODE PWM_COMPLEMENTARY_OUTPUT_ACTIVE_HIGH;
+# else
+# define PWM_OUTPUT_MODE PWM_COMPLEMENTARY_OUTPUT_ACTIVE_LOW;
# endif
#else
# if BACKLIGHT_ON_STATE == 1
diff --git a/platforms/chibios/drivers/i2c_master.c b/platforms/chibios/drivers/i2c_master.c
index 0d5fb1e985..1d7fe27633 100644
--- a/platforms/chibios/drivers/i2c_master.c
+++ b/platforms/chibios/drivers/i2c_master.c
@@ -29,17 +29,37 @@
#include "i2c_master.h"
#include "gpio.h"
#include "chibios_config.h"
-#include <string.h>
#include <ch.h>
#include <hal.h>
+#ifndef I2C_DRIVER
+# define I2C_DRIVER I2CD1
+#endif
+
#ifndef I2C1_SCL_PIN
# define I2C1_SCL_PIN B6
#endif
+
+#ifndef I2C1_SCL_PAL_MODE
+# ifdef USE_GPIOV1
+# define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATE_OPENDRAIN
+# else
+# define I2C1_SCL_PAL_MODE 4
+# endif
+#endif
+
#ifndef I2C1_SDA_PIN
# define I2C1_SDA_PIN B7
#endif
+#ifndef I2C1_SDA_PAL_MODE
+# ifdef USE_GPIOV1
+# define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATE_OPENDRAIN
+# else
+# define I2C1_SDA_PAL_MODE 4
+# endif
+#endif
+
#ifdef USE_I2CV1
# ifndef I2C1_OPMODE
# define I2C1_OPMODE OPMODE_I2C
@@ -70,27 +90,6 @@
# endif
#endif
-#ifndef I2C_DRIVER
-# define I2C_DRIVER I2CD1
-#endif
-
-#ifdef USE_GPIOV1
-# ifndef I2C1_SCL_PAL_MODE
-# define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATE_OPENDRAIN
-# endif
-# ifndef I2C1_SDA_PAL_MODE
-# define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATE_OPENDRAIN
-# endif
-#else
-// The default PAL alternate modes are used to signal that the pins are used for I2C
-# ifndef I2C1_SCL_PAL_MODE
-# define I2C1_SCL_PAL_MODE 4
-# endif
-# ifndef I2C1_SDA_PAL_MODE
-# define I2C1_SDA_PAL_MODE 4
-# endif
-#endif
-
static const I2CConfig i2cconfig = {
#if defined(USE_I2CV1_CONTRIB)
I2C1_CLOCK_SPEED,
diff --git a/platforms/chibios/drivers/i2c_master.h b/platforms/chibios/drivers/i2c_master.h
deleted file mode 100644
index 132ffd14c0..0000000000
--- a/platforms/chibios/drivers/i2c_master.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright 2018 Jack Humbert
- * Copyright 2018 Yiancar
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-
-/* This library follows the convention of the AVR i2c_master library.
- * As a result addresses are expected to be already shifted (addr << 1).
- * I2CD1 is the default driver which corresponds to pins B6 and B7. This
- * can be changed.
- * Please ensure that HAL_USE_I2C is TRUE in the halconf.h file and that
- * STM32_I2C_USE_I2C1 is TRUE in the mcuconf.h file.
- */
-#pragma once
-
-#include <stdint.h>
-
-// ### DEPRECATED - DO NOT USE ###
-#define i2c_writeReg(devaddr, regaddr, data, length, timeout) i2c_write_register(devaddr, regaddr, data, length, timeout)
-#define i2c_writeReg16(devaddr, regaddr, data, length, timeout) i2c_write_register16(devaddr, regaddr, data, length, timeout)
-#define i2c_readReg(devaddr, regaddr, data, length, timeout) i2c_read_register(devaddr, regaddr, data, length, timeout)
-#define i2c_readReg16(devaddr, regaddr, data, length, timeout) i2c_read_register16(devaddr, regaddr, data, length, timeout)
-// ###############################
-
-typedef int16_t i2c_status_t;
-
-#define I2C_STATUS_SUCCESS (0)
-#define I2C_STATUS_ERROR (-1)
-#define I2C_STATUS_TIMEOUT (-2)
-
-void i2c_init(void);
-i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout);
-i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);
-i2c_status_t i2c_write_register(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout);
-i2c_status_t i2c_write_register16(uint8_t devaddr, uint16_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout);
-i2c_status_t i2c_read_register(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);
-i2c_status_t i2c_read_register16(uint8_t devaddr, uint16_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);
-i2c_status_t i2c_ping_address(uint8_t address, uint16_t timeout);
diff --git a/platforms/chibios/drivers/spi_master.c b/platforms/chibios/drivers/spi_master.c
index 414e5b10a3..f5e48edfda 100644
--- a/platforms/chibios/drivers/spi_master.c
+++ b/platforms/chibios/drivers/spi_master.c
@@ -15,8 +15,49 @@
*/
#include "spi_master.h"
+#include "chibios_config.h"
+#include <ch.h>
+#include <hal.h>
-#include "timer.h"
+#ifndef SPI_DRIVER
+# define SPI_DRIVER SPID2
+#endif
+
+#ifndef SPI_SCK_PIN
+# define SPI_SCK_PIN B13
+#endif
+
+#ifndef SPI_SCK_PAL_MODE
+# ifdef USE_GPIOV1
+# define SPI_SCK_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
+# else
+# define SPI_SCK_PAL_MODE 5
+# endif
+#endif
+
+#ifndef SPI_MOSI_PIN
+# define SPI_MOSI_PIN B15
+#endif
+
+#ifndef SPI_MOSI_PAL_MODE
+# ifdef USE_GPIOV1
+# define SPI_MOSI_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
+# else
+# define SPI_MOSI_PAL_MODE 5
+# endif
+#endif
+
+#ifndef SPI_MISO_PIN
+# define SPI_MISO_PIN B14
+#endif
+
+#ifndef SPI_MISO_PAL_MODE
+# ifdef USE_GPIOV1
+# define SPI_MISO_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
+# else
+# define SPI_MISO_PAL_MODE 5
+# endif
+#endif
static bool spiStarted = false;
#if SPI_SELECT_MODE == SPI_SELECT_MODE_NONE
diff --git a/platforms/chibios/drivers/spi_master.h b/platforms/chibios/drivers/spi_master.h
deleted file mode 100644
index 4ad6144091..0000000000
--- a/platforms/chibios/drivers/spi_master.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* 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 <https://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include <ch.h>
-#include <hal.h>
-#include <stdbool.h>
-
-#include "gpio.h"
-#include "chibios_config.h"
-
-#ifndef SPI_DRIVER
-# define SPI_DRIVER SPID2
-#endif
-
-#ifndef SPI_SCK_PIN
-# define SPI_SCK_PIN B13
-#endif
-
-#ifndef SPI_SCK_PAL_MODE
-# if defined(USE_GPIOV1)
-# define SPI_SCK_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
-# else
-# define SPI_SCK_PAL_MODE 5
-# endif
-#endif
-
-#ifndef SPI_MOSI_PIN
-# define SPI_MOSI_PIN B15
-#endif
-
-#ifndef SPI_MOSI_PAL_MODE
-# if defined(USE_GPIOV1)
-# define SPI_MOSI_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
-# else
-# define SPI_MOSI_PAL_MODE 5
-# endif
-#endif
-
-#ifndef SPI_MISO_PIN
-# define SPI_MISO_PIN B14
-#endif
-
-#ifndef SPI_MISO_PAL_MODE
-# if defined(USE_GPIOV1)
-# define SPI_MISO_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
-# else
-# define SPI_MISO_PAL_MODE 5
-# endif
-#endif
-
-typedef int16_t spi_status_t;
-
-#define SPI_STATUS_SUCCESS (0)
-#define SPI_STATUS_ERROR (-1)
-#define SPI_STATUS_TIMEOUT (-2)
-
-#define SPI_TIMEOUT_IMMEDIATE (0)
-#define SPI_TIMEOUT_INFINITE (0xFFFF)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-typedef struct spi_start_config_t {
- pin_t slave_pin;
- bool lsb_first;
- uint8_t mode;
- uint16_t divisor;
- bool cs_active_low;
-} spi_start_config_t;
-
-void spi_init(void);
-
-bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor);
-bool spi_start_extended(spi_start_config_t *start_config);
-
-spi_status_t spi_write(uint8_t data);
-
-spi_status_t spi_read(void);
-
-spi_status_t spi_transmit(const uint8_t *data, uint16_t length);
-
-spi_status_t spi_receive(uint8_t *data, uint16_t length);
-
-void spi_stop(void);
-#ifdef __cplusplus
-}
-#endif
diff --git a/platforms/chibios/drivers/uart.h b/platforms/chibios/drivers/uart.h
deleted file mode 100644
index c1945575f1..0000000000
--- a/platforms/chibios/drivers/uart.h
+++ /dev/null
@@ -1,200 +0,0 @@
-// Copyright 2024 Stefan Kerkmann
-// Copyright 2021 QMK
-// Copyright 2024 Stefan Kerkmann
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include <hal.h>
-
-#include "gpio.h"
-#include "chibios_config.h"
-
-// ======== DEPRECATED DEFINES - DO NOT USE ========
-#ifdef SERIAL_DRIVER
-# define UART_DRIVER SERIAL_DRIVER
-#endif
-#ifdef SD1_TX_PIN
-# define UART_TX_PIN SD1_TX_PIN
-#endif
-#ifdef SD1_RX_PIN
-# define UART_RX_PIN SD1_RX_PIN
-#endif
-#ifdef SD1_CTS_PIN
-# define UART_CTS_PIN SD1_CTS_PIN
-#endif
-#ifdef SD1_RTS_PIN
-# define UART_RTS_PIN SD1_RTS_PIN
-#endif
-#ifdef SD1_TX_PAL_MODE
-# define UART_TX_PAL_MODE SD1_TX_PAL_MODE
-#endif
-#ifdef SD1_RX_PAL_MODE
-# define UART_RX_PAL_MODE SD1_RX_PAL_MODE
-#endif
-#ifdef SD1_CTS_PAL_MODE
-# define UART_RTS_PAL_MODE SD1_CTS_PAL_MODE
-#endif
-#ifdef SD1_RTS_PAL_MODE
-# define UART_TX_PAL_MODE SD1_RTS_PAL_MODE
-#endif
-#ifdef SD1_CR1
-# define UART_CR1 SD1_CR1
-#endif
-#ifdef SD1_CR2
-# define UART_CR2 SD1_CR2
-#endif
-#ifdef SD1_CR3
-# define UART_CR3 SD1_CR3
-#endif
-#ifdef SD1_WRDLEN
-# define UART_WRDLEN SD1_WRDLEN
-#endif
-#ifdef SD1_STPBIT
-# define UART_STPBIT SD1_STPBIT
-#endif
-#ifdef SD1_PARITY
-# define UART_PARITY SD1_PARITY
-#endif
-#ifdef SD1_ATFLCT
-# define UART_ATFLCT SD1_ATFLCT
-#endif
-// ========
-
-#ifndef UART_DRIVER
-# if (HAL_USE_SERIAL == TRUE)
-# define UART_DRIVER SD1
-# elif (HAL_USE_SIO == TRUE)
-# define UART_DRIVER SIOD1
-# endif
-#endif
-
-#ifndef UART_TX_PIN
-# define UART_TX_PIN A9
-#endif
-
-#ifndef UART_RX_PIN
-# define UART_RX_PIN A10
-#endif
-
-#ifndef UART_CTS_PIN
-# define UART_CTS_PIN A11
-#endif
-
-#ifndef UART_RTS_PIN
-# define UART_RTS_PIN A12
-#endif
-
-#ifdef USE_GPIOV1
-# ifndef UART_TX_PAL_MODE
-# define UART_TX_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
-# endif
-# ifndef UART_RX_PAL_MODE
-# define UART_RX_PAL_MODE PAL_MODE_INPUT
-# endif
-# ifndef UART_CTS_PAL_MODE
-# define UART_CTS_PAL_MODE PAL_MODE_INPUT
-# endif
-# ifndef UART_RTS_PAL_MODE
-# define UART_RTS_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
-# endif
-#else
-# ifndef UART_TX_PAL_MODE
-# define UART_TX_PAL_MODE 7
-# endif
-
-# ifndef UART_RX_PAL_MODE
-# define UART_RX_PAL_MODE 7
-# endif
-
-# ifndef UART_CTS_PAL_MODE
-# define UART_CTS_PAL_MODE 7
-# endif
-
-# ifndef UART_RTS_PAL_MODE
-# define UART_RTS_PAL_MODE 7
-# endif
-#endif
-
-#ifndef UART_CR1
-# define UART_CR1 0
-#endif
-
-#ifndef UART_CR2
-# define UART_CR2 0
-#endif
-
-#ifndef UART_CR3
-# define UART_CR3 0
-#endif
-
-#ifndef UART_WRDLEN
-# define UART_WRDLEN 3
-#endif
-
-#ifndef UART_STPBIT
-# define UART_STPBIT 0
-#endif
-
-#ifndef UART_PARITY
-# define UART_PARITY 0
-#endif
-
-#ifndef UART_ATFLCT
-# define UART_ATFLCT 0
-#endif
-
-/**
- * @brief Initialize the UART driver. This function must be called only once,
- * before any of the below functions can be called.
- *
- * @param baud The baud rate to transmit and receive at. This may depend on the
- * device you are communicating with. Common values are 1200, 2400, 4800, 9600,
- * 19200, 38400, 57600, and 115200.
- */
-void uart_init(uint32_t baud);
-
-/**
- * @brief Transmit a single byte.
- *
- * @param data The byte to transmit.
- */
-void uart_write(uint8_t data);
-
-/**
- * @brief Receive a single byte.
- *
- * @return uint8_t The byte read from the receive buffer. This function will
- * block if the buffer is empty (ie. no data to read).
- */
-uint8_t uart_read(void);
-
-/**
- * @brief Transmit multiple bytes.
- *
- * @param data A pointer to the data to write from.
- * @param length The number of bytes to write. Take care not to overrun the
- * length of `data`.
- */
-void uart_transmit(const uint8_t *data, uint16_t length);
-
-/**
- * @brief Receive multiple bytes.
- *
- * @param data A pointer to the buffer to read into.
- * @param length The number of bytes to read. Take care not to overrun the
- * length of `data`.
- */
-void uart_receive(uint8_t *data, uint16_t length);
-
-/**
- * @brief Return whether the receive buffer contains data. Call this function
- * to determine if `uart_read()` will return data immediately.
- *
- * @return true If there is data available to read.
- * @return false If there is no data available to read.
- */
-bool uart_available(void);
diff --git a/platforms/chibios/drivers/uart_serial.c b/platforms/chibios/drivers/uart_serial.c
index 6aff4eae47..e0afb9768a 100644
--- a/platforms/chibios/drivers/uart_serial.c
+++ b/platforms/chibios/drivers/uart_serial.c
@@ -3,6 +3,89 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "uart.h"
+#include "gpio.h"
+#include "chibios_config.h"
+#include <hal.h>
+
+#ifndef UART_DRIVER
+# define UART_DRIVER SD1
+#endif
+
+#ifndef UART_TX_PIN
+# define UART_TX_PIN A9
+#endif
+
+#ifndef UART_TX_PAL_MODE
+# ifdef USE_GPIOV1
+# define UART_TX_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
+# else
+# define UART_TX_PAL_MODE 7
+# endif
+#endif
+
+#ifndef UART_RX_PIN
+# define UART_RX_PIN A10
+#endif
+
+#ifndef UART_RX_PAL_MODE
+# ifdef USE_GPIOV1
+# define UART_RX_PAL_MODE PAL_MODE_INPUT
+# else
+# define UART_RX_PAL_MODE 7
+# endif
+#endif
+
+#ifndef UART_CTS_PIN
+# define UART_CTS_PIN A11
+#endif
+
+#ifndef UART_CTS_PAL_MODE
+# ifdef USE_GPIOV1
+# define UART_CTS_PAL_MODE PAL_MODE_INPUT
+# else
+# define UART_CTS_PAL_MODE 7
+# endif
+#endif
+
+#ifndef UART_RTS_PIN
+# define UART_RTS_PIN A12
+#endif
+
+#ifndef UART_RTS_PAL_MODE
+# ifdef USE_GPIOV1
+# define UART_RTS_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
+# else
+# define UART_RTS_PAL_MODE 7
+# endif
+#endif
+
+#ifndef UART_CR1
+# define UART_CR1 0
+#endif
+
+#ifndef UART_CR2
+# define UART_CR2 0
+#endif
+
+#ifndef UART_CR3
+# define UART_CR3 0
+#endif
+
+#ifndef UART_WRDLEN
+# define UART_WRDLEN 3
+#endif
+
+#ifndef UART_STPBIT
+# define UART_STPBIT 0
+#endif
+
+#ifndef UART_PARITY
+# define UART_PARITY 0
+#endif
+
+#ifndef UART_ATFLCT
+# define UART_ATFLCT 0
+#endif
#if defined(MCU_KINETIS)
static SerialConfig serialConfig = {SERIAL_DEFAULT_BITRATE};
diff --git a/platforms/chibios/drivers/uart_sio.c b/platforms/chibios/drivers/uart_sio.c
index 442df1c54d..fc12f0abed 100644
--- a/platforms/chibios/drivers/uart_sio.c
+++ b/platforms/chibios/drivers/uart_sio.c
@@ -3,6 +3,73 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "uart.h"
+#include "gpio.h"
+#include "chibios_config.h"
+#include <hal.h>
+
+#ifndef UART_DRIVER
+# define UART_DRIVER SIOD1
+#endif
+
+#ifndef UART_TX_PIN
+# define UART_TX_PIN A9
+#endif
+
+#ifndef UART_TX_PAL_MODE
+# ifdef USE_GPIOV1
+# define UART_TX_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
+# else
+# define UART_TX_PAL_MODE 7
+# endif
+#endif
+
+#ifndef UART_RX_PIN
+# define UART_RX_PIN A10
+#endif
+
+#ifndef UART_RX_PAL_MODE
+# ifdef USE_GPIOV1
+# define UART_RX_PAL_MODE PAL_MODE_INPUT
+# else
+# define UART_RX_PAL_MODE 7
+# endif
+#endif
+
+#ifndef UART_CTS_PIN
+# define UART_CTS_PIN A11
+#endif
+
+#ifndef UART_CTS_PAL_MODE
+# ifdef USE_GPIOV1
+# define UART_CTS_PAL_MODE PAL_MODE_INPUT
+# else
+# define UART_CTS_PAL_MODE 7
+# endif
+#endif
+
+#ifndef UART_RTS_PIN
+# define UART_RTS_PIN A12
+#endif
+
+#ifndef UART_RTS_PAL_MODE
+# ifdef USE_GPIOV1
+# define UART_RTS_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
+# else
+# define UART_RTS_PAL_MODE 7
+# endif
+#endif
+
+#ifndef UART_CR1
+# define UART_CR1 0
+#endif
+
+#ifndef UART_CR2
+# define UART_CR2 0
+#endif
+
+#ifndef UART_CR3
+# define UART_CR3 0
+#endif
#if defined(MCU_RP)
// 38400 baud, 8 data bits, 1 stop bit, no parity, no flow control