mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
STM32: Single wire UART support from Thomas Grubler
This commit is contained in:
@@ -6356,4 +6356,6 @@
|
|||||||
tools (2013-21-31).
|
tools (2013-21-31).
|
||||||
* configs/z16f2800100zcog/nsh: Add a Z16F NSH configuration. Does not
|
* configs/z16f2800100zcog/nsh: Add a Z16F NSH configuration. Does not
|
||||||
yet work (2014-1-1).
|
yet work (2014-1-1).
|
||||||
|
* arch/arm/src/stm32/stm32_serial.c: Single-wire UART support from
|
||||||
|
Thomas Grubler (2014-1-2).
|
||||||
|
|
||||||
|
|||||||
@@ -1744,6 +1744,18 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
uint32_t cr = up_serialin(priv, STM32_USART_CR3_OFFSET);
|
uint32_t cr = up_serialin(priv, STM32_USART_CR3_OFFSET);
|
||||||
|
|
||||||
|
#if defined(CONFIG_STM32_STM32F10XX)
|
||||||
|
if (arg == SER_SINGLEWIRE_ENABLED)
|
||||||
|
{
|
||||||
|
stm32_configgpio((priv->tx_gpio & ~(GPIO_CNF_MASK)) | GPIO_CNF_AFOD);
|
||||||
|
cr |= USART_CR3_HDSEL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stm32_configgpio((priv->tx_gpio & ~(GPIO_CNF_MASK)) | GPIO_CNF_AFPP);
|
||||||
|
cr &= ~USART_CR3_HDSEL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (arg == SER_SINGLEWIRE_ENABLED)
|
if (arg == SER_SINGLEWIRE_ENABLED)
|
||||||
{
|
{
|
||||||
stm32_configgpio(priv->tx_gpio | GPIO_OPENDRAIN);
|
stm32_configgpio(priv->tx_gpio | GPIO_OPENDRAIN);
|
||||||
@@ -1754,6 +1766,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
|||||||
stm32_configgpio(priv->tx_gpio | GPIO_PUSHPULL);
|
stm32_configgpio(priv->tx_gpio | GPIO_PUSHPULL);
|
||||||
cr &= ~USART_CR3_HDSEL;
|
cr &= ~USART_CR3_HDSEL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
up_serialout(priv, STM32_USART_CR3_OFFSET, cr);
|
up_serialout(priv, STM32_USART_CR3_OFFSET, cr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user