/*----------------------------------------------------------------------------- * check for new received bus telegram * return codes: * BUS_NO_MSG no telegram in progress * BUS_MSG_OK telegram received completely * BUS_MSG_RXING telegram receiving in progress * BUS_MSG_ERROR errorous telegram received (checksum error) */ uint8_t BusCheck(void) { static uint8_t ret = BUS_NO_MSG; uint8_t ch; uint8_t retTmp; uint8_t numRxChar; numRxChar = SioRead(&ch); if (numRxChar != 0) { ret = BusDecode(ch); if ((ret == BUS_MSG_ERROR) || (ret == BUS_MSG_OK)) { retTmp = ret; ret = BUS_NO_MSG; return retTmp; } } return ret; }
/*----------------------------------------------------------------------------- * check for new received bus telegram * return codes: * BUS_NO_MSG no telegram in progress * BUS_MSG_OK telegram received completely * BUS_MSG_RXING telegram receiving in progress * BUS_MSG_ERROR errorous telegram received (checksum error) */ UINT8 BusCheck(void) { static UINT8 ret = BUS_NO_MSG; UINT8 ch; UINT8 retTmp; UINT8 numRxChar; numRxChar = SioRead(&ch); if (numRxChar != 0) { ret = BusDecode(ch); if ((ret == BUS_MSG_ERROR) || (ret == BUS_MSG_OK)) { retTmp = ret; ret = BUS_NO_MSG; return retTmp; } } return ret; }