digitalwritefast, digitalwrite, and direct port manipluation July 12, 2011 02:11AM |
Registered: 13 years ago Posts: 1,797 |
Re: digitalwritefast, digitalwrite, and direct port manipluation September 07, 2012 05:27AM |
Quote
jamesdanielv
if (statechange) {digitalWriteFast(pinumber,lowOrHigh);} // added brackets
#define some_macro(parameters) do { statement; statement; ... } while (0)Notice that the do/while statement is incomplete because there is NO semicolon at the end. Then, when you use the macro like this:
some_macro(parameters);it becomes a single complete statement, instead of the semicolon becoming an extra empty statement. With this trick, you can write
if (condition) some_macro(actual_parameter); else something_else();and it works as intended.
Re: digitalwritefast, digitalwrite, and direct port manipluation September 08, 2012 12:40AM |
Registered: 13 years ago Posts: 1,797 |
Re: digitalwritefast, digitalwrite, and direct port manipluation September 08, 2012 04:46AM |