Rev 57 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
41 | ingob | 1 | #ifndef _SPI_SLAVE_H |
2 | #define _SPI_SLAVE_H |
||
1 | ingob | 3 | |
41 | ingob | 4 | #include "fifo.h" |
1 | ingob | 5 | |
41 | ingob | 6 | |
1 | ingob | 7 | #define SS_PIN GPIO_ReadBit(GPIO2, GPIO_Pin_7) |
8 | |||
41 | ingob | 9 | #define SPI_CMD_USER 10 |
10 | #define SPI_CMD_STICK 11 |
||
11 | #define SPI_CMD_MISC 12 |
||
12 | #define SPI_CMD_PARAMETER1 13 |
||
13 | #define SPI_CMD_VERSION 14 |
||
14 | |||
15 | extern s32 FC_Kalman_K; |
||
16 | extern s32 Kalman_MaxDrift; |
||
17 | extern s32 Kalman_MaxFusion; |
||
18 | typedef struct |
||
1 | ingob | 19 | { |
20 | u8 Command; |
||
21 | s16 IntegralNick; |
||
22 | s16 IntegralRoll; |
||
23 | s16 AccNick; |
||
24 | s16 AccRoll; |
||
41 | ingob | 25 | s16 GyroHeading; |
1 | ingob | 26 | s16 GyroNick; |
27 | s16 GyroRoll; |
||
41 | ingob | 28 | s16 GyroYaw; |
29 | union |
||
30 | { |
||
31 | s8 sByte[12]; |
||
32 | u8 Byte[12]; |
||
33 | s16 Int[6]; |
||
34 | s32 Long[3]; |
||
1 | ingob | 35 | float Float[3]; |
36 | } Param; |
||
37 | u8 Chksum; |
||
41 | ingob | 38 | } __attribute__((packed)) FromFlightCtrl_t; |
39 | |||
40 | #define SPI_KALMAN 103 |
||
1 | ingob | 41 | |
41 | ingob | 42 | typedef struct |
43 | { |
||
44 | u8 Command; |
||
45 | s16 GPS_Nick; |
||
46 | s16 GPS_Roll; |
||
47 | s16 GPS_Yaw; |
||
48 | s16 CompassHeading; |
||
49 | s16 Status; |
||
50 | u16 BeepTime; |
||
51 | union |
||
52 | { |
||
53 | s8 sByte[12]; |
||
54 | u8 Byte[12]; |
||
55 | s16 Int[6]; |
||
56 | s32 Long[3]; |
||
57 | float Float[3]; |
||
58 | }Param; |
||
59 | u8 Chksum; |
||
60 | } __attribute__((packed)) ToFlightCtrl_t; |
||
1 | ingob | 61 | |
62 | |||
41 | ingob | 63 | typedef struct |
1 | ingob | 64 | { |
41 | ingob | 65 | u8 Major; |
66 | u8 Minor; |
||
67 | u8 Patch; |
||
68 | u8 Compatible; |
||
61 | holgerb | 69 | u8 Hardware; |
41 | ingob | 70 | } __attribute__((packed)) SPI_Version_t; |
1 | ingob | 71 | |
41 | ingob | 72 | extern volatile FromFlightCtrl_t FromFlightCtrl; |
73 | extern volatile ToFlightCtrl_t ToFlightCtrl; |
||
74 | extern SPI_Version_t FC_Version; |
||
75 | extern fifo_t CompassCalcStateFiFo; |
||
76 | extern u32 CheckSPIOkay; |
||
1 | ingob | 77 | |
41 | ingob | 78 | void SPI0_Init(void); |
79 | void SPI0_GetFlightCtrlVersion(void); |
||
80 | void SPI0_UpdateBuffer(void); |
||
1 | ingob | 81 | |
82 | |||
83 | |||
41 | ingob | 84 | #endif //_SPI_SLAVE_H |