Beispiel #1
0
/**
 * @brief	Disables the CAN1 interface
 * @param	None
 * @retval	None
 */
static ErrorStatus prvDisableCan1Interface()
{
	/*##-1- Reset peripherals ##################################################*/
	__CAN1_FORCE_RESET();
	__CAN1_RELEASE_RESET();

	/*##-2- Disable the NVIC for CAN reception #################################*/
	HAL_NVIC_DisableIRQ(CAN1_RX0_IRQn);
	HAL_NVIC_DisableIRQ(CAN1_TX_IRQn);

	return SUCCESS;
}
Beispiel #2
0
STATIC void can_deinit(pyb_can_obj_t *can_obj) {
    can_obj->is_enabled = false;
    CAN_HandleTypeDef *can = &can_obj->can;
    HAL_CAN_DeInit(can);
    if (can->Instance == CAN1) {
        __CAN1_FORCE_RESET();
        __CAN1_RELEASE_RESET();
        __CAN1_CLK_DISABLE();
    } else if (can->Instance == CAN2) {
        __CAN2_FORCE_RESET();
        __CAN2_RELEASE_RESET();
        __CAN2_CLK_DISABLE();
    }
}