Subversion Repositories FlightCtrl

Rev

Go to most recent revision | Details | 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;
1777 ingob 10
extern unsigned volatile char JetiUpdateModeActive;
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;
693 hbuss 18
extern int Debug_Timer,Kompass_Timer;
1 ingob 19
extern void UART_Init (void);
1444 ingob 20
extern void  uart_putchar (char c);
1 ingob 21
extern void boot_program_page (uint32_t page, uint8_t *buf);
22
extern void DatenUebertragung(void);
1211 hbuss 23
extern void Uart1Init(void);
395 hbuss 24
extern void BearbeiteRxDaten(void);
1212 hbuss 25
extern unsigned char MotorTest[16];
1 ingob 26
struct str_DebugOut
27
{
1702 holgerb 28
 unsigned char Status[2];
805 hbuss 29
 signed int Analog[32];    // Debugwerte
1 ingob 30
};
31
 
32
extern struct str_DebugOut    DebugOut;
33
 
693 hbuss 34
struct str_WinkelOut
35
{
849 hbuss 36
   signed int  Winkel[2];
819 hbuss 37
 unsigned char UserParameter[2];
1051 killagreg 38
 unsigned char CalcState;
819 hbuss 39
 unsigned char Orientation;
693 hbuss 40
};
41
extern struct str_WinkelOut  WinkelOut;
42
 
1171 hbuss 43
struct str_Data3D
1561 killagreg 44
{
1171 hbuss 45
   signed int  Winkel[3]; // nick, roll, compass in 0,1°
1685 holgerb 46
   signed char Centroid[3];
47
   signed char reserve[5];
1171 hbuss 48
};
49
extern struct str_Data3D Data3D;
50
 
595 hbuss 51
struct str_ExternControl
1 ingob 52
{
53
 unsigned char Digital[2];
54
 unsigned char RemoteTasten;
595 hbuss 55
 signed char   Nick;
56
 signed char   Roll;
57
 signed char   Gier;
58
 unsigned char Gas;
59
 signed char   Hight;
60
 unsigned char free;
61
 unsigned char Frame;
62
 unsigned char Config;
1051 killagreg 63
};
595 hbuss 64
extern struct str_ExternControl   ExternControl;
1 ingob 65
 
1765 killagreg 66
// FC hardware errors
67
 
68
// bitmask for UART_VersionInfo_t.HardwareError[0]
69
#define FC_ERROR0_GYRO_NICK     0x01
70
#define FC_ERROR0_GYRO_ROLL     0x02
71
#define FC_ERROR0_GYRO_YAW              0x04
72
#define FC_ERROR0_ACC_NICK              0x08
73
#define FC_ERROR0_ACC_ROLL              0x10
74
#define FC_ERROR0_ACC_TOP               0x20
75
#define FC_ERROR0_PRESSURE              0x40
76
#define FC_ERROR0_CAREFREE              0x80
77
// bitmask for UART_VersionInfo_t.HardwareError[1]
78
#define FC_ERROR1_I2C                   0x01
79
#define FC_ERROR1_BL_MISSING    0x02
80
#define FC_ERROR1_SPI_RX                0x04
81
#define FC_ERROR1_PPM                   0x08
82
#define FC_ERROR1_MIXER                 0x10
83
#define FC_ERROR1_RES1                  0x20
84
#define FC_ERROR1_RES2                  0x40
85
#define FC_ERROR1_RES3                  0x80
86
 
1 ingob 87
struct str_VersionInfo
88
{
1058 killagreg 89
  unsigned char SWMajor;
90
  unsigned char SWMinor;
91
  unsigned char ProtoMajor;
92
  unsigned char ProtoMinor;
93
  unsigned char SWPatch;
1702 holgerb 94
  unsigned char HardwareError[5];
1051 killagreg 95
};
1702 holgerb 96
 
1 ingob 97
extern struct str_VersionInfo VersionInfo;
98
 
1561 killagreg 99
//#define USART0_BAUD 9600
100
//#define USART0_BAUD 14400
101
//#define USART0_BAUD 28800
102
//#define USART0_BAUD 38400
103
#define USART0_BAUD 57600
1 ingob 104
 
105
 
106
#endif //_UART_H