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