Subversion Repositories FlightCtrl

Rev

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

Rev 1378 Rev 1550
Line 46... Line 46...
46
#define SLAVE_SELECT_DDR_PORT   DDRC
46
#define SLAVE_SELECT_DDR_PORT   DDRC
47
#define SLAVE_SELECT_PORT       PORTC
47
#define SLAVE_SELECT_PORT       PORTC
48
#define SPI_SLAVE_SELECT        PC5
48
#define SPI_SLAVE_SELECT        PC5
Line 49... Line 49...
49
 
49
 
50
 
50
 
51
#define SPI_CMD_USER        10
51
#define SPI_FCCMD_USER                  10
52
#define SPI_CMD_STICK       11
52
#define SPI_FCCMD_STICK                 11
53
#define SPI_CMD_MISC        12
53
#define SPI_FCCMD_MISC                  12
54
#define SPI_CMD_PARAMETER1  13
54
#define SPI_FCCMD_PARAMETER1    13
-
 
55
#define SPI_FCCMD_VERSION               14
Line 55... Line 56...
55
#define SPI_CMD_VERSION     14
56
#define SPI_FCCMD_SERVOS                15
56
#define SPI_CMD_SERVOS          15
57
#define SPI_FCCMD_ACCU                  16
57
 
58
 
58
struct str_ToNaviCtrl
59
struct str_ToNaviCtrl
Line 67... Line 68...
67
        signed int  GyroNick;
68
        signed int  GyroNick;
68
        signed int  GyroRoll;
69
        signed int  GyroRoll;
69
        signed int  GyroGier;
70
        signed int  GyroGier;
70
        union
71
        union
71
        {
72
        {
72
                char sByte[12];
-
 
73
                unsigned char Byte[12];
73
                unsigned char Byte[12];
-
 
74
                char sByte[12];
-
 
75
                unsigned int Int[6];
74
                int  Int[6];
76
                int  sInt[6];
-
 
77
                unsigned long Long[3];
75
                long Long[3];
78
                long sLong[3];
76
                float Float[3];
79
                float Float[3];
77
        } Param;
80
        } Param;
78
        unsigned char Chksum;
81
        unsigned char Chksum;
79
};
82
};
Line 80... Line 83...
80
 
83
 
-
 
84
#define SPI_NCCMD_KALMAN                103
-
 
85
#define SPI_NCCMD_VERSION               104
Line 81... Line 86...
81
#define SPI_KALMAN          103
86
#define SPI_NCCMD_GPSINFO               105
82
 
87
 
83
struct str_FromNaviCtrl
88
struct str_FromNaviCtrl
84
{
89
{
Line 89... Line 94...
89
        signed int  CompassValue;
94
        signed int  CompassValue;
90
        signed int  Status;
95
        signed int  Status;
91
        unsigned int BeepTime;
96
        unsigned int BeepTime;
92
        union
97
        union
93
        {
98
        {
94
                char sByte[12];
-
 
95
                unsigned char Byte[12];
99
                unsigned char Byte[12];
-
 
100
                char sByte[12];
-
 
101
                unsigned int Int[6];
96
                int  Int[6];
102
                int  sInt[6];
-
 
103
                unsigned long Long[3];
97
                long Long[3];
104
                long sLong[3];
98
                float Float[3];
105
                float Float[3];
99
        } Param;
106
        } Param;
100
        unsigned char Chksum;
107
        unsigned char Chksum;
101
};
108
};
Line 113... Line 120...
113
{
120
{
114
  unsigned char Major;
121
  unsigned char Major;
115
  unsigned char Minor;
122
  unsigned char Minor;
116
  unsigned char Patch;
123
  unsigned char Patch;
117
  unsigned char Compatible;
124
  unsigned char Compatible;
-
 
125
  unsigned char Hardware;
118
};
126
};
Line -... Line 127...
-
 
127
 
-
 
128
// Satfix types for GPSData.SatFix
-
 
129
#define SATFIX_NONE                             0x00
-
 
130
#define SATFIX_DEADRECKOING             0x01
-
 
131
#define SATFIX_2D                               0x02
-
 
132
#define SATFIX_3D                               0x03
119
 
133
#define SATFIX_GPS_DEADRECKOING 0x04
-
 
134
#define SATFIX_TIMEONLY                 0x05
-
 
135
// Flags for interpretation of the GPSData.Flags
-
 
136
#define FLAG_GPSFIXOK                   0x01 // (i.e. within DOP & ACC Masks)
-
 
137
#define FLAG_DIFFSOLN                   0x02 // (is DGPS used)
-
 
138
#define FLAG_WKNSET                             0x04 // (is Week Number valid)
Line -... Line 139...
-
 
139
#define FLAG_TOWSET                             0x08 // (is Time of Week valid)
-
 
140
 
-
 
141
struct str_GPSInfo
-
 
142
{
-
 
143
        unsigned char   Flags;                  // Status Flags
-
 
144
        unsigned char   NumOfSats;              // number of satelites
-
 
145
        unsigned char   SatFix;                 // type of satfix
-
 
146
        unsigned int    HomeDistance;   // distance to Home in dm
-
 
147
        int                             HomeBearing;    // bearing to home in deg
-
 
148
};
-
 
149
 
-
 
150
 
-
 
151
#ifdef USE_SPI_COMMUNICATION
120
#ifdef USE_SPI_COMMUNICATION
152
extern struct str_GPSInfo GPSInfo;
121
 
153
extern struct str_SPI_VersionInfo NC_Version;
122
extern struct str_FromNaviCtrl_Value FromNaviCtrl_Value;
154
extern struct str_FromNaviCtrl_Value FromNaviCtrl_Value;
123
extern struct str_ToNaviCtrl   ToNaviCtrl;
155
extern struct str_ToNaviCtrl   ToNaviCtrl;
Line 124... Line -...
124
extern struct str_FromNaviCtrl FromNaviCtrl;
-
 
Line 125... Line 156...
125
extern unsigned char SPI_CommandCounter,NaviDataOkay;
156
extern struct str_FromNaviCtrl FromNaviCtrl;
126
 
157
extern unsigned char SPI_CommandCounter,NaviDataOkay;
127
//#define SPI_CMD_VALUE   0x03
158
 
128
 
159