Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of CANnucleo by
Diff: CAN.cpp
- Revision:
- 11:439f3a34c42e
- Parent:
- 10:227a455d0f9f
- Child:
- 14:0344705e6fb8
--- a/CAN.cpp Sat Dec 05 10:18:24 2015 +0000
+++ b/CAN.cpp Tue Dec 22 18:19:16 2015 +0000
@@ -185,22 +185,26 @@
* To set up filter #0 we call:
* can.filter(0x0207 << 21, 0xFFE00004, CANAny, 0);
*
- * Only these bits of filter id are compared with the corresponding
+ * Only these bits of filter id are compared with the corresponding
* bits of received message (the others are disregarded)
- * │
- * ┌┬┬┬┬┬┬┬─┬┬┬───┴────────────────┐
+ * |
+ * ---------------------------------
+ * |||||||| ||| |
* Filter mask = 11111111 11100000 00000000 00000100 (= 0xFFE00004)
* Filter id = 01000000 11100000 00000000 00000000 (= 0x40E00000)
- * └┴┴┴┴┴┴┴─┴┴┴───┬────────────────┘
- * │
- * To receive the message the values of these bits must match.
- * Otherwise the message is passed to the next filter or
+ * |||||||| ||| |
+ * ---------------------------------
+ * |
+ * To receive the message the values of these bits must match.
+ * Otherwise the message is passed to the next filter or
* discarded if this was the last active filter.
- * │
- * ┌┬┬┬┬┬┬┬─┬┬┬───┴────────────────┐
+ * |
+ * ---------------------------------
+ * |||||||| ||| |
* Received id = 01000000 11100000 00000000 00000010 (= 0x40E00002)
- * └┴┴┴┴─┴┴┴┴┴┴┼┴─┴┴┴┴┴─┴┘
- * │
+ * ||||| |||||||| ||||| ||
+ * -----------------------
+ * |
* These bits are disregarded (masked).
* They can have arbitrary values.
*
@@ -225,12 +229,20 @@
* @retval
*/
void CAN::attach(void (*fptr) (void), IrqType type) {
+#if defined(TARGET_NUCLEO_F103RB)
HAL_NVIC_DisableIRQ(USB_LP_CAN1_RX0_IRQn);
+#elif defined(TARGET_NUCLEO_F303RE)
+ HAL_NVIC_DisableIRQ(CAN_RX1_IRQn);
+#endif
if(fptr) {
can_irq_set(fptr);
}
can_irq_init(&_can, &CAN::_irq_handler, (uint32_t) this);
- HAL_NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn);
+#if defined(TARGET_NUCLEO_F103RB)
+ HAL_NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn);
+#elif defined(TARGET_NUCLEO_F303RE)
+ HAL_NVIC_EnableIRQ(CAN_RX1_IRQn);
+#endif
}
/**
@@ -250,3 +262,4 @@
+
