mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 04:52:02 +08:00
stm32f0l0g0 serial:Add SINGLEWIRE PUSHPULL option
This commit is contained in:
committed by
Xiang Xiao
parent
749dbce431
commit
156024671e
@@ -1603,7 +1603,9 @@ static int stm32serial_ioctl(FAR struct file *filep, int cmd,
|
||||
|
||||
if ((arg & SER_SINGLEWIRE_ENABLED) != 0)
|
||||
{
|
||||
uint32_t gpio_val = GPIO_OPENDRAIN;
|
||||
uint32_t gpio_val = (arg & SER_SINGLEWIRE_PUSHPULL) ==
|
||||
SER_SINGLEWIRE_PUSHPULL ?
|
||||
GPIO_PUSHPULL : GPIO_OPENDRAIN;
|
||||
gpio_val |= (arg & SER_SINGLEWIRE_PULL_MASK) == SER_SINGLEWIRE_PULLUP ? GPIO_PULLUP : GPIO_FLOAT;
|
||||
gpio_val |= (arg & SER_SINGLEWIRE_PULL_MASK) == SER_SINGLEWIRE_PULLDOWN ? GPIO_PULLDOWN : GPIO_FLOAT;
|
||||
stm32_configgpio((priv->tx_gpio & ~(GPIO_PUPD_MASK | GPIO_OPENDRAIN)) | gpio_val);
|
||||
|
||||
@@ -1162,7 +1162,9 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
if ((arg & SER_SINGLEWIRE_ENABLED) != 0)
|
||||
{
|
||||
uint32_t gpio_val = GPIO_OPENDRAIN;
|
||||
uint32_t gpio_val = (arg & SER_SINGLEWIRE_PUSHPULL) ==
|
||||
SER_SINGLEWIRE_PUSHPULL ?
|
||||
GPIO_PUSHPULL : GPIO_OPENDRAIN;
|
||||
gpio_val |= (arg & SER_SINGLEWIRE_PULL_MASK) == SER_SINGLEWIRE_PULLUP ? GPIO_PULLUP : GPIO_FLOAT;
|
||||
gpio_val |= (arg & SER_SINGLEWIRE_PULL_MASK) == SER_SINGLEWIRE_PULLDOWN ? GPIO_PULLDOWN : GPIO_FLOAT;
|
||||
stm32_configgpio((priv->tx_gpio & ~(GPIO_PUPD_MASK | GPIO_OPENDRAIN)) | gpio_val);
|
||||
|
||||
Reference in New Issue
Block a user