From d9615a2eb72894c1684ab47bb306c78a220bc0b0 Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Mon, 8 May 2017 22:48:38 +0000 Subject: [PATCH] stm32: can: update to modern includes and apis No functional change. But allows automatic functionality on platforms that support CAN with only makefile changes now. --- lib/stm32/can.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/lib/stm32/can.c b/lib/stm32/can.c index a7ca00fd..d1621674 100644 --- a/lib/stm32/can.c +++ b/lib/stm32/can.c @@ -36,18 +36,7 @@ LGPL License Terms @ref lgpl_license */ #include - -#if defined(STM32F1) -# include -#elif defined(STM32F2) -# include -#elif defined(STM32F3) -# include -#elif defined(STM32F4) -# include -#else -# error "stm32 family not defined." -#endif +#include /* Timeout for CAN INIT acknowledge * this value is difficult to define. @@ -74,12 +63,10 @@ can_reg_base. void can_reset(uint32_t canport) { if (canport == CAN1) { - rcc_peripheral_reset(&RCC_APB1RSTR, RCC_APB1RSTR_CAN1RST); - rcc_peripheral_clear_reset(&RCC_APB1RSTR, RCC_APB1RSTR_CAN1RST); + rcc_periph_reset_pulse(RCC_CAN1); } else { #if defined(BX_CAN2_BASE) - rcc_peripheral_reset(&RCC_APB1RSTR, RCC_APB1RSTR_CAN2RST); - rcc_peripheral_clear_reset(&RCC_APB1RSTR, RCC_APB1RSTR_CAN2RST); + rcc_periph_reset_pulse(RCC_CAN2); #endif } }