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

Committer:
martydd3
Date:
Fri Oct 10 20:59:36 2014 +0000
Revision:
7:5f6e31faa08e
Parent:
2:baeb80c778f7
PollSwitch code;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
martydd3 2:baeb80c778f7 1 /*
martydd3 2:baeb80c778f7 2 Code by Parth Patel, Penn Electric Racing 2014, 9/23/2014
martydd3 2:baeb80c778f7 3
martydd3 2:baeb80c778f7 4 This library provides an easy to use, buffered, hardware-filtered CAN interface for
martydd3 2:baeb80c778f7 5 high performance CAN applications. Provides automatic reception of messages via CAN RX interrupt
martydd3 2:baeb80c778f7 6 into a rx ring buffer. Provides automatic transmission of messages via CAN TX interrupt.
martydd3 2:baeb80c778f7 7
martydd3 2:baeb80c778f7 8 @File CAN_Filter_LUT.h: Contains the formatted lookup tables to program the onboard CAN acceptance filters
martydd3 2:baeb80c778f7 9
martydd3 2:baeb80c778f7 10 */
martydd3 2:baeb80c778f7 11 #ifndef _FILE_CAN_FILTER_LUT_H
martydd3 2:baeb80c778f7 12 #define _FILE_CAN_FILTER_LUT_H
martydd3 2:baeb80c778f7 13
martydd3 2:baeb80c778f7 14 #define STDMASK 0x7FF
martydd3 2:baeb80c778f7 15 #define EXTMASK 0x1FFFFFFF
martydd3 2:baeb80c778f7 16
martydd3 2:baeb80c778f7 17 // These arrays defines the CAN Controller Acceptance Filter Lookup Table.
martydd3 2:baeb80c778f7 18 // Follow notes below or else the chip's behaviour will be undefined
martydd3 2:baeb80c778f7 19 // MAX SIZE PERMITTED = 512 32bit ints total across all tables
martydd3 2:baeb80c778f7 20 // Note that AF_LUT_SEI is 16bit, divide #entries by 2 for this one
martydd3 2:baeb80c778f7 21 // Note that AF_LUT_EIR is 64bit, multipy #entries by 2 for this one
martydd3 2:baeb80c778f7 22
martydd3 2:baeb80c778f7 23 const uint16_t AF_LUT_SEI[] = {
martydd3 2:baeb80c778f7 24 // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00) !!
martydd3 2:baeb80c778f7 25
martydd3 2:baeb80c778f7 26 // STANDARD EXPLICIT IDs - CAN CONTROLLER 1
martydd3 2:baeb80c778f7 27 //( 0xID & STDMASK),
martydd3 2:baeb80c778f7 28
martydd3 2:baeb80c778f7 29 // STANDARD EXPLICIT IDs - CAN CONTROLLER 2
martydd3 2:baeb80c778f7 30 //( 0xID & STDMASK) | 1<<13,
martydd3 2:baeb80c778f7 31 };
martydd3 2:baeb80c778f7 32
martydd3 2:baeb80c778f7 33 const uint32_t AF_LUT_SIR[] = {
martydd3 2:baeb80c778f7 34 // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00), NO OVERLAPPING RANGES !!
martydd3 2:baeb80c778f7 35
martydd3 2:baeb80c778f7 36 // STANDARD ID RANGES - CAN CONTROLLER 1
martydd3 2:baeb80c778f7 37 //( 0xLOWERBOUND & STDMASK) << 16 | ( 0xUPPERBOUND & STDMASK), lower/upperbounds are inclusive
martydd3 2:baeb80c778f7 38
martydd3 2:baeb80c778f7 39 // STANDARD ID RANGES - CAN CONTROLLER 2
martydd3 2:baeb80c778f7 40 //( 0xLOWERBOUND & STDMASK | 1<<13) << 16 | ( 0xUPPERBOUND & STDMASK | 1<<13), lower/upperbounds are inclusive
martydd3 2:baeb80c778f7 41 ( 0x400 & STDMASK | 1<<13) << 16 | ( 0x4FF & STDMASK | 1<<13), // Index1
martydd3 2:baeb80c778f7 42 };
martydd3 2:baeb80c778f7 43
martydd3 2:baeb80c778f7 44 const uint32_t AF_LUT_EEI[] = {
martydd3 2:baeb80c778f7 45 // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00) !!
martydd3 2:baeb80c778f7 46
martydd3 2:baeb80c778f7 47 // EXTENDED EXPLICIT IDs - CAN CONTROLLER 1
martydd3 2:baeb80c778f7 48 //( 0xID & EXTMASK),
martydd3 2:baeb80c778f7 49
martydd3 2:baeb80c778f7 50 // EXTENDED EXPLICIT IDs - CAN CONTROLLER 2
martydd3 2:baeb80c778f7 51 //( 0xID & EXTMASK) | 1<<29,
martydd3 2:baeb80c778f7 52 };
martydd3 2:baeb80c778f7 53
martydd3 2:baeb80c778f7 54 const uint64_t AF_LUT_EIR[] = {
martydd3 2:baeb80c778f7 55 // !! ID's MUST BE IN ASCENDING ORDER (starting at 0x00), NO OVERLAPPING RANGES !!
martydd3 2:baeb80c778f7 56
martydd3 2:baeb80c778f7 57 // EXTENDED ID RANGES - CAN CONTROLLER 1
martydd3 2:baeb80c778f7 58 //( 0xLOWERBOUND & EXTMASK) << 32 | ( 0xUPPERBOUND & EXTMASK), lower/upperbounds are inclusive
martydd3 2:baeb80c778f7 59
martydd3 2:baeb80c778f7 60 // EXTENDED ID RANGES - CAN CONTROLLER 2
martydd3 2:baeb80c778f7 61 //( 0xLOWERBOUND & EXTMASK | 1<<29) << 32 | ( 0xUPPERBOUND & EXTMASK | 1<<29), lower/upperbounds are inclusive
martydd3 2:baeb80c778f7 62
martydd3 2:baeb80c778f7 63 };
martydd3 2:baeb80c778f7 64
martydd3 2:baeb80c778f7 65 #endif