Subversion Repositories NaviCtrl

Rev

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

Rev 194 Rev 195
Line 265... Line 265...
265
void UART1_IRQHandler(void)
265
void UART1_IRQHandler(void)
266
{
266
{
267
        static u8 abortState = 0;
267
        static u8 abortState = 0;
268
        u8 c;
268
        u8 c;
Line -... Line 269...
-
 
269
 
-
 
270
        IENABLE;
269
 
271
 
270
        if((UART_GetITStatus(UART1, UART_IT_Receive) != RESET) || (UART_GetITStatus(UART1, UART_IT_ReceiveTimeOut) != RESET) )
272
        if((UART_GetITStatus(UART1, UART_IT_Receive) != RESET) || (UART_GetITStatus(UART1, UART_IT_ReceiveTimeOut) != RESET) )
271
        {
273
        {
272
                // clear the pending bits!
274
                // clear the pending bits!
273
                UART_ClearITPendingBit(UART1, UART_IT_Receive);
275
                UART_ClearITPendingBit(UART1, UART_IT_Receive);
Line 334... Line 336...
334
                                        //fifo_purge(&UART1_rx_fifo); // flush the whole buffer
336
                                        //fifo_purge(&UART1_rx_fifo); // flush the whole buffer
335
                                }
337
                                }
336
                        } // EOF while some byes in the hardware fifo
338
                        } // EOF while some byes in the hardware fifo
337
                } // eof DebugUart = UART1
339
                } // eof DebugUart = UART1
338
        }
340
        }
-
 
341
 
-
 
342
        IDISABLE;
339
}
343
}
Line 340... Line 344...
340
 
344
 
341
/**************************************************************/
345
/**************************************************************/
342
/* Process incomming data from debug uart                     */
346
/* Process incomming data from debug uart                     */
Line 371... Line 375...
371
                                Buffer_Copy(&UART1_rx_buffer, &UART2_tx_buffer); //forward to FC
375
                                Buffer_Copy(&UART1_rx_buffer, &UART2_tx_buffer); //forward to FC
372
                                Buffer_Clear(&UART1_rx_buffer); // free rc buffer for next frame
376
                                Buffer_Clear(&UART1_rx_buffer); // free rc buffer for next frame
373
                                return; //end process rx data
377
                                return; //end process rx data
374
                        break;
378
                        break;
375
                }
379
                }
376
        }      
380
        }
Line 377... Line 381...
377
 
381
 
378
        MKProtocol_DecodeSerialFrameData(&UART1_rx_buffer, &SerialMsg); // decode serial frame in rxd buffer
382
        MKProtocol_DecodeSerialFrameData(&UART1_rx_buffer, &SerialMsg); // decode serial frame in rxd buffer
379
    if(SerialMsg.CmdID != 'z') SerialLinkOkay = 250;      // reset SerialTimeout, but not in case of the "ping"
383
    if(SerialMsg.CmdID != 'z') SerialLinkOkay = 250;      // reset SerialTimeout, but not in case of the "ping"
380
        switch(SerialMsg.Address) // check for Slave Address
384
        switch(SerialMsg.Address) // check for Slave Address
Line 497... Line 501...
497
                        /*
501
                        /*
498
                        case 'b': // submit extern control
502
                        case 'b': // submit extern control
499
                                memcpy(&ExternControl, SerialMsg.pData, sizeof(ExternControl));
503
                                memcpy(&ExternControl, SerialMsg.pData, sizeof(ExternControl));
500
                                UART1_ConfirmFrame = ExternControl.Frame;
504
                                UART1_ConfirmFrame = ExternControl.Frame;
501
                                break;
505
                                break;
502
                        */     
506
                        */
503
                        case 'd': // request for debug data;
507
                        case 'd': // request for debug data;
504
                                UART1_DebugData_Interval = (u32) SerialMsg.pData[0] * 10;
508
                                UART1_DebugData_Interval = (u32) SerialMsg.pData[0] * 10;
505
                                if(UART1_DebugData_Interval > 0) UART1_Request_DebugData = TRUE;
509
                                if(UART1_DebugData_Interval > 0) UART1_Request_DebugData = TRUE;
506
                                break;
510
                                break;
Line 516... Line 520...
516
                        */
520
                        */
517
                        case 'h':// reqest for display line
521
                        case 'h':// reqest for display line
518
                                if((SerialMsg.pData[0]& 0x80) == 0x00)// old format
522
                                if((SerialMsg.pData[0]& 0x80) == 0x00)// old format
519
                                {
523
                                {
520
                                        UART1_DisplayLine = 2;
524
                                        UART1_DisplayLine = 2;
521
                                        UART1_Display_Interval = 0;    
525
                                        UART1_Display_Interval = 0;
522
                                }
526
                                }
523
                                else
527
                                else
524
                                {
528
                                {
525
                                        RemoteKeys |= ~SerialMsg.pData[0];
529
                                        RemoteKeys |= ~SerialMsg.pData[0];
526
                                        UART1_Display_Interval = (u32) SerialMsg.pData[1] * 10;
530
                                        UART1_Display_Interval = (u32) SerialMsg.pData[1] * 10;
Line 684... Line 688...
684
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'G', NC_ADDRESS, 1, (u8 *)&ExternControl, sizeof(ExternControl));
688
                MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'G', NC_ADDRESS, 1, (u8 *)&ExternControl, sizeof(ExternControl));
685
                UART1_Request_ExternalControl = FALSE;
689
                UART1_Request_ExternalControl = FALSE;
686
        }
690
        }
687
        */
691
        */
688
        else if( (( (UART1_Display_Interval > 0) && CheckDelay(UART1_Display_Timer)) || UART1_Request_Display) && (UART1_tx_buffer.Locked == FALSE))
692
        else if( (( (UART1_Display_Interval > 0) && CheckDelay(UART1_Display_Timer)) || UART1_Request_Display) && (UART1_tx_buffer.Locked == FALSE))
689
        {      
693
        {
690
                if(UART1_DisplayLine > 3)
694
                if(UART1_DisplayLine > 3)
691
                {
695
                {
692
                        LCD_PrintMenu();
696
                        LCD_PrintMenu();
693
                        MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'H', NC_ADDRESS, 1, (u8*)DisplayBuff, sizeof(DisplayBuff));
697
                        MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'H', NC_ADDRESS, 1, (u8*)DisplayBuff, sizeof(DisplayBuff));
694
                }
698
                }