mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 03:13:33 +08:00
px4fmu: allow for GPIO_SET_OUTPUT with initial value
this is needed to prevent inadvertent camera trigger when setting up a port
This commit is contained in:
committed by
Lorenz Meier
parent
9c1a02d673
commit
f38b1bf160
@@ -2502,7 +2502,9 @@ PX4FMU::gpio_set_function(uint32_t gpios, int function)
|
|||||||
gpios |= 3;
|
gpios |= 3;
|
||||||
|
|
||||||
/* flip the buffer to output mode if required */
|
/* flip the buffer to output mode if required */
|
||||||
if (GPIO_SET_OUTPUT == function) {
|
if (GPIO_SET_OUTPUT == function ||
|
||||||
|
GPIO_SET_OUTPUT_LOW == function ||
|
||||||
|
GPIO_SET_OUTPUT_HIGH == function) {
|
||||||
stm32_gpiowrite(GPIO_GPIO_DIR, 1);
|
stm32_gpiowrite(GPIO_GPIO_DIR, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2521,6 +2523,14 @@ PX4FMU::gpio_set_function(uint32_t gpios, int function)
|
|||||||
stm32_configgpio(_gpio_tab[i].output);
|
stm32_configgpio(_gpio_tab[i].output);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GPIO_SET_OUTPUT_LOW:
|
||||||
|
stm32_configgpio((_gpio_tab[i].output & ~(GPIO_OUTPUT_SET)) | GPIO_OUTPUT_CLEAR);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GPIO_SET_OUTPUT_HIGH:
|
||||||
|
stm32_configgpio((_gpio_tab[i].output & ~(GPIO_OUTPUT_CLEAR)) | GPIO_OUTPUT_SET);
|
||||||
|
break;
|
||||||
|
|
||||||
case GPIO_SET_ALT_1:
|
case GPIO_SET_ALT_1:
|
||||||
if (_gpio_tab[i].alt != 0) {
|
if (_gpio_tab[i].alt != 0) {
|
||||||
stm32_configgpio(_gpio_tab[i].alt);
|
stm32_configgpio(_gpio_tab[i].alt);
|
||||||
@@ -2716,6 +2726,8 @@ PX4FMU::gpio_ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GPIO_SET_OUTPUT:
|
case GPIO_SET_OUTPUT:
|
||||||
|
case GPIO_SET_OUTPUT_LOW:
|
||||||
|
case GPIO_SET_OUTPUT_HIGH:
|
||||||
case GPIO_SET_INPUT:
|
case GPIO_SET_INPUT:
|
||||||
case GPIO_SET_ALT_1:
|
case GPIO_SET_ALT_1:
|
||||||
gpio_set_function(arg, cmd);
|
gpio_set_function(arg, cmd);
|
||||||
|
|||||||
Reference in New Issue
Block a user