Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
304 | ingob | 1 | // ######################## SPI - FlightCtrl ################### |
2 | #ifndef _SPI_H |
||
3 | #define _SPI_H |
||
4 | |||
597 | ingob | 5 | //#define USE_SPI_COMMUNICATION |
6 | |||
304 | ingob | 7 | #define SPI_PROTOCOL_COMP 1 |
8 | |||
9 | //----------------------------------------- |
||
10 | #define DDR_SPI DDRB |
||
11 | #define DD_SS PB4 |
||
12 | #define DD_SCK PB7 |
||
13 | #define DD_MOSI PB5 |
||
14 | #define DD_MISO PB6 |
||
15 | |||
596 | ingob | 16 | // for compatibility reasons gcc3.x <-> gcc4.x |
17 | #ifndef SPCR |
||
18 | #define SPCR SPCR0 |
||
19 | #endif |
||
20 | #ifndef SPE |
||
21 | #define SPE SPE0 |
||
22 | #endif |
||
23 | #ifndef MSTR |
||
24 | #define MSTR MSTR0 |
||
25 | #endif |
||
26 | #ifndef SPR1 |
||
27 | #define SPR1 SPR01 |
||
28 | #endif |
||
29 | #ifndef SPIE |
||
30 | #define SPIE SPIE0 |
||
31 | #endif |
||
32 | #ifndef SPDR |
||
33 | #define SPDR SPDR0 |
||
34 | #endif |
||
35 | #ifndef SPIF |
||
36 | #define SPIF SPIF0 |
||
37 | #endif |
||
38 | #ifndef SPSR |
||
39 | #define SPSR SPSR0 |
||
40 | #endif |
||
41 | // ------------------------- |
||
304 | ingob | 42 | |
43 | #define SLAVE_SELECT_DDR_PORT DDRC |
||
44 | #define SLAVE_SELECT_PORT PORTC |
||
45 | #define SPI_SLAVE_SELECT PC5 |
||
46 | |||
47 | struct str_ToNaviCtrl |
||
48 | { |
||
49 | unsigned char Comp; |
||
50 | int IntegralNick; |
||
51 | int IntegralRoll; |
||
52 | char StickNick,StickRoll,StickGier; |
||
53 | }; |
||
54 | |||
55 | struct str_FromNaviCtrl |
||
56 | { |
||
596 | ingob | 57 | unsigned int Dummy; |
304 | ingob | 58 | unsigned char Comp; |
59 | int GPS_Nick; |
||
60 | int GPS_Roll; |
||
61 | int CompassValue; |
||
62 | }; |
||
63 | |||
597 | ingob | 64 | #ifdef USE_SPI_COMMUNICATION |
304 | ingob | 65 | extern struct str_ToNaviCtrl ToNaviCtrl; |
66 | extern struct str_FromNaviCtrl FromNaviCtrl; |
||
67 | |||
68 | |||
69 | extern void SPI_MasterInit(void); |
||
70 | extern void SPI_StartTransmitPacket(void); |
||
71 | extern void UpdateSPI_Buffer(void); |
||
72 | extern void SPI_TransmitByte(void); |
||
597 | ingob | 73 | #else |
304 | ingob | 74 | |
75 | |||
597 | ingob | 76 | // -------------------------------- Dummy ----------------------------------------- |
77 | #define SPI_MasterInit() ; |
||
78 | #define SPI_StartTransmitPacket() ; |
||
79 | #define UpdateSPI_Buffer() ; |
||
80 | #define SPI_TransmitByte() ; |
||
81 | #endif |
||
304 | ingob | 82 | |
597 | ingob | 83 | |
84 | #endif |