1 | #ifndef __TYPEDEFS_H
|
---|
2 | #define __TYPEDEFS_H
|
---|
3 | //-----------------------------------------------------------------------------
|
---|
4 |
|
---|
5 | #include <stdio.h>
|
---|
6 | #include <stdlib.h>
|
---|
7 | #include <string.h>
|
---|
8 | #include <ctype.h>
|
---|
9 | #include <limits.h>
|
---|
10 | #include <util/delay.h>
|
---|
11 | #include <avr/io.h>
|
---|
12 | #include <avr/interrupt.h>
|
---|
13 | #include "macros.h"
|
---|
14 | #include <avr/pgmspace.h>
|
---|
15 |
|
---|
16 | //-----------------------------------------------------------------------------
|
---|
17 |
|
---|
18 | #define true 1
|
---|
19 | #define TRUE 1
|
---|
20 | #define ON 1
|
---|
21 | #define on 1
|
---|
22 | #define SET 1
|
---|
23 | #define set 1
|
---|
24 |
|
---|
25 | #define false 0
|
---|
26 | #define FALSE 0
|
---|
27 | #define OFF 0
|
---|
28 | #define off 0
|
---|
29 | #define CLEAR 0
|
---|
30 | #define clear 0
|
---|
31 |
|
---|
32 | #define BIT0 0x01
|
---|
33 | #define BIT1 0x02
|
---|
34 | #define BIT2 0x04
|
---|
35 | #define BIT3 0x08
|
---|
36 | #define BIT4 0x10
|
---|
37 | #define BIT5 0x20
|
---|
38 | #define BIT6 0x40
|
---|
39 | #define BIT7 0x80
|
---|
40 | #define BIT8 0x0100
|
---|
41 | #define BIT9 0x0200
|
---|
42 | #define BIT10 0x0400
|
---|
43 | #define BIT11 0x0800
|
---|
44 | #define BIT12 0x1000
|
---|
45 | #define BIT13 0x2000
|
---|
46 | #define BIT14 0x4000
|
---|
47 | #define BIT15 0x8000
|
---|
48 | #define BIT16 0x010000
|
---|
49 | #define BIT17 0x020000
|
---|
50 | #define BIT18 0x040000
|
---|
51 | #define BIT19 0x080000
|
---|
52 | #define BIT20 0x100000
|
---|
53 | #define BIT21 0x200000
|
---|
54 | #define BIT22 0x400000
|
---|
55 | #define BIT23 0x800000
|
---|
56 | #define BIT24 0x01000000
|
---|
57 | #define BIT25 0x02000000
|
---|
58 | #define BIT26 0x04000000
|
---|
59 | #define BIT27 0x08000000
|
---|
60 | #define BIT28 0x10000000
|
---|
61 | #define BIT29 0x20000000
|
---|
62 | #define BIT30 0x40000000
|
---|
63 | #define BIT31 0x80000000
|
---|
64 | //-----------------------------------------------------------------------------
|
---|
65 |
|
---|
66 | // Typendeklarationen
|
---|
67 | typedef signed char S8;
|
---|
68 | typedef signed char S08;
|
---|
69 | typedef signed char tS08;
|
---|
70 | typedef unsigned char U8;
|
---|
71 | typedef unsigned char U08;
|
---|
72 | typedef unsigned char tU08;
|
---|
73 |
|
---|
74 | typedef signed int S16;
|
---|
75 | typedef signed int tS16;
|
---|
76 | typedef unsigned int U16;
|
---|
77 | typedef unsigned int tU16;
|
---|
78 | typedef signed long S32;
|
---|
79 | typedef signed long tS32;
|
---|
80 | typedef unsigned long U32;
|
---|
81 | typedef unsigned long tU32;
|
---|
82 |
|
---|
83 | typedef S08 *pS8;
|
---|
84 | typedef S08 *pS08;
|
---|
85 | typedef U08 *pU8;
|
---|
86 | typedef U08 *pU08;
|
---|
87 | typedef S16 *pS16;
|
---|
88 | typedef U16 *pU16;
|
---|
89 | typedef S32 *pS32;
|
---|
90 | typedef U32 *pU32;
|
---|
91 | typedef float *pfloat;
|
---|
92 |
|
---|
93 | typedef U08 BOOL;
|
---|
94 | typedef BOOL *pBOOL;
|
---|
95 |
|
---|
96 | //typedef U08 __flash *fpU08; //geht nicht mit gcc
|
---|
97 | //typedef U08 PROGMEM prog_U08;
|
---|
98 | //typedef prog_U08 *fpU08;
|
---|
99 | typedef U08 *fpU08;
|
---|
100 |
|
---|
101 | typedef union uMEM16 // Word and Byte access to 16-Bit data
|
---|
102 | {
|
---|
103 | U16 word; // Word
|
---|
104 | pU16 pword; // Pointer to Word
|
---|
105 | U08 byte[2]; // Byte
|
---|
106 | pU08 pbyte; // Pointer to Byte
|
---|
107 | } tMEM16;
|
---|
108 |
|
---|
109 | typedef union uMEM32 // DWord, Word and Byte access to 32-Bit data
|
---|
110 | {
|
---|
111 | U32 dword; // DWORD
|
---|
112 | pU32 pdword[2]; // Pointer to U32
|
---|
113 |
|
---|
114 | float fp; // Float
|
---|
115 | pfloat pfp[2]; // Pointer to float
|
---|
116 |
|
---|
117 | U16 word[2]; // Word
|
---|
118 | pU16 pword[2]; // Pointer to U16
|
---|
119 |
|
---|
120 | U08 byte[4]; // Byte
|
---|
121 | pU08 pbyte[2]; // Pointer to U08
|
---|
122 |
|
---|
123 | } tMEM32;
|
---|
124 |
|
---|
125 | typedef enum // Enumeration of watchdog prescale values
|
---|
126 | {
|
---|
127 | WDT_PS_2K, // 2048 cycles (16ms)
|
---|
128 | WDT_PS_4K, // 40968 cycles (32ms)
|
---|
129 | WDT_PS_8K, // 8192 cycles (64ms)
|
---|
130 | WDT_PS_16K, // 16384 cycles (0.125s)
|
---|
131 | WDT_PS_32K, // 32768 cycles (0.25s)
|
---|
132 | WDT_PS_64K, // 65536 cycles (0.5s)
|
---|
133 | WDT_PS_128K, // 131072 cycles (1.0s)
|
---|
134 | WDT_PS_256K, // 262144 cycles (2.0s)
|
---|
135 | WDT_PS_512K, // 524288 cycles (4.0s)
|
---|
136 | WDT_PS_1024K // 1048576 cycles (8.0s)
|
---|
137 | } tWDT_PRESCALE;
|
---|
138 | //-----------------------------------------------------------------------------
|
---|
139 |
|
---|
140 | #endif
|
---|