615 |
kaklik |
1 |
#ifndef __common_h__ |
|
|
2 |
#define __common_h__ |
|
|
3 |
|
|
|
4 |
#define CLRBIT(aReg,aBit) (aReg) &= ~(aBit) |
|
|
5 |
#define SETBIT(aReg,aBit) (aReg) |= (aBit) |
|
|
6 |
#define TOGGLEBIT(aReg,aBit) (aReg) ^= (aBit) |
|
|
7 |
//#define TESTBIT(aValue,aConst) ((aValue & aConst) != 0) |
|
|
8 |
#define TESTBIT(aValue,aConst) ({ \ |
|
|
9 |
uint8_t Temp = (uint8_t)(aValue); \ |
|
|
10 |
__asm__ ( \ |
|
|
11 |
"andi %0, %2" "\n\t" \ |
|
|
12 |
"breq L_%=" "\n\t" \ |
|
|
13 |
"ldi %0,1" "\n\t" \ |
|
|
14 |
"L_%=: " "\n\t" \ |
|
|
15 |
: "=r" (Temp) : "0" (Temp), "M" (aConst)\ |
|
|
16 |
); \ |
|
|
17 |
Temp; \ |
|
|
18 |
}) |
|
|
19 |
|
|
|
20 |
|
|
|
21 |
#if defined BOARD_rs232if |
|
|
22 |
#define BOARD |
|
|
23 |
#elif defined BOARD_umServo32 |
|
|
24 |
#define BOARD |
|
|
25 |
#elif defined BOARD_umHBridge |
|
|
26 |
#define BOARD |
|
|
27 |
#elif defined BOARD_NA |
|
|
28 |
#define BOARD |
|
|
29 |
#else |
|
|
30 |
#error BOARD_xxx must be defined |
|
|
31 |
#endif |
|
|
32 |
|
|
|
33 |
#endif // __common_h__ |