/* Returns the LSB of the 9-bit CANx Transmit Error Counter(TEC).  */
uint8_t CAN_Peli_GetLSBTransmitErrorCounter(CAN_TypeDef *CANx)
/* Returns the LSB of the 9-bit CANx Transmit Error Counter(TEC).  */
uint8_t CAN_Peli_GetLSBTransmitErrorCounter(CAN_TypeDef *CANx)
{
    uint8_t counter = 0;
    assert_param(IS_CAN_ALL_PERIPH(CANx));
        switch (*(uint32_t*)&CANx)
            {
                    case CAN1_BASE:
                            counter = (uint8_t)(CAN1_PELI->TXERR);
                            break;
                    case CAN2_BASE:
                            counter = (uint8_t)(CAN2_PELI->TXERR);
                            break;
                    default:
                            break;
            }
    return counter;
}