Rev 304 | Rev 597 | Go to most recent revision | Show entire file | Regard 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 |
|
Line 50... | Line 48... | ||
50 | { SPI_Buffer[SPI_BufferIndex]= SPDR; // get data |
48 | // if (SPI_BufferIndex < 32 ) DebugOut.Analog[26+SPI_BufferIndex] = SPI_Buffer[SPI_BufferIndex]; |
51 | 49 | ||
Line 52... | Line 50... | ||
52 | //if(SPDR!= 0x00) DebugOut.Analog[19]++; ; |
50 | //if(SPDR!= 0x00) DebugOut.Analog[19]++; ; |
Line 57... | Line 55... | ||
57 | 55 | ||
58 | } |
56 | } |
59 | else |
57 | else |
60 | { |
58 | { |
61 | unsigned char *ptr = (unsigned char *)&FromNaviCtrl; |
- | |
Line 62... | Line 59... | ||
62 | unsigned char i; |
59 | unsigned char *ptr = (unsigned char *)&FromNaviCtrl; |
63 | - | ||
64 | SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave |
60 | |
65 | 61 | SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave |
|
Line 66... | Line 62... | ||
66 | memcpy(ptr, (unsigned char *) SPI_Buffer, sizeof(SPI_Buffer)); |
62 | memcpy(ptr, (unsigned char *) SPI_Buffer, sizeof(SPI_Buffer)); |
67 | } |
63 | } |