Rev 304 | Rev 597 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 304 | Rev 596 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | SLAVE_SELECT_PORT &= ~(1 << SPI_SLAVE_SELECT); // SelectSlave |
26 | SLAVE_SELECT_PORT &= ~(1 << SPI_SLAVE_SELECT); // SelectSlave |
27 | UpdateSPI_Buffer(); // update buffer |
27 | UpdateSPI_Buffer(); // update buffer |
28 | SPI_BufferIndex = 1; |
28 | SPI_BufferIndex = 1; |
29 | DebugOut.Analog[16]++; |
29 | DebugOut.Analog[16]++; |
30 | // -- Debug-Output --- |
30 | // -- Debug-Output --- |
31 | cli(); |
- | |
32 | DebugOut.Analog[20] = FromNaviCtrl.Comp; |
31 | /* DebugOut.Analog[20] = FromNaviCtrl.Comp; |
33 | DebugOut.Analog[21] = FromNaviCtrl.GPS_Nick; |
32 | DebugOut.Analog[21] = FromNaviCtrl.GPS_Nick; |
34 | DebugOut.Analog[22] = FromNaviCtrl.GPS_Roll; |
33 | DebugOut.Analog[22] = FromNaviCtrl.GPS_Roll; |
35 | DebugOut.Analog[23] = FromNaviCtrl.CompassValue; |
34 | DebugOut.Analog[23] = FromNaviCtrl.CompassValue; |
36 | sei(); |
- | |
37 | - | ||
38 | 35 | */ |
|
39 | //---- |
36 | //---- |
40 | SPDR = ToNaviCtrl.Comp; // Start transmission |
37 | SPDR = ToNaviCtrl.Comp; // Start transmission |
41 | } |
38 | } |
Line 42... | Line 39... | ||
42 | 39 | ||
Line 46... | Line 43... | ||
46 | { |
43 | { |
47 | if (!(SPSR & (1 << SPIF))) return; |
44 | if (!(SPSR & (1 << SPIF))) return; |
Line 48... | Line 45... | ||
48 | 45 | ||
49 | if (SPI_BufferIndex < sizeof(FromNaviCtrl)) |
46 | if (SPI_BufferIndex < sizeof(FromNaviCtrl)) |
- | 47 | { SPI_Buffer[SPI_BufferIndex]= SPDR; // get data |
|
50 | { SPI_Buffer[SPI_BufferIndex]= SPDR; // get data |
48 | // if (SPI_BufferIndex < 32 ) DebugOut.Analog[26+SPI_BufferIndex] = SPI_Buffer[SPI_BufferIndex]; |
51 | 49 | ||
52 | //if(SPDR!= 0x00) DebugOut.Analog[19]++; ; |
50 | //if(SPDR!= 0x00) DebugOut.Analog[19]++; ; |
Line 53... | Line 51... | ||
53 | } |
51 | } |
54 | 52 | ||
Line 55... | Line 53... | ||
55 | if (SPI_BufferIndex < sizeof(ToNaviCtrl)) |
53 | if (SPI_BufferIndex < sizeof(ToNaviCtrl)) |
56 | { SPDR = Ptr_buffer[SPI_BufferIndex]; |
54 | { SPDR = Ptr_buffer[SPI_BufferIndex]; |
57 | 55 | ||
58 | } |
56 | } |
59 | else |
- | |
60 | { |
- | |
61 | unsigned char *ptr = (unsigned char *)&FromNaviCtrl; |
- | |
Line -... | Line 57... | ||
- | 57 | else |
|
62 | unsigned char i; |
58 | { |
63 | 59 | unsigned char *ptr = (unsigned char *)&FromNaviCtrl; |
|
Line 64... | Line 60... | ||
64 | SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave |
60 | |
65 | 61 | SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave |