cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO_ToggleBits(GPIOD,GPIO_Pin_9);

pic_micro
Associate II
Posted on November 09, 2014 at 12:46

Dear All,

I am using CMSIS '' STM32F0-Discovery_FW_V1.0.0 '' library files for STM32F0 MCU programming which does not support GPIO_ToggleBits(GPIOD,GPIO_Pin_9); instruction

I already checked the ''gpio'' file which do not have Toggle function

please advice

2 REPLIES 2
Posted on November 09, 2014 at 16:19

Ok, neither the F0 or F1 libraries have this. Pretty simple though, and more efficient ways of setting/clearing.

/**
* @brief Toggles the specified GPIO pins..
* @param GPIOx: where x can be (A..I) to select the GPIO peripheral.
* @param GPIO_Pin: Specifies the pins to be toggled.
* @retval None
*/
void GPIO_ToggleBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
{
/* Check the parameters */
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
GPIOx->ODR ^= GPIO_Pin;
}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
pic_micro
Associate II
Posted on November 09, 2014 at 16:43

Dear clive

Grate  thanks for the reply

I used following old method

GPIOC->ODR ^= GPIO_Pin_8;

Can I know the instruction base on CMSIS type