Commit 9650727e authored by Papy's avatar Papy Committed by Nicolas Pouillon

library/boards/brain: add canbus declarations

parent 1af05589
......@@ -31,6 +31,10 @@
CONFIG_DRIVER_I2C_BITBANG
%end
%subsection canbus
CONFIG_DRIVER_STM32_CANBUS
%end
%section bmaaa-pinky
%inherit nrf51-xxac
......
......@@ -29,6 +29,7 @@
#include <device/class/timer.h>
#include <device/class/canbus.h>
#include <device/class/i2c.h>
#include <device/class/canbus.h>
#include <arch/stm32/irq.h>
#include <arch/stm32/mmap.h>
......@@ -159,6 +160,27 @@ DEV_DECLARE_STATIC(i2c_dev, "i2c0", 0, i2c_bitbang_drv,
);
#endif
#if defined(CONFIG_DRIVER_STM32_CANBUS)
/* CAN bus controller */
DEV_DECLARE_STATIC(canbus_dev, "canbus1", 0, stm32_canbus_drv,
DEV_STATIC_RES_MEM(STM32_BXCAN_ADDR, STM32_BXCAN_ADDR + STM32_BXCAN_SIZE),
DEV_STATIC_RES_FREQ(36000000, 1),
DEV_STATIC_RES_DEV_ICU("/cpu"),
DEV_STATIC_RES_IRQ(0, STM32_IRQ_CAN1_RX0, DEV_IRQ_SENSE_HIGH_LEVEL, 0, 0x1),
DEV_STATIC_RES_IRQ(1, STM32_IRQ_CAN1_RX1, DEV_IRQ_SENSE_HIGH_LEVEL, 0, 0x1),
DEV_STATIC_RES_IRQ(2, STM32_IRQ_CAN1_TX, DEV_IRQ_SENSE_HIGH_LEVEL, 0, 0x1),
DEV_STATIC_RES_IRQ(3, STM32_IRQ_CAN1_SCE, DEV_IRQ_SENSE_HIGH_LEVEL, 0, 0x1),
DEV_STATIC_RES_DEV_IOMUX("/gpio"),
DEV_STATIC_RES_IOMUX("rx", 0, STM32_PD0, 0, 0),
DEV_STATIC_RES_IOMUX("tx", 0, STM32_PD1, 0, 0),
DEV_STATIC_RES_CANBUS_INFO(500000 /* 500kbps */, 2 /* meters */)
);
#endif
#include <hexo/endian.h>
#include <hexo/iospace.h>
#include <arch/stm32/f1/rcc.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment