Created
August 10, 2012 03:01
-
-
Save holachek/3310645 to your computer and use it in GitHub Desktop.
Convenient Arduino-like pin macros
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// super awesome Arduino-like pin macros save you from having to remember bitmasks | |
// code from Matthew T. Pandina's Demystifying the TLC5940 tutorial: | |
// URL: https://sites.google.com/site/artcfox/demystifying-the-tlc5940 | |
#define setOutput(ddr, pin) ((ddr) |= (1<< (pin))) | |
#define setLow(port, pin) ((port) &= ~(1 << (pin))) | |
#define setHigh(port, pin) ((port) |= (1 << (pin))) | |
#define outputState(port, pin) ((port) & (1 << (pin))) | |
#define pulse(port, pin) do { \ | |
setHigh((port), (pin)); \ | |
setLow((port), (pin)); \ | |
} while (0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment