aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/wiring.h
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2008-10-25 12:52:07 +0000
committerDavid A. Mellis <d.mellis@arduino.cc>2008-10-25 12:52:07 +0000
commitda84adb1e9d09b069137dd90f2e99c43a4db42ad (patch)
tree1adee6ae83c6159a9a952183d5feed51a2fbf779 /cores/arduino/wiring.h
parent5444b25e11bce6139a58c8a641dccd266f90a0f1 (diff)
Adding word datatype and cast/construction macros, bitRead(), bitWrite(), bitSet(), bitClear(), bit().
Diffstat (limited to 'cores/arduino/wiring.h')
-rwxr-xr-xcores/arduino/wiring.h28
1 files changed, 12 insertions, 16 deletions
diff --git a/cores/arduino/wiring.h b/cores/arduino/wiring.h
index 3701f6d..46d5334 100755
--- a/cores/arduino/wiring.h
+++ b/cores/arduino/wiring.h
@@ -66,13 +66,6 @@ extern "C"{
#undef abs
#endif
-//#define int(x) ((int)(x))
-//#define char(x) ((char)(x))
-//#define long(x) ((long)(x))
-//#define byte(x) ((uint8_t)(x))
-//#define float(x) ((float)(x))
-//#define boolean(x) ((uint8_t)((x)==0?0:1))
-
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(x) ((x)>0?(x):-(x))
@@ -89,6 +82,18 @@ extern "C"{
#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
+#define lowByte(w) ((w) & 0xff)
+#define highByte(w) ((w) >> 8)
+
+#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
+#define bitSet(value, bit) ((value) |= (1UL << (bit)))
+#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
+#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
+
+typedef unsigned int word;
+
+#define bit(b) (1 << (b))
+
typedef uint8_t boolean;
typedef uint8_t byte;
@@ -106,15 +111,6 @@ void serialWrite(unsigned char);
int serialAvailable(void);
int serialRead(void);
void serialFlush(void);
-void printMode(int);
-void printByte(unsigned char c);
-void printNewline(void);
-void printString(const char *s);
-void printInteger(long n);
-void printHex(unsigned long n);
-void printOctal(unsigned long n);
-void printBinary(unsigned long n);
-void printIntegerInBase(unsigned long n, unsigned long base);
unsigned long millis(void);
void delay(unsigned long);