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:
- 14:0344705e6fb8
- Parent:
- 11:439f3a34c42e
- Child:
- 21:bcd8161f8f6c
diff -r a3e2be3d49a2 -r 0344705e6fb8 CAN.cpp --- a/CAN.cpp Wed Dec 23 10:37:01 2015 +0000 +++ b/CAN.cpp Sun Dec 27 09:02:47 2015 +0000 @@ -177,6 +177,10 @@ * * To compare only the bits representing STID we set the filter mask adequately: * Filter mask = 11111111 11100000 00000000 00000100 = 0xFFE00004 + * |||||||| ||| | + * -------- --- | + * | | | + * STID[10:3] STID[2:0] IDE * * Keep in mind that filter #0 was already set up in the constructor to receive all CAN messages by default. * So we have to reconfigure it. If we were set up filter #1 here then filter #0 would receive all the messages @@ -185,7 +189,7 @@ * 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 (set to 1) of filter id are compared with the corresponding * bits of received message (the others are disregarded) * | * --------------------------------- @@ -205,7 +209,7 @@ * ||||| |||||||| ||||| || * ----------------------- * | - * These bits are disregarded (masked). + * These bits (set to 0 in filter mask) are disregarded (masked). * They can have arbitrary values. * * NOTE: For the meaning of individual bits see the mapping of 32-bits explained above. @@ -229,20 +233,12 @@ * @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 + HAL_NVIC_DisableIRQ(CAN_IRQ); if(fptr) { can_irq_set(fptr); } can_irq_init(&_can, &CAN::_irq_handler, (uint32_t) this); -#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 + HAL_NVIC_EnableIRQ(CAN_IRQ); } /**