Subversion Repositories FlightCtrl

Rev

Rev 37 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21 user 1
#ifndef _UART_H
2
 #define _UART_H
3
 
4
#define MAX_SENDE_BUFF     150
5
#define MAX_EMPFANGS_BUFF  150
6
 
7
extern unsigned char DebugGetAnforderung;
8
extern unsigned volatile char SendeBuffer[MAX_SENDE_BUFF];
9
extern unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF];
10
extern unsigned volatile char UebertragungAbgeschlossen;
11
extern unsigned volatile char PC_DebugTimeout;
12
extern unsigned volatile char NeueKoordinateEmpfangen;
13
extern unsigned char MeineSlaveAdresse;
14
extern unsigned char PcZugriff;
15
extern int Debug_Timer;
16
extern void UART_Init (void);
17
extern int uart_putchar (char c);
18
extern void boot_program_page (uint32_t page, uint8_t *buf);
19
extern void DatenUebertragung(void);
20
extern void DecodeNMEA(void);
21
extern unsigned char MotorTest[4];
22
struct str_DebugOut
23
{
24
 unsigned char Digital[13];
25
 unsigned int AnzahlZyklen;
26
 unsigned int  Zeit;
27
 unsigned char Sekunden;
28
 unsigned int Analog[16];    // Debugwerte
29
};
30
 
31
extern struct str_DebugOut    DebugOut;
32
 
33
#define _B1(bit)                (1 << (bit))  
34
#define _B0(bit)                (0 << (bit))
35
 
36
typedef struct {
37 hallo2 37
        long            x;                      // in cm (+ = north)
38
        long            y;                      // in cm (+ = east)
39
        long            z;                      // in cm
40
        long            vx;
41
        long            vy;
42
        long            vz;
43
        //long          groundSpeed;
44
        //long          heading;
21 user 45
 
46
        uint8_t         state;                          // status of data: 0 = invlid; 1 = valid
47
        uint8_t         noSV;                           // number of sats
48
} gpsInfo_t;
49
 
50
 
51
extern gpsInfo_t                lockedPos;                      // stored position to fly to
52
extern gpsInfo_t                actualPos;                      // measured position (last gps record)
53
 
54
extern void GPSscanData (void);
55
extern void GPSupdate(void);
56
extern void GPSsaveTarget (uint8_t mode);
57
 
58
struct str_Debug
59
{
60
 unsigned char Digital[2];
61
 unsigned char RemoteTasten;
62
 unsigned int Analog[4];
63
};
64
extern struct str_Debug       DebugIn;
65
 
66
struct str_VersionInfo
67
{
68
  unsigned char Hauptversion;
69
  unsigned char Nebenversion;
70
  unsigned char PCKompatibel;
71
  unsigned char Rserved[7];
72
};  
73
extern struct str_VersionInfo VersionInfo;
74
 
75
//Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud
76
//#define BAUD_RATE 9600                //Baud Rate für die Serielle Schnittstelle      
77
//#define BAUD_RATE 14400               //Baud Rate für die Serielle Schnittstelle      
78
//#define BAUD_RATE 28800               //Baud Rate für die Serielle Schnittstelle      
79
//#define BAUD_RATE 38400               //Baud Rate für die Serielle Schnittstelle      
80
#define BAUD_RATE 57600         //Baud Rate für die Serielle Schnittstelle      
81
 
82
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird
83
#if defined (__AVR_ATmega128__)
84
#       define USR UCSR0A
85
#       define UCR UCSR0B
86
#       define UDR UDR0
87
#       define UBRR UBRR0L
88
#       define EICR EICRB
89
#endif
90
 
91
#if defined (__AVR_ATmega32__)
92
#       define USR UCSRA
93
#       define UCR UCSRB
94
#       define UBRR UBRRL
95
#       define EICR EICRB
96
#   define INT_VEC_RX  SIG_UART_RECV
97
#   define INT_VEC_TX  SIG_UART_TRANS
98
#endif
99
 
100
#if defined (__AVR_ATmega644__)
101
#       define USR  UCSR0A
102
#       define UCR  UCSR0B
103
#       define UDR  UDR0
104
#       define UBRR UBRR0L
105
#       define EICR EICR0B
106
#   define TXEN TXEN0
107
#   define RXEN RXEN0
108
#   define RXCIE RXCIE0
109
#   define TXCIE TXCIE0
110
#   define U2X  U2X0
111
#   define UCSRB UCSR0B
112
#   define UDRE UDRE0
113
#   define INT_VEC_RX  SIG_USART_RECV
114
#   define INT_VEC_TX  SIG_USART_TRANS
115
#endif
116
 
117
 
118
#endif //_UART_H