Rev 885 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 885 | Rev 886 | ||
---|---|---|---|
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 4... | Line 4... | ||
4 | 4 | ||
- | 5 | //#include <util/delay.h> |
|
Line 5... | Line 6... | ||
5 | #include <util/delay.h> |
6 | #include <inttypes.h> |
Line 6... | Line 7... | ||
6 | 7 | ||
Line 51... | Line 52... | ||
51 | 52 | ||
52 | 53 | ||
53 | #define SPI_CMD_USER 10 |
54 | #define SPI_CMD_USER 10 |
- | 55 | #define SPI_CMD_STICK 11 |
|
54 | #define SPI_CMD_STICK 11 |
56 | #define SPI_CMD_CAL_COMPASS 12 |
55 | #define SPI_CMD_CAL_COMPASS 12 |
57 | |
- | 58 | typedef struct |
|
56 | struct str_ToNaviCtrl |
59 | { |
57 | { |
60 | uint8_t Sync1; |
58 | unsigned char Sync1, Sync2; |
61 | uint8_t Sync2; |
59 | unsigned char Command; |
62 | uint8_t Command; |
60 | signed int IntegralNick; |
63 | int16_t IntegralPitch; |
61 | signed int IntegralRoll; |
64 | int16_t IntegralRoll; |
62 | signed int AccNick; |
65 | int16_t AccPitch; |
63 | signed int AccRoll; |
66 | int16_t AccRoll; |
64 | signed int GyroCompass; |
67 | int16_t GyroHeading; |
65 | signed int GyroNick; |
68 | int16_t GyroPitch; |
66 | signed int GyroRoll; |
69 | int16_t GyroRoll; |
- | 70 | int16_t GyroYaw; |
|
- | 71 | union |
|
67 | signed int GyroGier; |
72 | { |
68 | union |
73 | int8_t sByte[12]; |
69 | { char Byte[12]; |
74 | uint8_t Byte[12]; |
70 | int Int[6]; |
75 | int16_t Int[6]; |
71 | long Long[3]; |
76 | int32_t Long[3]; |
72 | float Float[3]; |
77 | float Float[3]; |
- | 78 | } Param; |
|
- | 79 | uint8_t Chksum; |
|
73 | } Param; |
80 | } ToNaviCtrl_t; |
Line 74... | Line 81... | ||
74 | unsigned char Chksum; |
81 | |
75 | }; |
82 | |
76 | 83 | ||
- | 84 | #define SPI_CMD_OSD_DATA 100 |
|
77 | #define SPI_CMD_OSD_DATA 100 |
85 | #define SPI_CMD_GPS_POS 101 |
78 | #define SPI_CMD_GPS_POS 101 |
86 | #define SPI_CMD_GPS_TARGET 102 |
79 | #define SPI_CMD_GPS_TARGET 102 |
87 | |
80 | struct str_FromNaviCtrl |
88 | typedef struct |
81 | { |
89 | { |
82 | unsigned char Command; |
90 | uint8_t Command; |
83 | signed int GPS_Nick; |
91 | int16_t GPS_Pitch; |
84 | signed int GPS_Roll; |
92 | int16_t GPS_Roll; |
85 | signed int GPS_Gier; |
93 | int16_t GPS_Yaw; |
86 | signed int CompassValue; |
94 | int16_t CompassHeading; |
- | 95 | int16_t Status; |
|
87 | signed int Status; |
96 | uint8_t BeepTime; |
88 | unsigned char BeepTime; |
97 | union |
89 | union |
98 | { |
90 | { char Byte[12]; |
99 | int8_t Byte[12]; |
91 | int Int[6]; |
100 | int16_t Int[6]; |
92 | long Long[3]; |
101 | int32_t Long[3]; |
93 | float Float[3]; |
102 | float Float[3]; |
94 | } Param; |
- | |
Line 95... | Line 103... | ||
95 | unsigned char Chksum; |
103 | } Param; |
Line 96... | Line 104... | ||
96 | }; |
104 | uint8_t Chksum; |
97 | 105 | } FromNaviCtrl_t; |
|
98 | - | ||
99 | #ifdef USE_SPI_COMMUNICATION |
- | |
Line 100... | Line 106... | ||
100 | 106 | ||
101 | extern struct str_ToNaviCtrl ToNaviCtrl; |
107 | #ifdef USE_SPI_COMMUNICATION |
102 | extern struct str_FromNaviCtrl FromNaviCtrl; |
- | |
103 | 108 | ||
104 | //#define SPI_CMD_VALUE 0x03 |
109 | extern ToNaviCtrl_t ToNaviCtrl; |
Line 105... | Line 110... | ||
105 | 110 | extern FromNaviCtrl_t FromNaviCtrl; |
|
Line 116... | Line 121... | ||
116 | #define UpdateSPI_Buffer() ; |
121 | #define UpdateSPI_Buffer() ; |
117 | #define SPI_TransmitByte() ; |
122 | #define SPI_TransmitByte() ; |
118 | #endif |
123 | #endif |
Line 119... | Line 124... | ||
119 | 124 |