In debugging, I found that the "bit_is_set" "bit_is_clear macros do an "andi" instruction and return the result. This yields a 0 or a non-zero. But the documentaiton says the macros return a 1 or a 0. The and causes a return of some power of 2 rather than always 1.
Error in "bit_is_set" "bit_is_clear" mac
Author
Message
Hi Steve,
I'm afraid this is by design. Check out the documentation at http://www.avrfreaks.com/AVRGCC/...
IOMACROS.H
bit_is_set( port, bit ); Returns something != 0, if bit 'bit' in 'port' is set, otherwise 0. Macro.
bit_is_clear( port, bit ); Returns something != 0, if bit 'bit' in 'port' is clear, otherwise 0. Macro.
Note the !=0 bit. HTH!
E
Ernest - you are so right!
MY ERROR was not noticing that the document:
https://www.avrfreaks.net/AVRGCC/...
is in error in describing these macros. It says "result = 1". It should say "result is non-zero"
steve