0
\$\begingroup\$

I'm using STM32Cube to generate the configuration. It creates the following code by default for MX_GPIO_Init in main.c:

...
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
...

However, I also want it to be triggered on falling, so I have to manually change it to:

GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;

Since I need regularly to change the setup (because I am both a starter, and want to gradually add pins), is there a way in STM32CubeMX to set this, so it is generated?

\$\endgroup\$
  • \$\begingroup\$ You need to disable interrupts before changing the trigger edge. maybe run it as an ISR? \$\endgroup\$ – Sparky256 Feb 5 '18 at 0:09
  • \$\begingroup\$ @Sparky256 it's not about the code execution/order, it's about the generation of code from STM32CubeMX. I would expect a field/widget somewhere inside STM32CubeMX to set the trigger edge type (falling/rising/falling+rising). \$\endgroup\$ – Michel Keijzers Feb 5 '18 at 9:40
1
\$\begingroup\$

In STM32CubeMX under: Configuration -> GPIO -> GPIO -> GPIO Mode

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.