Subversion Repositories FlightCtrl

Rev

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

Rev Author Line No. Line
595 hbuss 1
 #ifndef _UART_H
1 ingob 2
 #define _UART_H
3
 
1444 ingob 4
#define printf_P(format, args...)   _printf_P(&uart_putchar, format , ## args)
5
#define printf(format, args...)     _printf_P(&uart_putchar, PSTR(format) , ## args)
1 ingob 6
 
304 ingob 7
void BearbeiteRxDaten(void);
8
 
1 ingob 9
extern unsigned char DebugGetAnforderung;
1942 holgerb 10
extern unsigned volatile char ReceiverUpdateModeActive;
1 ingob 11
extern unsigned volatile char UebertragungAbgeschlossen;
12
extern unsigned volatile char PC_DebugTimeout;
13
extern unsigned volatile char NeueKoordinateEmpfangen;
1212 hbuss 14
extern unsigned volatile char PC_MotortestActive;
1 ingob 15
extern unsigned char MeineSlaveAdresse;
16
extern unsigned char PcZugriff;
499 hbuss 17
extern unsigned char RemotePollDisplayLine;
1782 ingob 18
extern unsigned volatile char RxdBuffer[];
693 hbuss 19
extern int Debug_Timer,Kompass_Timer;
1 ingob 20
extern void UART_Init (void);
1444 ingob 21
extern void  uart_putchar (char c);
2008 holgerb 22
//extern void boot_program_page (uint32_t page, uint8_t *buf);
1 ingob 23
extern void DatenUebertragung(void);
1211 hbuss 24
extern void Uart1Init(void);
395 hbuss 25
extern void BearbeiteRxDaten(void);
1212 hbuss 26
extern unsigned char MotorTest[16];
1 ingob 27
struct str_DebugOut
28
{
1702 holgerb 29
 unsigned char Status[2];
805 hbuss 30
 signed int Analog[32];    // Debugwerte
1 ingob 31
};
32
 
33
extern struct str_DebugOut    DebugOut;
34
 
693 hbuss 35
struct str_WinkelOut
36
{
849 hbuss 37
   signed int  Winkel[2];
819 hbuss 38
 unsigned char UserParameter[2];
1051 killagreg 39
 unsigned char CalcState;
819 hbuss 40
 unsigned char Orientation;
693 hbuss 41
};
42
extern struct str_WinkelOut  WinkelOut;
43
 
1171 hbuss 44
struct str_Data3D
1561 killagreg 45
{
1171 hbuss 46
   signed int  Winkel[3]; // nick, roll, compass in 0,1°
1685 holgerb 47
   signed char Centroid[3];
48
   signed char reserve[5];
1171 hbuss 49
};
50
extern struct str_Data3D Data3D;
51
 
595 hbuss 52
struct str_ExternControl
1 ingob 53
{
54
 unsigned char Digital[2];
55
 unsigned char RemoteTasten;
595 hbuss 56
 signed char   Nick;
57
 signed char   Roll;
58
 signed char   Gier;
59
 unsigned char Gas;
60
 signed char   Hight;
61
 unsigned char free;
62
 unsigned char Frame;
63
 unsigned char Config;
1051 killagreg 64
};
595 hbuss 65
extern struct str_ExternControl   ExternControl;
1 ingob 66
 
1765 killagreg 67
// FC hardware errors
68
 
69
// bitmask for UART_VersionInfo_t.HardwareError[0]
70
#define FC_ERROR0_GYRO_NICK     0x01
71
#define FC_ERROR0_GYRO_ROLL     0x02
72
#define FC_ERROR0_GYRO_YAW              0x04
73
#define FC_ERROR0_ACC_NICK              0x08
74
#define FC_ERROR0_ACC_ROLL              0x10
75
#define FC_ERROR0_ACC_TOP               0x20
76
#define FC_ERROR0_PRESSURE              0x40
77
#define FC_ERROR0_CAREFREE              0x80
78
// bitmask for UART_VersionInfo_t.HardwareError[1]
79
#define FC_ERROR1_I2C                   0x01
80
#define FC_ERROR1_BL_MISSING    0x02
81
#define FC_ERROR1_SPI_RX                0x04
82
#define FC_ERROR1_PPM                   0x08
83
#define FC_ERROR1_MIXER                 0x10
84
#define FC_ERROR1_RES1                  0x20
85
#define FC_ERROR1_RES2                  0x40
86
#define FC_ERROR1_RES3                  0x80
87
 
2342 holgerb 88
 
89
// for FlightCtrl
90
//VersionInfo.Flags
91
#define FC_VERSION_FLAG_NC_PRESENT           0x01
92
// for NaviCtrl
93
#define NC_VERSION_FLAG_MK3MAG_PRESENT       0x01
94
 
1 ingob 95
struct str_VersionInfo
96
{
1058 killagreg 97
  unsigned char SWMajor;
98
  unsigned char SWMinor;
99
  unsigned char ProtoMajor;
2342 holgerb 100
  unsigned char reserved1;
1058 killagreg 101
  unsigned char SWPatch;
2342 holgerb 102
  unsigned char HardwareError[2];
103
  unsigned char HWMajor;
2466 holgerb 104
  unsigned char BL_Firmware;  
2342 holgerb 105
  unsigned char Flags;
1051 killagreg 106
};
1702 holgerb 107
 
1 ingob 108
extern struct str_VersionInfo VersionInfo;
109
 
1561 killagreg 110
//#define USART0_BAUD 9600
111
//#define USART0_BAUD 14400
112
//#define USART0_BAUD 28800
113
//#define USART0_BAUD 38400
114
#define USART0_BAUD 57600
1 ingob 115
 
116
 
117
#endif //_UART_H