Skip to content
Snippets Groups Projects
Commit c01e9558 authored by Gregory Nutt's avatar Gregory Nutt
Browse files

STM32: Single wire UART support from Thomas Grubler

parent 70792243
No related branches found
No related tags found
No related merge requests found
......@@ -6356,4 +6356,6 @@
tools (2013-21-31).
* configs/z16f2800100zcog/nsh: Add a Z16F NSH configuration. Does not
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);
#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)
{
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);
cr &= ~USART_CR3_HDSEL;
}
#endif
up_serialout(priv, STM32_USART_CR3_OFFSET, cr);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment