Subversion Repositories FlightCtrl

Rev

Rev 885 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 885 Rev 886
Line 1... Line 1...
1
 #ifndef _UART_H
1
#ifndef _UART_H
2
 #define _UART_H
2
#define _UART_H
-
 
3
 
-
 
4
#define TXD_BUFFER_LEN  150
-
 
5
#define RXD_BUFFER_LEN  150
Line 3... Line -...
3
 
-
 
4
#define MAX_SENDE_BUFF     150
-
 
5
#define MAX_EMPFANGS_BUFF  150
6
 
6
#define DUB_KEY_UP     4
7
#define DUB_KEY_UP     4
7
#define DUB_KEY_DOWN   8
-
 
8
#define DUB_KEY_RIGHT  32
8
#define DUB_KEY_DOWN   8
-
 
9
#define DUB_KEY_LEFT   16
9
#define DUB_KEY_LEFT   16
10
#define DUB_KEY_RIGHT  32
Line 10... Line 11...
10
#define DUB_KEY_FIRE   64
11
#define DUB_KEY_FIRE   64
Line 11... Line -...
11
 
-
 
12
void BearbeiteRxDaten(void);
-
 
13
 
-
 
14
extern unsigned char DebugGetAnforderung;
-
 
15
extern unsigned volatile char SendeBuffer[MAX_SENDE_BUFF];
-
 
16
extern unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF];
-
 
17
extern unsigned volatile char UebertragungAbgeschlossen;
-
 
18
extern unsigned volatile char PC_DebugTimeout;
-
 
19
extern unsigned volatile char NeueKoordinateEmpfangen;
-
 
20
extern unsigned char MeineSlaveAdresse;
-
 
21
extern unsigned char PcZugriff;
-
 
22
extern unsigned char RemotePollDisplayLine;
-
 
23
extern int Debug_Timer,Kompass_Timer;
-
 
24
extern void UART_Init (void);
-
 
25
extern int uart_putchar (char c);
-
 
26
extern void boot_program_page (uint32_t page, uint8_t *buf);
-
 
27
extern void DatenUebertragung(void);
-
 
28
extern void DecodeNMEA(void);
-
 
29
extern void BearbeiteRxDaten(void);
12
 
30
extern unsigned char MotorTest[4];
-
 
31
extern unsigned char DubWiseKeys[4];
13
#include <inttypes.h>
32
struct str_DebugOut
-
 
33
{
-
 
Line 34... Line -...
34
 unsigned char Digital[2];
-
 
Line -... Line 14...
-
 
14
 
-
 
15
//Baud rate of the USART
-
 
16
#define USART0_BAUD 57600
-
 
17
 
-
 
18
 
35
 signed int Analog[32];    // Debugwerte
19
extern void USART0_Init (void);
-
 
20
extern void USART0_TransmitTxData(void);
-
 
21
extern void USART0_ProcessRxData(void);
-
 
22
extern int16_t uart_putchar(int8_t c);
-
 
23
 
-
 
24
extern uint8_t PcAccess;
36
};
25
extern uint8_t RemotePollDisplayLine;
37
 
26
extern uint8_t MotorTest[4];
38
extern struct str_DebugOut    DebugOut;
27
extern uint8_t DubWiseKeys[4];
39
 
-
 
40
struct str_WinkelOut
28
 
41
{
-
 
42
   signed int  Winkel[2];
-
 
Line 43... Line 29...
43
 unsigned char UserParameter[2];
29
typedef struct
-
 
30
{
-
 
31
 uint8_t Digital[2];
44
 unsigned char CalcState;        
32
 uint16_t Analog[32];    // Debugvalues
45
 unsigned char Orientation;
33
} DebugOut_t;
46
};
34
 
47
extern struct str_WinkelOut  WinkelOut;
35
extern DebugOut_t DebugOut;
48
 
36
 
49
struct str_ExternControl
37
typedef struct
50
{
38
{
51
 unsigned char Digital[2];
39
 uint8_t        Digital[2];
52
 unsigned char RemoteTasten;
40
 uint8_t        RemoteButtons;
53
 signed char   Nick;
41
 int8_t         Pitch;
54
 signed char   Roll;
42
 int8_t         Roll;
-
 
43
 int8_t         Yaw;
55
 signed char   Gier;
44
 uint8_t        Thrust;
56
 unsigned char Gas;
45
 int8_t         Height;
Line 57... Line 46...
57
 signed char   Hight;
46
 uint8_t        free;
58
 unsigned char free;
47
 uint8_t        Frame;
59
 unsigned char Frame;
48
 uint8_t        Config;
60
 unsigned char Config;
49
} ExternControl_t;
61
};
50
 
62
extern struct str_ExternControl   ExternControl;
51
extern ExternControl_t ExternControl;
63
 
-
 
64
struct str_VersionInfo
-
 
65
{
-
 
66
  unsigned char Hauptversion;
-
 
67
  unsigned char Nebenversion;
-
 
68
  unsigned char PCKompatibel;
-
 
69
  unsigned char Rserved[7];
-
 
70
};  
-
 
71
extern struct str_VersionInfo VersionInfo;
-
 
72
 
-
 
73
//Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud
-
 
74
//#define BAUD_RATE 9600                //Baud Rate für die Serielle Schnittstelle      
-
 
75
//#define BAUD_RATE 14400               //Baud Rate für die Serielle Schnittstelle      
-
 
76
//#define BAUD_RATE 28800               //Baud Rate für die Serielle Schnittstelle      
-
 
77
//#define BAUD_RATE 38400               //Baud Rate für die Serielle Schnittstelle      
-
 
78
#define BAUD_RATE 57600         //Baud Rate für die Serielle Schnittstelle      
-
 
79
 
-
 
80
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird
-
 
81
#if defined (__AVR_ATmega128__)
-
 
82
#       define USR UCSR0A
-
 
83
#       define UCR UCSR0B
-
 
84
#       define UDR UDR0
-
 
85
#       define UBRR UBRR0L
-
 
86
#       define EICR EICRB
-
 
87
#endif
-
 
88
 
-
 
89
#if defined (__AVR_ATmega32__)
-
 
90
#       define USR UCSRA
-
 
91
#       define UCR UCSRB
-
 
92
#       define UBRR UBRRL
-
 
93
#       define EICR EICRB
-
 
94
#   define INT_VEC_RX  SIG_UART_RECV
-
 
95
#   define INT_VEC_TX  SIG_UART_TRANS
-
 
96
#endif
-
 
97
 
-
 
98
#if defined (__AVR_ATmega644__)
-
 
99
#       define USR  UCSR0A
-
 
100
#       define UCR  UCSR0B
-
 
101
#       define UDR  UDR0
52
 
102
#       define UBRR UBRR0L
-
 
103
#       define EICR EICR0B
-
 
104
#   define TXEN TXEN0
-
 
105
#   define RXEN RXEN0
-
 
106
#   define RXCIE RXCIE0
-
 
Line -... Line 53...
-
 
53
typedef struct
Line 107... Line 54...
107
#   define TXCIE TXCIE0
54
{