mirror of
https://github.com/apache/nuttx.git
synced 2026-10-12 16:50:21 +00:00
STM32: Single wire UART support from Thomas Grubler
This commit is contained in:
parent
707922432c
commit
c01e95584c
2 changed files with 15 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue