Subversion Repositories FlightCtrl

Rev

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

Rev Author Line No. Line
2248 - 1
// -------------------------------------------------------------------------------------------------------------------------------------
2
// uart.h
3
// -------------------------------------------------------------------------------------------------------------------------------------
4
 
5
#ifndef _UART_H
6
 #define _UART_H
7
 
8
#define MAX_SENDE_BUFF     150
9
#define MAX_EMPFANGS_BUFF  150
10
 
11
void BearbeiteRxDaten(void);
12
 
13
extern unsigned char DebugGetAnforderung;
14
extern unsigned volatile char SendeBuffer[MAX_SENDE_BUFF];
15
extern unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF];
16
extern unsigned volatile char UebertragungAbgeschlossen;
17
extern unsigned volatile char PC_DebugTimeout;
18
extern unsigned volatile char NeueKoordinateEmpfangen;
19
extern unsigned volatile char PC_MotortestActive;
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 BearbeiteRxDaten(void);
29
extern unsigned char MotorTest[16];
30
 
31
struct str_DebugOut
32
{
33
        unsigned char Digital[2];
34
        signed int Analog[32];                                                          // Debugwerte
35
};
36
 
37
extern struct str_DebugOut    DebugOut;
38
 
39
struct str_WinkelOut
40
{
41
        signed int  Winkel[2];
42
        unsigned char UserParameter[2];
43
        unsigned char CalcState;                                                        // wird als vierstufiges Flag in spi.c uart.c fc.c und main.c verwendet
44
        unsigned char Orientation;
45
};
46
 
47
extern struct str_WinkelOut  WinkelOut;
48
 
49
struct str_Data3D
50
{
51
        signed int  Winkel[3];                                                          // nick, roll, compass in 0,1°
52
        signed char reserve[8];
53
};
54
 
55
extern struct str_Data3D Data3D;
56
 
57
struct str_ExternControl
58
{
59
        unsigned char Digital[2];
60
        unsigned char RemoteTasten;
61
        signed char   Nick;
62
        signed char   Roll;
63
        signed char   Gier;
64
        unsigned char Gas;
65
        signed char   Hight;
66
        unsigned char free;
67
        unsigned char Frame;
68
        unsigned char Config;
69
};
70
 
71
extern struct str_ExternControl   ExternControl;
72
 
73
struct str_VersionInfo
74
{
75
  unsigned char SWMajor;
76
  unsigned char SWMinor;
77
  unsigned char ProtoMajor;
78
  unsigned char ProtoMinor;
79
  unsigned char SWPatch;
80
  unsigned char Reserved[5];
81
};
82
 
83
extern struct str_VersionInfo VersionInfo;
84
 
85
 
86
#define BAUD_RATE 57600         //Die Baud_Rate der Seriellen Schnittstelle ist 57600 Baud
87
 
88
//Anpassen der seriellen Schnittstellen Register-----
89
#if defined (__AVR_ATmega644__)
90
#       define USR  UCSR0A
91
// #    define UCR  UCSR0B
92
#       define UDR  UDR0
93
#       define UBRR UBRR0L
94
#       define EICR EICR0B
95
#   define TXEN TXEN0
96
#   define RXEN RXEN0
97
#   define RXCIE RXCIE0
98
#   define TXCIE TXCIE0
99
#   define U2X  U2X0
100
#   define UCSRB UCSR0B
101
#   define UDRE UDRE0
102
#   define INT_VEC_RX  SIG_USART_RECV
103
#   define INT_VEC_TX  SIG_USART_TRANS
104
#endif
105
//--------------------------------------
106
#if defined (__AVR_ATmega644P__)
107
# define USR  UCSR0A
108
# define UCR  UCSR0B
109
# define UDR  UDR0
110
# define UBRR UBRR0L
111
# define EICR EICR0B
112
#   define TXEN TXEN0
113
#   define RXEN RXEN0
114
#   define RXCIE RXCIE0
115
#   define TXCIE TXCIE0
116
#   define U2X  U2X0
117
#   define UCSRB UCSR0B
118
#   define UDRE UDRE0
119
#   define INT_VEC_RX  SIG_USART_RECV
120
#   define INT_VEC_TX  SIG_USART_TRANS
121
#endif
122
 
123
#endif //_UART_H
124
//--------------------------------------------------