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 /* mbed Microcontroller Library
martydd3 2:baeb80c778f7 2 * Copyright (c) 2006-2013 ARM Limited
martydd3 2:baeb80c778f7 3 *
martydd3 2:baeb80c778f7 4 * Licensed under the Apache License, Version 2.0 (the "License");
martydd3 2:baeb80c778f7 5 * you may not use this file except in compliance with the License.
martydd3 2:baeb80c778f7 6 * You may obtain a copy of the License at
martydd3 2:baeb80c778f7 7 *
martydd3 2:baeb80c778f7 8 * http://www.apache.org/licenses/LICENSE-2.0
martydd3 2:baeb80c778f7 9 *
martydd3 2:baeb80c778f7 10 * Unless required by applicable law or agreed to in writing, software
martydd3 2:baeb80c778f7 11 * distributed under the License is distributed on an "AS IS" BASIS,
martydd3 2:baeb80c778f7 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
martydd3 2:baeb80c778f7 13 * See the License for the specific language governing permissions and
martydd3 2:baeb80c778f7 14 * limitations under the License.
martydd3 2:baeb80c778f7 15 */
martydd3 2:baeb80c778f7 16 #ifndef MBED_ERROR_H
martydd3 2:baeb80c778f7 17 #define MBED_ERROR_H
martydd3 2:baeb80c778f7 18
martydd3 2:baeb80c778f7 19 /** To generate a fatal compile-time error, you can use the pre-processor #error directive.
martydd3 2:baeb80c778f7 20 *
martydd3 2:baeb80c778f7 21 * @code
martydd3 2:baeb80c778f7 22 * #error "That shouldn't have happened!"
martydd3 2:baeb80c778f7 23 * @endcode
martydd3 2:baeb80c778f7 24 *
martydd3 2:baeb80c778f7 25 * If the compiler evaluates this line, it will report the error and stop the compile.
martydd3 2:baeb80c778f7 26 *
martydd3 2:baeb80c778f7 27 * For example, you could use this to check some user-defined compile-time variables:
martydd3 2:baeb80c778f7 28 *
martydd3 2:baeb80c778f7 29 * @code
martydd3 2:baeb80c778f7 30 * #define NUM_PORTS 7
martydd3 2:baeb80c778f7 31 * #if (NUM_PORTS > 4)
martydd3 2:baeb80c778f7 32 * #error "NUM_PORTS must be less than 4"
martydd3 2:baeb80c778f7 33 * #endif
martydd3 2:baeb80c778f7 34 * @endcode
martydd3 2:baeb80c778f7 35 *
martydd3 2:baeb80c778f7 36 * Reporting Run-Time Errors:
martydd3 2:baeb80c778f7 37 * To generate a fatal run-time error, you can use the mbed error() function.
martydd3 2:baeb80c778f7 38 *
martydd3 2:baeb80c778f7 39 * @code
martydd3 2:baeb80c778f7 40 * error("That shouldn't have happened!");
martydd3 2:baeb80c778f7 41 * @endcode
martydd3 2:baeb80c778f7 42 *
martydd3 2:baeb80c778f7 43 * If the mbed running the program executes this function, it will print the
martydd3 2:baeb80c778f7 44 * message via the USB serial port, and then die with the blue lights of death!
martydd3 2:baeb80c778f7 45 *
martydd3 2:baeb80c778f7 46 * The message can use printf-style formatting, so you can report variables in the
martydd3 2:baeb80c778f7 47 * message too. For example, you could use this to check a run-time condition:
martydd3 2:baeb80c778f7 48 *
martydd3 2:baeb80c778f7 49 * @code
martydd3 2:baeb80c778f7 50 * if(x >= 5) {
martydd3 2:baeb80c778f7 51 * error("expected x to be less than 5, but got %d", x);
martydd3 2:baeb80c778f7 52 * }
martydd3 2:baeb80c778f7 53 * #endcode
martydd3 2:baeb80c778f7 54 */
martydd3 2:baeb80c778f7 55
martydd3 2:baeb80c778f7 56 // for some reason, the rtos library can't access mbed_error.h from the mbed library
martydd3 2:baeb80c778f7 57 // This is a pretty recent bug as of Oct 5, 2014
martydd3 2:baeb80c778f7 58 // If they fix the bug, remove this file
martydd3 2:baeb80c778f7 59
martydd3 2:baeb80c778f7 60 #ifdef __cplusplus
martydd3 2:baeb80c778f7 61 extern "C" {
martydd3 2:baeb80c778f7 62 #endif
martydd3 2:baeb80c778f7 63
martydd3 2:baeb80c778f7 64 void error(const char* format, ...);
martydd3 2:baeb80c778f7 65
martydd3 2:baeb80c778f7 66 #ifdef __cplusplus
martydd3 2:baeb80c778f7 67 }
martydd3 2:baeb80c778f7 68 #endif
martydd3 2:baeb80c778f7 69
martydd3 2:baeb80c778f7 70 #endif