Subversion Repositories FlightCtrl

Rev

Rev 692 | Rev 709 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 692 Rev 708
Line 1... Line 1...
1
// ######################## SPI - FlightCtrl ###################
1
// ######################## SPI - FlightCtrl ###################
2
#ifndef _SPI_H
2
#ifndef _SPI_H
3
#define _SPI_H
3
#define _SPI_H
Line -... Line 4...
-
 
4
 
-
 
5
#include <util/delay.h>
4
 
6
 
Line 5... Line 7...
5
//#define USE_SPI_COMMUNICATION 
7
#define USE_SPI_COMMUNICATION 
Line 6... Line 8...
6
 
8
 
7
#define SPI_PROTOCOL_COMP   1
9
#define SPI_PROTOCOL_COMP   1
Line 45... Line 47...
45
 
47
 
46
#define SLAVE_SELECT_DDR_PORT   DDRC
48
#define SLAVE_SELECT_DDR_PORT   DDRC
47
#define SLAVE_SELECT_PORT       PORTC
49
#define SLAVE_SELECT_PORT       PORTC
Line 48... Line 50...
48
#define SPI_SLAVE_SELECT        PC5
50
#define SPI_SLAVE_SELECT        PC5
-
 
51
 
-
 
52
struct str_ToNaviCtrl_Value
-
 
53
{
-
 
54
 unsigned char Sync1, Sync2;
-
 
55
 unsigned char Command;
-
 
56
 signed int IntegralNick;
-
 
57
 signed int  IntegralRoll;
-
 
58
  char StickNick,StickRoll,  
-
 
59
       StickGier, StickGas,  
-
 
60
       Poti1,Poti2,  
-
 
61
           Poti3,Poti4;
-
 
62
  signed int  GyroCompass;
-
 
63
  signed int  d0;
-
 
64
  signed int  d1;
-
 
65
  unsigned char Chksum;
-
 
66
};
49
 
67
 
50
struct str_ToNaviCtrl
68
 struct str_ToNaviCtrl_Version
-
 
69
 {
-
 
70
  unsigned char Sync1, Sync2;
-
 
71
  unsigned char Command;
51
{
72
  unsigned char  HVersion;
52
 unsigned char Sync1, Sync2;
73
  unsigned char  NVersion;
-
 
74
  unsigned char  Comp;
53
 unsigned char Comp;
75
  unsigned char  d0;
-
 
76
  signed int  d1;
-
 
77
  signed int  d2;
-
 
78
  signed int  d3;
-
 
79
  signed int  d4;
54
 int IntegralNick;
80
  signed int  d5;
55
 int IntegralRoll;
81
  signed int  d6;
56
 char StickNick,StickRoll,StickGier;
82
  signed int  d7;
Line 57... Line 83...
57
 unsigned char ChkSum;
83
  unsigned char Chksum;
58
};
84
 };
-
 
85
 
-
 
86
struct str_FromNaviCtrl_Value
-
 
87
{
-
 
88
 unsigned char Command;
-
 
89
  signed int  GPS_Nick;
-
 
90
  signed int  GPS_Roll;
-
 
91
  signed int  GPS_Gier;
-
 
92
  signed int  GPS_Height;
59
 
93
  signed int  CompassValue;
-
 
94
  signed int  Status;
-
 
95
  signed int  d0;
-
 
96
  signed int  d1;
-
 
97
  signed int  d2;
-
 
98
  unsigned char Chksum;
-
 
99
};
-
 
100
 
-
 
101
 struct str_FromNaviCtrl_Version
-
 
102
 {
60
struct str_FromNaviCtrl
103
  unsigned char Command;
-
 
104
  unsigned char  HVersion;
61
{
105
  unsigned char  NVersion;
62
 unsigned int Dummy;
106
  unsigned char  Comp;
-
 
107
  unsigned char  d0;
-
 
108
  signed int  d1;
-
 
109
  signed int  d2;
-
 
110
  signed int  d3;
-
 
111
  signed int  d4;
63
 unsigned char Comp;
112
  signed int  d5;
64
 int GPS_Nick;
113
  signed int  d6;
Line 65... Line 114...
65
 int GPS_Roll;
114
  signed int  d7;
-
 
115
  unsigned char Chksum;
-
 
116
 };
-
 
117
 
66
 int CompassValue;
118
#ifdef USE_SPI_COMMUNICATION
67
};
119
extern struct str_ToNaviCtrl_Version   ToNaviCtrl_Version;
Line -... Line 120...
-
 
120
extern struct str_FromNaviCtrl_Version   FromNaviCtrl_Version;
-
 
121
 
Line 68... Line 122...
68
 
122
extern struct str_ToNaviCtrl_Value   ToNaviCtrl_Value;
69
#ifdef USE_SPI_COMMUNICATION
123
extern struct str_FromNaviCtrl_Value   FromNaviCtrl_Value;
70
extern struct str_ToNaviCtrl   ToNaviCtrl;
124
 
71
extern struct str_FromNaviCtrl   FromNaviCtrl;
125
#define SPI_CMD_VERSION 0x02
72
 
126
#define SPI_CMD_VALUE   0x03