Rev 1612 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1612 | Rev 1645 | ||
---|---|---|---|
Line 2... | Line 2... | ||
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> |
5 | //#include <util/delay.h> |
6 | #include <inttypes.h> |
- | |
7 | - | ||
8 | 6 | #include <inttypes.h> |
|
Line 9... | Line -... | ||
9 | #define SPI_PROTOCOL_COMP 1 |
- | |
10 | 7 | #define SPI_PROTOCOL_COMP 1 |
|
11 | 8 | ||
12 | #define SPI_CMD_USER 10 |
9 | #define SPI_CMD_USER 10 |
13 | #define SPI_CMD_STICK 11 |
10 | #define SPI_CMD_STICK 11 |
14 | #define SPI_CMD_MISC 12 |
11 | #define SPI_CMD_MISC 12 |
Line 15... | Line 12... | ||
15 | #define SPI_CMD_PARAMETER1 13 |
12 | #define SPI_CMD_PARAMETER1 13 |
16 | #define SPI_CMD_VERSION 14 |
- | |
17 | 13 | #define SPI_CMD_VERSION 14 |
|
18 | typedef struct |
14 | |
19 | { |
15 | typedef struct { |
20 | uint8_t Sync1; |
16 | uint8_t Sync1; |
21 | uint8_t Sync2; |
17 | uint8_t Sync2; |
Line 26... | Line 22... | ||
26 | int16_t AccRoll; |
22 | int16_t AccRoll; |
27 | int16_t GyroHeading; |
23 | int16_t GyroHeading; |
28 | int16_t GyroNick; |
24 | int16_t GyroNick; |
29 | int16_t GyroRoll; |
25 | int16_t GyroRoll; |
30 | int16_t GyroYaw; |
26 | int16_t GyroYaw; |
31 | union |
27 | union { |
32 | { |
- | |
33 | int8_t sByte[12]; |
28 | int8_t sByte[12]; |
34 | uint8_t Byte[12]; |
29 | uint8_t Byte[12]; |
35 | int16_t Int[6]; |
30 | int16_t Int[6]; |
36 | int32_t Long[3]; |
31 | int32_t Long[3]; |
37 | float Float[3]; |
32 | float Float[3]; |
38 | } Param; |
33 | } Param; |
39 | uint8_t Chksum; |
34 | uint8_t Chksum; |
40 | } __attribute__((packed)) ToNaviCtrl_t; |
35 | } __attribute__((packed)) ToNaviCtrl_t; |
Line 41... | Line -... | ||
41 | - | ||
42 | - | ||
43 | 36 | ||
44 | #define SPI_CMD_OSD_DATA 100 |
37 | #define SPI_CMD_OSD_DATA 100 |
45 | #define SPI_CMD_GPS_POS 101 |
38 | #define SPI_CMD_GPS_POS 101 |
46 | #define SPI_CMD_GPS_TARGET 102 |
39 | #define SPI_CMD_GPS_TARGET 102 |
Line 47... | Line 40... | ||
47 | #define SPI_KALMAN 103 |
40 | #define SPI_KALMAN 103 |
48 | - | ||
49 | typedef struct |
41 | |
50 | { |
42 | typedef struct { |
51 | uint8_t Command; |
43 | uint8_t Command; |
52 | int16_t GPSStickNick; |
44 | int16_t GPSStickNick; |
53 | int16_t GPSStickRoll; |
45 | int16_t GPSStickRoll; |
54 | int16_t GPS_Yaw; |
46 | int16_t GPS_Yaw; |
55 | int16_t CompassHeading; |
47 | int16_t CompassHeading; |
56 | int16_t Status; |
48 | int16_t Status; |
57 | uint16_t BeepTime; |
- | |
58 | union |
49 | uint16_t BeepTime; |
59 | { |
50 | union { |
60 | int8_t Byte[12]; |
51 | int8_t Byte[12]; |
61 | int16_t Int[6]; |
52 | int16_t Int[6]; |
62 | int32_t Long[3]; |
53 | int32_t Long[3]; |
63 | float Float[3]; |
54 | float Float[3]; |
64 | } Param; |
55 | } Param; |
Line 65... | Line 56... | ||
65 | uint8_t Chksum; |
56 | uint8_t Chksum; |
66 | } __attribute__((packed)) FromNaviCtrl_t; |
- | |
67 | 57 | } __attribute__((packed)) FromNaviCtrl_t; |
|
68 | 58 | ||
69 | typedef struct |
59 | |
70 | { |
60 | typedef struct { |
71 | uint8_t Major; |
61 | uint8_t Major; |
Line 72... | Line -... | ||
72 | uint8_t Minor; |
- | |
73 | uint8_t Patch; |
62 | uint8_t Minor; |
74 | uint8_t Compatible; |
63 | uint8_t Patch; |
Line 75... | Line -... | ||
75 | } __attribute__((packed)) SPI_VersionInfo_t; |
- | |
76 | 64 | uint8_t Compatible; |
|
77 | - | ||
78 | extern ToNaviCtrl_t ToNaviCtrl; |
65 | } __attribute__((packed)) SPI_VersionInfo_t; |
79 | extern FromNaviCtrl_t FromNaviCtrl; |
66 | |
80 | 67 | extern ToNaviCtrl_t ToNaviCtrl; |
|
81 | 68 | extern FromNaviCtrl_t FromNaviCtrl; |
|
82 | typedef struct |
69 | |
Line 83... | Line -... | ||
83 | { |
- | |
84 | int8_t KalmanK; |
70 | typedef struct { |
85 | int8_t KalmanMaxDrift; |
71 | int8_t KalmanK; |
Line 86... | Line 72... | ||
86 | int8_t KalmanMaxFusion; |
72 | int8_t KalmanMaxDrift; |
87 | uint8_t SerialDataOkay; |
73 | int8_t KalmanMaxFusion; |
88 | } __attribute__((packed)) NCData_t; |
74 | uint8_t SerialDataOkay; |
Line 89... | Line -... | ||
89 | - | ||
90 | - | ||
91 | extern uint8_t NCDataOkay; |
75 | } __attribute__((packed)) NCData_t; |