00001 /* FreeEMS - the open source engine management system 00002 * 00003 * Copyright 2008, 2009, 2010 Fred Cooke 00004 * 00005 * This file is part of the FreeEMS project. 00006 * 00007 * FreeEMS software is free software: you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation, either version 3 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * FreeEMS software is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with any FreeEMS software. If not, see http://www.gnu.org/licenses/ 00019 * 00020 * We ask that if you make any changes to this file you email them upstream to 00021 * us at admin(at)diyefi(dot)org or, even better, fork the code on github.com! 00022 * 00023 * Thank you for choosing FreeEMS to run your engine! 00024 */ 00025 00026 00032 /* Header file multiple inclusion protection courtesy eclipse Header Template */ 00033 /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */ 00034 #ifndef FILE_UTILS_H_SEEN 00035 #define FILE_UTILS_H_SEEN 00036 00037 00038 #ifdef EXTERN 00039 #warning "EXTERN already defined by another header, please sort it out!" 00040 #undef EXTERN /* If fail on warning is off, remove the definition such that we can redefine correctly. */ 00041 #endif 00042 00043 00044 #ifdef UTILS_C 00045 #define EXTERN 00046 #else 00047 #define EXTERN extern 00048 #endif 00049 00050 EXTERN unsigned short safeAdd(unsigned short, unsigned short); 00051 EXTERN unsigned short safeTrim(unsigned short, signed short); 00052 EXTERN unsigned short safeScale(unsigned short, unsigned short); 00053 00054 EXTERN void sleep(unsigned short) FPAGE_FE; 00055 EXTERN void sleepMicro(unsigned short) FPAGE_FE; 00056 00057 EXTERN void adjustPWM(void) FPAGE_FE; 00058 EXTERN void setupPagedRAM(unsigned char) FPAGE_F8; 00059 EXTERN void resetToNonRunningState(void) FPAGE_F8; 00060 00061 EXTERN void sampleEachADC(ADCArray*) FPAGE_F8; 00062 EXTERN void sampleLoopADC(ADCArray*) FPAGE_F8; 00063 //EXTERN void sampleBlockADC(ADCArray*) FPAGE_F8; broken, do not use 00064 00065 EXTERN unsigned char checksum(unsigned char *, unsigned short) FPAGE_F8; 00066 EXTERN unsigned short stringCopy(unsigned char*, unsigned char*) FPAGE_F8; 00067 EXTERN unsigned short compare(unsigned char*, unsigned char*, unsigned short); // In unpaged flash as it needs to compare paged flash with unpaged things 00068 00069 00070 #undef EXTERN 00071 00072 00073 #else 00074 /* let us know if we are being untidy with headers */ 00075 #warning "Header file UTILS_H seen before, sort it out!" 00076 /* end of the wrapper ifdef from the very top */ 00077 #endif