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];
25
};
26
extern struct str_WinkelOut  WinkelOut;
27
 
28
struct str_AnFlightCtrl
29
{
30
 int Heading;
31
};
32
extern struct str_AnFlightCtrl  AnFlightCtrl;
33
 
34
struct str_ExternControl
35
{
36
 unsigned char Digital[2];
37
 unsigned char RemoteTasten;
38
 signed char   Nick;
39
 signed char   Roll;
40
 signed char   Gier;
41
 unsigned char Gas;
42
 signed char   Hight;
43
 unsigned char Par1;
44
 unsigned char Par2;
45
 unsigned char Par3;
46
};
47
extern struct str_ExternControl  ExternControl;
48
 
49
struct str_VersionInfo
50
{
51
  unsigned char Hauptversion;
52
  unsigned char Nebenversion;
53
  unsigned char PCKompatibel;
54
  unsigned char Rserved[7];
55
};  
56
extern struct str_VersionInfo VersionInfo;
57
 
58
 
59
extern struct str_DebugOut    DebugOut;
60
extern struct str_DebugOut    DebugOut;
61
//Die Baud_Rate der Seriellen Schnittstelle 
62
//#define BAUD_RATE 9600                //Baud Rate für die Serielle Schnittstelle      
63
//#define BAUD_RATE 14400               //Baud Rate für die Serielle Schnittstelle      
64
//#define BAUD_RATE 28800               //Baud Rate für die Serielle Schnittstelle      
65
 
66
#if X3D_SIO == 1
67
 #define BAUD_RATE 38400                //Baud Rate für die Serielle Schnittstelle      
68
#else
69
 #define BAUD_RATE 57600                //Baud Rate für die Serielle Schnittstelle      
70
#endif
71
 
72
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird
73
#if defined (__AVR_ATmega128__)
74
#       define USR UCSR0A
75
#       define UCR UCSR0B
76
#       define UDR UDR0
77
#       define UBRR UBRR0L
78
#       define EICR EICRB
79
#endif
80
 
81
#if defined (__AVR_ATmega8__)
82
#       define USR UCSRA
83
#       define UCR UCSRB
84
#       define UBRR UBRRL
85
#       define EICR EICRB
86
#   define INT_VEC_RX  SIG_UART_RECV
87
#   define INT_VEC_TX  SIG_UART_TRANS
88
#endif
89
 
90
#if defined (__AVR_ATmega168__)
91
#       define USR  UCSR0A
92
#       define UCR  UCSR0B
93
#       define UDR  UDR0
94
#       define UBRR UBRR0L
95
#       define EICR EICR0B
96
#   define TXEN TXEN0
97
#   define RXEN RXEN0
98
#   define RXCIE RXCIE0
99
#   define TXCIE TXCIE0
100
#   define U2X  U2X0
101
#   define UCSRB UCSR0B
102
#   define UDRE UDRE0
103
#   define INT_VEC_RX  SIG_USART_RECV
104
#   define INT_VEC_TX  SIG_USART_TRANS
105
#endif
106
 
107
 
108
#if defined (__AVR_ATmega32__)
109
#       define USR UCSRA
110
#       define UCR UCSRB
111
#       define UBRR UBRRL
112
#       define EICR EICRB
113
#   define INT_VEC_RX  SIG_UART_RECV
114
#   define INT_VEC_TX  SIG_UART_TRANS
115
#endif
116
 
117
#if defined (__AVR_ATmega644__)
118
#       define USR  UCSR0A
119
#       define UCR  UCSR0B
120
#       define UDR  UDR0
121
#       define UBRR UBRR0L
122
#       define EICR EICR0B
123
#   define TXEN TXEN0
124
#   define RXEN RXEN0
125
#   define RXCIE RXCIE0
126
#   define TXCIE TXCIE0
127
#   define U2X  U2X0
128
#   define UCSRB UCSR0B
129
#   define UDRE UDRE0
130
#   define INT_VEC_RX  SIG_USART_RECV
131
#   define INT_VEC_TX  SIG_USART_TRANS
132
#endif
133
 
134
 
135
#endif //_UART_H