2016-07-29 09:11 AM
I have been using the GPIO_WriteBit() function to set/reset pins, but found it not working. The same function by register worked fine.
Example:GPIO_WriteBit(GPIOB, GPIO_Pin_4, RESET); // this does not work!?
GPIOB->ODR &= 0xef; // this is ok.
I check the source code of GPIO_WriteBit() and suspect there is a bug. Specifically, when RESETing, the function callsClrBit(GPIOx->ODR, GPIO_Pin);
whereas macro ClrBit is defined as&sharpdefine ClrBit(VAR,Place) ( (VAR) &= (uint8_t)((uint8_t)((uint8_t)1<<(uint8_t)(Place))^(uint8_t)0xFF) )
It seems that it intends to do ChlrBit(GPIOB, 4) but instead does ClrBit(GPIOB, GPIO_Pin_4), which is not working.Can somebody confirm this? #std_lib #stm8l2017-10-25 02:52 PM
Confirmed.... better late than never. Documentation error for the 2nd parameter.
-p.