mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +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:
parent
9c1a02d673
commit
f38b1bf160
@ -2502,7 +2502,9 @@ PX4FMU::gpio_set_function(uint32_t gpios, int function)
|
||||
gpios |= 3;
|
||||
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
@ -2521,6 +2523,14 @@ PX4FMU::gpio_set_function(uint32_t gpios, int function)
|
||||
stm32_configgpio(_gpio_tab[i].output);
|
||||
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:
|
||||
if (_gpio_tab[i].alt != 0) {
|
||||
stm32_configgpio(_gpio_tab[i].alt);
|
||||
@ -2716,6 +2726,8 @@ PX4FMU::gpio_ioctl(struct file *filp, int cmd, unsigned long arg)
|
||||
break;
|
||||
|
||||
case GPIO_SET_OUTPUT:
|
||||
case GPIO_SET_OUTPUT_LOW:
|
||||
case GPIO_SET_OUTPUT_HIGH:
|
||||
case GPIO_SET_INPUT:
|
||||
case GPIO_SET_ALT_1:
|
||||
gpio_set_function(arg, cmd);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user