diff --git a/ChangeLog b/ChangeLog index afa205f88ec..77e52b99d6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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). diff --git a/arch/arm/src/stm32/stm32_serial.c b/arch/arm/src/stm32/stm32_serial.c index 3cbcd6a92c0..510efc75bbd 100644 --- a/arch/arm/src/stm32/stm32_serial.c +++ b/arch/arm/src/stm32/stm32_serial.c @@ -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); }