Subversion Repositories FlightCtrl

Rev

Rev 304 | Rev 597 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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