Subversion Repositories MK3Mag

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 ingob 1
#ifndef _UART_H
2
 #define _UART_H
3
 
4
extern unsigned volatile char SIO_Sollwert;
5
extern unsigned volatile char UebertragungAbgeschlossen;
6
extern unsigned volatile char PC_DebugTimeout;
7
extern unsigned char MeineSlaveAdresse;
8
extern int Debug_Timer;
9
extern void UART_Init (void);
10
extern int uart_putchar (char c);
11
extern void boot_program_page (uint32_t page, uint8_t *buf);
12
extern void SendUart(void);
13
 
14
void DatenUebertragung(void);
15
 
16
struct str_DebugOut
17
{
18
 unsigned char Digital[2];
19
 unsigned int Analog[16];    // Debugwerte
20
};
21
 
22
struct str_WinkelOut
23
{
24
 signed int Winkel[2];
5 hbuss 25
 unsigned char UserParameter[4];
1 ingob 26
};
27
extern struct str_WinkelOut  WinkelOut;
3 ingob 28
#define NICK 0
29
#define ROLL 1
1 ingob 30
 
31
 
32
struct str_ExternControl
33
{
34
 unsigned char Digital[2];
35
 unsigned char RemoteTasten;
36
 signed char   Nick;
37
 signed char   Roll;
38
 signed char   Gier;
39
 unsigned char Gas;
40
 signed char   Hight;
41
 unsigned char Par1;
42
 unsigned char Par2;
43
 unsigned char Par3;
44
};
45
extern struct str_ExternControl  ExternControl;
46
 
47
struct str_VersionInfo
48
{
49
  unsigned char Hauptversion;
50
  unsigned char Nebenversion;
51
  unsigned char PCKompatibel;
52
  unsigned char Rserved[7];
53
};  
54
extern struct str_VersionInfo VersionInfo;
55
 
56
 
57
extern struct str_DebugOut    DebugOut;
58
extern struct str_DebugOut    DebugOut;
59
//Die Baud_Rate der Seriellen Schnittstelle 
60
//#define BAUD_RATE 9600                //Baud Rate für die Serielle Schnittstelle      
61
//#define BAUD_RATE 14400               //Baud Rate für die Serielle Schnittstelle      
62
//#define BAUD_RATE 28800               //Baud Rate für die Serielle Schnittstelle      
63
 
64
#if X3D_SIO == 1
65
 #define BAUD_RATE 38400                //Baud Rate für die Serielle Schnittstelle      
66
#else
67
 #define BAUD_RATE 57600                //Baud Rate für die Serielle Schnittstelle      
68
#endif
69
 
70
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird
71
#if defined (__AVR_ATmega128__)
72
#       define USR UCSR0A
73
#       define UCR UCSR0B
74
#       define UDR UDR0
75
#       define UBRR UBRR0L
76
#       define EICR EICRB
77
#endif
78
 
79
#if defined (__AVR_ATmega8__)
80
#       define USR UCSRA
81
#       define UCR UCSRB
82
#       define UBRR UBRRL
83
#       define EICR EICRB
84
#   define INT_VEC_RX  SIG_UART_RECV
85
#   define INT_VEC_TX  SIG_UART_TRANS
86
#endif
87
 
88
#if defined (__AVR_ATmega168__)
89
#       define USR  UCSR0A
90
#       define UCR  UCSR0B
91
#       define UDR  UDR0
92
#       define UBRR UBRR0L
93
#       define EICR EICR0B
94
#   define TXEN TXEN0
95
#   define RXEN RXEN0
96
#   define RXCIE RXCIE0
97
#   define TXCIE TXCIE0
98
#   define U2X  U2X0
99
#   define UCSRB UCSR0B
100
#   define UDRE UDRE0
101
#   define INT_VEC_RX  SIG_USART_RECV
102
#   define INT_VEC_TX  SIG_USART_TRANS
103
#endif
104
 
105
 
106
#if defined (__AVR_ATmega32__)
107
#       define USR UCSRA
108
#       define UCR UCSRB
109
#       define UBRR UBRRL
110
#       define EICR EICRB
111
#   define INT_VEC_RX  SIG_UART_RECV
112
#   define INT_VEC_TX  SIG_UART_TRANS
113
#endif
114
 
115
#if defined (__AVR_ATmega644__)
116
#       define USR  UCSR0A
117
#       define UCR  UCSR0B
118
#       define UDR  UDR0
119
#       define UBRR UBRR0L
120
#       define EICR EICR0B
121
#   define TXEN TXEN0
122
#   define RXEN RXEN0
123
#   define RXCIE RXCIE0
124
#   define TXCIE TXCIE0
125
#   define U2X  U2X0
126
#   define UCSRB UCSR0B
127
#   define UDRE UDRE0
128
#   define INT_VEC_RX  SIG_USART_RECV
129
#   define INT_VEC_TX  SIG_USART_TRANS
130
#endif
131
 
132
 
133
#endif //_UART_H