Subversion Repositories NaviCtrl

Rev

Rev 362 | Rev 380 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 362 Rev 378
Line 75... Line 75...
75
#include "params.h"
75
#include "params.h"
76
#include "fifo.h"
76
#include "fifo.h"
77
#include "debug.h"
77
#include "debug.h"
78
#include "spi_slave.h"
78
#include "spi_slave.h"
79
#include "ftphelper.h"
79
#include "ftphelper.h"
-
 
80
#include "led.h"
Line 80... Line 81...
80
 
81
 
81
#define FALSE   0
82
#define FALSE   0
Line 82... Line 83...
82
#define TRUE    1
83
#define TRUE    1
Line 112... Line 113...
112
u32 UART1_FollowMe_Timer        = 0;
113
u32 UART1_FollowMe_Timer        = 0;
113
Point_t FollowMe;
114
Point_t FollowMe;
114
#endif
115
#endif
Line 115... Line 116...
115
 
116
 
116
// the primary rx fifo
117
// the primary rx fifo
117
#define UART1_RX_FIFO_LEN 512
118
#define UART1_RX_FIFO_LEN 1024
118
u8 UART1_rxfifobuffer[UART1_RX_FIFO_LEN];
119
u8 UART1_rxfifobuffer[UART1_RX_FIFO_LEN];
Line 119... Line 120...
119
fifo_t UART1_rx_fifo;
120
fifo_t UART1_rx_fifo;
120
 
121
 
121
// the rx buffer
122
// the rx buffer
122
#define UART1_RX_BUFFER_LEN  150
123
#define UART1_RX_BUFFER_LEN  1024
Line 123... Line 124...
123
u8 UART1_rbuffer[UART1_RX_BUFFER_LEN];
124
u8 UART1_rbuffer[UART1_RX_BUFFER_LEN];
124
Buffer_t UART1_rx_buffer;
125
Buffer_t UART1_rx_buffer;
Line 350... Line 351...
350
                        } // EOF while some byes in the hardware fifo
351
                        } // EOF while some byes in the hardware fifo
351
                } // eof DebugUart = UART1
352
                } // eof DebugUart = UART1
352
        }
353
        }
Line 353... Line 354...
353
 
354
 
-
 
355
        IDISABLE;
354
        IDISABLE;
356
        VIC1->VAR = 0xFF; // write any value to VIC1 Vector address register
Line 355... Line 357...
355
}
357
}
356
 
358
 
357
/**************************************************************/
359
/**************************************************************/
358
/* Process incomming data from debug uart                     */
360
/* Process incomming data from debug uart                     */
359
/**************************************************************/
361
/**************************************************************/
360
void UART1_ProcessRxData(void)
362
void UART1_ProcessRxData(void)
361
{
363
{
362
        // return on forwarding uart  or unlocked rx buffer
-
 
363
        if(DebugUART != UART1) return;
364
        // return on forwarding uart  or unlocked rx buffer
364
 
365
        if(DebugUART != UART1) return;
365
        u8 c;
366
        u8 c;
366
        // if rx buffer is not locked
367
        // if rx buffer is not locked
367
        if(UART1_rx_buffer.Locked == FALSE)
368
        if(UART1_rx_buffer.Locked == FALSE)
Line 662... Line 663...
662
                        }
663
                        }
663
                }
664
                }
664
        }
665
        }
665
}
666
}
Line -... Line 667...
-
 
667
 
666
 
668
 
667
/**************************************************************/
669
/**************************************************************/
668
/* Send the answers to incomming commands at the debug uart   */
670
/* Send the answers to incomming commands at the debug uart   */
669
/**************************************************************/
671
/**************************************************************/
670
void UART1_TransmitTxData(void)
672
void UART1_TransmitTxData(void)
Line 676... Line 678...
676
        {
678
        {
677
                UART1_DebugData_Interval = 0;
679
                UART1_DebugData_Interval = 0;
678
                UART1_NaviData_Interval = 0;
680
                UART1_NaviData_Interval = 0;
679
                UART1_Data3D_Interval = 0;
681
                UART1_Data3D_Interval = 0;
680
                UART1_Display_Interval = 0;
682
                UART1_Display_Interval = 0;
-
 
683
                UART1_MotorData_Interval = 0;
681
        }
684
        }
Line 682... Line 685...
682
 
685
 
683
        UART1_Transmit(); // output pending bytes in tx buffer
686
        UART1_Transmit(); // output pending bytes in tx buffer
Line 725... Line 728...
725
                UART1_Request_DebugLabel = 0xFF;
728
                UART1_Request_DebugLabel = 0xFF;
726
        }
729
        }
727
        else if(( ((UART1_NaviData_Interval > 0) && CheckDelay(UART1_NaviData_Timer) ) || UART1_Request_NaviData) && (UART1_tx_buffer.Locked == FALSE))
730
        else if(( ((UART1_NaviData_Interval > 0) && CheckDelay(UART1_NaviData_Timer) ) || UART1_Request_NaviData) && (UART1_tx_buffer.Locked == FALSE))
728
        {
731
        {
729
                NaviData.Errorcode = ErrorCode;
732
                NaviData.Errorcode = ErrorCode;
730
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS,1, (u8 *)&NaviData, sizeof(NaviData));
733
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS, 1 , (u8 *)&NaviData, sizeof(NaviData));
731
                UART1_NaviData_Timer = SetDelay(UART1_NaviData_Interval);
734
                UART1_NaviData_Timer = SetDelay(UART1_NaviData_Interval);
732
                UART1_Request_NaviData = FALSE;
735
                UART1_Request_NaviData = FALSE;
733
                LastTransmittedFCStatusFlags2 = NaviData.FCStatusFlags2;
736
                LastTransmittedFCStatusFlags2 = NaviData.FCStatusFlags2;
734
        }
737
        }
735
        else if( (( (UART1_DebugData_Interval > 0) && CheckDelay(UART1_DebugData_Timer)) || UART1_Request_DebugData) && (UART1_tx_buffer.Locked == FALSE))
738
        else if( (( (UART1_DebugData_Interval > 0) && CheckDelay(UART1_DebugData_Timer)) || UART1_Request_DebugData) && (UART1_tx_buffer.Locked == FALSE))