Bug in GPIO_WriteBit() function in STM8L Library???
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-07-29 9:11 AM
Posted on July 29, 2016 at 18:11
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 #stm8l
Labels:
- Labels:
-
SPL
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-10-25 2:52 PM
Posted on October 25, 2017 at 23:52
Confirmed.... better late than never. Documentation error for the 2nd parameter.
-p.
