/** * @brief Disables the CAN2 interface * @param None * @retval None */ static ErrorStatus prvDisableCan2Interface() { /*##-1- Reset peripherals ##################################################*/ __CAN2_FORCE_RESET(); __CAN2_RELEASE_RESET(); /*##-3- Disable the NVIC for CAN reception #################################*/ HAL_NVIC_DisableIRQ(CAN2_RX0_IRQn); return SUCCESS; }
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(); } }