pub
Fork of CANnucleo by
Diff: CAN.cpp
- Revision:
- 10:227a455d0f9f
- Parent:
- 9:e9224f2c6d37
- Child:
- 11:439f3a34c42e
--- a/CAN.cpp Sat Oct 31 18:40:03 2015 +0000 +++ b/CAN.cpp Sat Dec 05 10:18:24 2015 +0000 @@ -17,7 +17,6 @@ * */ #include "CAN.h" -//#if DEVICE_CAN #include "cmsis.h" namespace mbed @@ -163,12 +162,15 @@ * IDE - Identifier Extension bit * RTR - Remote Transmission Request bit * - * 1 : bit is considered - * 0 : bit is disregarded + * 1 -> bit is considered + * 0 -> bit is disregarded * - * Example of filter set-up and filtering: - * - * Let's assume we would like to receive only messages with standard identifier STID = 0x0207 (STID[15:0] = 00000010 00000111) + * ---------------------------------------- + * Example of filter set up and filtering: + * ---------------------------------------- +* + * Let's assume we would like to receive only messages + * with standard identifier STID = 0x0207 (STID[15:0] = 00000010 00000111) * * We map the STID to filter ID by shifting the bits appropriately: * Filter id = STID << (16 + (15 - 10)) = STID << 21 = 01000000 11100000 00000000 00000000 = 0x40E00000 @@ -185,24 +187,20 @@ * * 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 * 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. *