receiver/main.h

Wed, 16 Nov 2011 17:04:10 +0100

author
Malte Bayer <mbayer@neo-soft.org>
date
Wed, 16 Nov 2011 17:04:10 +0100
changeset 9
20dbe0546a36
child 11
69c2a1408619
permissions
-rw-r--r--

added receiver testing stuff

9
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
1 #ifndef MAIN_H
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
2 #define MAIN_H
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
3
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
4 #include <avr/wdt.h>
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
5
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
6 #define uchar unsigned char
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
7 #define uint unsigned int
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
8
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
9 // Macro used to write to a single I/O pin
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
10 #define writeBit(port,bit,value) { if ((value)>0) (port) |= (1<<bit); else (port) &= ~(1<<bit); }
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
11
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
12 // Macro used to read from a single I/O pin
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
13 #define readBit(port,bit) (((port) >> (bit)) & 1)
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
14
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
15 // we have internal AREF...
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
16 // #define EXT_AREF 1
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
17
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
18 // RESET ROUTINE FOR DOING A SOFT-RESET:
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
19 #define soft_reset() \
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
20 do \
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
21 { \
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
22 wdt_enable(WDTO_15MS); \
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
23 for(;;) \
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
24 { \
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
25 } \
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
26 } while(0)
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
27
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
28
20dbe0546a36 added receiver testing stuff
Malte Bayer <mbayer@neo-soft.org>
parents:
diff changeset
29 #endif

mercurial