Int32 processInputStreamISR() { Byte c = 0; Int32 r; do { //err_code = app_uart_get(&c); //if( err_code != NRF_SUCCESS) // break; r = serLow_rxStreamPop(ref c); // r = maikonC_rxStreamPop(&c); if (r != 1) break; r = 0; if (guess_PktType == epktType_t.ePkt_Unknown) { m_uartRx_c1 = m_uartRx_c0; m_uartRx_c0 = c; if (m_uartRx_c0 == 0xC0) { guess_PktType = epktType_t.ePkt_0xC0; blk_uart_On_UartRx(0xC0); } if (m_uartRx_c0 == 0x01) { guess_PktType = epktType_t.ePkt_0x01; blk_uart_On_UartRx(0x01); } if ((m_uartRx_c1 == (Byte)'T') && (m_uartRx_c0 == (Byte)'2')) { guess_PktType = epktType_t.ePkt_T2; blk_uart_On_UartRx((Byte)'T'); blk_uart_On_UartRx((Byte)'2'); } if ((m_uartRx_c1 == 'K') && (m_uartRx_c0 == '2')) { guess_PktType = epktType_t.ePkt_K2; blk_uart_On_UartRx((Byte)'K'); blk_uart_On_UartRx((Byte)'2'); } } else { r = blk_uart_On_UartRx(c); if (r == 1) break; } } while (true); return (42);//( r ); }
//============================================================================= int maikonC_main_proc() { int r = 0; r = processInputStreamISR(); if (g_Flag_frame01_rx_done) { g_Flag_frame01_rx_done = false; guess_PktType =epktType_t.ePkt_Unknown; //proc01_process_rxframe(uartUni_buffer); sendToBLE_(rxB, rxB_rdPtr, rxB_wrPtr); rxB_rdPtr = 0; rxB_wrPtr = 0; } if (g_Flag_frameT2_rx_done) { g_Flag_frameT2_rx_done = false; guess_PktType = epktType_t.ePkt_Unknown; //procT2_process_rxframe(uartUni_buffer); sendToBLE_(rxB, rxB_rdPtr, rxB_wrPtr); rxB_rdPtr = 0; rxB_wrPtr = 0; } proc_otherProcessing(); r = processOutputStreamISR(); return (r); }