Subversion Repositories FlightCtrl

Rev

Rev 838 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
838 MikeW 1
#ifndef _UART_H
2
 #define _UART_H
3
 
4
#define MAX_SENDE_BUFF     150
5
#define MAX_EMPFANGS_BUFF  150
6
 
7
 
8
void BearbeiteRxDaten(void);
9
 
10
extern unsigned char DebugGetAnforderung;
11
extern unsigned volatile char SendeBuffer[MAX_SENDE_BUFF];
12
extern unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF];
13
extern unsigned volatile char UebertragungAbgeschlossen;
14
extern unsigned volatile char PC_DebugTimeout;
15
extern unsigned volatile char NeueKoordinateEmpfangen;
16
extern unsigned char MeineSlaveAdresse;
17
extern unsigned char PcZugriff;
18
extern int Debug_Timer;
19
extern void UART_Init (void);
20
extern int uart_putchar (char c);
21
extern void boot_program_page (uint32_t page, uint8_t *buf);
22
extern void DatenUebertragung(void);
23
extern void DecodeNMEA(void);
24
extern void BearbeiteRxDaten(void);
25
extern unsigned char MotorTest[4];
26
struct str_DebugOut
27
{
28
 unsigned char Digital[2];
29
 unsigned int Analog[16];    // Debugwerte
30
};
31
 
32
extern struct str_DebugOut    DebugOut;
33
 
34
struct str_Debug
35
{
36
 unsigned char Digital[2];
37
 unsigned char RemoteTasten;
38
 unsigned int Analog[4];
39
};
40
extern struct str_Debug       DebugIn;
41
 
42
struct str_VersionInfo
43
{
44
  unsigned char Hauptversion;
45
  unsigned char Nebenversion;
46
  unsigned char PCKompatibel;
47
  unsigned char Rserved[7];
966 MikeW 48
};
838 MikeW 49
extern struct str_VersionInfo VersionInfo;
50
 
51
//Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud
966 MikeW 52
//#define BAUD_RATE 9600  //Baud Rate für die Serielle Schnittstelle    
53
//#define BAUD_RATE 14400 //Baud Rate für die Serielle Schnittstelle    
54
//#define BAUD_RATE 28800 //Baud Rate für die Serielle Schnittstelle    
55
//#define BAUD_RATE 38400 //Baud Rate für die Serielle Schnittstelle    
56
#define BAUD_RATE 57600   //Baud Rate für die Serielle Schnittstelle    
838 MikeW 57
 
58
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird
59
#if defined (__AVR_ATmega128__)
60
#       define USR UCSR0A
61
#       define UCR UCSR0B
62
#       define UDR UDR0
63
#       define UBRR UBRR0L
64
#       define EICR EICRB
65
#endif
66
 
67
#if defined (__AVR_ATmega32__)
68
#       define USR UCSRA
69
#       define UCR UCSRB
70
#       define UBRR UBRRL
71
#       define EICR EICRB
72
#   define INT_VEC_RX  SIG_UART_RECV
73
#   define INT_VEC_TX  SIG_UART_TRANS
74
#endif
75
 
76
//#if defined (__AVR_ATmega644__)
77
#define SYSCLK 20000000
78
#if 1
966 MikeW 79
#define USR  UCSR0A
80
#define UCR  UCSR0B
81
#define UDR  UDR0
82
#define UBRR UBRR0L
83
#define EICR EICR0B
84
#define TXEN TXEN0
85
#define RXEN RXEN0
86
#define RXCIE RXCIE0
87
#define TXCIE TXCIE0
88
#define U2X  U2X0
89
#define UCSRB UCSR0B
90
#define UDRE UDRE0
91
#define INT_VEC_RX  SIG_USART_RECV
92
#define INT_VEC_TX  SIG_USART_TRANS
838 MikeW 93
#endif
94
 
95
 
96
#endif //_UART_H