Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added digitalWrite(pin, TOGGLE)

  • Loading branch information...
commit 043555a302903be4aeae270a2040f4aaf490c88b 1 parent 36b5d52
@Lauszus authored
View
3  build/shared/lib/keywords.txt
@@ -1,7 +1,8 @@
# LITERAL1 specifies constants
-HIGH LITERAL1 Constants
LOW LITERAL1 Constants
+HIGH LITERAL1 Constants
+TOGGLE LITERAL1 Constants
INPUT LITERAL1 Constants
INPUT_PULLUP LITERAL1 Constants
OUTPUT LITERAL1 Constants
View
5 hardware/arduino/cores/arduino/Arduino.h
@@ -15,9 +15,10 @@
extern "C"{
#endif
-#define HIGH 0x1
#define LOW 0x0
-
+#define HIGH 0x1
+#define TOGGLE 0x2
+
#define INPUT 0x0
#define OUTPUT 0x1
#define INPUT_PULLUP 0x2
View
7 hardware/arduino/cores/arduino/wiring_digital.c
@@ -152,11 +152,12 @@ void digitalWrite(uint8_t pin, uint8_t val)
uint8_t oldSREG = SREG;
cli();
- if (val == LOW) {
+ if (val == LOW)
*out &= ~bit;
- } else {
+ else if (val == TOGGLE)
+ *out ^= bit;
+ else
*out |= bit;
- }
SREG = oldSREG;
}
Please sign in to comment.
Something went wrong with that request. Please try again.