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.
This commit is contained in:
parent
5af89ae596
commit
d9615a2eb7
@ -36,18 +36,7 @@ LGPL License Terms @ref lgpl_license
|
||||
*/
|
||||
|
||||
#include <libopencm3/stm32/can.h>
|
||||
|
||||
#if defined(STM32F1)
|
||||
# include <libopencm3/stm32/f1/rcc.h>
|
||||
#elif defined(STM32F2)
|
||||
# include <libopencm3/stm32/f2/rcc.h>
|
||||
#elif defined(STM32F3)
|
||||
# include <libopencm3/stm32/f3/rcc.h>
|
||||
#elif defined(STM32F4)
|
||||
# include <libopencm3/stm32/f4/rcc.h>
|
||||
#else
|
||||
# error "stm32 family not defined."
|
||||
#endif
|
||||
#include <libopencm3/stm32/rcc.h>
|
||||
|
||||
/* 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
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user