System Management code
Dependencies: mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP
Fork of SystemManagement by
IOobjects/CAN_Filter_LUT.h
- Committer:
- pspatel321
- Date:
- 2015-02-11
- Revision:
- 39:ddf38df9699e
- Parent:
- 33:6bc82b6b62e5
File content as of revision 39:ddf38df9699e:
/* Code by Parth Patel, Penn Electric Racing 2014, 9/23/2014 This library provides an easy to use, buffered, hardware-filtered CAN interface for high performance CAN applications. Provides automatic reception of messages via CAN RX interrupt into a rx ring buffer. Provides automatic transmission of messages via CAN TX interrupt. @File CAN_Filter_LUT.h: Contains the formatted lookup tables to program the onboard CAN acceptance filters */ #ifndef _FILE_CAN_FILTER_LUT_H #define _FILE_CAN_FILTER_LUT_H #include "CAN_RxIDs.h" #define STDMASK 0x7FF #define EXTMASK 0x1FFFFFFF // These arrays defines the CAN Controller Acceptance Filter Lookup Table. // Follow notes below or else the chip's behaviour will be undefined // MAX SIZE PERMITTED = 512 32bit ints total across all tables // Note that AF_LUT_SEI is 16bit, divide #entries by 2 for this one // Note that AF_LUT_EIR is 64bit, multipy #entries by 2 for this one const uint16_t AF_LUT_SEI[] = { // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00) !! // STANDARD EXPLICIT IDs - CAN CONTROLLER 1 //( 0xID & STDMASK), // STANDARD EXPLICIT IDs - CAN CONTROLLER 2 //( 0xID & STDMASK) | 1<<13, }; const uint32_t AF_LUT_SIR[] = { // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00), NO OVERLAPPING RANGES !! // STANDARD ID RANGES - CAN CONTROLLER 1 //( 0xLOWERBOUND & STDMASK) << 16 | ( 0xUPPERBOUND & STDMASK), lower/upperbounds are inclusive // STANDARD ID RANGES - CAN CONTROLLER 2 //( 0xLOWERBOUND & STDMASK | 1<<13) << 16 | ( 0xUPPERBOUND & STDMASK | 1<<13), lower/upperbounds are inclusive ( 0x200 & STDMASK | 1<<13) << 16 | ( 0x7FF & STDMASK | 1<<13), //lower/upperbounds are inclusive, 0x200 to 0x7FF includes everything except motor controller messages }; const uint32_t AF_LUT_EEI[] = { // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00) !! // EXTENDED EXPLICIT IDs - CAN CONTROLLER 1 //( 0xID & EXTMASK), // EXTENDED EXPLICIT IDs - CAN CONTROLLER 2 //( 0xID & EXTMASK) | 1<<29, }; const uint64_t AF_LUT_EIR[] = { // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00), NO OVERLAPPING RANGES !! // EXTENDED ID RANGES - CAN CONTROLLER 1 //( 0xLOWERBOUND & EXTMASK) << 32 | ( 0xUPPERBOUND & EXTMASK), lower/upperbounds are inclusive // EXTENDED ID RANGES - CAN CONTROLLER 2 //( 0xLOWERBOUND & EXTMASK | 1<<29) << 32 | ( 0xUPPERBOUND & EXTMASK | 1<<29), lower/upperbounds are inclusive }; #endif