System Management code

Dependencies:   CANBuffer mbed SystemManagement mbed-rtos

Dependents:   SystemManagement

System Management code for Penn Electric Racing

Functions:

Controls Fans and Pumps via instruction from CAN Messages, ramps them up over time to prevent damage

Turns on/off DC-DC converter via instruction from CAN Messages

CAN_Filter_LUT.h

Committer:
martydd3
Date:
2014-10-10
Revision:
7:5f6e31faa08e
Parent:
2:baeb80c778f7

File content as of revision 7:5f6e31faa08e:

/*
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
 
#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
  ( 0x400        & STDMASK | 1<<13) << 16 | ( 0x4FF        & STDMASK | 1<<13),  // Index1
};
 
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