Subversion Repositories FlightCtrl

Rev

Rev 1775 | Rev 2039 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1775 Rev 2035
Line 4... Line 4...
4
//uint8_t    NC_getCommand(void);
4
//uint8_t    NC_getCommand(void);
5
//int16_t    NC_getVariable(uint8_t varNum);
5
//int16_t    NC_getVariable(uint8_t varNum);
6
//void       NC_calibrate(void);
6
//void       NC_calibrate(void);
7
//uint8_t    NC_getSignalQuality (void);
7
//uint8_t    NC_getSignalQuality (void);
8
//void       NC_setNeutral(void);
8
//void       NC_setNeutral(void);
9
 
-
 
10
// ######################## SPI - FlightCtrl ###################
-
 
11
#ifndef _NAVICONTROL_H
-
 
12
#define _NAVICONTROL_H
-
 
13
 
-
 
14
//#include <util/delay.h>
-
 
15
#include <inttypes.h>
-
 
16
#define SPI_PROTOCOL_COMP   1
-
 
17
 
-
 
18
#define SPI_CMD_USER        10
-
 
19
#define SPI_CMD_STICK       11
-
 
20
#define SPI_CMD_MISC            12
-
 
21
#define SPI_CMD_PARAMETER1      13
-
 
22
#define SPI_CMD_VERSION         14
-
 
23
 
-
 
24
typedef struct {
-
 
25
  uint8_t Sync1;
-
 
26
  uint8_t Sync2;
-
 
27
  uint8_t Command;
-
 
28
  int16_t IntegralPitch;
-
 
29
  int16_t IntegralRoll;
-
 
30
  int16_t AccPitch;
-
 
31
  int16_t AccRoll;
-
 
32
  int16_t GyroHeading;
-
 
33
  int16_t GyroPitch;
-
 
34
  int16_t GyroRoll;
-
 
35
  int16_t GyroYaw;
-
 
36
  union {
-
 
37
    int8_t  sByte[12];
-
 
38
    uint8_t Byte[12];
-
 
39
    int16_t Int[6];
-
 
40
    int32_t Long[3];
-
 
41
    float   Float[3];
-
 
42
  } Param;
-
 
43
  uint8_t Chksum;
-
 
44
} __attribute__((packed)) ToNaviCtrl_t;
-
 
45
 
-
 
46
#define SPI_CMD_OSD_DATA        100
-
 
47
#define SPI_CMD_GPS_POS         101
-
 
48
#define SPI_CMD_GPS_TARGET      102
-
 
49
#define SPI_KALMAN                      103
-
 
50
 
-
 
51
typedef struct {
-
 
52
  uint8_t Command;
-
 
53
  int16_t GPSStickPitch;
-
 
54
  int16_t GPSStickRoll;
-
 
55
  int16_t GPS_Yaw;
-
 
56
  int16_t CompassHeading;
-
 
57
  int16_t Status;
-
 
58
  uint16_t BeepTime;
-
 
59
  union {
-
 
60
    int8_t  Byte[12];
-
 
61
    int16_t Int[6];
-
 
62
    int32_t Long[3];
-
 
63
    float   Float[3];
-
 
64
  } Param;
-
 
65
  uint8_t Chksum;
-
 
66
} __attribute__((packed)) FromNaviCtrl_t;
-
 
67
 
-
 
68
typedef struct {
-
 
69
  uint8_t Major;
-
 
70
  uint8_t Minor;
-
 
71
  uint8_t Patch;
-
 
72
  uint8_t Compatible;
-
 
73
  //    unsigned char Hardware;
-
 
74
} __attribute__((packed)) SPI_VersionInfo_t;
-
 
75
 
-
 
76
extern ToNaviCtrl_t                     toNaviCtrl;
-
 
77
extern FromNaviCtrl_t                   fromNaviCtrl;
-
 
78
 
-
 
79
typedef struct {
-
 
80
  int8_t        KalmanK;
-
 
81
  int8_t        KalmanMaxDrift;
-
 
82
  int8_t        KalmanMaxFusion;
-
 
83
  uint8_t       SerialDataOkay;
-
 
84
} __attribute__((packed)) NCData_t;
-
 
85
 
-
 
86
extern uint8_t NCDataOkay;
-
 
87
extern uint8_t NCSerialDataOkay;
-
 
88
 
-
 
89
void SPI_MasterInit(void);
-
 
90
void SPI_StartTransmitPacket(void);
-
 
91
void SPI_TransmitByte(void);
-
 
92
// new:
-
 
93
// extern void UpdateSPI_Buffer(void);
-
 
94
 
-
 
95
#endif //_NAVICONTROL_H
-