Last active
November 1, 2017 15:41
-
-
Save benjcal/91eaf40c617d3288281aaf8022d551e9 to your computer and use it in GitHub Desktop.
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
// Credits: https://github.com/hexagon5un/AVR-Programming/blob/master/AVR-Programming-Library/macros.h | |
#define BV(bit) (1 << bit) | |
#define set_bit(sfr, bit) (_SFR_BYTE(sfr) |= BV(bit)) // old sbi() | |
#define clear_bit(sfr, bit) (_SFR_BYTE(sfr) &= ~BV(bit)) // old cbi() | |
#define toggle_bit(sfr, bit) (_SFR_BYTE(sfr) ^= BV(bit)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment